mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-04 14:12:20 -07:00
Add PlayerJumpEvent
This commit is contained in:
43
Spigot-Server-Patches/Add-PlayerJumpEvent.patch
Normal file
43
Spigot-Server-Patches/Add-PlayerJumpEvent.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Thu, 28 Sep 2017 17:21:44 -0400
|
||||
Subject: [PATCH] Add PlayerJumpEvent
|
||||
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
d8 = d5 - this.p;
|
||||
d9 = d6 - this.q;
|
||||
if (this.player.onGround && !packetplayinflying.a() && d8 > 0.0D) {
|
||||
- this.player.cu();
|
||||
+ // Paper start - Add player jump event
|
||||
+ Player player = this.getPlayer();
|
||||
+ Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
|
||||
+ Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
|
||||
+
|
||||
+ // If the packet contains movement information then we update the To location with the correct XYZ.
|
||||
+ if (packetplayinflying.hasPos) {
|
||||
+ to.setX(packetplayinflying.x);
|
||||
+ to.setY(packetplayinflying.y);
|
||||
+ to.setZ(packetplayinflying.z);
|
||||
+ }
|
||||
+
|
||||
+ // If the packet contains look information then we update the To location with the correct Yaw & Pitch.
|
||||
+ if (packetplayinflying.hasLook) {
|
||||
+ to.setYaw(packetplayinflying.yaw);
|
||||
+ to.setPitch(packetplayinflying.pitch);
|
||||
+ }
|
||||
+
|
||||
+ PlayerJumpEvent event = new PlayerJumpEvent(player, from, to);
|
||||
+
|
||||
+ if (event.callEvent()) {
|
||||
+ this.player.cu();
|
||||
+ } else {
|
||||
+ from = event.getFrom();
|
||||
+ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet());
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, d7, d8, d9);
|
||||
--
|
Reference in New Issue
Block a user