From 3837b411ce4b7649eb5859dc0e9de9166ee091c9 Mon Sep 17 00:00:00 2001 From: bedrock3359 Date: Wed, 24 Jun 2026 16:13:06 -0400 Subject: [PATCH] Drop remnant uses of paperlib; fixes teleportAsync error on teleport --- .../java/com/earth2me/essentials/AsyncTeleport.java | 13 ++++++------- .../essentials/EssentialsPlayerListener.java | 3 +-- .../com/earth2me/essentials/RandomTeleport.java | 3 +-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java b/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java index 07ec598e1c6..5644524405c 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java +++ b/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java @@ -5,7 +5,6 @@ import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.LocationUtil; import io.canvasmc.canvas.event.PlayerRespawnAsyncEvent; -import io.papermc.lib.PaperLib; import net.ess3.api.IEssentials; import net.ess3.api.IUser; import net.ess3.api.TranslatableException; @@ -135,7 +134,7 @@ public void now(final Player entity, final boolean cooldown, final TeleportCause @Override public void nowUnsafe(Location loc, TeleportCause cause, CompletableFuture future) { - final CompletableFuture paperFuture = PaperLib.teleportAsync(teleportOwner.getBase(), loc, cause); + final CompletableFuture paperFuture = teleportOwner.getBase().teleportAsync(loc, cause); paperFuture.thenAccept(future::complete); paperFuture.exceptionally(future::completeExceptionally); } @@ -174,15 +173,15 @@ protected void nowAsync(final IUser teleportee, final ITarget target, final Tele targetLoc.setZ(LocationUtil.getZInsideWorldBorder(targetLoc.getWorld(), targetLoc.getBlockZ())); } ess.scheduleLocationDelayedTask(targetLoc, () -> - PaperLib.getChunkAtAsync(targetLoc.getWorld(), targetLoc.getBlockX() >> 4, targetLoc.getBlockZ() >> 4, true, true).thenAccept(chunk -> { + targetLoc.getWorld().getChunkAtAsync(targetLoc.getBlockX() >> 4, targetLoc.getBlockZ() >> 4, true, true).thenAccept(chunk -> { if (LocationUtil.isBlockUnsafeForUser(ess, teleportee, targetLoc.getWorld(), targetLoc.getBlockX(), targetLoc.getBlockY(), targetLoc.getBlockZ())) { if (ess.getSettings().isTeleportSafetyEnabled()) { if (ess.getSettings().isForceDisableTeleportSafety()) { - PaperLib.teleportAsync(teleportee.getBase(), targetLoc, cause); + teleportee.getBase().teleportAsync(targetLoc, cause); } else { try { //There's a chance the safer location is outside the loaded chunk so still teleport async here. - PaperLib.teleportAsync(teleportee.getBase(), LocationUtil.getSafeDestination(ess, teleportee, targetLoc), cause); + teleportee.getBase().teleportAsync(LocationUtil.getSafeDestination(ess, teleportee, targetLoc), cause); } catch (final Exception e) { future.completeExceptionally(e); return; @@ -194,14 +193,14 @@ protected void nowAsync(final IUser teleportee, final ITarget target, final Tele } } else { if (ess.getSettings().isForceDisableTeleportSafety()) { - PaperLib.teleportAsync(teleportee.getBase(), targetLoc, cause); + teleportee.getBase().teleportAsync(targetLoc, cause); } else { Location dest = targetLoc; if (ess.getSettings().isTeleportToCenterLocation()) { dest = LocationUtil.getRoundedDestination(targetLoc); } // There's a *small* chance the rounded destination produces a location outside the loaded chunk so still teleport async here. - PaperLib.teleportAsync(teleportee.getBase(), dest, cause); + teleportee.getBase().teleportAsync(dest, cause); } } future.complete(true); diff --git a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java index 56dae99a7a0..04c6cef8d23 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/main/java/com/earth2me/essentials/EssentialsPlayerListener.java @@ -15,7 +15,6 @@ import com.earth2me.essentials.utils.LocationUtil; import com.earth2me.essentials.utils.MaterialUtil; import com.earth2me.essentials.utils.VersionUtil; -import io.papermc.lib.PaperLib; import io.papermc.paper.ban.BanListType; import io.papermc.paper.event.connection.configuration.AsyncPlayerConnectionConfigureEvent; import io.papermc.paper.event.player.PlayerServerFullCheckEvent; @@ -1033,7 +1032,7 @@ public void run() { while (LocationUtil.isBlockDamaging(loc.getWorld(), loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ())) { loc.setY(loc.getY() + 1d); } - PaperLib.teleportAsync(user.getBase(), loc, TeleportCause.PLUGIN); + user.getBase().teleportAsync(loc, TeleportCause.PLUGIN); } } diff --git a/Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java b/Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java index df4b0c869f1..21e6be86c1f 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java +++ b/Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java @@ -5,7 +5,6 @@ import com.earth2me.essentials.config.entities.LazyLocation; import com.earth2me.essentials.utils.LocationUtil; import com.earth2me.essentials.utils.VersionUtil; -import io.papermc.lib.PaperLib; import net.ess3.provider.BiomeKeyProvider; import net.ess3.provider.BiomeNameProvider; import net.ess3.provider.WorldInfoProvider; @@ -214,7 +213,7 @@ private CompletableFuture calculateRandomLocation(final Location cente 360 * RANDOM.nextFloat() - 180, 0 ); - PaperLib.getChunkAtAsync(location).thenAccept(chunk -> { + location.getWorld().getChunkAtAsync(location).thenAccept(chunk -> { if (World.Environment.NETHER.equals(center.getWorld().getEnvironment())) { location.setY(getNetherYAt(location)); } else {