Skip to content

Commit

Permalink
Redirect 'teleport' to 'teleportAsync'
Browse files Browse the repository at this point in the history
  • Loading branch information
AltronMaxX committed Nov 5, 2024
1 parent 4b3c004 commit 6397c55
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions patches/server/0050-Redirect-teleport-to-teleportAsync.patch
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

0 comments on commit 6397c55

Please sign in to comment.