SteamWar/BungeeCore
Archiviert
13
2

Fix mod list array
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
zOnlyKroks 2023-01-01 21:05:34 +01:00
Ursprung c2a962a865
Commit abe45da57d
3 geänderte Dateien mit 11 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -107,7 +107,7 @@ public class WhoisCommand extends SWCommand {
if(!user.getActiveMods().isEmpty()) { if(!user.getActiveMods().isEmpty()) {
Message.send("WHOIS_ACTIVE_MODS",player); Message.send("WHOIS_ACTIVE_MODS",player);
for(Mod mod : user.getActiveMods()) { for(Mod mod : user.getActiveMods()) {
Message.sendPrefixless("WHOIS_ACTIVE_MOD", player,mod.getModName()); Message.send("WHOIS_ACTIVE_MOD", player,mod.getModName());
} }
}else { }else {
Message.send("WHOIS_NO_ACTIVE_MODS",player); Message.send("WHOIS_NO_ACTIVE_MODS",player);

Datei anzeigen

@ -89,7 +89,7 @@ public class Fabric extends BasicListener {
} }
Storage.fabricExpectPluginMessage.remove(player); Storage.fabricExpectPluginMessage.remove(player);
List<Mod> mods = new LinkedList<>(); ArrayList<Mod> mods = new ArrayList<>();
Utils.VarInt varInt = Utils.readVarInt(data,0); Utils.VarInt varInt = Utils.readVarInt(data,0);
@ -127,6 +127,8 @@ public class Fabric extends BasicListener {
return; return;
} }
user.setActiveMods(mods);
if(Utils.handleMods(player,mods)) { if(Utils.handleMods(player,mods)) {
if (Storage.fabricCheckedPlayers.containsKey(player)) { if (Storage.fabricCheckedPlayers.containsKey(player)) {
long current = Storage.fabricCheckedPlayers.get(player); long current = Storage.fabricCheckedPlayers.get(player);
@ -139,7 +141,6 @@ public class Fabric extends BasicListener {
Storage.fabricCheckedPlayers.put(player, dataString.hashCode()); Storage.fabricCheckedPlayers.put(player, dataString.hashCode());
} }
Storage.fabricPlayers.remove(player); Storage.fabricPlayers.remove(player);
user.setActiveMods(mods);
} }
} }
@ -164,7 +165,6 @@ public class Fabric extends BasicListener {
public static void remove(ProxiedPlayer player) { public static void remove(ProxiedPlayer player) {
Storage.fabricCheckedPlayers.remove(player); Storage.fabricCheckedPlayers.remove(player);
SteamwarUser.get(player.getUniqueId()).setActiveMods(new LinkedList<>());
synchronized (Storage.fabricExpectPluginMessage) { synchronized (Storage.fabricExpectPluginMessage) {
Storage.fabricExpectPluginMessage.remove(player); Storage.fabricExpectPluginMessage.remove(player);
} }

Datei anzeigen

@ -39,6 +39,7 @@ 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;
@ -80,7 +81,7 @@ public class SteamwarUser {
private Locale locale; private Locale locale;
private boolean manualLocale; private boolean manualLocale;
private List<Mod> activeMods = new LinkedList<>(); private List<Mod> activeMods = new CopyOnWriteArrayList<>();
static { static {
try { try {
@ -396,8 +397,11 @@ public class SteamwarUser {
} }
public void setActiveMods(List<Mod> activeMods) { public void setActiveMods(List<Mod> activeMods) {
this.activeMods = activeMods; this.activeMods.clear();
this.activeMods.addAll(activeMods);
} }
public List<Mod> getActiveMods() {return this.activeMods;} public List<Mod> getActiveMods() {
return new ArrayList<>(activeMods);
}
} }