2022-07-05 14:32:47 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Allink <arclicious@vivaldi.net>
|
|
|
|
Date: Tue, 5 Jul 2022 04:00:42 +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
|
2022-08-20 02:12:18 +00:00
|
|
|
index 64c438459f150af1cabdd3cea29c2951d42d69a0..b0bd0412010320cc624535d6abffe417a135a4dc 100644
|
2022-07-05 14:32:47 +00:00
|
|
|
--- 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;
|
|
|
|
|
2023-06-11 05:47:40 +00:00
|
|
|
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
2022-07-05 14:32:47 +00:00
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
import com.google.common.primitives.Floats;
|
|
|
|
import com.mojang.brigadier.ParseResults;
|
|
|
|
@@ -1948,6 +1949,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
|
|
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;
|
|
|
|
}
|