mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
36 lines
1.9 KiB
Diff
36 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sun, 20 Jun 2021 21:55:59 -0700
|
|
Subject: [PATCH] Fix PlayerDropItemEvent using wrong item
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index a09ef51e94a0bf9f51bf358e7cf77dd5d272aab2..d0369b9db86dc3436e6a016f138f2ffe91da6ed4 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -2342,7 +2342,7 @@ public class ServerPlayer extends Player {
|
|
|
|
if (retainOwnership) {
|
|
if (!itemstack1.isEmpty()) {
|
|
- this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), stack.getCount());
|
|
+ this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), itemstack1.getCount()); // Paper - Fix PlayerDropItemEvent using wrong item
|
|
}
|
|
|
|
this.awardStat(Stats.DROP);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
index 8ab62f37c9e1eb1582fba4adc02c3404bebc80f4..4d967016ac34d21161f10217db494f5bb537bd07 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -727,6 +727,11 @@ public abstract class Player extends LivingEntity {
|
|
}
|
|
|
|
double d0 = this.getEyeY() - 0.30000001192092896D;
|
|
+ // Paper start
|
|
+ ItemStack tmp = itemstack.copy();
|
|
+ itemstack.setCount(0);
|
|
+ itemstack = tmp;
|
|
+ // Paper end
|
|
ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), d0, this.getZ(), itemstack);
|
|
|
|
entityitem.setPickUpDelay(40);
|