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