From 0f970e3a4926565a83b652d3b105ee7e8cc2383a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 25 Mar 2021 08:47:21 +0100 Subject: [PATCH] Reformat Detonator --- .../steamwar/bausystem/world/Detonator.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java index fe445c3..bc2cd42 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Detonator.java @@ -116,26 +116,26 @@ public class Detonator implements Listener { VersionedRunnable.call(new VersionedRunnable(() -> execute(player, PLAYER_LOCS.get(player)), 12), new VersionedRunnable(() -> { try { ItemStack item = getNextBestDetonator(player); - if(item == null) + if (item == null) return; Detonator detonator = getDetonator(player, item); execute(player, detonator.getLocs()); - }catch (SecurityException e) { + } catch (SecurityException e) { player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage()); } }, 15)); } private static ItemStack getNextBestDetonator(Player player) { - if(player.getInventory().getItemInMainHand().getItemMeta() != null && player.getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer().has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { + if (player.getInventory().getItemInMainHand().getItemMeta() != null && player.getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer().has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { return player.getInventory().getItemInMainHand(); } for (ItemStack item : player.getInventory().getContents()) { - if(item == null) + if (item == null) continue; - if(item.getItemMeta() != null && + if (item.getItemMeta() != null && item.getItemMeta().getPersistentDataContainer().has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { return item; } @@ -170,11 +170,11 @@ public class Detonator implements Listener { private static int getFreeSlot(ItemStack item) { ItemMeta meta = item.getItemMeta(); - if(meta == null) { + if (meta == null) { throw new SecurityException("Das Item ist kein Detonator"); } PersistentDataContainer container = meta.getPersistentDataContainer(); - if(!container.has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { + if (!container.has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { throw new SecurityException("Das Item ist kein Detonator"); } for (int i = 0; i < getDetoLocs(container) + 1; i++) { @@ -185,17 +185,17 @@ public class Detonator implements Listener { } private static int getDetoLocs(PersistentDataContainer container) { - if(!container.has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { + if (!container.has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { throw new SecurityException("Das Item ist kein Detonator"); } return container.get(new NamespacedKey(BauSystem.getPlugin(), "deto-locs"), PersistentDataType.INTEGER); } private static void increaseLocsSize(PersistentDataContainer container, int to) { - if(!container.has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { + if (!container.has(new NamespacedKey(BauSystem.getPlugin(), "deto"), PersistentDataType.BYTE)) { throw new SecurityException("Das Item ist kein Detonator"); } - if(container.get(new NamespacedKey(BauSystem.getPlugin(), "deto-locs"), PersistentDataType.INTEGER) < to) { + if (container.get(new NamespacedKey(BauSystem.getPlugin(), "deto-locs"), PersistentDataType.INTEGER) < to) { container.set(new NamespacedKey(BauSystem.getPlugin(), "deto-locs"), PersistentDataType.INTEGER, to); } }