2022-07-28 03:57:50 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2023-10-15 22:45:13 +00:00
|
|
|
From: Allink <arclicious@vivaldi.net>
|
|
|
|
Date: Tue, 5 Jul 2022 04:12:31 +0100
|
2022-07-28 03:57:50 +00:00
|
|
|
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
|
2024-01-18 23:05:55 +00:00
|
|
|
index cafd0cde26a623861c7d3d01b496cb32fdc77335..4293978e1ddb789d5b9ff8f2dfbbb23bffba10ad 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
|
2023-10-15 22:45:13 +00:00
|
|
|
@@ -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.authlib.GameProfile;
|
2024-01-18 23:05:55 +00:00
|
|
|
@@ -2039,6 +2040,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
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());
|
2023-09-24 21:42:28 +00:00
|
|
|
+ if (!event.callEvent()) {
|
2022-07-28 03:57:50 +00:00
|
|
|
+ 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;
|
|
|
|
}
|