|
|
|
@ -19,10 +19,7 @@
|
|
|
|
|
|
|
|
|
|
package de.steamwar.bungeecore.listeners.mods;
|
|
|
|
|
|
|
|
|
|
import de.steamwar.bungeecore.BungeeCore;
|
|
|
|
|
import de.steamwar.bungeecore.Servertype;
|
|
|
|
|
import de.steamwar.bungeecore.Storage;
|
|
|
|
|
import de.steamwar.bungeecore.Subserver;
|
|
|
|
|
import de.steamwar.bungeecore.*;
|
|
|
|
|
import de.steamwar.bungeecore.listeners.BasicListener;
|
|
|
|
|
import net.md_5.bungee.api.connection.Connection;
|
|
|
|
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
|
|
@ -31,6 +28,8 @@ 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;
|
|
|
|
|
|
|
|
|
|
public class ModLoaderBlocker extends BasicListener {
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
@ -45,17 +44,37 @@ public class ModLoaderBlocker extends BasicListener {
|
|
|
|
|
if(new String(e.getData()).contains("fabric")){
|
|
|
|
|
ProxiedPlayer p = (ProxiedPlayer) sender;
|
|
|
|
|
Storage.fabricPlayers.add(p);
|
|
|
|
|
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du hast Fabric installiert. Mit Fabric kannst du nicht auf die Arenen");
|
|
|
|
|
Message.send("MODLOADER_INSTALLED", p, "Fabric");
|
|
|
|
|
}else if(new String(e.getData()).contains("LiteLoader")) {
|
|
|
|
|
ProxiedPlayer p = (ProxiedPlayer) sender;
|
|
|
|
|
Storage.fabricPlayers.add(p);
|
|
|
|
|
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du hast LiteLoader installiert. Mit LiteLoader kannst du nicht auf die Arenen");
|
|
|
|
|
Message.send("MODLOADER_INSTALLED", p, "LiteLoader");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void onPluginMessage(PluginMessageEvent e){
|
|
|
|
|
if(!e.getTag().equals("minecraft:register"))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Connection sender = e.getSender();
|
|
|
|
|
if(!(sender instanceof ProxiedPlayer))
|
|
|
|
|
return;
|
|
|
|
|
ProxiedPlayer p = (ProxiedPlayer) sender;
|
|
|
|
|
|
|
|
|
|
if(p.getPendingConnection().getVersion() <= 340)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
String registered = new String(e.getData(), StandardCharsets.UTF_8);
|
|
|
|
|
if(registered.contains("fml:loginwrapper") || registered.contains("fml:handshake") || registered.contains("fml:play")){
|
|
|
|
|
Storage.fabricPlayers.add(p);
|
|
|
|
|
Message.send("MODLOADER_INSTALLED", p, "Forge");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void onDisconnect(PlayerDisconnectEvent e){
|
|
|
|
|
Storage.fabricPlayers.removeIf(player -> player == e.getPlayer());
|
|
|
|
|
Storage.fabricPlayers.remove(e.getPlayer());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
@ -64,7 +83,7 @@ public class ModLoaderBlocker extends BasicListener {
|
|
|
|
|
&& Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA
|
|
|
|
|
&& isFabric(event.getPlayer())) {
|
|
|
|
|
event.getPlayer().connect(BungeeCore.get().getProxy().getServerInfo(BungeeCore.LOBBY_SERVER));
|
|
|
|
|
BungeeCore.send(event.getPlayer(), BungeeCore.CHAT_PREFIX + "§cMit Fabric und LiteLoader kannst du nicht auf die Arenen");
|
|
|
|
|
Message.send("MODLOADER_DENIED", event.getPlayer());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|