diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/TeleportCommand.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/TeleportCommand.java.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/TeleportCommand.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/TeleportCommand.java.patch new file mode 100644 index 0000000000..193801f2b2 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/TeleportCommand.java.patch @@ -0,0 +1,53 @@ +--- a/net/minecraft/server/commands/TeleportCommand.java ++++ b/net/minecraft/server/commands/TeleportCommand.java +@@ -33,6 +32,12 @@ + import net.minecraft.world.level.Level; + import net.minecraft.world.phys.Vec2; + import net.minecraft.world.phys.Vec3; ++// CraftBukkit start ++import org.bukkit.Location; ++import org.bukkit.craftbukkit.CraftWorld; ++import org.bukkit.event.entity.EntityTeleportEvent; ++import org.bukkit.event.player.PlayerTeleportEvent; ++// CraftBukkit end + + public class TeleportCommand { + +@@ -156,11 +161,34 @@ + float f2 = Mth.wrapDegrees(f); + float f3 = Mth.wrapDegrees(f1); + +- if (entity.teleportTo(serverlevel, d0, d1, d2, set, f2, f3)) { +- if (teleportcommand_lookat != null) { +- teleportcommand_lookat.perform(commandsourcestack, entity); ++ // CraftBukkit start - Teleport event ++ boolean result; ++ if (entity instanceof ServerPlayer player) { ++ result = player.teleportTo(level, x, d1, y, set, f2, f3, PlayerTeleportEvent.TeleportCause.COMMAND); ++ } else { ++ Location to = new Location(level.getWorld(), x, d1, y, f2, f3); ++ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to); ++ level.getCraftServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return; + } + ++ x = to.getX(); ++ d1 = to.getY(); ++ y = to.getZ(); ++ f2 = to.getYaw(); ++ f3 = to.getPitch(); ++ level = ((CraftWorld) to.getWorld()).getHandle(); ++ ++ result = entity.teleportTo(level, x, d1, y, set, f2, f3); ++ } ++ ++ if (result) { ++ // CraftBukkit end ++ if (relativeList != null) { ++ relativeList.perform(source, entity); ++ } ++ + label23: + { + if (entity instanceof LivingEntity) { |