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
71 lines
3.7 KiB
Diff
71 lines
3.7 KiB
Diff
From 292b6bb1583fa684c7438958fcc58b3aa0f95117 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
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 9614348157..b357cb2077 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -1481,6 +1481,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
return 0;
|
|
}
|
|
|
|
+ public void jump() { this.cH(); } // Paper - OBFHELPER
|
|
public void cH() {
|
|
super.cH();
|
|
this.a(StatisticList.JUMP);
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index 3289ba3ffd..b54da4eb79 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -59,6 +59,8 @@ import org.bukkit.inventory.CraftingInventory;
|
|
import org.bukkit.inventory.EquipmentSlot;
|
|
import org.bukkit.inventory.InventoryView;
|
|
import org.bukkit.util.NumberConversions;
|
|
+import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper
|
|
+import com.destroystokyo.paper.event.player.PlayerJumpEvent; // Paper
|
|
import co.aikar.timings.MinecraftTimings; // Paper
|
|
// CraftBukkit end
|
|
|
|
@@ -875,7 +877,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
|
d8 = d5 - this.p;
|
|
d9 = d6 - this.q;
|
|
if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) {
|
|
- this.player.cH();
|
|
+ // 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.jump();
|
|
+ } 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);
|
|
--
|
|
2.19.1
|
|
|