SteamWar/BungeeCore
Archiviert
13
2

Fix a few things
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
zOnlyKroks 2023-01-03 16:18:07 +01:00
Ursprung 62484dfea2
Commit b12e1ee1fa
3 geänderte Dateien mit 7 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -68,7 +68,8 @@ public class WhoisCommand extends SWCommand {
if (user == null) { if (user == null) {
Message.send("UNKNOWN_PLAYER", player); Message.send("UNKNOWN_PLAYER", player);
} else { } else {
sendUserinfo(player, user, Arrays.asList(parameters)); EnumSet<WhoisParameterTypes> set = parameters.length == 0 ? EnumSet.noneOf(WhoisParameterTypes.class) : EnumSet.copyOf(Arrays.asList(parameters));
sendUserinfo(player, user, set);
} }
} }
@ -77,7 +78,7 @@ public class WhoisCommand extends SWCommand {
return SWCommandUtils.createMapper(s -> s, s -> BungeeCord.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList())); return SWCommandUtils.createMapper(s -> s, s -> BungeeCord.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList()));
} }
private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, List<WhoisParameterTypes> parameterTypes) { private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, EnumSet<WhoisParameterTypes> parameterTypes) {
Message.send("WHOIS_USERNAME", player, user.getUserName()); Message.send("WHOIS_USERNAME", player, user.getUserName());
Message.send("WHOIS_UUID", player, Message.parse("WHOIS_UUID_HOVER", player), new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, user.getUuid().toString()), user.getUuid().toString()); Message.send("WHOIS_UUID", player, Message.parse("WHOIS_UUID_HOVER", player), new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, user.getUuid().toString()), user.getUuid().toString());
Message.send("WHOIS_ID", player, user.getId()); Message.send("WHOIS_ID", player, user.getId());
@ -167,17 +168,17 @@ public class WhoisCommand extends SWCommand {
} }
private enum WhoisParameterTypes { private enum WhoisParameterTypes {
ALL(Arrays.asList("-a","-all"),UserGroup.Admin,UserGroup.Moderator,UserGroup.Developer,UserGroup.Supporter,UserGroup.Builder), ALL(Arrays.asList("-a","-all"), UserGroup.Admin, UserGroup.Moderator, UserGroup.Developer, UserGroup.Supporter, UserGroup.Builder),
MOD(Arrays.asList("-m","-mod","-mods"),UserGroup.Admin,UserGroup.Moderator,UserGroup.Developer); MOD(Arrays.asList("-m","-mod","-mods"), UserGroup.Admin, UserGroup.Moderator, UserGroup.Developer);
private final Set<UserGroup> userGroupSet; private final EnumSet<UserGroup> userGroupSet;
@Getter @Getter
private List<String> tabCompletes; private List<String> tabCompletes;
WhoisParameterTypes(List<String> tabCompletes,UserGroup... userGroups) { WhoisParameterTypes(List<String> tabCompletes,UserGroup... userGroups) {
this.userGroupSet = new HashSet<>(Arrays.asList(userGroups)); this.userGroupSet = EnumSet.copyOf(Arrays.asList(userGroups));
this.tabCompletes = tabCompletes; this.tabCompletes = tabCompletes;
} }
} }

Datei anzeigen

@ -122,15 +122,6 @@ public class Fabric extends BasicListener {
mods.add(Mod.get(mod.getAsString(), Mod.Platform.FABRIC)); 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)) { if(!neededModsContained(mods)) {
logMessage(user, "Needed mods are not contained", dataString); logMessage(user, "Needed mods are not contained", dataString);
return; return;
@ -159,17 +150,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) { private boolean neededModsContained(List<Mod> mods) {
return mods.stream() return mods.stream()
.map(Mod::getModName) .map(Mod::getModName)

Datei anzeigen

@ -39,7 +39,6 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.*; import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;