13
0

Fixing serverswitching

Dieser Commit ist enthalten in:
Lixfel 2019-07-12 21:57:01 +02:00
Ursprung 1f853ab61c
Commit 95cb544788

Datei anzeigen

@ -3,7 +3,7 @@ package de.steamwar.bungeecore;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ServerSwitchEvent; import net.md_5.bungee.api.event.ServerConnectedEvent;
import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
@ -25,11 +25,10 @@ public class Subserver implements Runnable, Listener {
private static final Logger logger = ProxyServer.getInstance().getLogger(); private static final Logger logger = ProxyServer.getInstance().getLogger();
public static Subserver getSubserver(ProxiedPlayer p){ public static Subserver getSubserver(ProxiedPlayer p){
for(Subserver s : serverList){ for(int i = serverList.size()-1; i >= 0; i--){
if(s.onServer(p)) if(serverList.get(i).onServer(p))
return s; return serverList.get(i);
} }
return null; return null;
} }
public static List<Subserver> getServerList(){ public static List<Subserver> getServerList(){
@ -157,7 +156,7 @@ public class Subserver implements Runnable, Listener {
} }
@EventHandler @EventHandler
public void onServerSwitchEvent(ServerSwitchEvent e){ public void onServerSwitchEvent(ServerConnectedEvent e){
ProxiedPlayer player = e.getPlayer(); ProxiedPlayer player = e.getPlayer();
if(player.getServer().getInfo().equals(server)) if(player.getServer().getInfo().equals(server))
return; return;