Merge pull request 'Work around new forge mod loader' (#165) from fixForgeDetection into master
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
8d9953d9db
@ -48,10 +48,10 @@ public class Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String parse(String message, boolean prefixed, CommandSender sender,Object... params){
|
private static String parse(String message, boolean prefixed, CommandSender sender,Object... params){
|
||||||
Locale locale;
|
Locale locale = null;
|
||||||
if(sender instanceof ProxiedPlayer)
|
if(sender instanceof ProxiedPlayer)
|
||||||
locale = ((ProxiedPlayer)sender).getLocale();
|
locale = ((ProxiedPlayer)sender).getLocale();
|
||||||
else
|
if(locale == null)
|
||||||
locale = Locale.getDefault();
|
locale = Locale.getDefault();
|
||||||
|
|
||||||
ResourceBundle resourceBundle = ResourceBundle.getBundle("de.steamwar.messages.BungeeCore", locale);
|
ResourceBundle resourceBundle = ResourceBundle.getBundle("de.steamwar.messages.BungeeCore", locale);
|
||||||
|
@ -19,10 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bungeecore.listeners.mods;
|
package de.steamwar.bungeecore.listeners.mods;
|
||||||
|
|
||||||
import de.steamwar.bungeecore.BungeeCore;
|
import de.steamwar.bungeecore.*;
|
||||||
import de.steamwar.bungeecore.Servertype;
|
|
||||||
import de.steamwar.bungeecore.Storage;
|
|
||||||
import de.steamwar.bungeecore.Subserver;
|
|
||||||
import de.steamwar.bungeecore.listeners.BasicListener;
|
import de.steamwar.bungeecore.listeners.BasicListener;
|
||||||
import net.md_5.bungee.api.connection.Connection;
|
import net.md_5.bungee.api.connection.Connection;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
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.api.event.ServerSwitchEvent;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public class ModLoaderBlocker extends BasicListener {
|
public class ModLoaderBlocker extends BasicListener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -45,17 +44,37 @@ public class ModLoaderBlocker extends BasicListener {
|
|||||||
if(new String(e.getData()).contains("fabric")){
|
if(new String(e.getData()).contains("fabric")){
|
||||||
ProxiedPlayer p = (ProxiedPlayer) sender;
|
ProxiedPlayer p = (ProxiedPlayer) sender;
|
||||||
Storage.fabricPlayers.add(p);
|
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")) {
|
}else if(new String(e.getData()).contains("LiteLoader")) {
|
||||||
ProxiedPlayer p = (ProxiedPlayer) sender;
|
ProxiedPlayer p = (ProxiedPlayer) sender;
|
||||||
Storage.fabricPlayers.add(p);
|
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
|
@EventHandler
|
||||||
public void onDisconnect(PlayerDisconnectEvent e){
|
public void onDisconnect(PlayerDisconnectEvent e){
|
||||||
Storage.fabricPlayers.removeIf(player -> player == e.getPlayer());
|
Storage.fabricPlayers.remove(e.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -64,7 +83,7 @@ public class ModLoaderBlocker extends BasicListener {
|
|||||||
&& Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA
|
&& Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA
|
||||||
&& 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));
|
||||||
BungeeCore.send(event.getPlayer(), BungeeCore.CHAT_PREFIX + "§cMit Fabric und LiteLoader kannst du nicht auf die Arenen");
|
Message.send("MODLOADER_DENIED", event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@ UNKNOWN_COMMAND=§cUnbekannter Befehl.
|
|||||||
UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht.
|
UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht.
|
||||||
INVALID_TIME=§cUngültige Zeitangabe.
|
INVALID_TIME=§cUngültige Zeitangabe.
|
||||||
|
|
||||||
|
#ModLoader blocker
|
||||||
|
MODLOADER_INSTALLED=§7Du hast §e{0} §7installiert. Daher kannst du keinen Arenen beitreten.
|
||||||
|
MODLOADER_DENIED=§cMit Fabric, Forge und LiteLoader kannst du keinen Arenen beitreten.
|
||||||
|
|
||||||
#Help command
|
#Help command
|
||||||
HELP_LOBBY=§7Kehre von überall mit §8/§el §7zur Lobby zurück!
|
HELP_LOBBY=§7Kehre von überall mit §8/§el §7zur Lobby zurück!
|
||||||
HELP_LOBBY_HOVER=§eZurück zur Lobby
|
HELP_LOBBY_HOVER=§eZurück zur Lobby
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren