mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 13:36:44 +01:00
SPIGOT-5188: Player loot table drops an additional duplicate loot for each subsequent death
This commit is contained in:
parent
e73aabd666
commit
9c887d4d80
1 changed files with 33 additions and 32 deletions
|
@ -231,7 +231,7 @@
|
|||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -353,9 +492,46 @@
|
||||
@@ -353,9 +492,47 @@
|
||||
@Override
|
||||
public void die(DamageSource damagesource) {
|
||||
boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES);
|
||||
|
@ -256,6 +256,7 @@
|
|||
+ for (org.bukkit.inventory.ItemStack item : this.drops) {
|
||||
+ loot.add(item);
|
||||
+ }
|
||||
+ this.drops.clear(); // SPIGOT-5188: make sure to clear
|
||||
+ }
|
||||
+
|
||||
+ IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage();
|
||||
|
@ -280,7 +281,7 @@
|
|||
|
||||
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
|
||||
if (!future.isSuccess()) {
|
||||
@@ -386,11 +562,16 @@
|
||||
@@ -386,11 +563,16 @@
|
||||
}
|
||||
|
||||
this.releaseShoulderEntities();
|
||||
|
@ -300,7 +301,7 @@
|
|||
EntityLiving entityliving = this.getKillingEntity();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -433,10 +614,12 @@
|
||||
@@ -433,10 +615,12 @@
|
||||
String s = this.getName();
|
||||
String s1 = entity.getName();
|
||||
|
||||
|
@ -315,7 +316,7 @@
|
|||
} else {
|
||||
this.a(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -454,7 +637,8 @@
|
||||
@@ -454,7 +638,8 @@
|
||||
int i = scoreboardteam.getColor().b();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
|
@ -325,7 +326,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -498,16 +682,26 @@
|
||||
@@ -498,16 +683,26 @@
|
||||
}
|
||||
|
||||
private boolean canPvP() {
|
||||
|
@ -355,7 +356,7 @@
|
|||
this.decouple();
|
||||
this.getWorldServer().removePlayer(this);
|
||||
if (!this.viewingCredits) {
|
||||
@@ -520,10 +714,12 @@
|
||||
@@ -520,10 +715,12 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.server.getWorldServer(dimensionmanager1);
|
||||
|
||||
|
@ -369,7 +370,7 @@
|
|||
this.playerConnection.sendPacket(new PacketPlayOutRespawn(dimensionmanager, worlddata.getType(), this.playerInteractManager.getGameMode()));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
@@ -531,6 +727,8 @@
|
||||
@@ -531,6 +728,8 @@
|
||||
playerlist.d(this);
|
||||
worldserver.removePlayer(this);
|
||||
this.dead = false;
|
||||
|
@ -378,7 +379,7 @@
|
|||
double d0 = this.locX;
|
||||
double d1 = this.locY;
|
||||
double d2 = this.locZ;
|
||||
@@ -540,6 +738,7 @@
|
||||
@@ -540,6 +739,7 @@
|
||||
float f2 = f1;
|
||||
|
||||
worldserver.getMethodProfiler().enter("moving");
|
||||
|
@ -386,7 +387,7 @@
|
|||
if (dimensionmanager1 == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
|
||||
this.cu = new Vec3D(this.locX, this.locY, this.locZ);
|
||||
d0 /= 8.0D;
|
||||
@@ -557,6 +756,52 @@
|
||||
@@ -557,6 +757,52 @@
|
||||
f = 0.0F;
|
||||
}
|
||||
|
||||
|
@ -439,7 +440,7 @@
|
|||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
worldserver.getMethodProfiler().exit();
|
||||
worldserver.getMethodProfiler().enter("placing");
|
||||
@@ -568,12 +813,13 @@
|
||||
@@ -568,12 +814,13 @@
|
||||
d0 = MathHelper.a(d0, d4, d6);
|
||||
d2 = MathHelper.a(d2, d5, d7);
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
|
@ -454,7 +455,7 @@
|
|||
|
||||
for (int l = -2; l <= 2; ++l) {
|
||||
for (int i1 = -2; i1 <= 2; ++i1) {
|
||||
@@ -583,11 +829,20 @@
|
||||
@@ -583,11 +830,20 @@
|
||||
int i2 = k + i1 * 0 - l * 1;
|
||||
boolean flag2 = j1 < 0;
|
||||
|
||||
|
@ -476,7 +477,7 @@
|
|||
this.setPositionRotation((double) i, (double) j, (double) k, f1, 0.0F);
|
||||
this.setMot(Vec3D.a);
|
||||
} else if (!worldserver1.getTravelAgent().a(this, f2)) {
|
||||
@@ -616,11 +871,16 @@
|
||||
@@ -616,11 +872,16 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
|
@ -494,7 +495,7 @@
|
|||
DimensionManager dimensionmanager = worldserver.worldProvider.getDimensionManager();
|
||||
DimensionManager dimensionmanager1 = this.world.worldProvider.getDimensionManager();
|
||||
|
||||
@@ -657,9 +917,16 @@
|
||||
@@ -657,9 +918,16 @@
|
||||
this.activeContainer.c();
|
||||
}
|
||||
|
||||
|
@ -513,7 +514,7 @@
|
|||
this.a(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.q.a(this);
|
||||
});
|
||||
@@ -667,6 +934,7 @@
|
||||
@@ -667,6 +935,7 @@
|
||||
|
||||
@Override
|
||||
public void wakeup(boolean flag, boolean flag1, boolean flag2) {
|
||||
|
@ -521,7 +522,7 @@
|
|||
if (this.isSleeping()) {
|
||||
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -754,8 +1022,9 @@
|
||||
@@ -754,8 +1023,9 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
|
||||
|
@ -532,7 +533,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -770,6 +1039,17 @@
|
||||
@@ -770,6 +1040,17 @@
|
||||
this.nextContainerCounter();
|
||||
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
|
||||
|
||||
|
@ -550,7 +551,7 @@
|
|||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
|
||||
@@ -777,9 +1057,11 @@
|
||||
@@ -777,9 +1058,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -564,7 +565,7 @@
|
|||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -792,13 +1074,24 @@
|
||||
@@ -792,13 +1075,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
|
@ -591,7 +592,7 @@
|
|||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
@@ -843,6 +1136,11 @@
|
||||
@@ -843,6 +1137,11 @@
|
||||
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
|
||||
|
@ -603,7 +604,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -852,6 +1150,7 @@
|
||||
@@ -852,6 +1151,7 @@
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
@ -611,7 +612,7 @@
|
|||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||
this.m();
|
||||
}
|
||||
@@ -886,7 +1185,7 @@
|
||||
@@ -886,7 +1186,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic, int i) {
|
||||
this.serverStatisticManager.b(this, statistic, i);
|
||||
|
@ -620,7 +621,7 @@
|
|||
scoreboardscore.addScore(i);
|
||||
});
|
||||
}
|
||||
@@ -894,7 +1193,7 @@
|
||||
@@ -894,7 +1194,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic) {
|
||||
this.serverStatisticManager.setStatistic(this, statistic, 0);
|
||||
|
@ -629,7 +630,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -943,7 +1242,16 @@
|
||||
@@ -943,7 +1243,16 @@
|
||||
|
||||
public void triggerHealthUpdate() {
|
||||
this.lastHealthSent = -1.0E8F;
|
||||
|
@ -646,7 +647,7 @@
|
|||
|
||||
@Override
|
||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
@@ -998,12 +1306,14 @@
|
||||
@@ -998,12 +1307,14 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
|
@ -662,7 +663,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1065,6 +1375,18 @@
|
||||
@@ -1065,6 +1376,18 @@
|
||||
|
||||
@Override
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
|
@ -681,7 +682,7 @@
|
|||
this.playerInteractManager.setGameMode(enumgamemode);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
|
||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||
@@ -1115,6 +1437,17 @@
|
||||
@@ -1115,6 +1438,17 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||
|
@ -699,7 +700,7 @@
|
|||
this.locale = packetplayinsettings.b();
|
||||
this.ck = packetplayinsettings.d();
|
||||
this.cl = packetplayinsettings.e();
|
||||
@@ -1151,13 +1484,13 @@
|
||||
@@ -1151,13 +1485,13 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
|
||||
} else {
|
||||
|
@ -715,7 +716,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1181,7 +1514,7 @@
|
||||
@@ -1181,7 +1515,7 @@
|
||||
this.spectatedEntity = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.spectatedEntity) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
|
||||
|
@ -724,7 +725,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1210,7 +1543,7 @@
|
||||
@@ -1210,7 +1544,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
|
@ -733,7 +734,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1228,21 +1561,33 @@
|
||||
@@ -1228,21 +1562,33 @@
|
||||
}
|
||||
|
||||
public void J() {
|
||||
|
@ -767,7 +768,7 @@
|
|||
if (worldserver == this.world) {
|
||||
this.playerConnection.a(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1265,6 +1610,9 @@
|
||||
@@ -1265,6 +1611,9 @@
|
||||
this.server.getPlayerList().a(this, worldserver);
|
||||
this.server.getPlayerList().updateClient(this);
|
||||
}
|
||||
|
@ -777,7 +778,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1316,4 +1664,144 @@
|
||||
@@ -1316,4 +1665,144 @@
|
||||
return entityitem;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue