geforkt von SteamWar/BungeeCore
Revert some stuff
Dieser Commit ist enthalten in:
Ursprung
3af6f43ccd
Commit
7b5ce77e93
@ -48,8 +48,10 @@ public class Fabric extends BasicListener {
|
||||
|
||||
private final Set<String> neededMods = new HashSet<>();
|
||||
|
||||
public static final Map<ProxiedPlayer, Integer> checkedPlayers = new HashMap<>();
|
||||
public static final Map<ProxiedPlayer, Long> expectPluginMessage = new HashMap<>();
|
||||
private static final Map<ProxiedPlayer, Integer> checkedPlayers = new HashMap<>();
|
||||
private static final Map<ProxiedPlayer, Long> expectPluginMessage = new HashMap<>();
|
||||
|
||||
private static final Object OBJECT = new Object();
|
||||
|
||||
{
|
||||
neededMods.add("java");
|
||||
@ -58,10 +60,12 @@ public class Fabric extends BasicListener {
|
||||
neededMods.add("steamwarmodsender");
|
||||
|
||||
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
|
||||
for (Map.Entry<ProxiedPlayer, Long> entry : expectPluginMessage.entrySet()) {
|
||||
if (System.currentTimeMillis() - entry.getValue() > TimeUnit.SECONDS.toMillis(20)) {
|
||||
banPlayer(SteamwarUser.get(entry.getKey()), entry.getKey());
|
||||
return;
|
||||
synchronized (OBJECT) {
|
||||
for (Map.Entry<ProxiedPlayer, Long> entry : expectPluginMessage.entrySet()) {
|
||||
if (System.currentTimeMillis() - entry.getValue() > TimeUnit.SECONDS.toMillis(20)) {
|
||||
banPlayer(SteamwarUser.get(entry.getKey()), entry.getKey());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 0, 1, TimeUnit.SECONDS);
|
||||
@ -79,9 +83,13 @@ public class Fabric extends BasicListener {
|
||||
ProxiedPlayer player = (ProxiedPlayer) e.getSender();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
|
||||
if (expectPluginMessage.containsKey(player) && !checkedPlayers.containsKey(player)) {
|
||||
banPlayer(user, player);
|
||||
return;
|
||||
if (!checkedPlayers.containsKey(player)) {
|
||||
synchronized (OBJECT) {
|
||||
if (expectPluginMessage.containsKey(player)) {
|
||||
banPlayer(user, player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Mod> mods = new LinkedList<>();
|
||||
@ -148,7 +156,9 @@ public class Fabric extends BasicListener {
|
||||
@EventHandler
|
||||
public void onServerSwitchEvent(ServerSwitchEvent e) {
|
||||
if (e.getFrom() == null) return;
|
||||
expectPluginMessage.put(e.getPlayer(), System.currentTimeMillis());
|
||||
synchronized (OBJECT) {
|
||||
expectPluginMessage.put(e.getPlayer(), System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSortedAlphabetically(List<Mod> mods) {
|
||||
@ -177,4 +187,11 @@ public class Fabric extends BasicListener {
|
||||
true);
|
||||
BungeeCore.log(Level.SEVERE,Message.parse("MODIFICATION_BAN_LOG", player, user.getUserName()));
|
||||
}
|
||||
|
||||
public static void remove(ProxiedPlayer player) {
|
||||
synchronized (OBJECT) {
|
||||
checkedPlayers.remove(player);
|
||||
expectPluginMessage.remove(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@ -58,8 +57,7 @@ public class ModLoaderBlocker extends BasicListener {
|
||||
|
||||
@EventHandler
|
||||
public void onDisconnect(PlayerDisconnectEvent e){
|
||||
Fabric.checkedPlayers.remove(e.getPlayer());
|
||||
Fabric.expectPluginMessage.remove(e.getPlayer());
|
||||
Fabric.remove(e.getPlayer());
|
||||
Storage.fabricPlayers.remove(e.getPlayer());
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren