diff --git a/src/main/java/com/songoda/skyblock/command/commands/island/TeleportCommand.java b/src/main/java/com/songoda/skyblock/command/commands/island/TeleportCommand.java index 727d37d1..aecf938a 100644 --- a/src/main/java/com/songoda/skyblock/command/commands/island/TeleportCommand.java +++ b/src/main/java/com/songoda/skyblock/command/commands/island/TeleportCommand.java @@ -14,6 +14,7 @@ import com.songoda.skyblock.utils.player.OfflinePlayer; import com.songoda.skyblock.utils.world.LocationUtil; import com.songoda.skyblock.visit.Visit; import com.songoda.skyblock.visit.VisitManager; +import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -111,7 +112,7 @@ public class TeleportCommand extends SubCommand { Bukkit.getServer().getScheduler().runTask(skyblock, () -> { Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main); LocationUtil.removeWaterFromLoc(skyblock, loc); - player.teleport(loc); + PaperLib.teleportAsync(player, loc); if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){ player.setFallDistance(0.0F); diff --git a/src/main/java/com/songoda/skyblock/island/IslandManager.java b/src/main/java/com/songoda/skyblock/island/IslandManager.java index 82b4ad5b..966ff74a 100644 --- a/src/main/java/com/songoda/skyblock/island/IslandManager.java +++ b/src/main/java/com/songoda/skyblock/island/IslandManager.java @@ -41,6 +41,7 @@ import com.songoda.skyblock.utils.world.WorldBorder; import com.songoda.skyblock.utils.world.block.BlockDegreesType; import com.songoda.skyblock.visit.VisitManager; import com.songoda.skyblock.world.WorldManager; +import io.papermc.lib.PaperLib; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -269,7 +270,7 @@ public class IslandManager { } Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(skyblock, () -> { - player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main)); + PaperLib.teleportAsync(player, island.getLocation(IslandWorld.Normal, IslandEnvironment.Main)); player.setFallDistance(0.0F); }, configLoad.getInt("Island.Creation.TeleportTimeout") * 20); @@ -336,7 +337,7 @@ public class IslandManager { Bukkit.getScheduler().callSyncMethod(SkyBlock.getInstance(), () -> { - player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Island)); + PaperLib.teleportAsync(player, island.getLocation(IslandWorld.Normal, IslandEnvironment.Island)); player.setGameMode(GameMode.SPECTATOR); return true; }); @@ -344,7 +345,7 @@ public class IslandManager { Bukkit.getScheduler().runTaskLater(skyblock, () -> { if (data.isPreview()) { Location spawn = fileManager.getLocation(fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")), "Location.Spawn", true); - player.teleport(spawn); + PaperLib.teleportAsync(player, spawn); player.setGameMode(GameMode.SURVIVAL); data.setIsland(null); islandStorage.remove(player.getUniqueId(), island); @@ -558,15 +559,7 @@ public class IslandManager { } } - if (skyblock.isPaperAsync()) { - Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> { - startDeletition(island, worldManager); - }); - } else { - startDeletition(island, worldManager); - } - - + startDeletition(island, worldManager); skyblock.getVisitManager().deleteIsland(island.getOwnerUUID()); skyblock.getBanManager().deleteIsland(island.getOwnerUUID()); @@ -1113,7 +1106,7 @@ public class IslandManager { if (island.hasRole(IslandRole.Member, player.getUniqueId()) || island.hasRole(IslandRole.Operator, player.getUniqueId()) || island.hasRole(IslandRole.Owner, player.getUniqueId())) { Location loc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Main); if(loc != null){ - player.teleport(loc); + PaperLib.teleportAsync(player, loc); if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){ player.setFallDistance(0.0F); } @@ -1153,7 +1146,7 @@ public class IslandManager { loc = LocationUtil.getSafeLocation(loc); } if(loc != null){ - player.teleport(loc); + PaperLib.teleportAsync(player, loc); if(!configLoad.getBoolean("Island.Teleport.FallDamage", true)){ player.setFallDistance(0.0F); } diff --git a/src/main/java/com/songoda/skyblock/listeners/Join.java b/src/main/java/com/songoda/skyblock/listeners/Join.java index 0b3883dd..82a702a3 100644 --- a/src/main/java/com/songoda/skyblock/listeners/Join.java +++ b/src/main/java/com/songoda/skyblock/listeners/Join.java @@ -14,6 +14,7 @@ import com.songoda.skyblock.scoreboard.Scoreboard; import com.songoda.skyblock.scoreboard.ScoreboardManager; import com.songoda.skyblock.usercache.UserCacheManager; import com.songoda.skyblock.utils.world.LocationUtil; +import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; @@ -60,7 +61,7 @@ public class Join implements Listener { if (configLoad.getBoolean("Island.Join.Spawn")) { LocationUtil.teleportPlayerToSpawn(player); } else if (configLoad.getBoolean("Island.Join.Island") && island != null) { - player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main)); + PaperLib.teleportAsync(player, island.getLocation(IslandWorld.Normal, IslandEnvironment.Main)); player.setFallDistance(0.0F); teleportedToIsland = true; } diff --git a/src/main/java/com/songoda/skyblock/listeners/Move.java b/src/main/java/com/songoda/skyblock/listeners/Move.java index ff9f5c44..77d00779 100644 --- a/src/main/java/com/songoda/skyblock/listeners/Move.java +++ b/src/main/java/com/songoda/skyblock/listeners/Move.java @@ -14,6 +14,7 @@ import com.songoda.skyblock.sound.SoundManager; import com.songoda.skyblock.utils.version.NMSUtil; import com.songoda.skyblock.utils.world.LocationUtil; import com.songoda.skyblock.world.WorldManager; +import io.papermc.lib.PaperLib; import org.bukkit.*; import org.bukkit.attribute.Attribute; import org.bukkit.block.data.Waterlogged; @@ -209,7 +210,7 @@ public class Move implements Listener { } } if(loc != null){ - player.teleport(loc); + PaperLib.teleportAsync(player, loc); } else { LocationUtil.teleportPlayerToSpawn(player); player.sendMessage(ChatColor.translateAlternateColorCodes('&', diff --git a/src/main/java/com/songoda/skyblock/listeners/Portal.java b/src/main/java/com/songoda/skyblock/listeners/Portal.java index d7001f1a..9276d87a 100644 --- a/src/main/java/com/songoda/skyblock/listeners/Portal.java +++ b/src/main/java/com/songoda/skyblock/listeners/Portal.java @@ -15,6 +15,7 @@ import com.songoda.skyblock.permission.event.events.PlayerEnterPortalEvent; import com.songoda.skyblock.sound.SoundManager; import com.songoda.skyblock.utils.world.LocationUtil; import com.songoda.skyblock.world.WorldManager; +import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.configuration.file.FileConfiguration; @@ -25,6 +26,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityPortalEnterEvent; import org.bukkit.event.player.PlayerMoveEvent; +import java.awt.print.Paper; import java.io.File; import java.util.HashMap; import java.util.Map; @@ -142,7 +144,8 @@ public class Portal implements Listener { default: IslandWorld toWorldF = toWorld; - Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> player.teleport(island.getLocation(toWorldF, spawnEnvironment)), 1L); + + Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> PaperLib.teleportAsync(player, island.getLocation(toWorldF, spawnEnvironment)), 1L); soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F); player.setFallDistance(0.0F); tick.setTick(1); @@ -166,7 +169,7 @@ public class Portal implements Listener { if(safeLoc != null){ loc = safeLoc; } - player.teleport(loc); + PaperLib.teleportAsync(player, loc); }, 1L); soundManager.playSound(player, CompatibleSound.ENTITY_ENDERMAN_TELEPORT.getSound(), 1.0F, 1.0F); player.setFallDistance(0.0F); diff --git a/src/main/java/com/songoda/skyblock/utils/world/LocationUtil.java b/src/main/java/com/songoda/skyblock/utils/world/LocationUtil.java index c2a4429f..a8c645e2 100644 --- a/src/main/java/com/songoda/skyblock/utils/world/LocationUtil.java +++ b/src/main/java/com/songoda/skyblock/utils/world/LocationUtil.java @@ -12,6 +12,7 @@ import com.songoda.skyblock.utils.math.VectorUtil; import com.songoda.skyblock.utils.version.NMSUtil; import com.songoda.skyblock.utils.world.block.BlockDegreesType; import com.songoda.skyblock.world.WorldManager; +import io.papermc.lib.PaperLib; import org.bukkit.*; import org.bukkit.World.Environment; import org.bukkit.block.Block; @@ -301,7 +302,7 @@ public final class LocationUtil { } Bukkit.getServer().getScheduler().runTask(skyblock, () -> { - player.teleport(spawnLocation); + PaperLib.teleportAsync(player, spawnLocation); player.setFallDistance(0.0F); }); }