mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 00:07:56 +01:00
Update documentation around PlayerJumpEvent
This commit is contained in:
parent
563ee0f840
commit
91e639e718
@ -6,7 +6,7 @@ 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
|
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
|
new file mode 100644
|
||||||
index 00000000..1ea9c65f
|
index 00000000..dd24f9b0
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
|
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
@ -20,7 +20,11 @@ index 00000000..1ea9c65f
|
|||||||
+import org.bukkit.event.player.PlayerEvent;
|
+import org.bukkit.event.player.PlayerEvent;
|
||||||
+
|
+
|
||||||
+/**
|
+/**
|
||||||
+ * Holds information for player jump events
|
+ * Called when the server detects the player is jumping.
|
||||||
|
+ * <p>
|
||||||
|
+ * 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 {
|
+public class PlayerJumpEvent extends PlayerEvent implements Cancellable {
|
||||||
+ private static final HandlerList handlers = new HandlerList();
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
@ -95,7 +99,7 @@ index 00000000..1ea9c65f
|
|||||||
+
|
+
|
||||||
+ private void validateLocation(Location loc) {
|
+ private void validateLocation(Location loc) {
|
||||||
+ Preconditions.checkArgument(loc != null, "Cannot use null location!");
|
+ 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
|
+ @Override
|
||||||
|
@ -4,8 +4,20 @@ Date: Thu, 28 Sep 2017 17:21:44 -0400
|
|||||||
Subject: [PATCH] Add PlayerJumpEvent
|
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
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||||
|
|
||||||
|
public void b(List<IRecipe> 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
|
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
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
@@ -0,0 +0,0 @@ import org.bukkit.inventory.EquipmentSlot;
|
@@ -0,0 +0,0 @@ import org.bukkit.inventory.EquipmentSlot;
|
||||||
@ -42,7 +54,7 @@ index 760cb16c3..f6c33b61f 100644
|
|||||||
+ PlayerJumpEvent event = new PlayerJumpEvent(player, from, to);
|
+ PlayerJumpEvent event = new PlayerJumpEvent(player, from, to);
|
||||||
+
|
+
|
||||||
+ if (event.callEvent()) {
|
+ if (event.callEvent()) {
|
||||||
+ this.player.cu();
|
+ this.player.jump();
|
||||||
+ } else {
|
+ } else {
|
||||||
+ from = event.getFrom();
|
+ from = event.getFrom();
|
||||||
+ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet());
|
+ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet());
|
||||||
|
@ -5,7 +5,7 @@ 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
|
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
|
--- a/src/main/java/net/minecraft/server/BlockStateEnum.java
|
||||||
+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java
|
+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java
|
||||||
@@ -0,0 +0,0 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
|
@@ -0,0 +0,0 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
|
||||||
|
Loading…
Reference in New Issue
Block a user