SteamWar/BauSystem2.0
Archiviert
12
0

Add Redstonetester Multi Lang

Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-06-13 22:38:13 +02:00
Ursprung b5881298cc
Commit 2a0b22b7fe
5 geänderte Dateien mit 40 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -348,4 +348,14 @@ MATERIAL_SOLID=§8- §eSolider Block
MATERIAL_GRAVITY=§8- §eFallender Block MATERIAL_GRAVITY=§8- §eFallender Block
MATERIAL_OCCLUDING=§8- §eOccluding Block MATERIAL_OCCLUDING=§8- §eOccluding Block
MATERIAL_INTERACT-ABLE=§8- §eInterargierbarer Block MATERIAL_INTERACT-ABLE=§8- §eInterargierbarer Block
MATERIAL_FLAMMABLE=§8- §eFlammbarer Block 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.

Datei anzeigen

@ -19,11 +19,11 @@
package de.steamwar.bausystem.features.redstonetester; package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission; 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.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -41,7 +41,12 @@ public class RedstoneTesterGuiItem extends BauGuiItem {
@Override @Override
public ItemStack getItem(Player player) { 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 @Override

Datei anzeigen

@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
@ -36,12 +35,13 @@ public class RedstonetesterCommand extends SWCommand {
@Register(help = true) @Register(help = true)
public void genericHelp(Player p, String... args) { 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 @Register
public void genericCommand(Player p) { public void genericCommand(Player p) {
p.sendMessage(BauSystem.PREFIX + "Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten"); BauSystem.MESSAGE.send("RT_GIVEN", p);
SWUtils.giveItemToPlayer(p, RedstonetesterUtils.WAND); SWUtils.giveItemToPlayer(p, RedstonetesterUtils.getWand(p));
} }
} }

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.config.ColorConfig; import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.utils.ItemUtils;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -42,7 +43,17 @@ import java.util.Map;
@UtilityClass @UtilityClass
public class RedstonetesterUtils { 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 @Getter
private final Map<Player, RedstoneTester> playerMap = new HashMap<>(); private final Map<Player, RedstoneTester> playerMap = new HashMap<>();
@ -59,7 +70,7 @@ public class RedstonetesterUtils {
if (block instanceof Powerable) return true; if (block instanceof Powerable) return true;
if (block instanceof Piston) return true; if (block instanceof Piston) return true;
if (block instanceof RedstoneWire) 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; return false;
} }
@ -94,7 +105,7 @@ public class RedstonetesterUtils {
return; return;
} }
if (tick != null && loc2.equals(location)) { 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));
} }
} }

Datei anzeigen

@ -20,9 +20,9 @@
package de.steamwar.bausystem.features.redstonetester; package de.steamwar.bausystem.features.redstonetester;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.config.ColorConfig;
import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.utils.ItemUtils;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -41,7 +41,7 @@ public class RestonetesterListener implements Listener {
@EventHandler @EventHandler
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
if (!RedstonetesterUtils.WAND.isSimilar(event.getItem())) return; if (!ItemUtils.isItem(event.getItem(), "redstonetester")) return;
Player player = event.getPlayer(); Player player = event.getPlayer();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
event.setCancelled(true); event.setCancelled(true);
@ -50,7 +50,7 @@ public class RestonetesterListener implements Listener {
case RIGHT_CLICK_AIR: case RIGHT_CLICK_AIR:
if (player.isSneaking()) { if (player.isSneaking()) {
RedstonetesterUtils.getPlayerMap().remove(event.getPlayer()); RedstonetesterUtils.getPlayerMap().remove(event.getPlayer());
player.sendMessage(BauSystem.PREFIX + "Positionen gelöscht" + ColorConfig.OTHER + "."); BauSystem.MESSAGE.send("RT_ACTIVATE", player);
} }
break; break;
case LEFT_CLICK_BLOCK: case LEFT_CLICK_BLOCK: