NoFabricFabric #460
@ -22,8 +22,6 @@ package de.steamwar.bungeecore.listeners;
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Storage;
|
||||
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.Connection;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@ -43,6 +41,7 @@ public class NonFabricFabricCheck extends BasicListener {
|
||||
private final Set<UUID> usingFabric = new HashSet<>();
|
||||
|
||||
private final Set<ProxiedPlayer> checking = new HashSet<>();
|
||||
private final Set<ProxiedPlayer> vanilla = new HashSet<>();
|
||||
|
||||
{
|
||||
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), usingFabric::clear, 0, 15, TimeUnit.MINUTES);
|
||||
@ -54,14 +53,23 @@ public class NonFabricFabricCheck extends BasicListener {
|
||||
if(!(sender instanceof ProxiedPlayer))
|
||||
return;
|
||||
|
||||
if(!e.getTag().equals("minecraft:brand"))
|
||||
return;
|
||||
|
||||
if(!new String(e.getData()).equals("vanilla")){
|
||||
ProxiedPlayer p = (ProxiedPlayer) sender;
|
||||
if (e.getTag().equals("minecraft:register") && new String(e.getData()).contains("fabric")) {
|
||||
|
||||
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
|
||||
if (!sender.isConnected()) return;
|
||||
if (!vanilla.remove(p)) return;
|
||||
if (Storage.fabricCheckedPlayers.containsKey(p)) return;
|
||||
p.disconnect(Message.parse("MOD_USE_MODSENDER", p));
|
||||
}, 5, TimeUnit.SECONDS);
|
||||
return;
|
||||
}
|
||||
|
||||
ProxiedPlayer p = (ProxiedPlayer) sender;
|
||||
if(!e.getTag().equals("minecraft:brand"))
|
||||
return;
|
||||
|
||||
if(!new String(e.getData()).equals("vanilla"))
|
||||
return;
|
||||
vanilla.add(p);
|
||||
|
||||
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
|
||||
if (!p.isConnected()) return;
|
||||
@ -82,12 +90,8 @@ public class NonFabricFabricCheck extends BasicListener {
|
||||
@EventHandler
|
||||
public void onPlayerDisconnect(PlayerDisconnectEvent e) {
|
||||
if (checking.remove(e.getPlayer())) {
|
||||
logMessage(SteamwarUser.get(e.getPlayer().getUniqueId()), "Player is potentially using rebranded Fabric");
|
||||
usingFabric.add(e.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
public void logMessage(SteamwarUser user, String reason) {
|
||||
SWException.log("Bungee", "NonFabricFabricCheck " + user.getUserName() + ": " + reason, "");
|
||||
vanilla.remove(e.getPlayer());
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Das ist mMn. eine zu grobe Prüfung.
Sollte dann jetzt eine bessere prüfung sein.