Archiviert
1
0

FabricModSender PP Circumventer notification

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 {
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("minecraft");
neededMods.add("fabricloader");
neededMods.add("steamwarmodsender");
}
{
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
synchronized (Storage.fabricExpectPluginMessage) {
for (Map.Entry<ProxiedPlayer, Long> entry : Storage.fabricExpectPluginMessage.entrySet()) {
@ -112,7 +128,7 @@ public class Fabric extends BasicListener {
JsonArray array;
try {
array = new JsonParser().parse(dataString).getAsJsonArray();
array = JsonParser.parseString(dataString).getAsJsonArray();
}catch (JsonSyntaxException exception) {
logMessage(user, "Invalid json", dataString);
return;
@ -123,7 +139,17 @@ public class Fabric extends BasicListener {
}
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)) {
long current = Storage.fabricCheckedPlayers.get(player);
if (current != dataString.hashCode()) {
@ -135,9 +161,6 @@ public class Fabric extends BasicListener {
Storage.fabricCheckedPlayers.put(player, dataString.hashCode());
}
Storage.fabricPlayers.remove(player);
} else if (!neededMods) {
logMessage(user, "Needed mods are not contained", dataString);
}
}
@EventHandler
@ -155,14 +178,17 @@ public class Fabric extends BasicListener {
.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);
}
public static void remove(ProxiedPlayer player) {
Storage.fabricCheckedPlayers.remove(player);
synchronized (Storage.fabricExpectPluginMessage) {
Storage.fabricExpectPluginMessage.remove(player);
private boolean ppCircumventerCheck(List<Mod> mods) {
for(Mod mod : mods) {
String name = mod.getModName();
if(!name.startsWith("fabric") && !ppCircumventerList.contains(name))
return false;
}
return true;
}
}