diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java index 4f98875..9275afa 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java @@ -84,7 +84,14 @@ public class Detonator implements Listener { PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).clear(); PLAYER_LOCS.get(player).add(detoloader); return item; - }, 12), new VersionedCallable<>(() -> pushLocToDetonator(clearDetonator(item), detoloader), 15)); + }, 12), new VersionedCallable<>(() -> { + try { + return pushLocToDetonator(clearDetonator(item), detoloader); + }catch (SecurityException e){ + player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage()); + return item; + } + }, 15)); } public static ItemStack toggleLocation(ItemStack item, Player player, Detoloader detoloader, Location location) { @@ -103,12 +110,26 @@ public class Detonator implements Listener { return VersionedCallable.call(new VersionedCallable<>(() -> { PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(location)); return item; - }, 12), new VersionedCallable<>(() -> pushLocToDetonator(item, new Detoloader.DetonatorActivation(location)), 15)); + }, 12), new VersionedCallable<>(() -> { + try { + return pushLocToDetonator(item, new Detoloader.DetonatorActivation(location)); + }catch (SecurityException e){ + player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage()); + return item; + } + }, 15)); else return VersionedCallable.call(new VersionedCallable<>(() -> { PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(detoloader.getActivation(), location)); return item; - }, 12), new VersionedCallable<>(() -> pushLocToDetonator(item, new Detoloader.DetonatorActivation(detoloader.getActivation(), location)), 15)); + }, 12), new VersionedCallable<>(() -> { + try { + return pushLocToDetonator(item, new Detoloader.DetonatorActivation(detoloader.getActivation(), location)); + }catch (SecurityException e){ + player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage()); + return item; + } + }, 15)); } } @@ -208,7 +229,7 @@ public class Detonator implements Listener { public static ItemStack pushLocToDetonator(ItemStack item, Detoloader.DetonatorActivation detoloader) { int slot = getFreeSlot(item); if (slot == -1) - throw new SecurityException("Ein Fehler ist aufgetreten"); + throw new SecurityException("Ein Fehler ist aufgetreten, Hohle dir einen neuen Detonator mit §8/§edt wand"); ItemMeta meta = item.getItemMeta(); Location block = detoloader.location; meta.getPersistentDataContainer().set(new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + slot), PersistentDataType.INTEGER_ARRAY, new int[]