Add Static Server Fabric Check
Dieser Commit ist enthalten in:
Ursprung
b5b6a624c6
Commit
3ea273767d
@ -263,6 +263,9 @@ public class BungeeCore extends Plugin {
|
|||||||
serverPermissions.get(serverName),
|
serverPermissions.get(serverName),
|
||||||
cmds.toArray(new String[0])
|
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 net.md_5.bungee.event.EventHandler;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class ModLoaderBlocker extends BasicListener {
|
public class ModLoaderBlocker extends BasicListener {
|
||||||
|
|
||||||
|
private static final Set<String> BLOCKED_SERVER = new HashSet<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginMessageEvent(PluginMessageEvent e){
|
public void onPluginMessageEvent(PluginMessageEvent e){
|
||||||
Connection sender = e.getSender();
|
Connection sender = e.getSender();
|
||||||
@ -79,8 +83,9 @@ public class ModLoaderBlocker extends BasicListener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onServerSwitch(ServerSwitchEvent event) {
|
public void onServerSwitch(ServerSwitchEvent event) {
|
||||||
if(Subserver.getSubserver(event.getPlayer()) != null
|
if(((Subserver.getSubserver(event.getPlayer()) != null
|
||||||
&& Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA
|
&& Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA)
|
||||||
|
|| BLOCKED_SERVER.contains(event.getPlayer().getServer().getInfo().getName()))
|
||||||
&& isFabric(event.getPlayer())) {
|
&& isFabric(event.getPlayer())) {
|
||||||
event.getPlayer().connect(BungeeCore.get().getProxy().getServerInfo(BungeeCore.LOBBY_SERVER));
|
event.getPlayer().connect(BungeeCore.get().getProxy().getServerInfo(BungeeCore.LOBBY_SERVER));
|
||||||
Message.send("MODLOADER_DENIED", event.getPlayer());
|
Message.send("MODLOADER_DENIED", event.getPlayer());
|
||||||
@ -90,4 +95,8 @@ public class ModLoaderBlocker extends BasicListener {
|
|||||||
public static boolean isFabric(ProxiedPlayer player) {
|
public static boolean isFabric(ProxiedPlayer player) {
|
||||||
return Storage.fabricPlayers.contains(player);
|
return Storage.fabricPlayers.contains(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addServer(String server) {
|
||||||
|
BLOCKED_SERVER.add(server);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren