Archiviert
1
0

Merge pull request 'ConvertFromWaterfall' (#363) from ConvertFromWaterfall into master

Reviewed-on: SteamWar/BungeeCore#363
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-06-08 16:54:22 +02:00
Commit 1ef5f9e625
3 geänderte Dateien mit 19 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -31,6 +31,7 @@ import net.md_5.bungee.UserConnection;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.ServerConnectRequest;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.HoverEvent;
@ -595,11 +596,24 @@ public class TeamCommand extends BasicCommand {
ProxyServer.getInstance().getServers().put(info.getName(), info); ProxyServer.getInstance().getServers().put(info.getName(), info);
return info; return info;
}); });
player.connect(ServerConnectRequest.builder()
.target(serverInfo)
.connectTimeout(BungeeCord.getInstance().getConfig().getServerConnectTimeout())
.retry(false)
.reason(ServerConnectEvent.Reason.PLUGIN)
.callback((success, error) -> {
if (error != null) {
Message.send("TEAM_OFFLINE", player);
}
})
.build());
/*
((UserConnection) player).connect(serverInfo, (success, error) -> { ((UserConnection) player).connect(serverInfo, (success, error) -> {
if (error != null) { if (error != null) {
Message.send("TEAM_OFFLINE", player); Message.send("TEAM_OFFLINE", player);
} }
}, false, ServerConnectEvent.Reason.PLUGIN, BungeeCord.getInstance().getConfig().getServerConnectTimeout(), false); }, false, ServerConnectEvent.Reason.PLUGIN, BungeeCord.getInstance().getConfig().getServerConnectTimeout(), false);
*/
} }
private void server(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ private void server(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){

Datei anzeigen

@ -19,12 +19,12 @@
package de.steamwar.bungeecore.listeners; package de.steamwar.bungeecore.listeners;
import io.github.waterfallmc.waterfall.utils.UUIDUtils;
import net.md_5.bungee.BungeeCord; import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.event.LoginEvent; import net.md_5.bungee.api.event.LoginEvent;
import net.md_5.bungee.connection.InitialHandler; import net.md_5.bungee.connection.InitialHandler;
import net.md_5.bungee.connection.LoginResult; import net.md_5.bungee.connection.LoginResult;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.protocol.Property;
import net.md_5.bungee.util.AddressUtil; import net.md_5.bungee.util.AddressUtil;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -50,11 +50,12 @@ public class SubserverProtocolFixer extends BasicListener {
public void loginEvent(LoginEvent e) { public void loginEvent(LoginEvent e) {
InitialHandler initialHandler = ((InitialHandler) e.getConnection()); InitialHandler initialHandler = ((InitialHandler) e.getConnection());
String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + UUIDUtils.undash(initialHandler.getUniqueId().toString()); String undashedUUID = initialHandler.getUniqueId().toString().replace("-", "");
String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + undashedUUID;
LoginResult result = initialHandler.getLoginProfile(); LoginResult result = initialHandler.getLoginProfile();
if (result != null) { if (result != null) {
LoginResult.Property[] properties = result.getProperties(); Property[] properties = result.getProperties();
if (properties.length > 0) { if (properties.length > 0) {
extraData += "\00" + BungeeCord.getInstance().gson.toJson(properties); extraData += "\00" + BungeeCord.getInstance().gson.toJson(properties);
} }

Datei anzeigen

@ -93,7 +93,7 @@ public class TablistManager extends BasicListener {
//Calculate server-player-map //Calculate server-player-map
tablist = new TablistGroup(true, ""); tablist = new TablistGroup(true, "");
TablistGroup bau = new TablistGroup(false, "Bau"); TablistGroup bau = new TablistGroup(false, "Bau");
for (ServerInfo server : ProxyServer.getInstance().getServersCopy().values()){ for (ServerInfo server : new ArrayList<>(ProxyServer.getInstance().getServers().values())){
if(server.getPlayers().isEmpty()) if(server.getPlayers().isEmpty())
continue; continue;