Archiviert
13
0

Use Item from PlayerPickupItemEvent when fired (fixes #1717)

Dieser Commit ist enthalten in:
Shane Freeder 2018-11-30 15:11:33 +00:00
Ursprung 1c8d620e6e
Commit 7d25c57f43
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C
2 geänderte Dateien mit 24 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -1,22 +1,25 @@
From 7ac07ac07ac07ac07ac07ac07ac07ac07ac07ac0 Mon Sep 17 00:00:00 2001
From 5f33e6c078a1af6a8a61615eda853205adf22009 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 7 Sep 2018 18:28:24 -0500
Subject: [PATCH] Fix #1420
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 7ac07ac07ac0..7ac07ac07ac0 100644
index 66e574bd3..a72d3dcc6 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -492,6 +492,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
@@ -492,7 +492,9 @@ public abstract class EntityArrow extends Entity implements IProjectile {
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
// CraftBukkit start
ItemStack itemstack = this.getItemStack();
- EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
+ EntityItem item = null; // Paper - GH-1420 - allow using event item
+ if (!itemstack.isEmpty()) { // Paper - GH-1420 (skip pick up event for fully damaged (or air) itemstack)
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
+ item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack); // Paper - GH-1420 - allow using event item
if (this.fromPlayer == PickupStatus.ALLOWED && entityhuman.inventory.canHold(itemstack) > 0) {
PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.Arrow) this.getBukkitEntity());
@@ -502,9 +503,10 @@ public abstract class EntityArrow extends Entity implements IProjectile {
// event.setCancelled(!entityhuman.canPickUpLoot); TODO
@@ -502,9 +504,10 @@ public abstract class EntityArrow extends Entity implements IProjectile {
return;
}
}
@ -24,10 +27,10 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.q() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item.getItemStack())) {
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(itemstack)) { // Paper - GH-1420
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(item != null ? item.getItemStack() : itemstack)) { // Paper - GH-1420
// CraftBukkit end
flag = false;
}
--
2.19.1
2.19.2

Datei anzeigen

@ -1,4 +1,4 @@
From d0a3de41338e9f77091303e911211ba09411900d Mon Sep 17 00:00:00 2001
From 202d3b30d84fa38f2d97a0f8854ebd947826baad Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 23 Oct 2018 20:25:05 -0400
Subject: [PATCH] Don't sleep after profile lookups if not needed
@ -7,30 +7,30 @@ Mojang was sleeping even if we had no more requests to go after
the current one finished, resulting in 100ms lost per profile lookup
diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
index 26a743722..6ed3199c3 100644
index 71e48e87b..23f1447cf 100644
--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
+++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
@@ -42,6 +42,7 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository {
}
final int page = 0;
}
final int page = 0;
+ boolean hasRequested = false; // Paper
for (final List<String> request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) {
int failCount = 0;
for (final List<String> request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) {
int failCount = 0;
@@ -67,6 +68,12 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository {
LOGGER.debug("Couldn't find profile {}", name);
callback.onProfileLookupFailed(new GameProfile(null, name), new ProfileNotFoundException("Server did not find the requested profile"));
}
LOGGER.debug("Couldn't find profile {}", name);
callback.onProfileLookupFailed(new GameProfile(null, name), new ProfileNotFoundException("Server did not find the requested profile"));
}
+ // Paper start
+ if (!hasRequested) {
+ hasRequested = true;
+ continue;
+ }
+ // Paper end
try {
Thread.sleep(DELAY_BETWEEN_PAGES);
try {
Thread.sleep(DELAY_BETWEEN_PAGES);
--
2.19.2