Skip to content

Commit

Permalink
updated p info cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
tim03we committed Dec 16, 2024
1 parent bb97d60 commit 9ae576c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
17 changes: 6 additions & 11 deletions src/main/java/ovis/futureplots/commands/sub/InfoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import cn.nukkit.Player;
import cn.nukkit.command.CommandSender;
import cn.nukkit.utils.TextFormat;
import ovis.futureplots.FuturePlots;
import ovis.futureplots.commands.SubCommand;
import ovis.futureplots.components.util.flags.FlagRegistry;
Expand Down Expand Up @@ -63,16 +62,13 @@ public void execute(CommandSender sender, String command, String[] args) {
final String plotOwner = this.plugin.getCorrectName(plot.getOwner());

final StringBuilder trusted = new StringBuilder();
final String trustedLastColors = TextFormat.getLastColors(this.translate(player, TranslationKey.INFO_TRUSTED));
plot.getTrusted().forEach(helper -> trusted.append(this.plugin.getCorrectName(helper)).append("§r§7, ").append(trustedLastColors));
plot.getTrusted().forEach(trust -> trusted.append(this.translate(player, TranslationKey.INFO_LIST, this.plugin.getCorrectName(trust))));

final StringBuilder helpers = new StringBuilder();
final String helpersLastColors = TextFormat.getLastColors(this.translate(player, TranslationKey.INFO_HELPERS, ""));
plot.getHelpers().forEach(helper -> helpers.append(this.plugin.getCorrectName(helper)).append("§r§7, ").append(helpersLastColors));
plot.getHelpers().forEach(helper -> helpers.append(this.translate(player, TranslationKey.INFO_LIST, this.plugin.getCorrectName(helper))));

final StringBuilder denied = new StringBuilder();
final String deniedLastColors = TextFormat.getLastColors(this.translate(player, TranslationKey.INFO_DENIED, ""));
plot.getDeniedPlayers().forEach(deniedPlayer -> denied.append(this.plugin.getCorrectName(deniedPlayer)).append("§r§7, ").append(deniedLastColors));
plot.getDeniedPlayers().forEach(deniedPlayer -> denied.append(this.translate(player, TranslationKey.INFO_LIST, this.plugin.getCorrectName(deniedPlayer))));

StringBuilder flags = new StringBuilder();
for (String flagKey : plot.getFlags().keySet()) {
Expand All @@ -97,13 +93,12 @@ public void execute(CommandSender sender, String command, String[] args) {

player.sendMessage(this.translate(player, TranslationKey.INFO_ID, plot.getOriginId()));
player.sendMessage(this.translate(player, TranslationKey.INFO_OWNER, plotOwner));
player.sendMessage(this.translate(player, TranslationKey.INFO_TRUSTED, (trusted.length() > 0 ? trusted.substring(0, trusted.length() - 2 - trustedLastColors.length()) : "§c-----")));
player.sendMessage(this.translate(player, TranslationKey.INFO_HELPERS, (helpers.length() > 0 ? helpers.substring(0, helpers.length() - 2 - helpersLastColors.length()) : "§c-----")));
player.sendMessage(this.translate(player, TranslationKey.INFO_DENIED, (denied.length() > 0 ? denied.substring(0, denied.length() - 2 - deniedLastColors.length()) : "§c-----")));
player.sendMessage(this.translate(player, TranslationKey.INFO_TRUSTED, (trusted.length() >= 2 ? trusted.substring(0, trusted.length() - 2) : "§c-----")));
player.sendMessage(this.translate(player, TranslationKey.INFO_HELPERS, (helpers.length() >= 2 ? helpers.substring(0, helpers.length() - 2) : "§c-----")));
player.sendMessage(this.translate(player, TranslationKey.INFO_DENIED, (denied.length() >= 2 ? denied.substring(0, denied.length() - 2) : "§c-----")));
player.sendMessage(this.translate(player, TranslationKey.INFO_FLAGS, flagsBuilderString));

player.sendMessage(this.translate(player, TranslationKey.INFO_END));
return;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public enum TranslationKey {
INFO_DAMAGE,
INFO_DENIED,
INFO_END,
INFO_LIST,
INFO_FAILURE,
INFO_TRUSTED,
INFO_HELPERS,
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/lang/de_DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ home.failure.own: "§8[§6F§eP§8] §r§cDu besitzt kein Grundstück!"
home.failure: "§8[§6F§eP§8] §r§cDer Spieler §r§6%1§r§c besitzt kein Grundstück!"
info.title: "§7§6Grundstücks-Info"
info.id: "§7ID: §6%1"
info.owner: "§7Besitzer: §6%1"
info.trusted: "§7Vertraute: §6%1"
info.helpers: "§7Helfer: §6%1"
info.denied: "§7Verboten: §6%1"
info.owner: "§7Besitzer: %1"
info.trusted: "§7Vertraute: %1"
info.helpers: "§7Helfer: %1"
info.denied: "§7Verboten: %1"
info.end: "§6Grundstücks-Info"
info.list: "§6%1§7, "
info.failure: "§8[§6F§eP§8] §r§cDieses Grundstück gehört niemandem."
removed.helper: "§8[§6F§eP§8] §r§6%1§r§a ist nun kein Helfer mehr!"
no.helper: "§8[§6F§eP§8] §r§6%1§r§c ist kein Helfer!"
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ info.trusted: "§7Trusted: §6%1"
info.helpers: "§7Helper: §6%1"
info.denied: "§7Denied: §6%1"
info.end: "§7§6Plot Info"
info.list: "§6%1§7, "
info.failure: "§8[§6F§eP§8] §r§cThis plot does not belong to a player."
removed.helper: "§8[§6F§eP§8] §r§6%1§r§a is no longer a helper!"
no.helper: "§8[§6F§eP§8] §r§6%1§r§c is no helper!"
Expand Down

0 comments on commit 9ae576c

Please sign in to comment.