2022-07-28 03:57:50 +00:00
|
|
|
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
|
2022-12-11 06:04:11 +00:00
|
|
|
index ff72911cca59528f7090533e52450a59ea50a92a..8d626169874c4188e2a9bc214b1c0af9689b11b3 100644
|
2022-07-28 03:57:50 +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;
|
|
|
|
|
|
|
|
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
import com.google.common.primitives.Floats;
|
|
|
|
import com.mojang.brigadier.ParseResults;
|
2022-12-11 06:04:11 +00:00
|
|
|
@@ -2072,6 +2073,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
2022-07-28 03:57:50 +00:00
|
|
|
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;
|
|
|
|
}
|