Merge pull request #222 from elytraa/bungee-destination

Use ServerConnectedEvent for bungee relay
This commit is contained in:
Sekwah 2020-09-21 00:19:19 +01:00 committed by GitHub
commit 69176c379b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -4,7 +4,7 @@ import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.bungee.BungeeMessages;
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.event.EventHandler;
@ -14,7 +14,7 @@ public class EventListener implements Listener {
public EventListener(AdvancedPortalsPlugin plugin) { this.plugin = plugin; }
@EventHandler
public void onPlayerSwitchServer(ServerSwitchEvent event) {
public void onServerConnected(ServerConnectedEvent event) {
String uuid = event.getPlayer().getUniqueId().toString();
if (plugin.PlayerDestiMap.containsKey(uuid)) {

View File

@ -32,10 +32,7 @@ public class PluginMessageReceiver implements Listener {
String targetUUID = in.readUTF();
plugin.PlayerDestiMap.put(targetUUID, new String[]{targetServer, targetDestination, targetUUID});
plugin.getProxy().getScheduler().schedule(plugin, () -> {
plugin.PlayerDestiMap.remove(targetUUID);
}, 20, TimeUnit.SECONDS);
plugin.PlayerDestiMap.remove(targetUUID);
}
else if (subChannel.equalsIgnoreCase(BungeeMessages.BUNGEE_COMMAND)) {
String command = in.readUTF();