From 40e4b3c975eb41a541d4d51227826e87d4f470d0 Mon Sep 17 00:00:00 2001 From: iTwins Date: Thu, 7 Sep 2023 01:10:32 +0200 Subject: [PATCH] remove enabled state cache --- .../slimefun4/api/network/SignalInsulator.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/SignalInsulator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/SignalInsulator.java index 7f704206cd..872a1f043b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/SignalInsulator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/SignalInsulator.java @@ -42,8 +42,6 @@ */ public abstract class SignalInsulator extends SlimefunItem { - private static final HashMap enabledStates = new HashMap<>(); - @ParametersAreNonnullByDefault public SignalInsulator(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { super(itemGroup, item, recipeType, recipe); @@ -86,16 +84,14 @@ public static void setEnabled(@Nonnull Location location, boolean enabled) { @Override public void preRegister() { - addItemHandler(onPlace()); - addItemHandler(onRightClick()); - addItemHandler(onBreak()); + addItemHandler(onPlace(), onRightClick()); } private @Nonnull BlockPlaceHandler onPlace() { return new BlockPlaceHandler(false) { @Override public void onPlayerPlace(@Nonnull BlockPlaceEvent e) { - enabledStates.put(e.getBlock().getLocation(), true); + setEnabled(e.getBlock().getLocation(), true); } }; } @@ -123,13 +119,4 @@ public void onPlayerPlace(@Nonnull BlockPlaceEvent e) { }; } - private @Nonnull BlockBreakHandler onBreak() { - return new SimpleBlockBreakHandler() { - @Override - public void onBlockBreak(@Nonnull Block b) { - enabledStates.remove(b.getLocation()); - } - }; - } - }