Scissors/patches/removed/0031-Add-spectator-teleport-event.patch
Telesphoreo 6b23f8bc8f Begin work on 1.19.3
Only got through one patch as of now. Not publishing JARs to Jenkins for now
2022-12-10 22:28:09 -06:00

33 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
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 c7d7711be1bd17a25c98578ad68154255135facd..21f2fa5b1e0eb2cdf73a0f3b6e4fec1c63fac062 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;
import com.google.common.collect.Lists;
import com.google.common.primitives.Floats;
import com.mojang.brigadier.ParseResults;
@@ -2077,6 +2078,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;
}