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()); - } - }; - } - }