From a8c503b86f69d2cf1d08a812b47e1a56edd1ea2a Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 29 Sep 2017 14:58:24 -0400 Subject: [PATCH] Update documentation around PlayerJumpEvent --- .../0070-Add-PlayerJumpEvent.patch | 14 +++++++++----- ...se-BlockStateEnum-hashCode-and-equals.patch | 6 +++--- .../0242-Add-PlayerJumpEvent.patch | 18 +++++++++++++++--- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Spigot-API-Patches/0070-Add-PlayerJumpEvent.patch b/Spigot-API-Patches/0070-Add-PlayerJumpEvent.patch index ad4f9acf7a..6eee12988e 100644 --- a/Spigot-API-Patches/0070-Add-PlayerJumpEvent.patch +++ b/Spigot-API-Patches/0070-Add-PlayerJumpEvent.patch @@ -1,4 +1,4 @@ -From d1874a92aadb4b6161c2b49276cd76740cc30919 Mon Sep 17 00:00:00 2001 +From e35607cf3ee0d7905ad75771762bc290f16cc359 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 28 Sep 2017 17:21:32 -0400 Subject: [PATCH] Add PlayerJumpEvent @@ -6,10 +6,10 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java new file mode 100644 -index 00000000..1ea9c65f +index 00000000..dd24f9b0 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java -@@ -0,0 +1,97 @@ +@@ -0,0 +1,101 @@ +package com.destroystokyo.paper.event.player; + +import com.google.common.base.Preconditions; @@ -20,7 +20,11 @@ index 00000000..1ea9c65f +import org.bukkit.event.player.PlayerEvent; + +/** -+ * Holds information for player jump events ++ * Called when the server detects the player is jumping. ++ *

++ * Added to avoid the overhead and special case logic that many plugins use ++ * when checking for jumps via PlayerMoveEvent, this event is fired whenever ++ * the server detects that the player is jumping. + */ +public class PlayerJumpEvent extends PlayerEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); @@ -95,7 +99,7 @@ index 00000000..1ea9c65f + + private void validateLocation(Location loc) { + Preconditions.checkArgument(loc != null, "Cannot use null location!"); -+ Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!"); ++ Preconditions.checkArgument(loc.getWorld() != null, "Cannot use location with null world!"); + } + + @Override diff --git a/Spigot-Server-Patches/0150-Optimise-BlockStateEnum-hashCode-and-equals.patch b/Spigot-Server-Patches/0150-Optimise-BlockStateEnum-hashCode-and-equals.patch index b3d569a2e8..223ac0a297 100644 --- a/Spigot-Server-Patches/0150-Optimise-BlockStateEnum-hashCode-and-equals.patch +++ b/Spigot-Server-Patches/0150-Optimise-BlockStateEnum-hashCode-and-equals.patch @@ -1,11 +1,11 @@ -From 674f409a72bc64e38d758cf2743f363c5d2d2eb8 Mon Sep 17 00:00:00 2001 +From 32ea6795e3fb76b3f806010ef01b593c210392a5 Mon Sep 17 00:00:00 2001 From: Alfie Cleveland Date: Fri, 19 Aug 2016 01:52:56 +0100 Subject: [PATCH] Optimise BlockStateEnum hashCode and equals diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java -index 288c52c5..66c459d8 100644 +index 288c52c55..66c459d83 100644 --- a/src/main/java/net/minecraft/server/BlockStateEnum.java +++ b/src/main/java/net/minecraft/server/BlockStateEnum.java @@ -16,6 +16,11 @@ public class BlockStateEnum & INamable> extends BlockState @@ -58,5 +58,5 @@ index 288c52c5..66c459d8 100644 public static & INamable> BlockStateEnum of(String s, Class oclass) { -- -2.13.1.windows.2 +2.14.1.windows.1 diff --git a/Spigot-Server-Patches/0242-Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/0242-Add-PlayerJumpEvent.patch index e4a136e7e6..dcb5ea19a3 100644 --- a/Spigot-Server-Patches/0242-Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/0242-Add-PlayerJumpEvent.patch @@ -1,11 +1,23 @@ -From 351c9bf5343039db037847212d2f4e3489933612 Mon Sep 17 00:00:00 2001 +From 57644ab38ce0b45b0012bc36bfa7a15304e50162 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 28 Sep 2017 17:21:44 -0400 Subject: [PATCH] Add PlayerJumpEvent +diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +index e9f48ecad..00fe92fa8 100644 +--- a/src/main/java/net/minecraft/server/EntityHuman.java ++++ b/src/main/java/net/minecraft/server/EntityHuman.java +@@ -1399,6 +1399,7 @@ public abstract class EntityHuman extends EntityLiving { + + public void b(List list) {} + ++ public void jump() { this.cu(); } // Paper - OBFHELPER + public void cu() { + super.cu(); + this.b(StatisticList.w); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 760cb16c3..f6c33b61f 100644 +index 760cb16c3..37a59de54 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -57,6 +57,7 @@ import org.bukkit.inventory.EquipmentSlot; @@ -42,7 +54,7 @@ index 760cb16c3..f6c33b61f 100644 + PlayerJumpEvent event = new PlayerJumpEvent(player, from, to); + + if (event.callEvent()) { -+ this.player.cu(); ++ this.player.jump(); + } else { + from = event.getFrom(); + this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet());