From cfcdcd1676d814ef269d4415d7007dad824b1094 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 16 Nov 2020 14:36:59 -0800 Subject: [PATCH 01/16] Fix Lure above 3 breaking fishing --- Changelog.txt | 6 ++++ pom.xml | 2 +- .../commands/skills/FishingCommand.java | 2 +- .../nossr50/listeners/PlayerListener.java | 17 +++++++++- .../runnables/skills/MasterAnglerTask.java | 6 ++-- .../skills/fishing/FishingManager.java | 31 ++++++++++++++++--- 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 1d360743d..1333e46e2 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,9 @@ +Version 2.1.158 + Fixed a bug where Lure level 4 and above would break fishing with the new Master Angler + + NOTES: + Master Angler will emulate the effects of Lure if the level is higher than 3 instead of attempting to stack with it to avoid a vanilla Minecraft bug where fish are never caught + Version 2.1.157 Fixed a NPE that prevented mctop (Leaderboards) from working diff --git a/pom.xml b/pom.xml index 3c1fb5ae8..a775af69e 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.157 + 2.1.158-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 0c12bcdc1..0f34e84b1 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -92,7 +92,7 @@ public class FishingCommand extends SkillCommand { // MASTER ANGLER if (canMasterAngler) { maMinWaitTime = StringUtils.ticksToSeconds(fishingManager.getMasterAnglerTickMinWaitReduction(RankUtils.getRank(player, SubSkillType.FISHING_MASTER_ANGLER), false)); - maMaxWaitTime = StringUtils.ticksToSeconds(fishingManager.getMasterAnglerTickMaxWaitReduction(RankUtils.getRank(player, SubSkillType.FISHING_MASTER_ANGLER), false)); + maMaxWaitTime = StringUtils.ticksToSeconds(fishingManager.getMasterAnglerTickMaxWaitReduction(RankUtils.getRank(player, SubSkillType.FISHING_MASTER_ANGLER), false, 0)); } } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 1aa393a22..c0fb6da54 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -35,6 +35,7 @@ import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockState; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.*; import org.bukkit.entity.minecart.PoweredMinecart; import org.bukkit.event.Event; @@ -387,7 +388,21 @@ public class PlayerListener implements Listener { switch (event.getState()) { case FISHING: if (fishingManager.canMasterAngler()) { - fishingManager.masterAngler(event.getHook()); + int lureLevel = 0; + ItemStack inHand = player.getInventory().getItemInMainHand(); + + //Grab lure level + if(inHand != null && inHand.getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) { + if(inHand.getItemMeta().hasEnchants()) { + for(Enchantment enchantment : inHand.getItemMeta().getEnchants().keySet()) { + if(enchantment.toString().toLowerCase().contains("lure")) { + lureLevel = inHand.getEnchantmentLevel(enchantment); + } + } + } + } + + fishingManager.masterAngler(event.getHook(), lureLevel); fishingManager.setFishingTarget(); } return; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/MasterAnglerTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/MasterAnglerTask.java index 720243f1c..0f652e02c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/MasterAnglerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/MasterAnglerTask.java @@ -8,14 +8,16 @@ import org.jetbrains.annotations.NotNull; public class MasterAnglerTask extends BukkitRunnable { private final @NotNull FishHook fishHook; private final @NotNull FishingManager fishingManager; + private final int lureLevel; - public MasterAnglerTask(@NotNull FishHook fishHook, @NotNull FishingManager fishingManager) { + public MasterAnglerTask(@NotNull FishHook fishHook, @NotNull FishingManager fishingManager, int lureLevel) { this.fishHook = fishHook; this.fishingManager = fishingManager; + this.lureLevel = lureLevel; } @Override public void run() { - fishingManager.processMasterAngler(fishHook); + fishingManager.processMasterAngler(fishHook, lureLevel); } } diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index f0733588c..9d76097b6 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -247,8 +247,8 @@ public class FishingManager extends SkillManager { EventUtils.callFakeFishEvent(getPlayer(), hook); } - public void masterAngler(@NotNull FishHook hook) { - new MasterAnglerTask(hook, this).runTaskLater(mcMMO.p, 0); //We run later to get the lure bonus applied + public void masterAngler(@NotNull FishHook hook, int lureLevel) { + new MasterAnglerTask(hook, this, lureLevel).runTaskLater(mcMMO.p, 0); //We run later to get the lure bonus applied } /** @@ -256,7 +256,7 @@ public class FishingManager extends SkillManager { * Reduced tick time on fish hook, etc * @param fishHook target fish hook */ - public void processMasterAngler(@NotNull FishHook fishHook) { + public void processMasterAngler(@NotNull FishHook fishHook, int lureLevel) { MasterAnglerCompatibilityLayer masterAnglerCompatibilityLayer = (MasterAnglerCompatibilityLayer) mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer(); if(masterAnglerCompatibilityLayer != null) { @@ -264,10 +264,17 @@ public class FishingManager extends SkillManager { int minWaitTicks = masterAnglerCompatibilityLayer.getMinWaitTime(fishHook); int masterAnglerRank = RankUtils.getRank(mmoPlayer, SubSkillType.FISHING_MASTER_ANGLER); + int convertedLureBonus = 0; + + //This avoids a Minecraft bug where lure levels above 3 break fishing + if(lureLevel > 3) { + masterAnglerCompatibilityLayer.setApplyLure(fishHook, false); + convertedLureBonus = lureLevel * 100; + } boolean boatBonus = isInBoat(); int minWaitReduction = getMasterAnglerTickMinWaitReduction(masterAnglerRank, boatBonus); - int maxWaitReduction = getMasterAnglerTickMaxWaitReduction(masterAnglerRank, boatBonus); + int maxWaitReduction = getMasterAnglerTickMaxWaitReduction(masterAnglerRank, boatBonus, convertedLureBonus); //Ticks for minWait and maxWait never go below this value int bonusCapMin = AdvancedConfig.getInstance().getFishingReductionMinWaitCap(); @@ -276,9 +283,21 @@ public class FishingManager extends SkillManager { int reducedMinWaitTime = getReducedTicks(minWaitTicks, minWaitReduction, bonusCapMin); int reducedMaxWaitTime = getReducedTicks(maxWaitTicks, maxWaitReduction, bonusCapMax); + boolean badValuesFix = false; + + //If we find bad values correct it + if(reducedMaxWaitTime < reducedMinWaitTime) { + reducedMaxWaitTime = reducedMinWaitTime + 100; + badValuesFix = true; + } + if(mmoPlayer.isDebugMode()) { mmoPlayer.getPlayer().sendMessage(ChatColor.GOLD + "Master Angler Debug"); + if(badValuesFix) { + mmoPlayer.getPlayer().sendMessage(ChatColor.RED + "Bad values were applied and corrected, check your configs, max wait should never be lower than min wait."); + } + mmoPlayer.getPlayer().sendMessage("ALLOW STACK WITH LURE: " + masterAnglerCompatibilityLayer.getApplyLure(fishHook)); mmoPlayer.getPlayer().sendMessage("MIN TICK REDUCTION: " + minWaitReduction); mmoPlayer.getPlayer().sendMessage("MAX TICK REDUCTION: " + maxWaitReduction); @@ -321,13 +340,15 @@ public class FishingManager extends SkillManager { return mmoPlayer.getPlayer().isInsideVehicle() && mmoPlayer.getPlayer().getVehicle() instanceof Boat; } - public int getMasterAnglerTickMaxWaitReduction(int masterAnglerRank, boolean boatBonus) { + public int getMasterAnglerTickMaxWaitReduction(int masterAnglerRank, boolean boatBonus, int emulatedLureBonus) { int totalBonus = AdvancedConfig.getInstance().getFishingReductionMaxWaitTicks() * masterAnglerRank; if(boatBonus) { totalBonus += getFishingBoatMaxWaitReduction(); } + totalBonus += emulatedLureBonus; + return totalBonus; } From 4fd8f6d6470549d6bb1e50bf871be42eba4ee69e Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 16 Nov 2020 23:39:07 +0100 Subject: [PATCH 02/16] Update locale_nl.properties (#4336) Fixed small translation errors --- src/main/resources/locale/locale_nl.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/locale/locale_nl.properties b/src/main/resources/locale/locale_nl.properties index ebdc4e956..cd2ae6e67 100644 --- a/src/main/resources/locale/locale_nl.properties +++ b/src/main/resources/locale/locale_nl.properties @@ -264,7 +264,7 @@ Commands.mcrank.Player=DOELWIT: &f{0} Commands.mmoedit=[player] &c - Pas doel aan Commands.mmoedit.Modified.1=&aUw level in {0} is veranderd naar {1} Commands.mmoedit.Modified.2={0} is aangepast voor {1}. -Commands.mcconvert.Database.Same= Je makt al gebruik van de {0} database! +Commands.mcconvert.Database.Same= Je maakt al gebruik van de {0} database! Commands.mcconvert.Database.InvalidType= {0} is geen geldig soort database. Commands.ModDescription=- Lees instructie mod beschrijving Commands.NoConsole=Deze commando wordt niet ondersteund vanuit de console. @@ -416,7 +416,7 @@ Smelting.SubSkill.FuelEfficiency.Name=Brandstof Effici\u00ebntie Smelting.Listener=Smelten: Smelting.SkillName=SMELTEN Commands.Description.mcstats=Toon je mcMMO niveaus en XP -Commands.Description.party=Beheer verscheidene mcMMO groep instellingen +Commands.Description.party=Beheer verschillende mcMMO groep instellingen Commands.Description.ptp=Teleport naar een groepslid UpdateChecker.Outdated=U gebruikt een verouderde versie van mcMMO! UpdateChecker.NewAvailable=Er is een nieuwe versie beschikbaar op BukkitDev. From 128ba88e6470c913beb85f03715d71f0b591f8f5 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 16 Nov 2020 14:39:33 -0800 Subject: [PATCH 03/16] Update changelog --- Changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.txt b/Changelog.txt index 1333e46e2..7c33c2d92 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Version 2.1.158 Fixed a bug where Lure level 4 and above would break fishing with the new Master Angler + Updated nl locale (thanks xl3ehindTim) NOTES: Master Angler will emulate the effects of Lure if the level is higher than 3 instead of attempting to stack with it to avoid a vanilla Minecraft bug where fish are never caught From c22a65f9f3dce22e5e92e1056f05ab6a14d89be7 Mon Sep 17 00:00:00 2001 From: Momshroom Date: Mon, 16 Nov 2020 16:42:24 -0600 Subject: [PATCH 04/16] Adding crossbows, shields, elytra, and tridents to default repair.vanilla.yml and fixing minor typo. (#4308) * Changed comment over netherite items to say "Netherite repairables" instead of "Diamond repairables" Added Crossbow to string repairables Added Shield to wood repairables, with oak planks as material Added Elytra and Trident to Other repairables, using phantom membrane and prismarine crystals respectively. * Changed comment over netherite items to say "Netherite repairables" instead of "Diamond repairables" Added Crossbow to string repairables Added Shield to wood repairables, with oak planks as material Added Elytra and Trident to Other repairables, using phantom membrane and prismarine crystals respectively. Added warped fungus on a stick as a string repairable. Signed-off-by: Momshroom * Added warped fungus on a stick as a string repairable. Signed-off-by: Momshroom --- src/main/resources/repair.vanilla.yml | 45 ++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/main/resources/repair.vanilla.yml b/src/main/resources/repair.vanilla.yml index 357c1b6d1..c7d5735e4 100644 --- a/src/main/resources/repair.vanilla.yml +++ b/src/main/resources/repair.vanilla.yml @@ -45,6 +45,14 @@ Repairables: # Wooden repairables ### # Tools + SHIELD: + MinimumLevel: 0 + XpMultiplier: .25 + ItemType: OTHER + ItemMaterialCategory: WOOD + RepairMaterial: OAK_PLANKS + MinimumQuantity: 6 + MaximumDurability: 336 WOODEN_SWORD: MinimumLevel: 0 XpMultiplier: .25 @@ -183,7 +191,7 @@ Repairables: XpMultiplier: 6 # - # Diamond repairables + # Netherite repairables ### # Tools NETHERITE_SWORD: @@ -243,3 +251,38 @@ Repairables: CARROT_ON_A_STICK: MinimumLevel: 0 XpMultiplier: .5 + CROSSBOW: + MinimumLevel: 0 + XpMultiplier: .5 + ItemType: TOOL + ItemMaterialCategory: STRING + RepairMaterial: STRING + MinimumQuantity: 3 + MaximumDurability: 326 + WARPED_FUNGUS_ON_A_STICK: + MinimumLevel: 0 + XpMultiplier: .5 + ItemType: TOOL + ItemMaterialCategory: STRING + RepairMaterial: STRING + MinimumQuantity: 3 + MaximumDurability: 100 + # + # Other + ### + ELYTRA: + MinimumLevel: 0 + XpMultiplier: 3 + ItemType: OTHER + ItemMaterialCategory: OTHER + RepairMaterial: PHANTOM_MEMBRANE + MinimumQuantity: 8 + MaximumDurability: 432 + TRIDENT: + MinimumLevel: 0 + XpMultiplier: 3 + ItemType: TOOL + ItemMaterialCategory: OTHER + RepairMaterial: PRISMARINE_CRYSTALS + MinimumQuantity: 16 + MaximumDurability: 250 \ No newline at end of file From 915855363d5bc689f537e2f149d44dd693f8188f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 16 Nov 2020 14:43:53 -0800 Subject: [PATCH 05/16] Update changelog --- Changelog.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 7c33c2d92..e42ba9583 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,8 +1,12 @@ Version 2.1.158 Fixed a bug where Lure level 4 and above would break fishing with the new Master Angler Updated nl locale (thanks xl3ehindTim) + Added Crossbow to string repairables (Thanks Momshroom) + Added Shield to wood repairables, with oak planks as material (Thanks Momshroom) + Added Elytra and Trident to Other repairables, using phantom membrane and prismarine crystals respectively. (Thanks Momshroom) NOTES: + Added some stuff to Repair, a rework to Repair is coming in the future, this stuff will work for now as a placeholder. Master Angler will emulate the effects of Lure if the level is higher than 3 instead of attempting to stack with it to avoid a vanilla Minecraft bug where fish are never caught Version 2.1.157 From db8086d6ad28bd72c8b117fa79ed17eb41a4aca1 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 16 Nov 2020 14:56:48 -0800 Subject: [PATCH 06/16] Allow URLs in chat again --- src/main/java/com/gmail/nossr50/util/text/TextUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java index 1f1b24c2c..d326a62a7 100644 --- a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java +++ b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java @@ -117,7 +117,7 @@ public class TextUtils { @NotNull private static LegacyComponentSerializer getSerializer() { - return LegacyComponentSerializer.builder().hexColors().useUnusualXRepeatedCharacterHexFormat().character('&').hexCharacter('#').build(); + return LegacyComponentSerializer.builder().hexColors().useUnusualXRepeatedCharacterHexFormat().character('&').hexCharacter('#').extractUrls().build(); } public static @NotNull String sanitizeForSerializer(@NotNull String string) { From bc53714ac860a22c5010a3bceb634a446cbea09d Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 16 Nov 2020 16:00:01 -0800 Subject: [PATCH 07/16] URL style adjust --- .../gmail/nossr50/util/text/TextUtils.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java index d326a62a7..b8d71500e 100644 --- a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java +++ b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java @@ -6,6 +6,8 @@ import net.kyori.adventure.text.ComponentBuilder; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.Style; +import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.md_5.bungee.api.chat.BaseComponent; import org.jetbrains.annotations.NotNull; @@ -107,7 +109,7 @@ public class TextUtils { return LegacyComponentSerializer.legacySection().deserialize(rawString); } - public static @NotNull TextComponent colorizeText(String rawtext) { + public static @NotNull TextComponent colorizeText(@NotNull String rawtext) { if(customLegacySerializer == null) { customLegacySerializer = getSerializer(); } @@ -117,7 +119,20 @@ public class TextUtils { @NotNull private static LegacyComponentSerializer getSerializer() { - return LegacyComponentSerializer.builder().hexColors().useUnusualXRepeatedCharacterHexFormat().character('&').hexCharacter('#').extractUrls().build(); + return LegacyComponentSerializer.builder() + .hexColors() + .useUnusualXRepeatedCharacterHexFormat() + .character('&') + .hexCharacter('#') + .extractUrls(Style.style() + .decorate(getURLStyle()) + .color(NamedTextColor.DARK_AQUA) + .build()) + .build(); + } + + public static @NotNull TextDecoration[] getURLStyle() { + return new TextDecoration[]{TextDecoration.UNDERLINED}; } public static @NotNull String sanitizeForSerializer(@NotNull String string) { From cf86e79e8793567012cf590e09b4655ab881cc9b Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 16 Nov 2020 16:24:27 -0800 Subject: [PATCH 08/16] Updated changelog --- Changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index e42ba9583..6c1ba883b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,11 +1,13 @@ Version 2.1.158 Fixed a bug where Lure level 4 and above would break fishing with the new Master Angler + URLs in party/admin chat work again (use https:// in front to make links clickable) Updated nl locale (thanks xl3ehindTim) Added Crossbow to string repairables (Thanks Momshroom) Added Shield to wood repairables, with oak planks as material (Thanks Momshroom) Added Elytra and Trident to Other repairables, using phantom membrane and prismarine crystals respectively. (Thanks Momshroom) NOTES: + Links in party/admin chat might not be clickable without https:// added in front of the url Added some stuff to Repair, a rework to Repair is coming in the future, this stuff will work for now as a placeholder. Master Angler will emulate the effects of Lure if the level is higher than 3 instead of attempting to stack with it to avoid a vanilla Minecraft bug where fish are never caught From c54161b7d1d39393acb12b8662720675b238fd9a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 16 Nov 2020 16:40:18 -0800 Subject: [PATCH 09/16] update changes --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a775af69e..a52d16156 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.158-SNAPSHOT + 2.1.158 mcMMO https://github.com/mcMMO-Dev/mcMMO From ab276ffe33d916d135642053740a1ff4de769021 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 16 Nov 2020 16:55:55 -0800 Subject: [PATCH 10/16] 2.1.158 --- Changelog.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 6c1ba883b..5516043a6 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,11 +2,12 @@ Version 2.1.158 Fixed a bug where Lure level 4 and above would break fishing with the new Master Angler URLs in party/admin chat work again (use https:// in front to make links clickable) Updated nl locale (thanks xl3ehindTim) - Added Crossbow to string repairables (Thanks Momshroom) - Added Shield to wood repairables, with oak planks as material (Thanks Momshroom) - Added Elytra and Trident to Other repairables, using phantom membrane and prismarine crystals respectively. (Thanks Momshroom) + * Added Crossbow to string repairables (Thanks Momshroom) + * Added Shield to wood repairables, with oak planks as material (Thanks Momshroom) + * Added Elytra and Trident to Other repairables, using phantom membrane and prismarine crystals respectively. (Thanks Momshroom) NOTES: + * You'll need to update repair.vanilla.yml yourself or delete the file and regenerate it (lazy easy way). Links in party/admin chat might not be clickable without https:// added in front of the url Added some stuff to Repair, a rework to Repair is coming in the future, this stuff will work for now as a placeholder. Master Angler will emulate the effects of Lure if the level is higher than 3 instead of attempting to stack with it to avoid a vanilla Minecraft bug where fish are never caught From bcd260d9c1fe0d38a39636914cbc805ff89eb082 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 27 Nov 2020 16:26:24 -0800 Subject: [PATCH 11/16] Memory leak fix --- Changelog.txt | 3 +++ pom.xml | 2 +- .../java/com/gmail/nossr50/util/TransientMetadataTools.java | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 5516043a6..c9a165be8 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,6 @@ +Version 2.1.159 + Fixed a memory leak involving renamed mobs + Version 2.1.158 Fixed a bug where Lure level 4 and above would break fishing with the new Master Angler URLs in party/admin chat work again (use https:// in front to make links clickable) diff --git a/pom.xml b/pom.xml index a52d16156..cb291c50a 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.158 + 2.1.159-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/util/TransientMetadataTools.java b/src/main/java/com/gmail/nossr50/util/TransientMetadataTools.java index 3e74d9bf8..72649c548 100644 --- a/src/main/java/com/gmail/nossr50/util/TransientMetadataTools.java +++ b/src/main/java/com/gmail/nossr50/util/TransientMetadataTools.java @@ -4,6 +4,7 @@ import com.gmail.nossr50.mcMMO; import org.bukkit.entity.LivingEntity; public class TransientMetadataTools { + public static final String OLD_NAME_METAKEY = "mcMMO_oldName"; private final mcMMO pluginRef; public TransientMetadataTools(mcMMO pluginRef) { @@ -17,6 +18,10 @@ public class TransientMetadataTools { livingEntity.removeMetadata(mcMMO.customNameKey, pluginRef); } + if(livingEntity.hasMetadata(OLD_NAME_METAKEY)) { + livingEntity.removeMetadata(OLD_NAME_METAKEY, pluginRef); + } + //Involved in changing mob names to hearts if (livingEntity.hasMetadata(mcMMO.customVisibleKey)) { livingEntity.setCustomNameVisible(livingEntity.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean()); From 0ce316e4284c2c546ca14ca7209c035497377f32 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 27 Nov 2020 16:55:40 -0800 Subject: [PATCH 12/16] update adventure (used for chat) --- Changelog.txt | 1 + pom.xml | 6 +++--- src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java | 4 ++-- .../java/com/gmail/nossr50/util/TransientMetadataTools.java | 2 +- .../java/com/gmail/nossr50/util/skills/CombatUtils.java | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index c9a165be8..7a7d137c8 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Version 2.1.159 Fixed a memory leak involving renamed mobs + Updated Adventure library (used in our chat code) Version 2.1.158 Fixed a bug where Lure level 4 and above would break fishing with the new Master Angler diff --git a/pom.xml b/pom.xml index cb291c50a..7defad4d5 100755 --- a/pom.xml +++ b/pom.xml @@ -202,12 +202,12 @@ net.kyori adventure-text-serializer-gson - 4.2.0-SNAPSHOT + 4.3.0-SNAPSHOT net.kyori adventure-api - 4.2.0-SNAPSHOT + 4.2.0 net.kyori @@ -232,7 +232,7 @@ org.apache.maven.scm maven-scm-provider-gitexe - 1.8.1 + 1.9.4 org.bstats diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index f306a4854..0ba956dd5 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -56,8 +56,8 @@ public final class MobHealthbarUtils { /* * Store the name in metadata */ - if(target.getMetadata("mcMMO_oldName").size() <= 0 && originalName != null) - target.setMetadata("mcMMO_oldName", new OldName(originalName, plugin)); + if(target.getMetadata(TransientMetadataTools.OLD_NAME_METAKEY).size() <= 0 && originalName != null) + target.setMetadata(TransientMetadataTools.OLD_NAME_METAKEY, new OldName(originalName, plugin)); if (oldName == null) { oldName = ""; diff --git a/src/main/java/com/gmail/nossr50/util/TransientMetadataTools.java b/src/main/java/com/gmail/nossr50/util/TransientMetadataTools.java index 72649c548..b84e8c60e 100644 --- a/src/main/java/com/gmail/nossr50/util/TransientMetadataTools.java +++ b/src/main/java/com/gmail/nossr50/util/TransientMetadataTools.java @@ -4,7 +4,7 @@ import com.gmail.nossr50.mcMMO; import org.bukkit.entity.LivingEntity; public class TransientMetadataTools { - public static final String OLD_NAME_METAKEY = "mcMMO_oldName"; + public static final String OLD_NAME_METAKEY = TransientMetadataTools.OLD_NAME_METAKEY; private final mcMMO pluginRef; public TransientMetadataTools(mcMMO pluginRef) { diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 464fa9e50..2c28b1969 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -448,7 +448,7 @@ public final class CombatUtils { */ public static void fixNames(@NotNull LivingEntity entity) { - List metadataValue = entity.getMetadata("mcMMO_oldName"); + List metadataValue = entity.getMetadata(TransientMetadataTools.OLD_NAME_METAKEY); if(metadataValue.size() <= 0) return; From dacd846fe76e762f6ecfaeea8bb84a2c89917a43 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 27 Nov 2020 16:59:37 -0800 Subject: [PATCH 13/16] 2.1.159 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7defad4d5..b5d5679ca 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.159-SNAPSHOT + 2.1.159 mcMMO https://github.com/mcMMO-Dev/mcMMO From 958fb6f0442d839776145facead5104f63f7bada Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 1 Dec 2020 13:08:33 -0800 Subject: [PATCH 14/16] Silenced a mostly harmless error that can happen when using plugins like crazyenchantments --- Changelog.txt | 3 + pom.xml | 2 +- .../runnables/skills/BleedTimerTask.java | 25 +- .../nossr50/skills/swords/SwordsManager.java | 31 +-- .../nossr50/skills/taming/TamingManager.java | 32 +-- ...rAttackCooldownExploitPreventionLayer.java | 32 --- .../DummyPlayerAttackCooldownToolLayer.java | 42 ++++ ...rAttackCooldownExploitPreventionLayer.java | 202 --------------- .../PlayerAttackCooldownMethods.java | 43 ++-- .../PlayerAttackCooldownToolLayer.java | 237 ++++++++++++++++++ .../gmail/nossr50/util/nms/NMSConstants.java | 2 + .../nossr50/util/skills/CombatUtils.java | 2 +- 12 files changed, 363 insertions(+), 290 deletions(-) delete mode 100644 src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/DummyPlayerAttackCooldownExploitPreventionLayer.java create mode 100644 src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/DummyPlayerAttackCooldownToolLayer.java delete mode 100644 src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownExploitPreventionLayer.java create mode 100644 src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownToolLayer.java diff --git a/Changelog.txt b/Changelog.txt index 7a7d137c8..8ca13a1d0 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,6 @@ +Version 2.1.160 + Silenced a harmless "error" related to Rupture/Bleed often produced when using mcMMO and crazy enchantments together + Version 2.1.159 Fixed a memory leak involving renamed mobs Updated Adventure library (used in our chat code) diff --git a/pom.xml b/pom.xml index b5d5679ca..523a3346e 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.159 + 2.1.160-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java index aef946971..aee720282 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java @@ -16,6 +16,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; +import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Iterator; @@ -23,7 +24,7 @@ import java.util.Map; import java.util.Map.Entry; public class BleedTimerTask extends BukkitRunnable { - private static final Map bleedList = new HashMap<>(); + private static final @NotNull Map bleedList = new HashMap<>(); private static boolean isIterating = false; @Override @@ -148,7 +149,7 @@ public class BleedTimerTask extends BukkitRunnable { isIterating = false; } - public static BleedContainer copyContainer(BleedContainer container) + public static @NotNull BleedContainer copyContainer(@NotNull BleedContainer container) { LivingEntity target = container.target; LivingEntity source = container.damageSource; @@ -164,7 +165,7 @@ public class BleedTimerTask extends BukkitRunnable { * * @param entity LivingEntity to bleed out */ - public static void bleedOut(LivingEntity entity) { + public static void bleedOut(@NotNull LivingEntity entity) { /* * Don't remove anything from the list outside of run() */ @@ -178,26 +179,36 @@ public class BleedTimerTask extends BukkitRunnable { * Add a LivingEntity to the bleedList if it is not in it. * * @param entity LivingEntity to add + * @param attacker source of the bleed/rupture * @param ticks Number of bleeding ticks */ - public static void add(LivingEntity entity, LivingEntity attacker, int ticks, int bleedRank, int toolTier) { + public static void add(@NotNull LivingEntity entity, @NotNull LivingEntity attacker, int ticks, int bleedRank, int toolTier) { if (!Bukkit.isPrimaryThread()) { throw new IllegalStateException("Cannot add bleed task async!"); } - if (isIterating) throw new IllegalStateException("Cannot add task while iterating timers!"); + if(isIterating) { + //Used to throw an error here, but in reality all we are really doing is preventing concurrency issues from other plugins being naughty and its not really needed + //I'm not really a fan of silent errors, but I'm sick of seeing people using crazy enchantments come in and report this "bug" + return; + } + +// if (isIterating) throw new IllegalStateException("Cannot add task while iterating timers!"); if(toolTier < 4) ticks = Math.max(1, (ticks / 3)); ticks+=1; - BleedContainer newBleedContainer = new BleedContainer(entity, ticks, bleedRank, toolTier, attacker); bleedList.put(entity, newBleedContainer); } - public static boolean isBleeding(LivingEntity entity) { + public static boolean isBleedOperationAllowed() { + return !isIterating && Bukkit.isPrimaryThread(); + } + + public static boolean isBleeding(@NotNull LivingEntity entity) { return bleedList.containsKey(entity); } } diff --git a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java index e536c50f1..ebcc93993 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java @@ -20,6 +20,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; import java.util.Map; @@ -59,26 +60,28 @@ public class SwordsManager extends SkillManager { * * @param target The defending entity */ - public void ruptureCheck(LivingEntity target) { - if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.SWORDS_RUPTURE, getPlayer(), this.mmoPlayer.getAttackStrength())) { + public void ruptureCheck(@NotNull LivingEntity target) throws IllegalStateException { + if(BleedTimerTask.isBleedOperationAllowed()) { + if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.SWORDS_RUPTURE, getPlayer(), this.mmoPlayer.getAttackStrength())) { - if (target instanceof Player) { - Player defender = (Player) target; + if (target instanceof Player) { + Player defender = (Player) target; - //Don't start or add to a bleed if they are blocking - if(defender.isBlocking()) - return; + //Don't start or add to a bleed if they are blocking + if(defender.isBlocking()) + return; - if (NotificationManager.doesPlayerUseNotifications(defender)) { - if(!BleedTimerTask.isBleeding(defender)) - NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started"); + if (NotificationManager.doesPlayerUseNotifications(defender)) { + if(!BleedTimerTask.isBleeding(defender)) + NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started"); + } } - } - BleedTimerTask.add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE), getToolTier(getPlayer().getInventory().getItemInMainHand())); + BleedTimerTask.add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE), getToolTier(getPlayer().getInventory().getItemInMainHand())); - if (mmoPlayer.useChatNotifications()) { - NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding"); + if (mmoPlayer.useChatNotifications()) { + NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding"); + } } } } diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 7b5f11f0b..64c2e8f16 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -31,6 +31,7 @@ import org.bukkit.Material; import org.bukkit.attribute.Attribute; import org.bukkit.entity.*; import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -147,7 +148,7 @@ public class TamingManager extends SkillManager { * * @param entity The LivingEntity to award XP for */ - public void awardTamingXP(LivingEntity entity) { + public void awardTamingXP(@NotNull LivingEntity entity) { applyXpGain(ExperienceConfig.getInstance().getTamingXP(entity.getType()), XPGainReason.PVE); } @@ -157,7 +158,7 @@ public class TamingManager extends SkillManager { * @param wolf The wolf using the ability * @param damage The damage being absorbed by the wolf */ - public void fastFoodService(Wolf wolf, double damage) { + public void fastFoodService(@NotNull Wolf wolf, double damage) { if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.TAMING_FAST_FOOD_SERVICE, getPlayer())) { return; } @@ -177,20 +178,23 @@ public class TamingManager extends SkillManager { * @param target The LivingEntity to apply Gore on * @param damage The initial damage */ - public double gore(LivingEntity target, double damage) { - if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.TAMING_GORE, getPlayer())) { - return 0; + public double gore(@NotNull LivingEntity target, double damage) { + if(BleedTimerTask.isBleedOperationAllowed()) { + if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.TAMING_GORE, getPlayer())) { + return 0; + } + + BleedTimerTask.add(target, getPlayer(), Taming.goreBleedTicks, 1, 2); + + if (target instanceof Player) { + NotificationManager.sendPlayerInformation((Player)target, NotificationType.SUBSKILL_MESSAGE, "Combat.StruckByGore"); + } + + NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.Gore"); + + damage = (damage * Taming.goreModifier) - damage; } - BleedTimerTask.add(target, getPlayer(), Taming.goreBleedTicks, 1, 2); - - if (target instanceof Player) { - NotificationManager.sendPlayerInformation((Player)target, NotificationType.SUBSKILL_MESSAGE, "Combat.StruckByGore"); - } - - NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.Gore"); - - damage = (damage * Taming.goreModifier) - damage; return damage; } diff --git a/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/DummyPlayerAttackCooldownExploitPreventionLayer.java b/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/DummyPlayerAttackCooldownExploitPreventionLayer.java deleted file mode 100644 index ad0e5d235..000000000 --- a/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/DummyPlayerAttackCooldownExploitPreventionLayer.java +++ /dev/null @@ -1,32 +0,0 @@ -//package com.gmail.nossr50.util.compat.layers.attackcooldown; -// -//import com.gmail.nossr50.util.nms.NMSVersion; -//import org.bukkit.entity.Player; -// -//import java.lang.reflect.InvocationTargetException; -// -//public class DummyPlayerAttackCooldownExploitPreventionLayer extends PlayerAttackCooldownExploitPreventionLayer { -// public DummyPlayerAttackCooldownExploitPreventionLayer() { -// super(NMSVersion.UNSUPPORTED); -// } -// -// @Override -// public boolean initializeLayer() { -// return noErrorsOnInitialize; -// } -// -// @Override -// public float getAttackStrength(Player player) throws InvocationTargetException, IllegalAccessException { -// return 1.0F; //Always full strength -// } -// -// @Override -// public float getCooldownValue(Player player) throws InvocationTargetException, IllegalAccessException { -// return 0F; -// } -// -// @Override -// public void resetAttackStrength(Player player) throws InvocationTargetException, IllegalAccessException { -// //Do nothing -// } -//} diff --git a/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/DummyPlayerAttackCooldownToolLayer.java b/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/DummyPlayerAttackCooldownToolLayer.java new file mode 100644 index 000000000..909f290b6 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/DummyPlayerAttackCooldownToolLayer.java @@ -0,0 +1,42 @@ +package com.gmail.nossr50.util.compat.layers.attackcooldown; + +import com.gmail.nossr50.util.nms.NMSVersion; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.lang.reflect.InvocationTargetException; + +public class DummyPlayerAttackCooldownToolLayer extends PlayerAttackCooldownToolLayer { + public DummyPlayerAttackCooldownToolLayer() { + super(NMSVersion.UNSUPPORTED); + } + + @Override + public boolean initializeLayer() { + return noErrorsOnInitialize; + } + + @Override + public float getAttackStrength(@NotNull Player player) throws InvocationTargetException, IllegalAccessException { + return 1.0F; //Always full strength + } + + @Override + public float getCooldownValue(@NotNull Player player) throws InvocationTargetException, IllegalAccessException { + return 0F; + } + + @Override + public void resetAttackStrength(@NotNull Player player) throws InvocationTargetException, IllegalAccessException { + //Do nothing + } + + @Override + public int getCooldownFieldValue(@NotNull Player player) throws InvocationTargetException, IllegalAccessException { + return 0; + } + + @Override + public void setCooldownFieldValue(@NotNull Player player, int fieldValue) throws InvocationTargetException, IllegalAccessException { + } +} diff --git a/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownExploitPreventionLayer.java b/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownExploitPreventionLayer.java deleted file mode 100644 index 3b5b929a4..000000000 --- a/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownExploitPreventionLayer.java +++ /dev/null @@ -1,202 +0,0 @@ -//package com.gmail.nossr50.util.compat.layers.attackcooldown; -// -//import com.gmail.nossr50.mcMMO; -//import com.gmail.nossr50.util.compat.layers.AbstractNMSCompatibilityLayer; -//import com.gmail.nossr50.util.nms.NMSConstants; -//import com.gmail.nossr50.util.nms.NMSVersion; -//import org.bukkit.entity.Player; -//import org.jetbrains.annotations.NotNull; -//import org.jetbrains.annotations.Nullable; -// -//import java.lang.reflect.InvocationTargetException; -//import java.lang.reflect.Method; -// -///** -// * -// * These classes are a band-aid solution for adding NMS support into 2.1.XXX -// * In 2.2 we are switching to modules and that will clean things up significantly -// * -// */ -//public class PlayerAttackCooldownExploitPreventionLayer extends AbstractNMSCompatibilityLayer implements PlayerAttackCooldownMethods{ -// -// private final String cbNMSVersionPath; -// -// protected Class craftPlayerClass; -// protected Class entityHumanClass; -// -// protected Method playerAttackCooldownMethod; -// protected Method playerAttackStrengthMethod; -// protected Method resetPlayerAttackCooldownMethod; -// protected Method getHandleMethod; -// -// public PlayerAttackCooldownExploitPreventionLayer(@NotNull NMSVersion nmsVersion) { -// super(nmsVersion); -// mcMMO.p.getLogger().info("Loading Compatibility Layer... (Player Attack Cooldown Exploit Prevention)"); -// if(!isCompatibleWithMinecraftVersion()) { -// mcMMO.p.getLogger().severe("this version of mcMMO does not support NMS for this version of Minecraft, try updating mcMMO or updating Minecraft. Not all versions of Minecraft will have NMS support built into mcMMO."); -// cbNMSVersionPath = ""; -// } else { -// if(NMSConstants.getCraftBukkitVersionPath(nmsVersion) != null) { -// cbNMSVersionPath = NMSConstants.getCraftBukkitVersionPath(nmsVersion); -// noErrorsOnInitialize = initializeLayer(); -// -// if(noErrorsOnInitialize) { -// mcMMO.p.getLogger().info("Successfully Loaded Compatibility Layer! (Player Attack Cooldown Exploit Prevention)"); -// } -// } else { -// mcMMO.p.getLogger().info("Failed to load - CL (Player Attack Cooldown Exploit Prevention) Could not find CB NMS path for CL"); -// flagErrorsDuringStartup(); -// mcMMO.p.getLogger().warning("Could not wire NMS package path for CraftBukkit!"); -// cbNMSVersionPath = ""; -// } -// } -// } -// -// private boolean isCompatibleWithMinecraftVersion() { -// switch(nmsVersion) { -// case NMS_1_13_2: -// case NMS_1_14_4: -// case NMS_1_15_2: -// case NMS_1_16_1: -// return true; -// default: -// return false; -// } -// -// } -// -// /** -// * Cache all reflection methods/types/classes needed for the NMS of this CompatibilityLayer -// * @param cooldownMethodName the cooldown method name -// * @param attackStrengthMethodName the attack strength method name -// * @param resetAttackCooldownMethodName the reset attack cooldown method name -// * @param getHandleMethodName the get handle method name -// * @return true if NMS was successfully wired -// */ -// public boolean wireNMS(@NotNull String cooldownMethodName, @NotNull String attackStrengthMethodName, @NotNull String resetAttackCooldownMethodName, @NotNull String getHandleMethodName) { -// entityHumanClass = initEntityHumanClass(); -// craftPlayerClass = initCraftPlayerClass(); -// -// try { -// this.playerAttackCooldownMethod = entityHumanClass.getMethod(cooldownMethodName); -// this.playerAttackStrengthMethod = entityHumanClass.getMethod(attackStrengthMethodName, float.class); -// this.resetPlayerAttackCooldownMethod = entityHumanClass.getMethod(resetAttackCooldownMethodName); -// if (craftPlayerClass != null) { -// this.getHandleMethod = craftPlayerClass.getMethod(getHandleMethodName); -// } else { -// return false; -// } -// return true; -// } catch (NoSuchMethodException e) { -// flagErrorsDuringStartup(); -// e.printStackTrace(); -// return false; -// } -// } -// -// /** -// * Get the cached player attack cooldown method -// * @return the cached player attack cooldown method -// */ -// private @Nullable Method getPlayerAttackCooldownMethod() { -// return playerAttackCooldownMethod; -// } -// -// /** -// * Get the cached player attack strength method -// * @return the cached player attack strength method -// */ -// private @Nullable Method getPlayerAttackStrengthMethod() { -// return playerAttackStrengthMethod; -// } -// -// /** -// * Get the cached player attack cooldown reset method -// * @return the cached player attack cooldown reset method -// */ -// private @Nullable Method getResetPlayerAttackCooldownMethod() { -// return resetPlayerAttackCooldownMethod; -// } -// -// /** -// * Grab the CraftPlayer class type from NMS -// * @return the CraftPlayer class type from NMS -// */ -// private @Nullable Class initCraftPlayerClass() { -// try { -// return Class.forName(NMSConstants.getCraftPlayerClassPath(cbNMSVersionPath)); -// } catch (ClassNotFoundException e) { -// flagErrorsDuringStartup(); -// e.printStackTrace(); -// return null; -// } -// } -// -// /** -// * Grab the EntityHuman class type from NMS -// * @return the EntityHuman class type from NMS -// */ -// private @Nullable Class initEntityHumanClass() { -// try { -// return Class.forName(NMSConstants.getEntityHumanClassPath(cbNMSVersionPath)); -// } catch (ClassNotFoundException e) { -// flagErrorsDuringStartup(); -// e.printStackTrace(); -// return null; -// } -// } -// -// private void flagErrorsDuringStartup() { -// noErrorsOnInitialize = false; -// } -// -// /** -// * Grabs the attack strength for a player -// * Should be noted that as of today there is no way to capture a players current attack strength in spigot when they attack an entity outside of network packet listening -// * @param player target player -// * @return the float value of the player's attack strength -// */ -// @Override -// public float getAttackStrength(Player player) throws InvocationTargetException, IllegalAccessException { -// Object craftPlayer = craftPlayerClass.cast(player); -// Object entityHuman = entityHumanClass.cast(getHandleMethod.invoke(craftPlayer)); -// -// return (float) playerAttackStrengthMethod.invoke(entityHuman, 0F); //Add no adjustment ticks -// } -// -// @Override -// public float getCooldownValue(Player player) throws InvocationTargetException, IllegalAccessException { -// Object craftPlayer = craftPlayerClass.cast(player); -// Object entityHuman = entityHumanClass.cast(getHandleMethod.invoke(craftPlayer)); -// -// return (float) playerAttackCooldownMethod.invoke(entityHuman); //Add no adjustment ticks -// } -// -// @Override -// public void resetAttackStrength(Player player) throws InvocationTargetException, IllegalAccessException { -// Object craftPlayer = craftPlayerClass.cast(player); -// Object entityHuman = entityHumanClass.cast(getHandleMethod.invoke(craftPlayer)); -// -// resetPlayerAttackCooldownMethod.invoke(entityHuman); -// } -// -// @Override -// public boolean initializeLayer() { -// switch(nmsVersion) { -// case NMS_1_12_2: -// return wireNMS("dr", "n", "ds", "getHandle"); -// case NMS_1_13_2: -// return wireNMS("dG", "r", "dH", "getHandle"); -// case NMS_1_14_4: -// return wireNMS("dY", "s", "dZ", "getHandle"); -// case NMS_1_15_2: -// return wireNMS("ex", "s", "ey", "getHandle"); -// case NMS_1_16_1: -// return wireNMS("eR", "getAttackCooldown", "resetAttackCooldown", "getHandle"); -// default: -// break; -// } -// -// return false; -// } -//} diff --git a/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownMethods.java b/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownMethods.java index d990fe1aa..510577a68 100644 --- a/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownMethods.java +++ b/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownMethods.java @@ -1,19 +1,24 @@ -//package com.gmail.nossr50.util.compat.layers.attackcooldown; -// -//import org.bukkit.entity.Player; -// -//import java.lang.reflect.InvocationTargetException; -// -//public interface PlayerAttackCooldownMethods { -// /** -// * Grabs the attack strength for a player -// * Should be noted that as of today there is no way to capture a players current attack strength in spigot when they attack an entity outside of network packet listening -// * @param player target player -// * @return the float value of the player's attack strength -// */ -// float getAttackStrength(Player player) throws InvocationTargetException, IllegalAccessException; -// -// float getCooldownValue(Player player) throws InvocationTargetException, IllegalAccessException; -// -// void resetAttackStrength(Player player) throws InvocationTargetException, IllegalAccessException; -//} +package com.gmail.nossr50.util.compat.layers.attackcooldown; + +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.lang.reflect.InvocationTargetException; + +public interface PlayerAttackCooldownMethods { + /** + * Grabs the attack strength for a player + * Should be noted that as of today there is no way to capture a players current attack strength in spigot when they attack an entity outside of network packet listening + * @param player target player + * @return the float value of the player's attack strength + */ + float getAttackStrength(@NotNull Player player) throws InvocationTargetException, IllegalAccessException; + + float getCooldownValue(@NotNull Player player) throws InvocationTargetException, IllegalAccessException; + + void resetAttackStrength(@NotNull Player player) throws InvocationTargetException, IllegalAccessException; + + int getCooldownFieldValue(@NotNull Player player) throws InvocationTargetException, IllegalAccessException; + + void setCooldownFieldValue(@NotNull Player player, int fieldValue) throws InvocationTargetException, IllegalAccessException; +} diff --git a/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownToolLayer.java b/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownToolLayer.java new file mode 100644 index 000000000..539c1a0c4 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/util/compat/layers/attackcooldown/PlayerAttackCooldownToolLayer.java @@ -0,0 +1,237 @@ +package com.gmail.nossr50.util.compat.layers.attackcooldown; + +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.compat.layers.AbstractNMSCompatibilityLayer; +import com.gmail.nossr50.util.nms.NMSConstants; +import com.gmail.nossr50.util.nms.NMSVersion; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * + * These classes are a band-aid solution for adding NMS support into 2.1.XXX + * In 2.2 we are switching to modules and that will clean things up significantly + * + */ +public class PlayerAttackCooldownToolLayer extends AbstractNMSCompatibilityLayer implements PlayerAttackCooldownMethods { + + private final String cbNMSVersionPath; + + protected Class craftPlayerClass; + protected Class entityHumanClass; + protected Class entityLivingClass; + + protected Method playerAttackCooldownMethod; + protected Method playerAttackStrengthMethod; + protected Method resetPlayerAttackCooldownMethod; + protected Method setPlayerAttackStrengthMethod; + protected Method getHandleMethod; + protected Field attackCooldownField; + protected String attackStrengthFieldName; + + public PlayerAttackCooldownToolLayer(@NotNull NMSVersion nmsVersion) { + super(nmsVersion); + mcMMO.p.getLogger().info("Loading Compatibility Layer... (Player Attack Cooldown Exploit Prevention)"); + if(!isCompatibleWithMinecraftVersion(nmsVersion)) { + mcMMO.p.getLogger().severe("this version of mcMMO does not support NMS for this version of Minecraft, try updating mcMMO or updating Minecraft. Not all versions of Minecraft will have NMS support built into mcMMO."); + cbNMSVersionPath = ""; + } else { + if(NMSConstants.getCraftBukkitVersionPath(nmsVersion) != null) { + cbNMSVersionPath = NMSConstants.getCraftBukkitVersionPath(nmsVersion); + noErrorsOnInitialize = initializeLayer(); + + if(noErrorsOnInitialize) { + mcMMO.p.getLogger().info("Successfully Loaded Compatibility Layer! (Player Attack Cooldown Exploit Prevention)"); + } + } else { + mcMMO.p.getLogger().info("Failed to load - CL (Player Attack Cooldown Exploit Prevention) Could not find CB NMS path for CL"); + flagErrorsDuringStartup(); + mcMMO.p.getLogger().warning("Could not wire NMS package path for CraftBukkit!"); + cbNMSVersionPath = ""; + } + } + } + + public static boolean isCompatibleWithMinecraftVersion(@NotNull NMSVersion nmsVersion) { + switch(nmsVersion) { + case NMS_1_13_2: + case NMS_1_14_4: + case NMS_1_15_2: + case NMS_1_16_4: + return true; + default: + return false; + } + } + + /** + * Cache all reflection methods/types/classes needed for the NMS of this CompatibilityLayer + * @param cooldownMethodName the cooldown method name + * @param attackStrengthMethodName the attack strength method name + * @param resetAttackCooldownMethodName the reset attack cooldown method name + * @param getHandleMethodName the get handle method name + * @return true if NMS was successfully wired + */ + public boolean wireNMS(@NotNull String cooldownMethodName, @NotNull String attackStrengthMethodName, @NotNull String resetAttackCooldownMethodName, @NotNull String getHandleMethodName, @NotNull String attackStrengthFieldName) { + entityHumanClass = initEntityHumanClass(); + + if (entityHumanClass != null) { + entityLivingClass = entityHumanClass.getSuperclass(); + } + + craftPlayerClass = initCraftPlayerClass(); + this.attackStrengthFieldName = attackStrengthFieldName; + + try { + this.attackCooldownField = entityLivingClass.getDeclaredField(attackStrengthFieldName); + this.attackCooldownField.setAccessible(true); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } + + try { + this.playerAttackCooldownMethod = entityHumanClass.getMethod(cooldownMethodName); + this.playerAttackStrengthMethod = entityHumanClass.getMethod(attackStrengthMethodName, float.class); + this.resetPlayerAttackCooldownMethod = entityHumanClass.getMethod(resetAttackCooldownMethodName); + + if (craftPlayerClass != null) { + this.getHandleMethod = craftPlayerClass.getMethod(getHandleMethodName); + } else { + return false; + } + return true; + } catch (NoSuchMethodException e) { + flagErrorsDuringStartup(); + e.printStackTrace(); + return false; + } + } + + /** + * Get the cached player attack cooldown method + * @return the cached player attack cooldown method + */ + private @Nullable Method getPlayerAttackCooldownMethod() { + return playerAttackCooldownMethod; + } + + /** + * Get the cached player attack strength method + * @return the cached player attack strength method + */ + private @Nullable Method getPlayerAttackStrengthMethod() { + return playerAttackStrengthMethod; + } + + /** + * Get the cached player attack cooldown reset method + * @return the cached player attack cooldown reset method + */ + private @Nullable Method getResetPlayerAttackCooldownMethod() { + return resetPlayerAttackCooldownMethod; + } + + /** + * Grab the CraftPlayer class type from NMS + * @return the CraftPlayer class type from NMS + */ + private @Nullable Class initCraftPlayerClass() { + try { + return Class.forName(NMSConstants.getCraftPlayerClassPath(cbNMSVersionPath)); + } catch (ClassNotFoundException e) { + flagErrorsDuringStartup(); + e.printStackTrace(); + return null; + } + } + + /** + * Grab the EntityHuman class type from NMS + * @return the EntityHuman class type from NMS + */ + private @Nullable Class initEntityHumanClass() { + try { + return Class.forName(NMSConstants.getEntityHumanClassPath(cbNMSVersionPath)); + } catch (ClassNotFoundException e) { + flagErrorsDuringStartup(); + e.printStackTrace(); + return null; + } + } + + private void flagErrorsDuringStartup() { + noErrorsOnInitialize = false; + } + + /** + * Grabs the attack strength for a player + * Should be noted that as of today there is no way to capture a players current attack strength in spigot when they attack an entity outside of network packet listening + * @param player target player + * @return the float value of the player's attack strength + */ + @Override + public float getAttackStrength(@NotNull Player player) throws InvocationTargetException, IllegalAccessException { + Object craftPlayer = craftPlayerClass.cast(player); + Object entityHuman = entityHumanClass.cast(getHandleMethod.invoke(craftPlayer)); + + return (float) playerAttackStrengthMethod.invoke(entityHuman, 0F); //Add no adjustment ticks + } + + @Override + public float getCooldownValue(@NotNull Player player) throws InvocationTargetException, IllegalAccessException { + Object craftPlayer = craftPlayerClass.cast(player); + Object entityHuman = entityHumanClass.cast(getHandleMethod.invoke(craftPlayer)); + + return (float) playerAttackCooldownMethod.invoke(entityHuman); //Add no adjustment ticks + } + + @Override + public void resetAttackStrength(@NotNull Player player) throws InvocationTargetException, IllegalAccessException { + Object craftPlayer = craftPlayerClass.cast(player); + Object entityHuman = entityHumanClass.cast(getHandleMethod.invoke(craftPlayer)); + Object entityLiving = entityLivingClass.cast(entityHuman); + + resetPlayerAttackCooldownMethod.invoke(entityLiving); + } + + @Override + public int getCooldownFieldValue(@NotNull Player player) throws InvocationTargetException, IllegalAccessException { + Object craftPlayer = craftPlayerClass.cast(player); + Object entityHuman = entityHumanClass.cast(getHandleMethod.invoke(craftPlayer)); + Object entityLiving = entityLivingClass.cast(entityHuman); + + return attackCooldownField.getInt(entityLiving); + } + + @Override + public void setCooldownFieldValue(@NotNull Player player, int fieldValue) throws InvocationTargetException, IllegalAccessException { + Object craftPlayer = craftPlayerClass.cast(player); + Object entityHuman = entityHumanClass.cast(getHandleMethod.invoke(craftPlayer)); + + attackCooldownField.setInt(entityHuman, fieldValue); + } + + @Override + public boolean initializeLayer() { + switch(nmsVersion) { + case NMS_1_12_2: + return wireNMS("dr", "n", "ds", "getHandle", "at"); + case NMS_1_13_2: + return wireNMS("dG", "r", "dH", "getHandle", "at"); + case NMS_1_14_4: + return wireNMS("dY", "s", "dZ", "getHandle", "at"); + case NMS_1_15_2: + return wireNMS("ex", "s", "ey", "getHandle", "at"); + case NMS_1_16_4: + return wireNMS("eR", "getAttackCooldown", "resetAttackCooldown", "getHandle", "at"); + default: + throw new RuntimeException("Unexpected NMS version support in PlayerAttackCooldown compatibility layer initialization!"); + } + } +} + diff --git a/src/main/java/com/gmail/nossr50/util/nms/NMSConstants.java b/src/main/java/com/gmail/nossr50/util/nms/NMSConstants.java index 6f740e084..38d65eb4b 100644 --- a/src/main/java/com/gmail/nossr50/util/nms/NMSConstants.java +++ b/src/main/java/com/gmail/nossr50/util/nms/NMSConstants.java @@ -50,6 +50,8 @@ public class NMSConstants { return "v1_15_R1"; case NMS_1_16_1: return "v1_16_R1"; + case NMS_1_16_4: + return "v1_16_R3"; case UNSUPPORTED: break; } diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 2c28b1969..616f0e562 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -600,7 +600,7 @@ public final class CombatUtils { return processingNoInvulnDamage; } - public static void dealNoInvulnerabilityTickDamage(@NotNull LivingEntity target, double damage, Entity attacker) { + public static void dealNoInvulnerabilityTickDamage(@NotNull LivingEntity target, double damage, @Nullable Entity attacker) { if (target.isDead()) { return; } From 7f213ee30549777c8745ef499ded311e27e505e9 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 9 Dec 2020 15:34:32 -0800 Subject: [PATCH 15/16] exploit fix --- .../nossr50/listeners/BlockListener.java | 32 +++------ .../nossr50/listeners/EntityListener.java | 71 +++---------------- 2 files changed, 20 insertions(+), 83 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index b2ce690f7..a2a4c2a76 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -158,6 +158,7 @@ public class BlockListener implements Listener { /** * Monitor blocks formed by entities (snowmen) + * Does not seem to monitor stuff like a falling block creating a new block * * @param event The event to watch */ @@ -176,6 +177,9 @@ public class BlockListener implements Listener { } } + /* + * Does not monitor stuff like a falling block replacing a liquid + */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockFormEvent(BlockFormEvent event) { @@ -183,12 +187,12 @@ public class BlockListener implements Listener { if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) return; - if(ExperienceConfig.getInstance().preventStoneLavaFarming()) - { - if(event.getNewState().getType() != Material.OBSIDIAN - && ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, event.getNewState().getBlockData())) - { - mcMMO.getPlaceStore().setTrue(event.getNewState()); + BlockState newState = event.getNewState(); + + if(ExperienceConfig.getInstance().preventStoneLavaFarming()) { + if(newState.getType() != Material.OBSIDIAN + && ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, newState.getBlockData())) { + mcMMO.getPlaceStore().setTrue(newState); } } } @@ -244,17 +248,6 @@ public class BlockListener implements Listener { /* Check if the blocks placed should be monitored so they do not give out XP in the future */ mcMMO.getPlaceStore().setTrue(blockState); } - -// /* WORLD BLACKLIST CHECK */ -// if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) { -// return; -// } -// -// Player player = event.getPlayer(); -// -// if (!UserManager.hasPlayerDataKey(player)) { -// return; -// } } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -265,11 +258,6 @@ public class BlockListener implements Listener { return; BlockState blockState = event.getBlock().getState(); - -// if (!BlockUtils.shouldBeWatched(blockState)) { -// return; -// } - mcMMO.getPlaceStore().setFalse(blockState); } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index ca1a5a94b..804c3c73a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -196,18 +196,24 @@ public class EntityListener implements Listener { return; Block block = event.getBlock(); + Entity entity = event.getEntity(); + Material notYetReplacedType = block.getState().getType(); //because its from getState() this is the block that hasn't been changed yet, which is likely air/lava/water etc + // When the event is fired for the falling block that changes back to a // normal block // event.getBlock().getType() returns AIR if (!BlockUtils.shouldBeWatched(block.getState()) - && block.getState().getType() != Material.WATER - && block.getType() != Material.AIR) { + && notYetReplacedType != Material.WATER && notYetReplacedType != Material.LAVA + && block.getType() != Material.AIR && block.getType() != Material.CAVE_AIR) { return; } + //I could just have it mark all blocks after this but it would potentially cause some really edge case consistency issues that no one would notice - Entity entity = event.getEntity(); - + /* + * This mess of code tries to avoid marking the moved block as true in our place store + * It's a headache to read but it works, I'm tempted to just remove it + */ if (entity instanceof FallingBlock || entity instanceof Enderman) { boolean isTracked = entity.hasMetadata(mcMMO.travelingBlock); @@ -228,63 +234,6 @@ public class EntityListener implements Listener { } } -// /** -// * Monitor EntityChangeBlock events. -// * -// * @param event -// * The event to watch -// */ -// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) -// public void onEntityChangeBlock(EntityChangeBlockEvent event) { -// /* WORLD BLACKLIST CHECK */ -// if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) -// return; -// -// Block block = event.getBlock(); -// -// // When the event is fired for the falling block that changes back to a -// // normal block -// // event.getBlock().getType() returns AIR -// if (!BlockUtils.shouldBeWatched(block.getState()) -// && block.getState().getType() != Material.WATER -// && block.getType() != Material.AIR) { -// return; -// } -// -// Entity entity = event.getEntity(); -// -// if (entity instanceof FallingBlock || entity instanceof Enderman) { -// trackMovingBlocks(block, entity); //ignore the IDE warning -// //Apparently redstone ore will throw these events -// } else if ((block.getType() != Material.REDSTONE_ORE)) { -// if (mcMMO.getPlaceStore().isTrue(block)) { -// mcMMO.getPlaceStore().setFalse(block); -// } -// } -// } - -// /** -// * This is a complex hack to track blocks for this event -// * This event is called when a block starts its movement, or ends its movement -// * It can start the movement through physics (falling blocks) or through being picked up (endermen) -// * Since this event can be cancelled, its even weirder to track this stuff -// * @param block this will either be the block that was originally picked up, or the block in its final destination -// * @param movementSourceEntity this will either be an Endermen or a Falling Block -// */ -// private void trackMovingBlocks(@NotNull Block block, @NotNull Entity movementSourceEntity) { -// -// //A block that has reached its destination, either being placed by endermen or having finished its fall -// if(movementSourceEntity.hasMetadata(mcMMO.travelingBlock)) { -// mcMMO.getPlaceStore().setTrue(block); -// movementSourceEntity.removeMetadata(mcMMO.travelingBlock, pluginRef); -// } else { -// //A block that is starting movement (from either Endermen or Falling/Physics) -// if(mcMMO.getPlaceStore().isTrue(block)) { -// mcMMO.getPlaceStore().setFalse(block); -// movementSourceEntity.setMetadata(mcMMO.blockMetadataKey, mcMMO.metadataValue); -// } -// } -// } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) { From a114886454f58cac5a6f61a3785be84cfd52de4b Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 9 Dec 2020 15:36:54 -0800 Subject: [PATCH 16/16] 2.1.160 --- Changelog.txt | 1 + pom.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 8ca13a1d0..67f252785 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ Version 2.1.160 + Fixed another 9+ year old exploit Silenced a harmless "error" related to Rupture/Bleed often produced when using mcMMO and crazy enchantments together Version 2.1.159 diff --git a/pom.xml b/pom.xml index 523a3346e..cb1fc2630 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.160-SNAPSHOT + 2.1.160 mcMMO https://github.com/mcMMO-Dev/mcMMO