SteamWar/BauSystem2.0
Archiviert
12
0

Add BauScoreboard multilingual

Dieser Commit ist enthalten in:
yoyosource 2021-05-07 17:38:55 +02:00
Ursprung daabe26f13
Commit 35585ed70d
6 geänderte Dateien mit 62 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,6 @@
PREFIX = §eBau§8System §8» PREFIX = §eBau§8System §8»
TIME = HH:mm:ss
DATE = ........
# Permission # Permission
PERMISSION_WORLD = Einstellungen vornehmen PERMISSION_WORLD = Einstellungen vornehmen
@ -9,6 +11,16 @@ PERMISSION_CHANGE_YOU_DISABLE = §cDer Spieler darf nun nicht mehr {0}
PERMISSION_CHANGE_OTHER_ENABLE = §aDu kannst nun auf der Welt von §6{0} §a{1} PERMISSION_CHANGE_OTHER_ENABLE = §aDu kannst nun auf der Welt von §6{0} §a{1}
PERMISSION_CHANGE_OTHER_DISABLE = §cDu kannst nun nicht mehr auf der Welt von §6{0} §c{1} PERMISSION_CHANGE_OTHER_DISABLE = §cDu kannst nun nicht mehr auf der Welt von §6{0} §c{1}
# Scoreboard
SCOREBOARD_TIME = Uhrzeit
SCOREBOARD_REGION = Region
SCOREBOARD_TRACE = Trace
SCOREBOARD_LOADER = Loader
SCOREBOARD_TPS = TPS
SCOREBOARD_TRACE_TICKS = Ticks
SCOREBOARD_TRACE_TNT_COUNT = Anzahl TNT
# Flags # Flags
FLAG_COLOR = Color FLAG_COLOR = Color
FLAG_TNT = TNT FLAG_TNT = TNT
@ -53,4 +65,17 @@ FLAG_COLOR_BLACK = §fSchwarz
# Region # Region
REGION_TYPE_NORMAL = Normal REGION_TYPE_NORMAL = Normal
REGION_TYPE_BUILD = Baubereich REGION_TYPE_BUILD = Baubereich
REGION_TYPE_ONLY_TB = Testblock REGION_TYPE_ONLY_TB = Testblock
# Trace
TRACE_RECORD = §aan
TRACE_RECORD_AUTO = §an
TRACE_IDLE = §caus
TRACE_IDLE_AUTO = §eauto
# Loader
LOADER_OFF = §caus
LOADER_SETUP = §eSetup
LOADER_RUNNING = §aRunning
LOADER_PAUSE = §7Pause
LOADER_END = §8Finished

Datei anzeigen

@ -208,10 +208,10 @@ public class Loader implements Listener {
@AllArgsConstructor @AllArgsConstructor
public enum Stage implements EnumDisplay { public enum Stage implements EnumDisplay {
SETUP("§eSetup"), SETUP("LOADER_SETUP"),
RUNNING("§aRunning"), RUNNING("LOADER_RUNNING"),
PAUSE("§7Pause"), PAUSE("LOADER_PAUSE"),
END("§8Finished"); END("LOADER_END");
@Getter @Getter
private String chatValue; private String chatValue;

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.features.tracer; package de.steamwar.bausystem.features.tracer;
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.config.ColorConfig;
import de.steamwar.bausystem.features.tracer.record.RecordStateMachine; import de.steamwar.bausystem.features.tracer.record.RecordStateMachine;
@ -42,7 +43,7 @@ public class TracerBauGuiItem extends BauGuiItem {
@Override @Override
public ItemStack getItem(Player player) { public ItemStack getItem(Player player) {
return new SWItem(Material.OBSERVER, ColorConfig.HIGHLIGHT + "Tracer", Arrays.asList(ColorConfig.BASE + "Status: " + RecordStateMachine.getRecordStatus().getName()), false, clickType -> { return new SWItem(Material.OBSERVER, ColorConfig.HIGHLIGHT + "Tracer", Arrays.asList(ColorConfig.BASE + "Status: " + BauSystem.MESSAGE.parse(RecordStateMachine.getRecordStatus().getName(), player)), false, clickType -> {
}).getItemStack(); }).getItemStack();
} }

Datei anzeigen

@ -21,10 +21,10 @@ package de.steamwar.bausystem.features.tracer.record;
public enum RecordStatus { public enum RecordStatus {
RECORD("§aan", true, "§cTNT-Tracer muss gestoppt werden"), RECORD("TRACE_RECORD", true, "§cTNT-Tracer muss gestoppt werden"),
RECORD_AUTO("§aan", true, "§cTNT-Tracer darf nicht aufnehmen"), RECORD_AUTO("TRACE_RECORD_AUTO", true, "§cTNT-Tracer darf nicht aufnehmen"),
IDLE("§caus", false, "§cAuto-Tracer gestoppt"), IDLE("TRACE_IDLE", false, "§cAuto-Tracer gestoppt"),
IDLE_AUTO("§eauto", false, "§aAuto-Tracer gestartet"); IDLE_AUTO("TRACE_IDLE_AUTO", false, "§aAuto-Tracer gestartet");
String name; String name;
boolean tracing; boolean tracing;

Datei anzeigen

@ -11,7 +11,6 @@ import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.core.TPSWatcher; import de.steamwar.core.TPSWatcher;
import de.steamwar.message.Message;
import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.scoreboard.SWScoreboard;
import de.steamwar.scoreboard.ScoreboardCallback; import de.steamwar.scoreboard.ScoreboardCallback;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -50,10 +49,11 @@ public class BauScoreboard implements Listener {
List<String> strings = new ArrayList<>(); List<String> strings = new ArrayList<>();
strings.add("§1"); strings.add("§1");
strings.add("§eUhrzeit§8: §7" + new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime())); strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TIME", p) + "§8: §7" + new SimpleDateFormat(BauSystem.MESSAGE.parse("TIME", p)).format(Calendar.getInstance().getTime()));
if (GlobalRegion.getInstance() != region) { if (GlobalRegion.getInstance() != region) {
strings.add("§eRegion§8: §7" + region.getDisplayName()); strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_REGION", p) + "§8: §7" + region.getDisplayName());
} }
strings.add("§2"); strings.add("§2");
for (Flag flag : Flag.getFlags()) { for (Flag flag : Flag.getFlags()) {
if (!flag.getRegionPredicate().test(region)) { if (!flag.getRegionPredicate().test(region)) {
@ -62,18 +62,19 @@ public class BauScoreboard implements Listener {
strings.add("§e" + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p)); strings.add("§e" + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p));
} }
strings.add("§eTrace§8: " + RecordStateMachine.getRecordStatus().getName()); strings.add("§3");
strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse(RecordStateMachine.getRecordStatus().getName(), p));
Loader loader = Loader.getLoader(p); Loader loader = Loader.getLoader(p);
strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().getChatValue()) : "§caus")); strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_LOADER", p) + "§8: " + BauSystem.MESSAGE.parse(loader != null ? loader.getStage().getChatValue() : "LOADER_OFF", p));
if (RecordStateMachine.getRecordStatus().isTracing()) { if (RecordStateMachine.getRecordStatus().isTracing()) {
strings.add("§3"); strings.add("§4");
strings.add("§eTicks§8: §7" + traceTicks()); strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", p) + "§8: §7" + traceTicks());
strings.add("§eAnzahl TNT§8: §7" + RecordStateMachine.size()); strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TNT_COUNT", p) + "§8: §7" + RecordStateMachine.size());
} }
strings.add("§4"); strings.add("§5");
strings.add("§eTPS§8: " + tpsColor() + TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit()); strings.add("§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8 " + tpsColor() + TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit());
int i = strings.size(); int i = strings.size();
HashMap<String, Integer> result = new HashMap<>(); HashMap<String, Integer> result = new HashMap<>();

Datei anzeigen

@ -20,15 +20,27 @@ import org.bukkit.entity.Player;
public class RegionUtils { public class RegionUtils {
public void actionBar(Region region, String s) { public void actionBar(Region region, String s) {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s))); Bukkit.getOnlinePlayers()
.stream()
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
.forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
} }
public static void message(Region region, String s) { public static void message(Region region, String s) {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.sendMessage(s)); Bukkit.getOnlinePlayers()
.stream()
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
.forEach(player -> player.sendMessage(s));
} }
public static void message(Region region, Function<Player, String> function) { public static void message(Region region, Function<Player, String> function) {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> { Bukkit.getOnlinePlayers()
.stream()
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
.forEach(player -> {
String message = function.apply(player); String message = function.apply(player);
if (message == null) { if (message == null) {
return; return;