mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-01 04:37:09 +00:00
33 lines
1.7 KiB
Diff
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: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
|
||
|
index 1901a14556b197b70a2e8bb46d07a216d5d6c07e..047eef16aa457757f968e2210dcba03207cf7448 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 com.github.atlasmediagroup.scissors.event.player.SpectatorTeleportEvent;
|
||
|
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;
|
||
|
}
|