From 07d18e2ebadc7b7a6867e527851899d011d8cdfb Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 5 Oct 2025 12:27:20 -0700 Subject: [PATCH] 1.21.9 support for treasures.yml, experience.yml, fishing_treasures.yml, and settings for mannequins and a fix for armor stands --- Changelog.txt | 17 ++++++--- .../config/experience/ExperienceConfig.java | 4 +++ .../nossr50/listeners/EntityListener.java | 11 +++--- .../gmail/nossr50/util/MaterialMapStore.java | 1 + .../nossr50/util/skills/CombatUtils.java | 8 ++--- src/main/resources/experience.yml | 4 +++ src/main/resources/fishing_treasures.yml | 36 +++++++++++++++++++ src/main/resources/treasures.yml | 8 +++++ 8 files changed, 77 insertions(+), 12 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index b40bf11d4..04692fe94 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,15 +1,24 @@ Version 2.2.043 Added support for the new copper tools and weapons added in Minecraft 1.21.9 + Added many missing buttons, trapdoors, doors, fence gates, etc to the ability/tool blacklists (see notes) Added copper tools and armor to repair.vanilla.yml (see notes) Added copper tools and armor to salvage.vanilla.yml (see notes) - Added many missing buttons, trapdoors, doors, fence gates, etc to the ability/tool blacklists (see notes) - TOOD: Smelting + Added copper tools and armor to fishing_treasures.yml (see notes) + Added Copper_Nugget to treasures.yml (see notes) + Added Copper_Nugget to experience.yml for Smelting XP + Added Copper_Golem to experience.yml for Combat XP + Fixed ExploitFix.PreventArmorStandInteraction in experience.yml not being respected + Added ExploitFix.PreventMannequinInteraction to experience.yml to prevent mannequins from granting XP or other effects NOTES: - You will need to manually update your repair.vanilla.yml and salvage.vanilla.yml files to get support for copper tools and armor. + You don't need to update your experience.yml, that one updates automatically when you run mcMMO after an update. + You will need to manually update the following files manually repair.vanilla.yml, salvage.vanilla.yml, treasures.yml, and fishing_treasures.yml files to get support for copper tools and armor. You can find the default config files in the defaults folder at plugins\mcMMO\defaults after running this mcMMO update at least once. - You can use this default file to copy paste if you please, or if you haven't customizes these two config files, simply delete them to have mcMMO regenerate them with the new entries. + You can use this default file to copy paste if you please + OR if you haven't customizes these config files, simply delete them to have mcMMO regenerate them with the new entries. mcMMO has an internal blacklist of blocks that abilities and tools won't activate or "ready" on, pretty much anything that is interactable should go on this list, and I performed an audit and there were quite a few missing entries, so I've added them in this update, what this means is you won't click on a button and have it ready your tool anymore, as it should have been doing. + Mannequins are treated the same way armor stands are treated, the default behavior is mcMMO won't process on them unless you turn on the setting under ExploitFix in experience.yml, in addition to this their default XP is set to 0.0 + mcMMO had a setting 'ExploitFix.PreventArmorStandInteraction' to allow mcMMO to process abilities and XP on armor stands, but it was never hooked up! I fixed that mistake in this update. Version 2.2.042 mcMMO now listens to BlockDropItemEvent at LOW priority instead of HIGHEST diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index a13b47019..b630a2815 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -201,6 +201,10 @@ public class ExperienceConfig extends BukkitConfig { return config.getBoolean("ExploitFix.PreventArmorStandInteraction", true); } + public boolean isMannequinInteractionPrevented() { + return config.getBoolean("ExploitFix.PreventMannequinInteraction", true); + } + public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 4cefae5b6..ec610dbef 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -34,6 +34,7 @@ import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.ProjectileUtils; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; +import java.util.Locale; import java.util.Set; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -352,11 +353,13 @@ public class EntityListener implements Listener { return; } - // Don't process this event for marked entities, for players this is handled above, - // However, for entities, we do not wanna cancel this event to allow plugins to observe changes - // properly + if (ExperienceConfig.getInstance().isArmorStandInteractionPrevented() + && attacker.getType().toString().toLowerCase(Locale.ENGLISH).equals("armor_stand")) { + return; + } - if (event.getEntity() instanceof ArmorStand) { + if (ExperienceConfig.getInstance().isMannequinInteractionPrevented() + && attacker.getType().toString().toLowerCase(Locale.ENGLISH).equals("mannequin")) { return; } diff --git a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java index 58d3456dc..e28380a63 100644 --- a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java +++ b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java @@ -1408,6 +1408,7 @@ public class MaterialMapStore { blackList.add("dropper"); blackList.add("hopper"); blackList.add("armor_stand"); + blackList.add("mannequin"); } private void fillAbilityBlackList() { 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 fc308689c..0f3591f19 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -58,7 +58,7 @@ import org.jetbrains.annotations.Nullable; public final class CombatUtils { - private static final ThreadLocal IN_MCMO_DAMAGE + private static final ThreadLocal IN_MCMMO_DAMAGE = ThreadLocal.withInitial(() -> false); @@ -75,14 +75,14 @@ public final class CombatUtils { */ public static void safeDealDamage(@NotNull LivingEntity target, double amount, @Nullable Entity attacker) { - boolean prev = IN_MCMO_DAMAGE.get(); + boolean prev = IN_MCMMO_DAMAGE.get(); if (prev || target.isDead()) { return; } try { - IN_MCMO_DAMAGE.set(true); + IN_MCMMO_DAMAGE.set(true); if (!hasIgnoreDamageMetadata(target)) { applyIgnoreDamageMetadata(target); } @@ -93,7 +93,7 @@ public final class CombatUtils { target.damage(amount); } } finally { - IN_MCMO_DAMAGE.set(false); + IN_MCMMO_DAMAGE.set(false); if (hasIgnoreDamageMetadata(target)) { removeIgnoreDamageMetadata(target); } diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index c9a2b4964..b44672872 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -30,6 +30,7 @@ ExploitFix: PistonCheating: true SnowGolemExcavation: true PreventArmorStandInteraction: true + PreventMannequinInteraction: true # This include NPCs from stuff like Citizens, this is not a setting for Vanilla Minecraft Villagers (Which can be considered NPCs) # mcMMO normally doesn't process attacks against an Entity if it is an NPC from another plugin # Of course, mcMMO doesn't know for sure whether something is an NPC, it checks a few known things, see our source code to see how @@ -553,6 +554,7 @@ Experience_Values: String: 1.8 Other: 1.5 Smelting: + Copper_Nugget: 85 Raw_Copper: 75 Deepslate_Redstone_Ore: 30 Deepslate_Copper_Ore: 100 @@ -683,3 +685,5 @@ Experience_Values: Camel: 1.2 Bogged: 2.0 Breeze: 4.0 + Armor_Stand: 0.0 + Mannequin: 0.0 diff --git a/src/main/resources/fishing_treasures.yml b/src/main/resources/fishing_treasures.yml index 3b9f796dc..f80284b11 100644 --- a/src/main/resources/fishing_treasures.yml +++ b/src/main/resources/fishing_treasures.yml @@ -63,6 +63,26 @@ Fishing: Amount: 1 XP: 200 Rarity: UNCOMMON + COPPER_SWORD: + Amount: 1 + XP: 200 + Rarity: UNCOMMON + COPPER_SHOVEL: + Amount: 1 + XP: 200 + Rarity: UNCOMMON + COPPER_PICKAXE: + Amount: 1 + XP: 200 + Rarity: UNCOMMON + COPPER_AXE: + Amount: 1 + XP: 200 + Rarity: UNCOMMON + COPPER_HOE: + Amount: 1 + XP: 200 + Rarity: UNCOMMON GOLDEN_SWORD: Amount: 1 XP: 200 @@ -143,6 +163,22 @@ Fishing: Amount: 1 XP: 200 Rarity: RARE + COPPER_BOOTS: + Amount: 1 + XP: 200 + Rarity: COMMON + COPPER_HELMET: + Amount: 1 + XP: 200 + Rarity: COMMON + COPPER_LEGGINGS: + Amount: 1 + XP: 200 + Rarity: COMMON + COPPER_CHESTPLATE: + Amount: 1 + XP: 200 + Rarity: COMMON IRON_BOOTS: Amount: 1 XP: 200 diff --git a/src/main/resources/treasures.yml b/src/main/resources/treasures.yml index 3de5a78a4..9a73a12f3 100755 --- a/src/main/resources/treasures.yml +++ b/src/main/resources/treasures.yml @@ -296,3 +296,11 @@ Hylian_Luck: Standard_Mode: 0 Retro_Mode: 0 Drops_From: [Pots] + COPPER_NUGGET: + Amount: 1 + XP: 5 + Drop_Chance: 100.0 + Level_Requirement: + Standard_Mode: 0 + Retro_Mode: 0 + Drops_From: [Pots]