SteamWar/BauSystem2.0
Archiviert
12
0

Update InfoCommand output
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-02-17 15:22:48 +01:00
Ursprung d1196c6e4e
Commit 7f62ad8005
3 geänderte Dateien mit 30 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -150,7 +150,7 @@ BAU_INFO_ITEM_LORE_ITEMS = §7Items§8: §e{0}
BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Information regarding this build server BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Information regarding this build server
BAU_INFO_COMMAND_OWNER = §7Owner§8: §e{0} BAU_INFO_COMMAND_OWNER = §7Owner§8: §e{0}
BAU_INFO_COMMAND_MEMBER = §7Member §8[§7{0}§8]§8: §e BAU_INFO_COMMAND_MEMBER = §7{0} §8[§7{1}§8]§8: §e{2}
BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1} BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1}
BAU_INFO_COMMAND_TPS = §7TPS§8:§e BAU_INFO_COMMAND_TPS = §7TPS§8:§e

Datei anzeigen

@ -149,7 +149,7 @@ BAU_INFO_ITEM_LORE_PROTECT = §7Protect§8: §e{0}
BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Gibt Informationen über den Bau BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Gibt Informationen über den Bau
BAU_INFO_COMMAND_OWNER = §7Besitzer§8: §e{0} BAU_INFO_COMMAND_OWNER = §7Besitzer§8: §e{0}
BAU_INFO_COMMAND_MEMBER = §7Mitglieder §8[§7{0}§8]§8: §e BAU_INFO_COMMAND_MEMBER = §7{0} §8[§7{1}§8]§8: §e{2}
BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1} BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1}
BAU_INFO_COMMAND_TPS = §7TPS§8:§e BAU_INFO_COMMAND_TPS = §7TPS§8:§e

Datei anzeigen

@ -13,7 +13,7 @@ import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.List; import java.util.*;
@Linked @Linked
public class InfoCommand extends SWCommand { public class InfoCommand extends SWCommand {
@ -41,24 +41,25 @@ public class InfoCommand extends SWCommand {
if (Permission.BUILD.hasPermission(p)) { if (Permission.BUILD.hasPermission(p)) {
List<BauweltMember> members = BauweltMember.getMembers(bauServer.getOwnerID()); List<BauweltMember> members = BauweltMember.getMembers(bauServer.getOwnerID());
StringBuilder membermessage = new StringBuilder(); Map<Permission, List<BauweltMember>> memberByPermission = new HashMap<>();
membermessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_MEMBER", p, members.size())); members.forEach(member -> {
for (int i = 0; i < members.size(); i++) {
if (i != 0) {
membermessage.append("§8, ");
}
BauweltMember member = members.get(i);
if (Permission.SUPERVISOR.hasPermission(member)) { if (Permission.SUPERVISOR.hasPermission(member)) {
membermessage.append("§e"); memberByPermission.computeIfAbsent(Permission.SUPERVISOR, __ -> new ArrayList<>()).add(member);
} else if (Permission.BUILD.hasPermission(member)) { } else if (Permission.BUILD.hasPermission(member)) {
membermessage.append("§6"); memberByPermission.computeIfAbsent(Permission.BUILD, __ -> new ArrayList<>()).add(member);
} else { } else {
membermessage.append("§7"); memberByPermission.computeIfAbsent(Permission.MEMBER, __ -> new ArrayList<>()).add(member);
} }
membermessage.append(SteamwarUser.get(member.getMemberID()).getUserName()); });
}
p.sendMessage(membermessage.toString()); List<BauweltMember> supervisor = memberByPermission.getOrDefault(Permission.SUPERVISOR, Collections.emptyList());
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_MEMBER", p, "§eSupervisor", supervisor.size(), supervisor.isEmpty() ? "§8<none>" : joining(supervisor));
List<BauweltMember> builder = memberByPermission.getOrDefault(Permission.BUILD, Collections.emptyList());
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_MEMBER", p, "§6Builder", builder.size(), builder.isEmpty() ? "§8<none>" : joining(builder));
List<BauweltMember> spectator = memberByPermission.getOrDefault(Permission.MEMBER, Collections.emptyList());
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_MEMBER", p, "§7Spectator", spectator.size(), spectator.isEmpty() ? "§8<none>" : joining(spectator));
} }
StringBuilder tpsMessage = new StringBuilder(); StringBuilder tpsMessage = new StringBuilder();
@ -70,4 +71,16 @@ public class InfoCommand extends SWCommand {
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)); tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES));
p.sendMessage(tpsMessage.toString()); p.sendMessage(tpsMessage.toString());
} }
private String joining(List<BauweltMember> bauweltMembers) {
StringBuilder st = new StringBuilder();
for (int i = 0; i < bauweltMembers.size(); i++) {
if (i != 0) {
st.append("§8, ");
}
st.append("§f");
st.append(SteamwarUser.get(bauweltMembers.get(i).getMemberID()).getUserName());
}
return st.toString();
}
} }