mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 01:10:37 +01:00
1e39773b53
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9d0221aa API to get client side view distance. 9be7f0ea SPIGOT-4395: Additions to PlayerBedEnterEvent. 01e534c6 Minor cosmetic cleanups to imports etc CraftBukkit Changes:96c461b3
API to get client side view distance.e2785f4e
Remove note about development builda8000588
SPIGOT-4395: Additions to PlayerBedEnterEvent. Spigot Changes: 117d4f7e Rebuild patches
65 lines
3.1 KiB
Diff
65 lines
3.1 KiB
Diff
From b94b61cf628b8659d485330e8c7c9e27978e7cab Mon Sep 17 00:00:00 2001
|
|
From: Caleb Bassham <caleb.bassham@gmail.com>
|
|
Date: Fri, 28 Sep 2018 02:32:19 -0500
|
|
Subject: [PATCH] Call player spectator target events
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index 720eb9184f..7bbcaba053 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -62,7 +62,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
private EntityHuman.EnumChatVisibility cs;
|
|
private boolean ct = true;
|
|
private long cu = SystemUtils.b();
|
|
- private Entity cv;
|
|
+ private Entity cv; private void setSpectatorTargetField(Entity e) { this.cv = e; } // Paper - OBFHELPER
|
|
public boolean worldChangeInvuln;
|
|
private boolean cx; private void setHasSeenCredits(boolean has) { this.cx = has; } // Paper - OBFHELPER
|
|
private final RecipeBookServer cy;
|
|
@@ -1375,15 +1375,36 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
return (Entity) (this.cv == null ? this : this.cv);
|
|
}
|
|
|
|
- public void setSpectatorTarget(Entity entity) {
|
|
+ public void setSpectatorTarget(Entity newSpectatorTarget) {
|
|
+ // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event
|
|
Entity entity1 = this.getSpecatorTarget();
|
|
|
|
- this.cv = (Entity) (entity == null ? this : entity);
|
|
- if (entity1 != this.cv) {
|
|
- this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cv));
|
|
- this.playerConnection.a(this.cv.locX, this.cv.locY, this.cv.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
|
|
+ if (newSpectatorTarget == null) {
|
|
+ newSpectatorTarget = this;
|
|
}
|
|
|
|
+ if (entity1 == newSpectatorTarget) return; // new spec target is the current spec target
|
|
+
|
|
+ if (newSpectatorTarget == this) {
|
|
+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
|
|
+
|
|
+ if (!playerStopSpectatingEntityEvent.callEvent()) {
|
|
+ return;
|
|
+ }
|
|
+ } else {
|
|
+ com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent playerStartSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity(), newSpectatorTarget.getBukkitEntity());
|
|
+
|
|
+ if (!playerStartSpectatingEntityEvent.callEvent()) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ setSpectatorTargetField(newSpectatorTarget);
|
|
+
|
|
+ this.playerConnection.sendPacket(new PacketPlayOutCamera(newSpectatorTarget));
|
|
+ // Paper end
|
|
+
|
|
+ this.playerConnection.a(this.cv.locX, this.cv.locY, this.cv.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit
|
|
}
|
|
|
|
protected void E() {
|
|
--
|
|
2.19.1
|
|
|