Archiviert
1
0

Merge branch 'master' into TeamTablist

Dieser Commit ist enthalten in:
YoyoNow 2022-10-24 17:17:35 +02:00
Commit 3606e75ab6
3 geänderte Dateien mit 14 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -86,6 +86,7 @@ public class ErrorLogger extends Handler {
contains.add("Error occurred processing connection for");
contains.add("Server is online mode!");
contains.add(" took ");
contains.add("Could not translate packet ");
ignoreContains = Collections.unmodifiableList(contains);
}
}

Datei anzeigen

@ -211,6 +211,8 @@ public abstract class Node {
if(!process.waitFor(1, TimeUnit.SECONDS))
throw new IOException(hostname + " timeout");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
if(reader == null)
throw new IOException("Why reader null? " + process.getInputStream());
calcLoadLimit(reader, reader);
}
} catch (IOException e) {

Datei anzeigen

@ -28,7 +28,7 @@ import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Storage;
import de.steamwar.bungeecore.listeners.BasicListener;
import de.steamwar.bungeecore.sql.Mod;
import de.steamwar.bungeecore.sql.Punishment;
import de.steamwar.bungeecore.sql.SWException;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -40,7 +40,6 @@ import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
public class Fabric extends BasicListener {
@ -59,7 +58,7 @@ public class Fabric extends BasicListener {
continue;
}
if (System.currentTimeMillis() - entry.getValue() > TimeUnit.SECONDS.toMillis(20)) {
banPlayer(SteamwarUser.get(entry.getKey()), entry.getKey(), "Expected message not received");
logMessage(SteamwarUser.get(entry.getKey()), "Expected message not received", String.valueOf(entry.getValue()));
return;
}
}
@ -78,11 +77,12 @@ public class Fabric extends BasicListener {
ProxiedPlayer player = (ProxiedPlayer) e.getSender();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
byte[] data = e.getData();
if (!Storage.fabricCheckedPlayers.containsKey(player)) {
synchronized (Storage.fabricExpectPluginMessage) {
if (Storage.fabricExpectPluginMessage.containsKey(player)) {
banPlayer(user, player, "Was not fabric checked but send message nonetheless");
logMessage(user, "Was not fabric checked but send message nonetheless", Arrays.toString(data));
return;
}
}
@ -91,11 +91,10 @@ public class Fabric extends BasicListener {
List<Mod> mods = new LinkedList<>();
byte[] data = e.getData();
Utils.VarInt varInt = Utils.readVarInt(data,0);
if(data.length != varInt.length + varInt.value) {
banPlayer(user,player, "Invalid message length");
logMessage(user, "Invalid message length", Arrays.toString(data));
return;
}
@ -106,7 +105,7 @@ public class Fabric extends BasicListener {
try{
dataString = new String(data, StandardCharsets.UTF_8);
}catch (UnsupportedCharsetException exception) {
banPlayer(user, player, "Unsupported charset");
logMessage(user, "Unsupported charset", Arrays.toString(data));
return;
}
@ -115,7 +114,7 @@ public class Fabric extends BasicListener {
try {
array = new JsonParser().parse(dataString).getAsJsonArray();
}catch (JsonSyntaxException exception) {
banPlayer(user, player, "Invalid json");
logMessage(user, "Invalid json", dataString);
return;
}
@ -133,7 +132,7 @@ public class Fabric extends BasicListener {
*/
if(!neededModsContained(mods)) {
banPlayer(user, player, "Needed mods are not contained");
logMessage(user, "Needed mods are not contained", dataString);
return;
}
@ -141,7 +140,7 @@ public class Fabric extends BasicListener {
if (Storage.fabricCheckedPlayers.containsKey(player)) {
long current = Storage.fabricCheckedPlayers.get(player);
if (current != dataString.hashCode()) {
banPlayer(user, player, "");
logMessage(user, "Mods changed during runtime", dataString);
return;
}
} else {
@ -178,11 +177,8 @@ public class Fabric extends BasicListener {
.count() == neededMods.size();
}
public void banPlayer(SteamwarUser user, ProxiedPlayer player, String reason) {
user.punishPerma(Punishment.PunishmentType.Ban,
Message.parse("MODIFICATION_BAN_MESSAGE", player, user.getUserName(), user.getId()),
0);
BungeeCore.log(Level.SEVERE,Message.parse("MODIFICATION_BAN_LOG", player, user.getUserName(), reason));
public void logMessage(SteamwarUser user, String reason, String data) {
SWException.log("Bungee", "FabricModSender " + user.getUserName() + ": " + reason, data);
}
public static void remove(ProxiedPlayer player) {