mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-01-27 10:31:34 +01:00
some comment deleted, add null-check/delay 20Ticks
This commit is contained in:
parent
a5c828e010
commit
5402a0ab4e
@ -1,5 +1,7 @@
|
||||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.bukkit.api.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.bukkit.api.portaldata.PortalArg;
|
||||
import com.sekwah.advancedportals.bukkit.listeners.Listeners;
|
||||
|
@ -20,7 +20,6 @@ public class PluginMessageReceiver implements PluginMessageListener {
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
// plugin.getLogger().info(""+channel.equals(plugin.channelName));
|
||||
|
||||
if (!channel.equals(plugin.channelName)) {
|
||||
return;
|
||||
@ -29,22 +28,18 @@ public class PluginMessageReceiver implements PluginMessageListener {
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(message);
|
||||
String subchannel = in.readUTF();
|
||||
|
||||
// plugin.getLogger().info("bukkit plugin received: " + subchannel);
|
||||
|
||||
if (subchannel.equals("BungeePortal")) {
|
||||
String targetPlayerUUID = in.readUTF();
|
||||
String targetDestination = in.readUTF();
|
||||
|
||||
OfflinePlayer msgPlayer = plugin.getServer().getOfflinePlayer(UUID.fromString(targetPlayerUUID));
|
||||
Player msgPlayer = plugin.getServer().getPlayer(UUID.fromString(targetPlayerUUID));
|
||||
|
||||
Destination.warp(msgPlayer.getPlayer(), targetDestination);
|
||||
|
||||
/* plugin.PlayerDestiMap.put(msgPlayer, targetDestination);
|
||||
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
||||
plugin.PlayerDestiMap.remove(msgPlayer),
|
||||
20L*10
|
||||
); */
|
||||
if (msgPlayer != null) {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,
|
||||
() -> Destination.warp(msgPlayer, targetDestination),
|
||||
20L
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,15 +20,11 @@ public class PluginMessageReceiver implements Listener {
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(event.getData());
|
||||
String subChannel = in.readUTF();
|
||||
|
||||
plugin.getProxy().getLogger().info("bungee plugin received: " + subChannel);
|
||||
|
||||
if (subChannel.equalsIgnoreCase("PortalEnter")) {
|
||||
String targetServer = in.readUTF();
|
||||
String targetPlayerUUID = in.readUTF();
|
||||
String targetDestination = in.readUTF();
|
||||
|
||||
// plugin.getProxy().getLogger().info(targetServer + " " + targetPlayerUUID + " " + targetDestination);
|
||||
|
||||
plugin.PlayerDestiMap.put(targetPlayerUUID, new String[]{targetServer, targetDestination});
|
||||
|
||||
plugin.getProxy().getScheduler().schedule(plugin, () -> {
|
||||
|
Loading…
Reference in New Issue
Block a user