-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redirect 'teleport' to 'teleportAsync'
- Loading branch information
1 parent
4b3c004
commit 6397c55
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
patches/server/0050-Redirect-teleport-to-teleportAsync.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: AltronMaxX <max06112004@gmail.com> | ||
Date: Tue, 5 Nov 2024 15:38:21 +0400 | ||
Subject: [PATCH] Redirect 'teleport' to 'teleportAsync' | ||
|
||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java | ||
index 7be80f2774b5ec3d0bede096da8f2b6d1cf7b09b..8dc22bff3a5e520f6b41ceb568f298bf5f9861b7 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java | ||
@@ -8,6 +8,8 @@ import com.google.common.collect.Lists; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
+import java.util.concurrent.ExecutionException; | ||
+ | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.nbt.Tag; | ||
import net.minecraft.network.chat.Component; | ||
@@ -241,8 +243,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { | ||
|
||
@Override | ||
public boolean teleport(Location location, TeleportCause cause, io.papermc.paper.entity.TeleportFlag... flags) { | ||
- // Folia start - region threading | ||
if (true) { | ||
+ server.getLogger().warning("Must use teleportAsync while in region threading!"); | ||
+ try { | ||
+ return teleportAsync(location, cause, flags).get(); | ||
+ } catch (InterruptedException | ExecutionException e) { | ||
+ throw new RuntimeException(e); | ||
+ } | ||
+ } | ||
+ // Folia start - region threading | ||
+ if (false) { | ||
throw new UnsupportedOperationException("Must use teleportAsync while in region threading"); | ||
} | ||
// Folia end - region threading |