From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Allink Date: Tue, 5 Jul 2022 04:12:31 +0100 Subject: [PATCH] Add spectator teleport event diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 2a609e43370e68943c580083f7f7d8c9b0972955..af4bbfea9ec461ffddd359b0d39843882cea40eb 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1,5 +1,6 @@ package net.minecraft.server.network; +import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors import com.google.common.collect.Lists; import com.google.common.primitives.Floats; import com.mojang.brigadier.ParseResults; @@ -2058,6 +2059,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic Entity entity = packet.getEntity(worldserver); if (entity != null) { + // Scissors start - Add spectator teleport event + final SpectatorTeleportEvent event = new SpectatorTeleportEvent(this.player.getBukkitEntity(), entity.getBukkitEntity()); + + if(!event.callEvent()) { + return; + } + // Scissors end + this.player.teleportTo(worldserver, entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit return; }