From c6f242dbeeaf0aca3abe6ac4ca9b0da6e4b1855e Mon Sep 17 00:00:00 2001 From: Intybyte Date: Fri, 3 May 2024 18:09:52 +0200 Subject: [PATCH 1/4] Added McMMO anvil fix - Now you cannot repair or use sf materials to repair other items - Translation key mcmmo-repair should be added --- .../integrations/McMMOIntegration.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java index 6b9f2cf28e..8b42a081f8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java @@ -2,6 +2,7 @@ import javax.annotation.Nonnull; +import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -19,7 +20,7 @@ /** * This handles all integrations with {@link mcMMO}. - * + * * @author TheBusyBiscuit * */ @@ -54,6 +55,18 @@ public void onItemSalvage(McMMOPlayerSalvageCheckEvent e) { } } + @EventHandler(ignoreCancelled = true) + public void onItemRepair(McMMOPlayerRepairCheckEvent e) { + ItemStack repaired = e.getRepairedObject(); + ItemStack material = e.getRepairMaterial(); + + if (isSalvageable(repaired) && isSalvageable(material)) + return; + + e.setCancelled(true); + Slimefun.getLocalization().sendMessage(e.getPlayer(), "anvil.mcmmo-repair"); + } + @EventHandler(ignoreCancelled = true) public void onAutoDisenchant(AutoDisenchantEvent e) { try { @@ -67,10 +80,10 @@ public void onAutoDisenchant(AutoDisenchantEvent e) { * This method checks if an {@link ItemStack} can be salvaged or not. * We basically don't want players to salvage any {@link SlimefunItem} unless * it is a {@link VanillaItem}. - * + * * @param item * The {@link ItemStack} to check - * + * * @return Whether this item can be safely salvaged */ private boolean isSalvageable(@Nonnull ItemStack item) { From bd8dc27232c7a77cf6a045ab28b584470c878fd3 Mon Sep 17 00:00:00 2001 From: Vaan1310 <61906290+Intybyte@users.noreply.github.com> Date: Sat, 4 May 2024 13:46:44 +0200 Subject: [PATCH 2/4] Update src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java Co-authored-by: J3fftw <44972470+J3fftw1@users.noreply.github.com> --- .../slimefun4/integrations/McMMOIntegration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java index 8b42a081f8..2c6886d816 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/integrations/McMMOIntegration.java @@ -60,8 +60,9 @@ public void onItemRepair(McMMOPlayerRepairCheckEvent e) { ItemStack repaired = e.getRepairedObject(); ItemStack material = e.getRepairMaterial(); - if (isSalvageable(repaired) && isSalvageable(material)) + if (isSalvageable(repaired) && isSalvageable(material)) { return; + } e.setCancelled(true); Slimefun.getLocalization().sendMessage(e.getPlayer(), "anvil.mcmmo-repair"); From 6a5443606088fd5afca588472b60a4893ef0e65d Mon Sep 17 00:00:00 2001 From: Intybyte Date: Sun, 12 Jan 2025 12:34:47 +0100 Subject: [PATCH 3/4] Add anvil msgs --- src/main/resources/languages/en/messages.yml | 1 + src/main/resources/languages/it/messages.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/main/resources/languages/en/messages.yml b/src/main/resources/languages/en/messages.yml index 81d5115c30..9bcd5d6524 100644 --- a/src/main/resources/languages/en/messages.yml +++ b/src/main/resources/languages/en/messages.yml @@ -339,6 +339,7 @@ machines: anvil: not-working: '&4You cannot use Slimefun items in an anvil!' mcmmo-salvaging: '&4You cannot salvage Slimefun items!' + mcmmo-repair: '&4You cannot repair using Slimefun items!' brewing_stand: not-working: '&4You cannot use Slimefun items in a brewing stand!' diff --git a/src/main/resources/languages/it/messages.yml b/src/main/resources/languages/it/messages.yml index f01aee0f4c..846ce81709 100644 --- a/src/main/resources/languages/it/messages.yml +++ b/src/main/resources/languages/it/messages.yml @@ -203,8 +203,12 @@ machines: waypoints: 'Panoramica dei waypoint' CARGO_NODES: must-be-placed: '&4Deve essere posizionato su una cassa o una macchina!' + anvil: not-working: '&4Non puoi usare gli oggetti della Slimefun in un''incudine!' + mcmmo-salvaging: '&4Non puoi riciclare oggetti della Slimefun!' + mcmmo-repair: '&4Non puoi riparare usando oggetti della Slimefun!' + smithing_table: not-working: '&4Non puoi usare un oggetto di Slimefun come materiale da fabbro!' backpack: From 5af996939605d907f1665605fefd4349b96147f2 Mon Sep 17 00:00:00 2001 From: Intybyte Date: Sun, 12 Jan 2025 13:07:49 +0100 Subject: [PATCH 4/4] Remove extra translations --- src/main/resources/languages/it/messages.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/resources/languages/it/messages.yml b/src/main/resources/languages/it/messages.yml index 846ce81709..f01aee0f4c 100644 --- a/src/main/resources/languages/it/messages.yml +++ b/src/main/resources/languages/it/messages.yml @@ -203,12 +203,8 @@ machines: waypoints: 'Panoramica dei waypoint' CARGO_NODES: must-be-placed: '&4Deve essere posizionato su una cassa o una macchina!' - anvil: not-working: '&4Non puoi usare gli oggetti della Slimefun in un''incudine!' - mcmmo-salvaging: '&4Non puoi riciclare oggetti della Slimefun!' - mcmmo-repair: '&4Non puoi riparare usando oggetti della Slimefun!' - smithing_table: not-working: '&4Non puoi usare un oggetto di Slimefun come materiale da fabbro!' backpack: