From 3a87fa172b9e21f6eb384b91784be374a85e8466 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Sun, 28 Jun 2020 01:06:59 +0200 Subject: [PATCH] Replace removed Commons methods with Bukkit methods --- .../main/java/de/erethon/dungeonsxl/dungeon/DGame.java | 3 +-- .../java/de/erethon/dungeonsxl/player/DEditPlayer.java | 6 +++--- .../java/de/erethon/dungeonsxl/player/DGamePlayer.java | 8 ++++---- .../java/de/erethon/dungeonsxl/player/DGlobalPlayer.java | 4 ++-- .../java/de/erethon/dungeonsxl/player/RespawnTask.java | 2 +- .../java/de/erethon/dungeonsxl/world/DInstanceWorld.java | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/dungeon/DGame.java b/core/src/main/java/de/erethon/dungeonsxl/dungeon/DGame.java index 2c359c56..43f96d43 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/dungeon/DGame.java +++ b/core/src/main/java/de/erethon/dungeonsxl/dungeon/DGame.java @@ -291,8 +291,7 @@ public class DGame implements Game { @Override public void run() { if (teleport) { - groups.forEach(g -> g.getMembers().getOnlinePlayers() - .forEach(p -> PlayerUtil.secureTeleport(p, world.getStartLocation(plugin.getPlayerGroup(p))))); + groups.forEach(g -> g.getMembers().getOnlinePlayers().forEach(p -> p.teleport(world.getStartLocation(plugin.getPlayerGroup(p))))); } for (DungeonSign dSign : world.getDungeonSigns()) { diff --git a/core/src/main/java/de/erethon/dungeonsxl/player/DEditPlayer.java b/core/src/main/java/de/erethon/dungeonsxl/player/DEditPlayer.java index 3bd56cb5..e4b2b7d7 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/player/DEditPlayer.java +++ b/core/src/main/java/de/erethon/dungeonsxl/player/DEditPlayer.java @@ -56,9 +56,9 @@ public class DEditPlayer extends DInstancePlayer implements EditPlayer { Location teleport = world.getLobbyLocation(); if (teleport == null) { - PlayerUtil.secureTeleport(player, world.getWorld().getSpawnLocation()); + player.teleport(world.getWorld().getSpawnLocation()); } else { - PlayerUtil.secureTeleport(player, teleport); + player.teleport(teleport); } // Permission bridge @@ -173,7 +173,7 @@ public class DEditPlayer extends DInstancePlayer implements EditPlayer { } if (!locationValid) { - PlayerUtil.secureTeleport(getPlayer(), teleportLocation); + getPlayer().teleport(teleportLocation); } } diff --git a/core/src/main/java/de/erethon/dungeonsxl/player/DGamePlayer.java b/core/src/main/java/de/erethon/dungeonsxl/player/DGamePlayer.java index 58e8741c..3c74f305 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/player/DGamePlayer.java +++ b/core/src/main/java/de/erethon/dungeonsxl/player/DGamePlayer.java @@ -106,9 +106,9 @@ public class DGamePlayer extends DInstancePlayer implements GamePlayer { Location teleport = world.getLobbyLocation(); if (teleport == null) { - PlayerUtil.secureTeleport(player, world.getWorld().getSpawnLocation()); + player.teleport(world.getWorld().getSpawnLocation()); } else { - PlayerUtil.secureTeleport(player, teleport); + player.teleport(teleport); } if (!((DGameWorld) world).hasReadySign()) { @@ -532,7 +532,7 @@ public class DGamePlayer extends DInstancePlayer implements GamePlayer { respawn = getWorld().getSpawnLocation(); } - PlayerUtil.secureTeleport(getPlayer(), respawn); + getPlayer().teleport(respawn); if (resetClassInventoryOnRespawn) { setPlayerClass(dClass); @@ -785,7 +785,7 @@ public class DGamePlayer extends DInstancePlayer implements GamePlayer { } if (!locationValid) { - PlayerUtil.secureTeleport(getPlayer(), teleportLocation); + getPlayer().teleport(teleportLocation); } if (teleportWolf) { diff --git a/core/src/main/java/de/erethon/dungeonsxl/player/DGlobalPlayer.java b/core/src/main/java/de/erethon/dungeonsxl/player/DGlobalPlayer.java index d9c4fa87..4ccde7b4 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/player/DGlobalPlayer.java +++ b/core/src/main/java/de/erethon/dungeonsxl/player/DGlobalPlayer.java @@ -446,7 +446,7 @@ public class DGlobalPlayer implements GlobalPlayer { new BukkitRunnable() { @Override public void run() { - PlayerUtil.respawn(player); + player.spigot().respawn(); reset(tpLoc, keepInventory); } }.runTaskLater(plugin, 1L); @@ -458,7 +458,7 @@ public class DGlobalPlayer implements GlobalPlayer { @Override public void reset(Location tpLoc, boolean keepInventory) { try { - PlayerUtil.secureTeleport(player, tpLoc); + player.teleport(tpLoc); player.setGameMode(data.getOldGameMode()); if (!keepInventory) { while (data.getOldInventory().size() > 36) { diff --git a/core/src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java b/core/src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java index a278a8b3..2907c8e3 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java +++ b/core/src/main/java/de/erethon/dungeonsxl/player/RespawnTask.java @@ -45,7 +45,7 @@ public class RespawnTask extends BukkitRunnable { return; } if (player.getWorld() != location.getWorld() || player.getLocation().distance(location) > 2) { - PlayerUtil.secureTeleport(player, location); + player.teleport(location); } if (resetClassInventory) { dPlayer.setPlayerClass(dPlayer.getPlayerClass()); diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java b/core/src/main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java index 7ccc7f22..8456cd4f 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DInstanceWorld.java @@ -171,7 +171,7 @@ public abstract class DInstanceWorld implements InstanceWorld { getPlayers().forEach(p -> p.leave()); // Players who shouldn't be in the dungeon but still are for some reason if (world != null) { - getWorld().getPlayers().forEach(p -> PlayerUtil.secureTeleport(p, Bukkit.getWorlds().get(0).getSpawnLocation())); + getWorld().getPlayers().forEach(p -> p.teleport(Bukkit.getWorlds().get(0).getSpawnLocation())); } }