geforkt von SteamWar/BungeeCore
FabricModSender PP Circumventer notification
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
630ee612e0
Commit
2a91876cb9
@ -1 +1 @@
|
|||||||
Subproject commit 7474478489da42735a32e84b3f91144c64847e30
|
Subproject commit 595df40e1e9078c310cbbb4bbded07744c361f15
|
@ -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,21 +139,28 @@ public class Fabric extends BasicListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean neededMods = neededModsContained(mods);
|
boolean neededMods = neededModsContained(mods);
|
||||||
if(Utils.handleMods(player,mods) && neededMods) {
|
if(!neededMods) {
|
||||||
if (Storage.fabricCheckedPlayers.containsKey(player)) {
|
|
||||||
long current = Storage.fabricCheckedPlayers.get(player);
|
|
||||||
if (current != dataString.hashCode()) {
|
|
||||||
logMessage(user, "Mods changed during runtime", dataString);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Message.send("MODIFICATION_CHECK_SUCCESS", player);
|
|
||||||
Storage.fabricCheckedPlayers.put(player, dataString.hashCode());
|
|
||||||
}
|
|
||||||
Storage.fabricPlayers.remove(player);
|
|
||||||
} else if (!neededMods) {
|
|
||||||
logMessage(user, "Needed mods are not contained", dataString);
|
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()) {
|
||||||
|
logMessage(user, "Mods changed during runtime", dataString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Message.send("MODIFICATION_CHECK_SUCCESS", player);
|
||||||
|
Storage.fabricCheckedPlayers.put(player, dataString.hashCode());
|
||||||
|
}
|
||||||
|
Storage.fabricPlayers.remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren