patched bungee issues

This commit is contained in:
LAX1DUDE 2022-05-15 00:20:56 -07:00
parent e7e763f9f8
commit 75c43e8a29
8 changed files with 17 additions and 2 deletions

View file

@ -38,6 +38,7 @@ public interface QueryConnection {
toSend.put("brand", EaglercraftBungee.brand); toSend.put("brand", EaglercraftBungee.brand);
toSend.put("vers", EaglercraftBungee.version); toSend.put("vers", EaglercraftBungee.version);
toSend.put("cracked", EaglercraftBungee.cracked); toSend.put("cracked", EaglercraftBungee.cracked);
toSend.put("secure", false);
toSend.put("time", System.currentTimeMillis()); toSend.put("time", System.currentTimeMillis());
toSend.put("uuid", BungeeCord.getInstance().config.getUuid()); toSend.put("uuid", BungeeCord.getInstance().config.getUuid());
toSend.put("data", msg); toSend.put("data", msg);
@ -51,6 +52,7 @@ public interface QueryConnection {
toSend.put("brand", EaglercraftBungee.brand); toSend.put("brand", EaglercraftBungee.brand);
toSend.put("vers", EaglercraftBungee.version); toSend.put("vers", EaglercraftBungee.version);
toSend.put("cracked", EaglercraftBungee.cracked); toSend.put("cracked", EaglercraftBungee.cracked);
toSend.put("secure", false);
toSend.put("time", System.currentTimeMillis()); toSend.put("time", System.currentTimeMillis());
toSend.put("uuid", BungeeCord.getInstance().config.getUuid()); toSend.put("uuid", BungeeCord.getInstance().config.getUuid());
toSend.put("data", msg); toSend.put("data", msg);

View file

@ -26,6 +26,7 @@ public class Configuration {
private boolean onlineMode; private boolean onlineMode;
private int playerLimit; private int playerLimit;
private String name; private String name;
private boolean showBanType;
public Configuration() { public Configuration() {
this.timeout = 30000; this.timeout = 30000;
@ -51,6 +52,7 @@ public class Configuration {
this.onlineMode = false; this.onlineMode = false;
this.playerLimit = adapter.getInt("player_limit", this.playerLimit); this.playerLimit = adapter.getInt("player_limit", this.playerLimit);
this.name = adapter.getString("server_name", EaglercraftBungee.name + " Server"); this.name = adapter.getString("server_name", EaglercraftBungee.name + " Server");
this.showBanType = adapter.getBoolean("display_ban_type_on_kick", false);
Preconditions.checkArgument(this.listeners != null && !this.listeners.isEmpty(), (Object) "No listeners defined."); Preconditions.checkArgument(this.listeners != null && !this.listeners.isEmpty(), (Object) "No listeners defined.");
final Map<String, ServerInfo> newServers = adapter.getServers(); final Map<String, ServerInfo> newServers = adapter.getServers();
Preconditions.checkArgument(newServers != null && !newServers.isEmpty(), (Object) "No servers defined"); Preconditions.checkArgument(newServers != null && !newServers.isEmpty(), (Object) "No servers defined");
@ -102,4 +104,9 @@ public class Configuration {
public String getServerName() { public String getServerName() {
return name; return name;
} }
public boolean shouldShowBanType() {
return this.showBanType;
}
} }

View file

@ -41,6 +41,7 @@ import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.eaglercraft.BanList; import net.md_5.bungee.eaglercraft.BanList;
import net.md_5.bungee.eaglercraft.WebSocketProxy; import net.md_5.bungee.eaglercraft.WebSocketProxy;
import net.md_5.bungee.eaglercraft.BanList.BanCheck; import net.md_5.bungee.eaglercraft.BanList.BanCheck;
import net.md_5.bungee.eaglercraft.BanList.BanState;
import net.md_5.bungee.api.ServerPing; import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.protocol.packet.PacketFEPing; import net.md_5.bungee.protocol.packet.PacketFEPing;
import net.md_5.bungee.Util; import net.md_5.bungee.Util;
@ -164,7 +165,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection {
default: default:
System.err.println("Player '" + un + "' is banned: " + bc.string); System.err.println("Player '" + un + "' is banned: " + bc.string);
} }
this.disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: " + bc.string); if(bc.reason == BanState.USER_BANNED || ((BungeeCord)bungee).config.shouldShowBanType()) {
this.disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: " + bc.string);
}else {
this.disconnect("" + ChatColor.RED + "You are banned.");
}
return; return;
} }
final int limit = BungeeCord.getInstance().config.getPlayerLimit(); final int limit = BungeeCord.getInstance().config.getPlayerLimit();
@ -266,7 +271,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection {
@Override @Override
public InetSocketAddress getVirtualHost() { public InetSocketAddress getVirtualHost() {
return (this.handshake == null) ? null : new InetSocketAddress(this.handshake.getHost(), this.handshake.getPort()); return (this.handshake == null) ? null : new InetSocketAddress(this.handshake.getHost(), this.handshake.getPort() & 0xFFFF);
} }
@Override @Override

View file

@ -56,6 +56,7 @@ servers:
address: localhost:25569 address: localhost:25569
restricted: false restricted: false
server_name: EaglercraftBungee Server server_name: EaglercraftBungee Server
display_ban_type_on_kick: false
permissions: permissions:
default: default:
- bungeecord.command.server - bungeecord.command.server