mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Merge remote-tracking branch 'upstream/master' into feature/simplify-blacklist
This commit is contained in:
commit
36b3eb6ef7
@ -1,5 +1,17 @@
|
||||
Version 2.1.202
|
||||
Fixed a bug where mcMMO didn't reward XP for Kelp
|
||||
Fixed a bug where mcMMO marked bonemealed Azalea trees as unnatural (and thus did not give XP or get affected by Tree Feller)
|
||||
Added Amethyst_Block to experience.yml for Mining
|
||||
Added Flowering Azalea Leaves to Tree Feller's white list
|
||||
Fixed a bug where mcMMO didn't appropriately flag blocks as natural in some tree growing events
|
||||
(SQL) Added more MySQL/MariaDB settings (allowPublicKeyRetrieval - thanks rosaage)
|
||||
(API) Added CREATED_PARTY and DISBANDED_PARTY to EventReason (used in some party events - thanks PikaMug )
|
||||
Party member name matching is no longer case sensitive (thanks Wariorrrr)
|
||||
Updated zh_CN locale (thanks GhostDC)
|
||||
Added some settings for over fishing (Settings are in experience.yml under Fishing_ExploitFix_Options - thanks tunagohan)
|
||||
|
||||
NOTES:
|
||||
This means tree feller will correctly traverse flowering azalea leaves during its ability
|
||||
|
||||
Version 2.1.201
|
||||
Tweaked the visual/audio effect for Rupture
|
||||
|
28
pom.xml
28
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.202-SNAPSHOT</version>
|
||||
<version>2.1.202</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
@ -141,7 +141,6 @@
|
||||
<include>net.kyori:adventure-text-serializer-gson</include>
|
||||
<include>net.kyori:adventure-platform-bukkit</include>
|
||||
<include>net.kyori:adventure-platform-api</include>
|
||||
<include>net.kyori:adventure-platform-common</include>
|
||||
<include>net.kyori:adventure-platform-viaversion</include>
|
||||
<include>net.kyori:adventure-platform-facet</include>
|
||||
<include>net.kyori:adventure-nbt</include>
|
||||
@ -248,48 +247,37 @@
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<version>4.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-api</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<version>4.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-nbt</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<version>4.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-key</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<version>4.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<version>4.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-api</artifactId>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-common</artifactId>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-nbt</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.scm</groupId>
|
||||
|
@ -238,7 +238,10 @@ public class BlockListener implements Listener {
|
||||
WorldCompatibilityLayer worldCompatibilityLayer = mcMMO.getCompatibilityManager().getWorldCompatibilityLayer();
|
||||
|
||||
if(BlockUtils.isWithinWorldBounds(worldCompatibilityLayer, block)) {
|
||||
mcMMO.getPlaceStore().setTrue(blockState);
|
||||
//NOTE: BlockMultiPlace has its own logic so don't handle anything that would overlap
|
||||
if (!(event instanceof BlockMultiPlaceEvent)) {
|
||||
mcMMO.getPlaceStore().setTrue(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -276,7 +279,16 @@ public class BlockListener implements Listener {
|
||||
|
||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||
if(BlockUtils.isWithinWorldBounds(worldCompatibilityLayer, block)) {
|
||||
mcMMO.getPlaceStore().setTrue(blockState);
|
||||
//Updated: 10/5/2021
|
||||
//Note: For some reason Azalea trees trigger this event but no other tree does (as of 10/5/2021) but if this changes in the future we may need to update this
|
||||
if(BlockUtils.isPartOfTree(event.getBlockPlaced())) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Track unnatural blocks
|
||||
for(BlockState replacedStates : event.getReplacedBlockStates()) {
|
||||
mcMMO.getPlaceStore().setTrue(replacedStates);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,6 @@ public class WorldListener implements Listener {
|
||||
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
||||
return;
|
||||
|
||||
if (!mcMMO.getPlaceStore().isTrue(event.getLocation().getBlock())) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (BlockState blockState : event.getBlocks()) {
|
||||
mcMMO.getPlaceStore().setFalse(blockState);
|
||||
}
|
||||
|
@ -251,6 +251,9 @@ public class HerbalismManager extends SkillManager {
|
||||
* @param brokenPlants plant blocks to process
|
||||
*/
|
||||
private void processHerbalismOnBlocksBroken(BlockBreakEvent blockBreakEvent, HashSet<Block> brokenPlants) {
|
||||
if(blockBreakEvent.isCancelled())
|
||||
return;
|
||||
|
||||
BlockState originalBreak = blockBreakEvent.getBlock().getState();
|
||||
boolean greenThumbActivated = false;
|
||||
|
||||
@ -263,16 +266,6 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
//When replanting a immature crop we cancel the block break event and back out
|
||||
if(greenThumbActivated) {
|
||||
if(originalBreak.getBlock().getBlockData() instanceof Ageable) {
|
||||
Ageable ageableCrop = (Ageable) originalBreak.getBlock().getBlockData();
|
||||
if(!isAgeableMature(ageableCrop)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark blocks for double drops
|
||||
* Be aware of the hacky interactions we are doing with Chorus Plants
|
||||
@ -394,6 +387,7 @@ public class HerbalismManager extends SkillManager {
|
||||
//Catcus and Sugar Canes cannot be trusted
|
||||
switch(blockData.getMaterial()) {
|
||||
case CACTUS:
|
||||
case KELP:
|
||||
case SUGAR_CANE:
|
||||
return true;
|
||||
default:
|
||||
@ -530,21 +524,18 @@ public class HerbalismManager extends SkillManager {
|
||||
* @param blockBreakEvent target event
|
||||
* @return a set of plant-blocks that were broken as a result of this event
|
||||
*/
|
||||
private HashSet<Block> getBrokenHerbalismBlocks(BlockBreakEvent blockBreakEvent) {
|
||||
private HashSet<Block> getBrokenHerbalismBlocks(@NotNull BlockBreakEvent blockBreakEvent) {
|
||||
//Get an updated capture of this block
|
||||
BlockState originalBlockBlockState = blockBreakEvent.getBlock().getState();
|
||||
Material originalBlockMaterial = originalBlockBlockState.getType();
|
||||
BlockState originBlockState = blockBreakEvent.getBlock().getState();
|
||||
Material originBlockMaterial = originBlockState.getType();
|
||||
HashSet<Block> blocksBroken = new HashSet<>(); //Blocks broken
|
||||
|
||||
//Check if this block is a one block plant or not
|
||||
boolean oneBlockPlant = isOneBlockPlant(originalBlockMaterial);
|
||||
//Add the initial block
|
||||
blocksBroken.add(originBlockState.getBlock());
|
||||
|
||||
if(oneBlockPlant) {
|
||||
//If the block is a one-block plant return only that
|
||||
blocksBroken.add(originalBlockBlockState.getBlock());
|
||||
} else {
|
||||
if(!isOneBlockPlant(originBlockMaterial)) {
|
||||
//If the block is a multi-block structure, capture a set of all blocks broken and return that
|
||||
blocksBroken = getBrokenBlocksMultiBlockPlants(originalBlockBlockState, blockBreakEvent);
|
||||
blocksBroken = getBrokenBlocksMultiBlockPlants(originBlockState);
|
||||
}
|
||||
|
||||
//Return all broken plant-blocks
|
||||
@ -580,17 +571,16 @@ public class HerbalismManager extends SkillManager {
|
||||
* The method to grab these blocks is a bit hacky and does not hook into the API
|
||||
* Basically we expect the blocks to be broken if this event is not cancelled and we determine which block are broken on our end rather than any event state captures
|
||||
*
|
||||
* @param blockBreakEvent target event
|
||||
* @return a set of plant-blocks broken from this event
|
||||
*/
|
||||
protected HashSet<Block> getBrokenBlocksMultiBlockPlants(BlockState originalBlockBroken, BlockBreakEvent blockBreakEvent) {
|
||||
protected HashSet<Block> getBrokenBlocksMultiBlockPlants(BlockState brokenBlock) {
|
||||
//Track the broken blocks
|
||||
HashSet<Block> brokenBlocks;
|
||||
|
||||
if (isChorusBranch(originalBlockBroken.getType())) {
|
||||
brokenBlocks = getBrokenChorusBlocks(originalBlockBroken);
|
||||
if (isChorusBranch(brokenBlock.getType())) {
|
||||
brokenBlocks = getBrokenChorusBlocks(brokenBlock);
|
||||
} else {
|
||||
brokenBlocks = getBlocksBrokenAbove(originalBlockBroken);
|
||||
brokenBlocks = getBlocksBrokenAbove(brokenBlock, false);
|
||||
}
|
||||
|
||||
return brokenBlocks;
|
||||
@ -610,21 +600,22 @@ public class HerbalismManager extends SkillManager {
|
||||
* The vertical search returns early if it runs into anything that is not a multi-block plant
|
||||
* Multi-block plants are hard-coded and kept in {@link MaterialMapStore}
|
||||
*
|
||||
* @param breakPointBlockState The point of the "break"
|
||||
* @param originBlock The point of the "break"
|
||||
* @return A set of blocks above the target block which can be assumed to be broken
|
||||
*/
|
||||
private HashSet<Block> getBlocksBrokenAbove(BlockState breakPointBlockState) {
|
||||
private HashSet<Block> getBlocksBrokenAbove(BlockState originBlock, boolean inclusive) {
|
||||
HashSet<Block> brokenBlocks = new HashSet<>();
|
||||
Block block = breakPointBlockState.getBlock();
|
||||
Block block = originBlock.getBlock();
|
||||
|
||||
//Add the initial block to the set
|
||||
brokenBlocks.add(block);
|
||||
if(inclusive)
|
||||
brokenBlocks.add(block);
|
||||
|
||||
//Limit our search
|
||||
int maxHeight = 255;
|
||||
int maxHeight = 512;
|
||||
|
||||
// Search vertically for multi-block plants, exit early if any non-multi block plants
|
||||
for (int y = 1; y < maxHeight; y++) {
|
||||
for (int y = 0; y < maxHeight; y++) {
|
||||
//TODO: Should this grab state? It would be more expensive..
|
||||
Block relativeUpBlock = block.getRelative(BlockFace.UP, y);
|
||||
|
||||
|
@ -285,8 +285,8 @@ public final class BlockUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isPartOfTree(Block rayCast) {
|
||||
return hasWoodcuttingXP(rayCast.getState()) || isNonWoodPartOfTree(rayCast.getType());
|
||||
public static boolean isPartOfTree(Block block) {
|
||||
return hasWoodcuttingXP(block.getState()) || isNonWoodPartOfTree(block.getType());
|
||||
}
|
||||
|
||||
public static boolean isWithinWorldBounds(@NotNull WorldCompatibilityLayer worldCompatibilityLayer, @NotNull Block block) {
|
||||
|
@ -1009,6 +1009,7 @@ public class MaterialMapStore {
|
||||
treeFellerDestructibleWhiteList.add("jungle_leaves");
|
||||
treeFellerDestructibleWhiteList.add("spruce_leaves");
|
||||
treeFellerDestructibleWhiteList.add("azalea_leaves");
|
||||
treeFellerDestructibleWhiteList.add("flowering_azalea_leaves");
|
||||
treeFellerDestructibleWhiteList.add("nether_wart_block");
|
||||
treeFellerDestructibleWhiteList.add("warped_wart_block");
|
||||
treeFellerDestructibleWhiteList.add("brown_mushroom_block");
|
||||
|
Loading…
Reference in New Issue
Block a user