mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-22 10:36:17 +01:00
Merge pull request #222 from elytraa/bungee-destination
Use ServerConnectedEvent for bungee relay
This commit is contained in:
commit
69176c379b
@ -4,7 +4,7 @@ import com.google.common.io.ByteArrayDataOutput;
|
|||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin;
|
import com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin;
|
||||||
import com.sekwah.advancedportals.bungee.BungeeMessages;
|
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.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ public class EventListener implements Listener {
|
|||||||
public EventListener(AdvancedPortalsPlugin plugin) { this.plugin = plugin; }
|
public EventListener(AdvancedPortalsPlugin plugin) { this.plugin = plugin; }
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerSwitchServer(ServerSwitchEvent event) {
|
public void onServerConnected(ServerConnectedEvent event) {
|
||||||
String uuid = event.getPlayer().getUniqueId().toString();
|
String uuid = event.getPlayer().getUniqueId().toString();
|
||||||
|
|
||||||
if (plugin.PlayerDestiMap.containsKey(uuid)) {
|
if (plugin.PlayerDestiMap.containsKey(uuid)) {
|
||||||
|
@ -32,10 +32,7 @@ public class PluginMessageReceiver implements Listener {
|
|||||||
String targetUUID = in.readUTF();
|
String targetUUID = in.readUTF();
|
||||||
|
|
||||||
plugin.PlayerDestiMap.put(targetUUID, new String[]{targetServer, targetDestination, targetUUID});
|
plugin.PlayerDestiMap.put(targetUUID, new String[]{targetServer, targetDestination, targetUUID});
|
||||||
|
plugin.PlayerDestiMap.remove(targetUUID);
|
||||||
plugin.getProxy().getScheduler().schedule(plugin, () -> {
|
|
||||||
plugin.PlayerDestiMap.remove(targetUUID);
|
|
||||||
}, 20, TimeUnit.SECONDS);
|
|
||||||
}
|
}
|
||||||
else if (subChannel.equalsIgnoreCase(BungeeMessages.BUNGEE_COMMAND)) {
|
else if (subChannel.equalsIgnoreCase(BungeeMessages.BUNGEE_COMMAND)) {
|
||||||
String command = in.readUTF();
|
String command = in.readUTF();
|
||||||
|
Loading…
Reference in New Issue
Block a user