SteamWar/BungeeCore
Archiviert
13
2

FabricModSender PP Circumventer notification
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-04-05 08:11:08 +02:00
Ursprung 630ee612e0
Commit 2a91876cb9
2 geänderte Dateien mit 48 neuen und 22 gelöschten Zeilen

@ -1 +1 @@
Subproject commit 7474478489da42735a32e84b3f91144c64847e30 Subproject commit 595df40e1e9078c310cbbb4bbded07744c361f15

Datei anzeigen

@ -43,14 +43,30 @@ import java.util.concurrent.TimeUnit;
public class Fabric extends BasicListener { public class Fabric extends BasicListener {
private final Set<String> neededMods = new HashSet<>(); public static void remove(ProxiedPlayer player) {
Storage.fabricCheckedPlayers.remove(player);
synchronized (Storage.fabricExpectPluginMessage) {
Storage.fabricExpectPluginMessage.remove(player);
}
}
{ private static final HashSet<String> ppCircumventerList = new HashSet<>();
static {
ppCircumventerList.add("java");
ppCircumventerList.add("minecraft");
ppCircumventerList.add("org_joml_joml");
ppCircumventerList.add("steamwarmodsender");
}
private static final Set<String> neededMods = new HashSet<>();
static {
neededMods.add("java"); neededMods.add("java");
neededMods.add("minecraft"); neededMods.add("minecraft");
neededMods.add("fabricloader"); neededMods.add("fabricloader");
neededMods.add("steamwarmodsender"); neededMods.add("steamwarmodsender");
}
{
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
synchronized (Storage.fabricExpectPluginMessage) { synchronized (Storage.fabricExpectPluginMessage) {
for (Map.Entry<ProxiedPlayer, Long> entry : Storage.fabricExpectPluginMessage.entrySet()) { for (Map.Entry<ProxiedPlayer, Long> entry : Storage.fabricExpectPluginMessage.entrySet()) {
@ -112,7 +128,7 @@ public class Fabric extends BasicListener {
JsonArray array; JsonArray array;
try { try {
array = new JsonParser().parse(dataString).getAsJsonArray(); array = JsonParser.parseString(dataString).getAsJsonArray();
}catch (JsonSyntaxException exception) { }catch (JsonSyntaxException exception) {
logMessage(user, "Invalid json", dataString); logMessage(user, "Invalid json", dataString);
return; return;
@ -123,7 +139,17 @@ public class Fabric extends BasicListener {
} }
boolean neededMods = neededModsContained(mods); boolean neededMods = neededModsContained(mods);
if(Utils.handleMods(player,mods) && neededMods) { if(!neededMods) {
logMessage(user, "Needed mods are not contained", dataString);
return;
}
if(ppCircumventerCheck(mods))
logMessage(user, "PP circumventer suspicion", dataString);
if(!Utils.handleMods(player,mods))
return;
if (Storage.fabricCheckedPlayers.containsKey(player)) { if (Storage.fabricCheckedPlayers.containsKey(player)) {
long current = Storage.fabricCheckedPlayers.get(player); long current = Storage.fabricCheckedPlayers.get(player);
if (current != dataString.hashCode()) { if (current != dataString.hashCode()) {
@ -135,9 +161,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);
} else if (!neededMods) {
logMessage(user, "Needed mods are not contained", dataString);
}
} }
@EventHandler @EventHandler
@ -155,14 +178,17 @@ public class Fabric extends BasicListener {
.count() == neededMods.size(); .count() == neededMods.size();
} }
public void logMessage(SteamwarUser user, String reason, String data) { private void logMessage(SteamwarUser user, String reason, String data) {
SWException.log("FabricModSender " + user.getUserName() + ": " + reason, data); SWException.log("FabricModSender " + user.getUserName() + ": " + reason, data);
} }
public static void remove(ProxiedPlayer player) { private boolean ppCircumventerCheck(List<Mod> mods) {
Storage.fabricCheckedPlayers.remove(player); for(Mod mod : mods) {
synchronized (Storage.fabricExpectPluginMessage) { String name = mod.getModName();
Storage.fabricExpectPluginMessage.remove(player); if(!name.startsWith("fabric") && !ppCircumventerList.contains(name))
} return false;
}
return true;
} }
} }