From 1db0aae46b8b12a2edf2d1838873fe7f19a44ef8 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 3 Jan 2025 15:41:18 -0800 Subject: [PATCH] fix alchemy xp permission issue Fixes #5131 --- Changelog.txt | 1 + .../java/com/gmail/nossr50/listeners/InventoryListener.java | 4 ++++ .../java/com/gmail/nossr50/util/ContainerMetadataUtils.java | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 09ff71359..639fa8a8a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ Version 2.2.030 + Fixed bug where Smelting permission was needed for Alchemy XP gain Fixed material based salvage permissions not functioning (Thanks Momshroom) Version 2.2.029 diff --git a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index acaab2b0d..9f2c746ef 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -167,11 +167,15 @@ public class InventoryListener implements Listener { McMMOPlayer mmoPlayer = UserManager.getPlayer(player); if (event.getInventory() instanceof FurnaceInventory furnaceInventory) { + if (!mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.SMELTING)) + return; //Switch owners ContainerMetadataUtils.processContainerOwnership(furnaceInventory.getHolder(), player); } if (event.getInventory() instanceof BrewerInventory brewerInventory) { + if (!mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.ALCHEMY)) + return; // switch owners ContainerMetadataUtils.processContainerOwnership(brewerInventory.getHolder(), player); } diff --git a/src/main/java/com/gmail/nossr50/util/ContainerMetadataUtils.java b/src/main/java/com/gmail/nossr50/util/ContainerMetadataUtils.java index b06c1fcdc..2a49f0461 100644 --- a/src/main/java/com/gmail/nossr50/util/ContainerMetadataUtils.java +++ b/src/main/java/com/gmail/nossr50/util/ContainerMetadataUtils.java @@ -79,9 +79,6 @@ public class ContainerMetadataUtils { } public static void processContainerOwnership(BlockState blockState, Player player) { - if (!mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.SMELTING)) - return; - if (getContainerOwner(blockState) != null) { if (getContainerOwner(blockState).getUniqueId().equals(player.getUniqueId())) return;