geforkt von SteamWar/BungeeCore
Merge pull request 'Add Static Server Fabric Check' (#189) from staticserverblock into master
Reviewed-on: SteamWar/BungeeCore#189 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
2301a618eb
@ -263,6 +263,9 @@ public class BungeeCore extends Plugin {
|
||||
serverPermissions.get(serverName),
|
||||
cmds.toArray(new String[0])
|
||||
);
|
||||
if(server.getBoolean("modchecked", false)) {
|
||||
ModLoaderBlocker.addServer(serverName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,13 @@ 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;
|
||||
|
||||
public class ModLoaderBlocker extends BasicListener {
|
||||
|
||||
private static final Set<String> BLOCKED_SERVER = new HashSet<>();
|
||||
|
||||
@EventHandler
|
||||
public void onPluginMessageEvent(PluginMessageEvent e){
|
||||
Connection sender = e.getSender();
|
||||
@ -79,8 +83,9 @@ public class ModLoaderBlocker extends BasicListener {
|
||||
|
||||
@EventHandler
|
||||
public void onServerSwitch(ServerSwitchEvent event) {
|
||||
if(Subserver.getSubserver(event.getPlayer()) != null
|
||||
&& Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA
|
||||
if(((Subserver.getSubserver(event.getPlayer()) != null
|
||||
&& Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA)
|
||||
|| BLOCKED_SERVER.contains(event.getPlayer().getServer().getInfo().getName()))
|
||||
&& isFabric(event.getPlayer())) {
|
||||
event.getPlayer().connect(BungeeCore.get().getProxy().getServerInfo(BungeeCore.LOBBY_SERVER));
|
||||
Message.send("MODLOADER_DENIED", event.getPlayer());
|
||||
@ -90,4 +95,8 @@ public class ModLoaderBlocker extends BasicListener {
|
||||
public static boolean isFabric(ProxiedPlayer player) {
|
||||
return Storage.fabricPlayers.contains(player);
|
||||
}
|
||||
|
||||
public static void addServer(String server) {
|
||||
BLOCKED_SERVER.add(server);
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren