geforkt von Mirrors/Paper
SPIGOT-2222, SPIGOT-6687: Pre-set keepLevel and only use it
By: DerFrZocker <derrieple@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
4a49f6bf8b
Commit
72591f6038
@ -263,7 +263,7 @@
|
|||||||
scoreboardscore.setScore(i);
|
scoreboardscore.setScore(i);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -552,9 +708,46 @@
|
@@ -552,9 +708,47 @@
|
||||||
@Override
|
@Override
|
||||||
public void die(DamageSource damagesource) {
|
public void die(DamageSource damagesource) {
|
||||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||||
@ -293,6 +293,7 @@
|
|||||||
+ IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage();
|
+ IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage();
|
||||||
+
|
+
|
||||||
+ String deathmessage = defaultMessage.getString();
|
+ String deathmessage = defaultMessage.getString();
|
||||||
|
+ keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel
|
||||||
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory);
|
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory);
|
||||||
+
|
+
|
||||||
+ // SPIGOT-943 - only call if they have an inventory open
|
+ // SPIGOT-943 - only call if they have an inventory open
|
||||||
@ -312,7 +313,7 @@
|
|||||||
|
|
||||||
this.connection.a((Packet) (new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent)), (future) -> {
|
this.connection.a((Packet) (new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent)), (future) -> {
|
||||||
if (!future.isSuccess()) {
|
if (!future.isSuccess()) {
|
||||||
@@ -588,12 +781,18 @@
|
@@ -588,12 +782,18 @@
|
||||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||||
this.fI();
|
this.fI();
|
||||||
}
|
}
|
||||||
@ -335,7 +336,7 @@
|
|||||||
EntityLiving entityliving = this.getKillingEntity();
|
EntityLiving entityliving = this.getKillingEntity();
|
||||||
|
|
||||||
if (entityliving != null) {
|
if (entityliving != null) {
|
||||||
@@ -630,10 +829,12 @@
|
@@ -630,10 +830,12 @@
|
||||||
String s = this.getName();
|
String s = this.getName();
|
||||||
String s1 = entity.getName();
|
String s1 = entity.getName();
|
||||||
|
|
||||||
@ -350,7 +351,7 @@
|
|||||||
} else {
|
} else {
|
||||||
this.a(StatisticList.MOB_KILLS);
|
this.a(StatisticList.MOB_KILLS);
|
||||||
}
|
}
|
||||||
@@ -651,7 +852,8 @@
|
@@ -651,7 +853,8 @@
|
||||||
int i = scoreboardteam.getColor().b();
|
int i = scoreboardteam.getColor().b();
|
||||||
|
|
||||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||||
@ -360,7 +361,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,18 +897,20 @@
|
@@ -695,18 +898,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canPvP() {
|
private boolean canPvP() {
|
||||||
@ -384,7 +385,7 @@
|
|||||||
} else {
|
} else {
|
||||||
return shapedetectorshape;
|
return shapedetectorshape;
|
||||||
}
|
}
|
||||||
@@ -715,11 +919,20 @@
|
@@ -715,11 +920,20 @@
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Entity b(WorldServer worldserver) {
|
public Entity b(WorldServer worldserver) {
|
||||||
@ -408,7 +409,7 @@
|
|||||||
this.decouple();
|
this.decouple();
|
||||||
this.getWorldServer().a(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
this.getWorldServer().a(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||||
if (!this.wonGame) {
|
if (!this.wonGame) {
|
||||||
@@ -730,6 +943,8 @@
|
@@ -730,6 +944,8 @@
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
} else {
|
} else {
|
||||||
@ -417,7 +418,7 @@
|
|||||||
WorldData worlddata = worldserver.getWorldData();
|
WorldData worlddata = worldserver.getWorldData();
|
||||||
|
|
||||||
this.connection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.gameMode.getGameMode(), this.gameMode.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
|
this.connection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.gameMode.getGameMode(), this.gameMode.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
|
||||||
@@ -739,22 +954,52 @@
|
@@ -739,22 +955,52 @@
|
||||||
playerlist.d(this);
|
playerlist.d(this);
|
||||||
worldserver1.a(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
worldserver1.a(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||||
this.unsetRemoved();
|
this.unsetRemoved();
|
||||||
@ -476,7 +477,7 @@
|
|||||||
worldserver1.getMethodProfiler().exit();
|
worldserver1.getMethodProfiler().exit();
|
||||||
this.triggerDimensionAdvancements(worldserver1);
|
this.triggerDimensionAdvancements(worldserver1);
|
||||||
this.connection.sendPacket(new PacketPlayOutAbilities(this.getAbilities()));
|
this.connection.sendPacket(new PacketPlayOutAbilities(this.getAbilities()));
|
||||||
@@ -772,12 +1017,31 @@
|
@@ -772,12 +1018,31 @@
|
||||||
this.lastSentExp = -1;
|
this.lastSentExp = -1;
|
||||||
this.lastSentHealth = -1.0F;
|
this.lastSentHealth = -1.0F;
|
||||||
this.lastSentFood = -1;
|
this.lastSentFood = -1;
|
||||||
@ -508,7 +509,7 @@
|
|||||||
private void a(WorldServer worldserver, BlockPosition blockposition) {
|
private void a(WorldServer worldserver, BlockPosition blockposition) {
|
||||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
|
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
|
||||||
|
|
||||||
@@ -794,17 +1058,17 @@
|
@@ -794,17 +1059,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -531,7 +532,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return optional1;
|
return optional1;
|
||||||
@@ -814,13 +1078,21 @@
|
@@ -814,13 +1079,21 @@
|
||||||
public void triggerDimensionAdvancements(WorldServer worldserver) {
|
public void triggerDimensionAdvancements(WorldServer worldserver) {
|
||||||
ResourceKey<World> resourcekey = worldserver.getDimensionKey();
|
ResourceKey<World> resourcekey = worldserver.getDimensionKey();
|
||||||
ResourceKey<World> resourcekey1 = this.level.getDimensionKey();
|
ResourceKey<World> resourcekey1 = this.level.getDimensionKey();
|
||||||
@ -556,7 +557,7 @@
|
|||||||
this.enteredNetherPosition = null;
|
this.enteredNetherPosition = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -848,10 +1120,8 @@
|
@@ -848,10 +1121,8 @@
|
||||||
this.containerMenu.d();
|
this.containerMenu.d();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +570,7 @@
|
|||||||
if (!this.isSleeping() && this.isAlive()) {
|
if (!this.isSleeping() && this.isAlive()) {
|
||||||
if (!this.level.getDimensionManager().isNatural()) {
|
if (!this.level.getDimensionManager().isNatural()) {
|
||||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
||||||
@@ -877,7 +1147,36 @@
|
@@ -877,7 +1148,36 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +608,7 @@
|
|||||||
this.a(StatisticList.SLEEP_IN_BED);
|
this.a(StatisticList.SLEEP_IN_BED);
|
||||||
CriterionTriggers.SLEPT_IN_BED.a(this);
|
CriterionTriggers.SLEPT_IN_BED.a(this);
|
||||||
});
|
});
|
||||||
@@ -890,9 +1189,8 @@
|
@@ -890,9 +1190,8 @@
|
||||||
return either;
|
return either;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -618,7 +619,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -919,6 +1217,24 @@
|
@@ -919,6 +1218,24 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void wakeup(boolean flag, boolean flag1) {
|
public void wakeup(boolean flag, boolean flag1) {
|
||||||
@ -643,7 +644,7 @@
|
|||||||
if (this.isSleeping()) {
|
if (this.isSleeping()) {
|
||||||
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
||||||
}
|
}
|
||||||
@@ -1000,8 +1316,9 @@
|
@@ -1000,8 +1317,9 @@
|
||||||
this.connection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
this.connection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,7 +655,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1009,13 +1326,35 @@
|
@@ -1009,13 +1327,35 @@
|
||||||
if (itileinventory == null) {
|
if (itileinventory == null) {
|
||||||
return OptionalInt.empty();
|
return OptionalInt.empty();
|
||||||
} else {
|
} else {
|
||||||
@ -690,7 +691,7 @@
|
|||||||
if (container == null) {
|
if (container == null) {
|
||||||
if (this.isSpectator()) {
|
if (this.isSpectator()) {
|
||||||
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
|
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
|
||||||
@@ -1023,9 +1362,11 @@
|
@@ -1023,9 +1363,11 @@
|
||||||
|
|
||||||
return OptionalInt.empty();
|
return OptionalInt.empty();
|
||||||
} else {
|
} else {
|
||||||
@ -704,7 +705,7 @@
|
|||||||
return OptionalInt.of(this.containerCounter);
|
return OptionalInt.of(this.containerCounter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1038,13 +1379,24 @@
|
@@ -1038,13 +1380,24 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||||
@ -731,7 +732,7 @@
|
|||||||
this.initMenu(this.containerMenu);
|
this.initMenu(this.containerMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1068,6 +1420,7 @@
|
@@ -1068,6 +1421,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeInventory() {
|
public void closeInventory() {
|
||||||
@ -739,7 +740,7 @@
|
|||||||
this.connection.sendPacket(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
this.connection.sendPacket(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||||
this.o();
|
this.o();
|
||||||
}
|
}
|
||||||
@@ -1097,7 +1450,7 @@
|
@@ -1097,7 +1451,7 @@
|
||||||
@Override
|
@Override
|
||||||
public void a(Statistic<?> statistic, int i) {
|
public void a(Statistic<?> statistic, int i) {
|
||||||
this.stats.b(this, statistic, i);
|
this.stats.b(this, statistic, i);
|
||||||
@ -748,7 +749,7 @@
|
|||||||
scoreboardscore.addScore(i);
|
scoreboardscore.addScore(i);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1105,7 +1458,7 @@
|
@@ -1105,7 +1459,7 @@
|
||||||
@Override
|
@Override
|
||||||
public void a(Statistic<?> statistic) {
|
public void a(Statistic<?> statistic) {
|
||||||
this.stats.setStatistic(this, statistic, 0);
|
this.stats.setStatistic(this, statistic, 0);
|
||||||
@ -757,7 +758,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1121,7 +1474,7 @@
|
@@ -1121,7 +1475,7 @@
|
||||||
|
|
||||||
for (int j = 0; j < i; ++j) {
|
for (int j = 0; j < i; ++j) {
|
||||||
MinecraftKey minecraftkey = aminecraftkey1[j];
|
MinecraftKey minecraftkey = aminecraftkey1[j];
|
||||||
@ -766,7 +767,7 @@
|
|||||||
|
|
||||||
Objects.requireNonNull(list);
|
Objects.requireNonNull(list);
|
||||||
optional.ifPresent(list::add);
|
optional.ifPresent(list::add);
|
||||||
@@ -1156,7 +1509,16 @@
|
@@ -1156,7 +1510,16 @@
|
||||||
|
|
||||||
public void triggerHealthUpdate() {
|
public void triggerHealthUpdate() {
|
||||||
this.lastSentHealth = -1.0E8F;
|
this.lastSentHealth = -1.0E8F;
|
||||||
@ -783,7 +784,7 @@
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||||
@@ -1211,11 +1573,12 @@
|
@@ -1211,11 +1574,12 @@
|
||||||
this.lastSentExp = -1;
|
this.lastSentExp = -1;
|
||||||
this.lastSentHealth = -1.0F;
|
this.lastSentHealth = -1.0F;
|
||||||
this.lastSentFood = -1;
|
this.lastSentFood = -1;
|
||||||
@ -797,7 +798,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1337,7 +1700,20 @@
|
@@ -1337,7 +1701,20 @@
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,7 +819,7 @@
|
|||||||
this.chatVisibility = packetplayinsettings.d();
|
this.chatVisibility = packetplayinsettings.d();
|
||||||
this.canChatColor = packetplayinsettings.e();
|
this.canChatColor = packetplayinsettings.e();
|
||||||
this.textFilteringEnabled = packetplayinsettings.h();
|
this.textFilteringEnabled = packetplayinsettings.h();
|
||||||
@@ -1407,7 +1783,7 @@
|
@@ -1407,7 +1784,7 @@
|
||||||
this.camera = (Entity) (entity == null ? this : entity);
|
this.camera = (Entity) (entity == null ? this : entity);
|
||||||
if (entity1 != this.camera) {
|
if (entity1 != this.camera) {
|
||||||
this.connection.sendPacket(new PacketPlayOutCamera(this.camera));
|
this.connection.sendPacket(new PacketPlayOutCamera(this.camera));
|
||||||
@ -827,7 +828,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1436,7 +1812,7 @@
|
@@ -1436,7 +1813,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public IChatBaseComponent getPlayerListName() {
|
public IChatBaseComponent getPlayerListName() {
|
||||||
@ -836,7 +837,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1457,9 +1833,16 @@
|
@@ -1457,9 +1834,16 @@
|
||||||
return this.advancements;
|
return this.advancements;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +854,7 @@
|
|||||||
if (worldserver == this.level) {
|
if (worldserver == this.level) {
|
||||||
this.connection.b(d0, d1, d2, f, f1);
|
this.connection.b(d0, d1, d2, f, f1);
|
||||||
} else {
|
} else {
|
||||||
@@ -1479,6 +1862,9 @@
|
@@ -1479,6 +1863,9 @@
|
||||||
this.server.getPlayerList().a(this, worldserver);
|
this.server.getPlayerList().a(this, worldserver);
|
||||||
this.server.getPlayerList().updateClient(this);
|
this.server.getPlayerList().updateClient(this);
|
||||||
}
|
}
|
||||||
@ -863,7 +864,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1634,4 +2020,145 @@
|
@@ -1634,4 +2021,145 @@
|
||||||
});
|
});
|
||||||
return this.a(itemstack, false, true) != null;
|
return this.a(itemstack, false, true) != null;
|
||||||
}
|
}
|
||||||
@ -972,7 +973,7 @@
|
|||||||
+ float exp = 0;
|
+ float exp = 0;
|
||||||
+ boolean keepInventory = this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY);
|
+ boolean keepInventory = this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY);
|
||||||
+
|
+
|
||||||
+ if (this.keepLevel || keepInventory) {
|
+ if (this.keepLevel) { // CraftBukkit - SPIGOT-6687: Only use keepLevel (was pre-set with RULE_KEEPINVENTORY value in PlayerDeathEvent)
|
||||||
+ exp = this.experienceProgress;
|
+ exp = this.experienceProgress;
|
||||||
+ this.newTotalExp = this.totalExperience;
|
+ this.newTotalExp = this.totalExperience;
|
||||||
+ this.newLevel = this.experienceLevel;
|
+ this.newLevel = this.experienceLevel;
|
||||||
@ -995,7 +996,7 @@
|
|||||||
+ this.lastHurtByMob = null;
|
+ this.lastHurtByMob = null;
|
||||||
+ this.combatTracker = new CombatTracker(this);
|
+ this.combatTracker = new CombatTracker(this);
|
||||||
+ this.lastSentExp = -1;
|
+ this.lastSentExp = -1;
|
||||||
+ if (this.keepLevel || keepInventory) {
|
+ if (this.keepLevel) { // CraftBukkit - SPIGOT-6687: Only use keepLevel (was pre-set with RULE_KEEPINVENTORY value in PlayerDeathEvent)
|
||||||
+ this.experienceProgress = exp;
|
+ this.experienceProgress = exp;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.giveExp(this.newExp);
|
+ this.giveExp(this.newExp);
|
||||||
|
@ -799,6 +799,7 @@ public class CraftEventFactory {
|
|||||||
CraftPlayer entity = victim.getBukkitEntity();
|
CraftPlayer entity = victim.getBukkitEntity();
|
||||||
PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage);
|
PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage);
|
||||||
event.setKeepInventory(keepInventory);
|
event.setKeepInventory(keepInventory);
|
||||||
|
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
|
||||||
org.bukkit.World world = entity.getWorld();
|
org.bukkit.World world = entity.getWorld();
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren