geforkt von SteamWar/BungeeCore
Add even better fabric check
Dieser Commit ist enthalten in:
Ursprung
42c23e4521
Commit
05b6b3ac66
@ -22,8 +22,6 @@ package de.steamwar.bungeecore.listeners;
|
|||||||
import de.steamwar.bungeecore.BungeeCore;
|
import de.steamwar.bungeecore.BungeeCore;
|
||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
import de.steamwar.bungeecore.Storage;
|
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.BungeeCord;
|
||||||
import net.md_5.bungee.api.connection.Connection;
|
import net.md_5.bungee.api.connection.Connection;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
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<UUID> usingFabric = new HashSet<>();
|
||||||
|
|
||||||
private final Set<ProxiedPlayer> checking = 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);
|
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))
|
if(!(sender instanceof ProxiedPlayer))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!e.getTag().equals("minecraft:brand"))
|
ProxiedPlayer p = (ProxiedPlayer) sender;
|
||||||
return;
|
if (e.getTag().equals("minecraft:register") && new String(e.getData()).contains("fabric")) {
|
||||||
|
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
|
||||||
if(!new String(e.getData()).equals("vanilla")){
|
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;
|
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(), () -> {
|
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
|
||||||
if (!p.isConnected()) return;
|
if (!p.isConnected()) return;
|
||||||
@ -82,12 +90,8 @@ public class NonFabricFabricCheck extends BasicListener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDisconnect(PlayerDisconnectEvent e) {
|
public void onPlayerDisconnect(PlayerDisconnectEvent e) {
|
||||||
if (checking.remove(e.getPlayer())) {
|
if (checking.remove(e.getPlayer())) {
|
||||||
logMessage(SteamwarUser.get(e.getPlayer().getUniqueId()), "Player is potentially using rebranded Fabric");
|
|
||||||
usingFabric.add(e.getPlayer().getUniqueId());
|
usingFabric.add(e.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
vanilla.remove(e.getPlayer());
|
||||||
|
|
||||||
public void logMessage(SteamwarUser user, String reason) {
|
|
||||||
SWException.log("Bungee", "NonFabricFabricCheck " + user.getUserName() + ": " + reason, "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren