From 66ee4c424350cbe1afce9242db3f5cdb523a8730 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 2 May 2023 21:37:10 +0200 Subject: [PATCH 1/2] Fixed issue with anvil menu under bedrock - Added: player level is set to 1 on opening anvil menu - Added: player level is set to 0 on anvil menu close --- SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java b/SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java index bd92d53..72449a6 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java @@ -72,10 +72,12 @@ public class SWAnvilInv { } public void addCloseCallback(Runnable callback) { + player.setLevel(0); builder.onClose(p -> callback.run()); } public void open() { + player.setLevel(1); builder.open(player); } From 332f52c98b92e18b0a8d64c05203385b0e010b57 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Tue, 2 May 2023 23:15:51 +0200 Subject: [PATCH 2/2] Fixed position of setLevel(0) call --- SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java b/SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java index 72449a6..e522e97 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWAnvilInv.java @@ -72,7 +72,6 @@ public class SWAnvilInv { } public void addCloseCallback(Runnable callback) { - player.setLevel(0); builder.onClose(p -> callback.run()); } @@ -85,6 +84,7 @@ public class SWAnvilInv { if(s.startsWith("ยป")) s = s.substring(1); callback.accept(s); + player.setLevel(0); return Collections.singletonList(AnvilGUI.ResponseAction.close()); } }