From 58e7323c3e9c143fbd0af8c43b68e47573307d2c Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 23 Sep 2021 12:59:58 -0700 Subject: [PATCH 1/7] Bring adventure-api and adventure-platform (and dependencies) up to date --- pom.xml | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 8f167b8d6..c04d7b8fd 100755 --- a/pom.xml +++ b/pom.xml @@ -141,7 +141,6 @@ net.kyori:adventure-text-serializer-gson net.kyori:adventure-platform-bukkit net.kyori:adventure-platform-api - net.kyori:adventure-platform-common net.kyori:adventure-platform-viaversion net.kyori:adventure-platform-facet net.kyori:adventure-nbt @@ -248,48 +247,37 @@ net.kyori adventure-text-serializer-gson - 4.8.0 + 4.9.1 net.kyori adventure-api - 4.8.0 + 4.9.1 net.kyori adventure-nbt - 4.8.0 + 4.9.1 net.kyori adventure-key - 4.8.0 + 4.9.1 net.kyori adventure-text-serializer-gson-legacy-impl - 4.8.0 + 4.9.1 net.kyori adventure-platform-bukkit - 4.0.0-SNAPSHOT + 4.0.0 net.kyori adventure-platform-api - 4.0.0-SNAPSHOT - - - net.kyori - adventure-platform-common - 4.0.0-SNAPSHOT - - - net.kyori - adventure-nbt - - + 4.0.0 org.apache.maven.scm From c30892a0a56edaa1fc541b439ee1031bb8e10789 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 28 Sep 2021 00:09:04 -0700 Subject: [PATCH 2/7] Add flowering azalea leaves to Tree Feller --- Changelog.txt | 4 ++++ src/main/java/com/gmail/nossr50/util/MaterialMapStore.java | 1 + 2 files changed, 5 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index f3f3c9a77..88f19588c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Version 2.1.202 Added Amethyst_Block to experience.yml for Mining + Added Flowering Azalea Leaves to Tree Feller's white list + + NOTES: + This means tree feller will destroy flowering azalea leaves during its ability Version 2.1.201 Tweaked the visual/audio effect for Rupture diff --git a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java index f170cfc3b..90104acce 100644 --- a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java +++ b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java @@ -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"); From 73c465ee64662023706d35fb4def942b20bd1bde Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 28 Sep 2021 16:58:40 -0700 Subject: [PATCH 3/7] Fixed a bug where mcMMO didn't flag all blocks as natural appropriately in some StructureGrowEvent(s) --- src/main/java/com/gmail/nossr50/listeners/WorldListener.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index a08071a04..5abea42b3 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -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); } From e55ce00d62dfdfd8719edeef11fa93b78122343a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 5 Oct 2021 10:13:07 -0700 Subject: [PATCH 4/7] Update changelog --- Changelog.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 88f19588c..53e4b03bc 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,13 @@ Version 2.1.202 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 destroy flowering azalea leaves during its ability From a2e10dbd0c80f9f426ed6947db551fb7e63a20cc Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 5 Oct 2021 11:58:31 -0700 Subject: [PATCH 5/7] Azalea trees bone mealed into existence no longer get marked unnatural Fixes #4640 --- Changelog.txt | 4 ++-- .../gmail/nossr50/listeners/BlockListener.java | 16 ++++++++++++++-- .../java/com/gmail/nossr50/util/BlockUtils.java | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 53e4b03bc..26f88d6a7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ Version 2.1.202 + 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 @@ -8,9 +9,8 @@ Version 2.1.202 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 destroy flowering azalea leaves during its ability + This means tree feller will correctly traverse flowering azalea leaves during its ability Version 2.1.201 Tweaked the visual/audio effect for Rupture diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 0953f00c3..5354d644a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -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); + } } } } diff --git a/src/main/java/com/gmail/nossr50/util/BlockUtils.java b/src/main/java/com/gmail/nossr50/util/BlockUtils.java index c9a00f015..566c95c3a 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockUtils.java +++ b/src/main/java/com/gmail/nossr50/util/BlockUtils.java @@ -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) { From f8433cdbcc2c735dd3b38d3fb4caff98f35874bd Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 5 Oct 2021 12:39:56 -0700 Subject: [PATCH 6/7] Fixed Kelp not awarding XP Fixed #4639 Fixed #4110 --- Changelog.txt | 1 + .../skills/herbalism/HerbalismManager.java | 53 ++++++++----------- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 26f88d6a7..87338abb9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ 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 diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 6200d9eec..c8c78bd02 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -251,6 +251,9 @@ public class HerbalismManager extends SkillManager { * @param brokenPlants plant blocks to process */ private void processHerbalismOnBlocksBroken(BlockBreakEvent blockBreakEvent, HashSet 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 getBrokenHerbalismBlocks(BlockBreakEvent blockBreakEvent) { + private HashSet 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 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 getBrokenBlocksMultiBlockPlants(BlockState originalBlockBroken, BlockBreakEvent blockBreakEvent) { + protected HashSet getBrokenBlocksMultiBlockPlants(BlockState brokenBlock) { //Track the broken blocks HashSet 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 getBlocksBrokenAbove(BlockState breakPointBlockState) { + private HashSet getBlocksBrokenAbove(BlockState originBlock, boolean inclusive) { HashSet 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); From def676d8d7a28b7f966014dda28dd3e9933616b3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 5 Oct 2021 12:41:25 -0700 Subject: [PATCH 7/7] 2.1.202 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c04d7b8fd..c861f48f1 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.202-SNAPSHOT + 2.1.202 mcMMO https://github.com/mcMMO-Dev/mcMMO