Update PluginMessageReceiver.java

This commit is contained in:
tmantti 2020-07-15 13:59:11 +03:00 committed by GitHub
parent 17fb0c5332
commit cf2ff77ccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,18 +33,19 @@ public class PluginMessageReceiver implements PluginMessageListener {
String targetDestination = in.readUTF();
UUID bungeeUUID = UUID.fromString(in.readUTF());
Player targetPlayer = this.plugin.getServer().getPlayer(bungeeUUID);
if (targetPlayer != null) {
Player finalTargetPlayer = targetPlayer;
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,
() -> Destination.warp(finalTargetPlayer, targetDestination, false, true),
20L
);
}
else {
plugin.getLogger().warning("Could not find player to teleport to destination");
}
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
Player targetPlayer = this.plugin.getServer().getPlayer(bungeeUUID);
if (targetPlayer != null) {
Player finalTargetPlayer = targetPlayer;
Destination.warp(finalTargetPlayer, targetDestination, false, true);
}
else {
plugin.getLogger().warning("Could not find player to teleport to destination");
}
}, 20);
}
}