mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-09 06:50:32 +08:00
aba4969668
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: e970fd72 Remove incorrect javadoc from TargetReason 84df6df1 SPIGOT-5282: Improve bucket event API CraftBukkit Changes:b2bcde89
SPIGOT-5258: TNT Not Moving Players in Creative Mode44d675ad
SPIGOT-5263: Chests stay open after InventoryOpenEvent cancelled.2439178e
SPIGOT-5278: EntityDrowned memory leak7055c931
SPIGOT-5264: Call event for experience orbs losing their target49141172
SPIGOT-5282: Improve bucket event API6bbb3b04
SPIGOT-5281: Clearer error messages for ChunkSnapshot misuse
43 lines
1.9 KiB
Diff
43 lines
1.9 KiB
Diff
From 8a68fc4ca19693cb47e182ac21fb3e1db11c2512 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 18 Jun 2018 01:12:53 -0400
|
|
Subject: [PATCH] PlayerReadyArrowEvent
|
|
|
|
Called when a player is firing a bow and the server is choosing an arrow to use.
|
|
Plugins can skip selection of certain arrows and control which is used.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
index dfd004f02..5a95fe160 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -2052,6 +2052,17 @@ public abstract class EntityHuman extends EntityLiving {
|
|
return (EntitySize) EntityHuman.b.getOrDefault(entitypose, EntityHuman.bs);
|
|
}
|
|
|
|
+ // Paper start
|
|
+ protected boolean tryReadyArrow(ItemStack bow, ItemStack itemstack) {
|
|
+ return !(this instanceof EntityPlayer) ||
|
|
+ new com.destroystokyo.paper.event.player.PlayerReadyArrowEvent(
|
|
+ ((EntityPlayer) this).getBukkitEntity(),
|
|
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(bow),
|
|
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)
|
|
+ ).callEvent();
|
|
+ // Paper end
|
|
+ }
|
|
+
|
|
@Override
|
|
public ItemStack f(ItemStack itemstack) {
|
|
if (!(itemstack.getItem() instanceof ItemProjectileWeapon)) {
|
|
@@ -2068,7 +2079,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
for (int i = 0; i < this.inventory.getSize(); ++i) {
|
|
ItemStack itemstack2 = this.inventory.getItem(i);
|
|
|
|
- if (predicate.test(itemstack2)) {
|
|
+ if (predicate.test(itemstack2) && tryReadyArrow(itemstack, itemstack2)) { // Paper
|
|
return itemstack2;
|
|
}
|
|
}
|
|
--
|
|
2.23.0
|
|
|