Initial whois Fabric Mod Implementation
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
59854ef3f0
Commit
c2a962a865
@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Storage;
|
||||
import de.steamwar.bungeecore.sql.Mod;
|
||||
import de.steamwar.bungeecore.sql.Punishment;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
@ -103,6 +104,15 @@ public class WhoisCommand extends SWCommand {
|
||||
Team team = Team.get(user.getTeam());
|
||||
Message.send("WHOIS_TEAM", player, Message.parse("WHOIS_TEAM_HOVER", player, team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName());
|
||||
|
||||
if(!user.getActiveMods().isEmpty()) {
|
||||
Message.send("WHOIS_ACTIVE_MODS",player);
|
||||
for(Mod mod : user.getActiveMods()) {
|
||||
Message.sendPrefixless("WHOIS_ACTIVE_MOD", player,mod.getModName());
|
||||
}
|
||||
}else {
|
||||
Message.send("WHOIS_NO_ACTIVE_MODS",player);
|
||||
}
|
||||
|
||||
Message.send("WHOIS_PUNISHMENTS", player);
|
||||
List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId());
|
||||
Set<Punishment.PunishmentType> found = new HashSet<>();
|
||||
|
@ -122,15 +122,6 @@ public class Fabric extends BasicListener {
|
||||
mods.add(Mod.get(mod.getAsString(), Mod.Platform.FABRIC));
|
||||
}
|
||||
|
||||
/*
|
||||
boolean isSorted = isSortedAlphabetically(mods);
|
||||
|
||||
if(!isSorted) {
|
||||
banPlayer(user, player, "Mods are not sorted alphabetically: " + mods.stream().map(Mod::getModName).collect(Collectors.joining(", ")));
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if(!neededModsContained(mods)) {
|
||||
logMessage(user, "Needed mods are not contained", dataString);
|
||||
return;
|
||||
@ -148,6 +139,7 @@ public class Fabric extends BasicListener {
|
||||
Storage.fabricCheckedPlayers.put(player, dataString.hashCode());
|
||||
}
|
||||
Storage.fabricPlayers.remove(player);
|
||||
user.setActiveMods(mods);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,17 +151,6 @@ public class Fabric extends BasicListener {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSortedAlphabetically(List<Mod> mods) {
|
||||
boolean isSorted = true;
|
||||
for(int i = 0; i < mods.size() - 1; i++) {
|
||||
if(mods.get(i).getModName().compareToIgnoreCase(mods.get(i + 1).getModName()) > 0) {
|
||||
isSorted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isSorted;
|
||||
}
|
||||
|
||||
private boolean neededModsContained(List<Mod> mods) {
|
||||
return mods.stream()
|
||||
.map(Mod::getModName)
|
||||
@ -183,6 +164,7 @@ public class Fabric extends BasicListener {
|
||||
|
||||
public static void remove(ProxiedPlayer player) {
|
||||
Storage.fabricCheckedPlayers.remove(player);
|
||||
SteamwarUser.get(player.getUniqueId()).setActiveMods(new LinkedList<>());
|
||||
synchronized (Storage.fabricExpectPluginMessage) {
|
||||
Storage.fabricExpectPluginMessage.remove(player);
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ public class SteamwarUser {
|
||||
private Locale locale;
|
||||
private boolean manualLocale;
|
||||
|
||||
private List<Mod> activeMods = new LinkedList<>();
|
||||
|
||||
static {
|
||||
try {
|
||||
LIXFEL_DE = InetAddress.getByAddress(new byte[]{(byte) 195, (byte) 201, (byte) 242, 43});
|
||||
@ -392,4 +394,10 @@ public class SteamwarUser {
|
||||
updateLocale.update(locale.toLanguageTag(), manualLocale, id);
|
||||
NetworkSender.send(getPlayer(), new LocaleInvalidationPacket(id));
|
||||
}
|
||||
|
||||
public void setActiveMods(List<Mod> activeMods) {
|
||||
this.activeMods = activeMods;
|
||||
}
|
||||
|
||||
public List<Mod> getActiveMods() {return this.activeMods;}
|
||||
}
|
||||
|
@ -596,6 +596,9 @@ WHOIS_PUNISHMENTS=§7Punish:
|
||||
WHOIS_PUNISHMENT=§7{0}§8» §f§l{1}: §e{2} - {3} §f{4}
|
||||
WHOIS_NO_PUNISHMENT=§a✓ §7This player has no active punishment.
|
||||
WHOIS_NO_ALL_PUNISHMENT=§a✓ §7The player has not done anything yet.
|
||||
WHOIS_ACTIVE_MODS=§7Active Mods:
|
||||
WHOIS_NO_ACTIVE_MODS=§7This player has no active mods.
|
||||
WHOIS_ACTIVE_MOD=§7{0}
|
||||
|
||||
#VerifyCommand
|
||||
VERIFY_USAGE=§c/verify [Code]
|
||||
|
@ -575,6 +575,9 @@ WHOIS_PUNISHMENTS=§7Strafen:
|
||||
WHOIS_PUNISHMENT=§7{0}§8» §f§l{1}: §e{2} - {3} §f{4}
|
||||
WHOIS_NO_PUNISHMENT=§a✓ §7Der Spieler hat keine aktiven Strafen.
|
||||
WHOIS_NO_ALL_PUNISHMENT=§a✓ §7Der Spieler hat noch nichts getan.
|
||||
WHOIS_ACTIVE_MODS=§7Aktive Mods:
|
||||
WHOIS_NO_ACTIVE_MODS=§7Der Spieler hat keine aktiven Mods.
|
||||
WHOIS_ACTIVE_MOD=§7{0}
|
||||
|
||||
#VerifyCommand
|
||||
VERIFY_USAGE=§c/verify [Code]
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren