diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 49b03e2b..4d61316b 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -348,4 +348,14 @@ MATERIAL_SOLID=§8- §eSolider Block MATERIAL_GRAVITY=§8- §eFallender Block MATERIAL_OCCLUDING=§8- §eOccluding Block MATERIAL_INTERACT-ABLE=§8- §eInterargierbarer Block -MATERIAL_FLAMMABLE=§8- §eFlammbarer Block \ No newline at end of file +MATERIAL_FLAMMABLE=§8- §eFlammbarer Block +# Redstonetester +RT_HELP_1=§8/§eredstonetester §8-§7 Gibt den RedstoneTester +RT_GIVEN=§7Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten +RT_ITEM_NAME=§eRedstonetester +RT_ITEM_LORE_1=§eLinksklick Block §8-§7 Setzt die 1. Position +RT_ITEM_LORE_2=§eRechtsklick Block §8-§7 Setzt die 2. Position +RT_ITEM_LORE_3=§eShift-Rechtsklick Luft §8-§7 Zurücksetzten +RT_INVALID_LOC=§cUnbekannte Position +RT_RESULT=Differenz§8: §e{0}§7 Ticks §8,§7 R-Ticks §e{1} +RT_ACTIVATE=§7Positionen gelöscht§8. \ No newline at end of file diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java index 7e347ab6..103c7d5f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstoneTesterGuiItem.java @@ -19,11 +19,11 @@ package de.steamwar.bausystem.features.redstonetester; +import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.config.ColorConfig; -import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.inventory.SWItem; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -41,7 +41,12 @@ public class RedstoneTesterGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { - return new SWItem(Material.REPEATER, ColorConfig.HIGHLIGHT + "Redstonetester", Arrays.asList(ColorConfig.HIGHLIGHT + "Linksklick Block " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Setzt die 1. Position", ColorConfig.HIGHLIGHT + "Rechtsklick Block " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Setzt die 2. Position", ColorConfig.HIGHLIGHT + "Shift-Rechtsklick Luft " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Zurücksetzten"), false, null).getItemStack(); + return new SWItem(Material.REPEATER, + BauSystem.MESSAGE.parse("RT_ITEM_NAME", player), + Arrays.asList(BauSystem.MESSAGE.parse("RT_ITEM_LORE_1", player), + BauSystem.MESSAGE.parse("RT_ITEM_LORE_2", player), + BauSystem.MESSAGE.parse("RT_ITEM_LORE_3", player)) + , false, null).getItemStack(); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java index 0bbf47a5..20e6c12f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterCommand.java @@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.redstonetester; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; @@ -36,12 +35,13 @@ public class RedstonetesterCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "redstonetester " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Gibt den RedstoneTester"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Redstone Tester"); + BauSystem.MESSAGE.sendPrefixless("RT_HELP_1", p); } @Register public void genericCommand(Player p) { - p.sendMessage(BauSystem.PREFIX + "Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten"); - SWUtils.giveItemToPlayer(p, RedstonetesterUtils.WAND); + BauSystem.MESSAGE.send("RT_GIVEN", p); + SWUtils.giveItemToPlayer(p, RedstonetesterUtils.getWand(p)); } } \ No newline at end of file diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterUtils.java index fdaff3df..c14d500e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterUtils.java @@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.redstonetester; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.features.tpslimit.TPSUtils; +import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.inventory.SWItem; import lombok.Getter; import lombok.Setter; @@ -42,7 +43,17 @@ import java.util.Map; @UtilityClass public class RedstonetesterUtils { - public final ItemStack WAND = new SWItem(Material.BLAZE_ROD, ColorConfig.HIGHLIGHT + "Redstonetester", Arrays.asList(ColorConfig.HIGHLIGHT + "Linksklick Block " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Setzt die 1. Position", ColorConfig.HIGHLIGHT + "Rechtsklick Block " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Setzt die 2. Position", ColorConfig.HIGHLIGHT + "Shift-Rechtsklick Luft " + ColorConfig.OTHER + "-" + ColorConfig.BASE + " Zurücksetzten"), false, null).getItemStack(); + public static ItemStack getWand(Player player) { + ItemStack i = new SWItem(Material.BLAZE_ROD, + BauSystem.MESSAGE.parse("RT_ITEM_NAME", player), + Arrays.asList(BauSystem.MESSAGE.parse("RT_ITEM_LORE_1", player), + BauSystem.MESSAGE.parse("RT_ITEM_LORE_2", player), + BauSystem.MESSAGE.parse("RT_ITEM_LORE_3", player)), + false, null).getItemStack(); + ItemUtils.setItem(i, "redstonetester"); + return i; + } + @Getter private final Map playerMap = new HashMap<>(); @@ -59,7 +70,7 @@ public class RedstonetesterUtils { if (block instanceof Powerable) return true; if (block instanceof Piston) return true; if (block instanceof RedstoneWire) return true; - player.sendMessage(BauSystem.PREFIX + ColorConfig.DISABLE + "Unbekannte Position"); + BauSystem.MESSAGE.send("RT_INVALID_LOC", player); return false; } @@ -94,7 +105,7 @@ public class RedstonetesterUtils { return; } if (tick != null && loc2.equals(location)) { - player.sendMessage(BauSystem.PREFIX + "Differenz" + ColorConfig.OTHER + ": " + ColorConfig.HIGHLIGHT + (TPSUtils.currentTick.get() - tick) + ColorConfig.BASE + " Ticks " + ColorConfig.OTHER + "," + ColorConfig.BASE + " R-Ticks " + ColorConfig.HIGHLIGHT + ((TPSUtils.currentTick.get() - tick) / 2.0)); + BauSystem.MESSAGE.send("RT_RESULT", player, (TPSUtils.currentTick.get() - tick), ((TPSUtils.currentTick.get() - tick) / 2.0)); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RestonetesterListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RestonetesterListener.java index 24892905..cef31f42 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RestonetesterListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RestonetesterListener.java @@ -20,9 +20,9 @@ package de.steamwar.bausystem.features.redstonetester; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.bausystem.utils.ItemUtils; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -41,7 +41,7 @@ public class RestonetesterListener implements Listener { @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { - if (!RedstonetesterUtils.WAND.isSimilar(event.getItem())) return; + if (!ItemUtils.isItem(event.getItem(), "redstonetester")) return; Player player = event.getPlayer(); Block block = event.getClickedBlock(); event.setCancelled(true); @@ -50,7 +50,7 @@ public class RestonetesterListener implements Listener { case RIGHT_CLICK_AIR: if (player.isSneaking()) { RedstonetesterUtils.getPlayerMap().remove(event.getPlayer()); - player.sendMessage(BauSystem.PREFIX + "Positionen gelöscht" + ColorConfig.OTHER + "."); + BauSystem.MESSAGE.send("RT_ACTIVATE", player); } break; case LEFT_CLICK_BLOCK: