Commits
md_5 authored 2e39de698d0
182 182 | + if (this.inventory.armor[i] != null) { |
183 183 | + loot.add(CraftItemStack.asCraftMirror(this.inventory.armor[i])); |
184 184 | + } |
185 185 | + } |
186 186 | + for (int i = 0; i < this.inventory.extraSlots.length; ++i) { |
187 187 | + if (this.inventory.extraSlots[i] != null) { |
188 188 | + loot.add(CraftItemStack.asCraftMirror(this.inventory.extraSlots[i])); |
189 189 | + } |
190 190 | + } |
191 191 | + } |
192 - | + |
193 - | + IChatBaseComponent chatmessage = this.getCombatTracker().getDeathMessage(); |
194 - | + |
195 - | + String deathmessage = chatmessage.toPlainText(); |
196 - | + org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); |
197 192 | |
198 193 | - if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) { |
199 194 | - if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) { |
200 195 | - this.server.getPlayerList().a((EntityHuman) this, this.getCombatTracker().getDeathMessage()); |
201 196 | - } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) { |
202 197 | - this.server.getPlayerList().b((EntityHuman) this, this.getCombatTracker().getDeathMessage()); |
198 + | + IChatBaseComponent chatmessage = this.getCombatTracker().getDeathMessage(); |
199 + | + |
200 + | + String deathmessage = chatmessage.toPlainText(); |
201 + | + org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); |
202 + | + |
203 203 | + String deathMessage = event.getDeathMessage(); |
204 204 | + |
205 205 | + if (deathMessage != null && deathMessage.length() > 0 && flag) { // TODO: allow plugins to override? |
206 206 | + if (deathMessage.equals(deathmessage)) { |
207 207 | + ScoreboardTeamBase scoreboardteambase = this.aQ(); |
208 208 | + |
209 209 | + if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) { |
210 210 | + if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) { |
211 211 | + this.server.getPlayerList().a((EntityHuman) this, chatmessage); |
212 212 | + } else if (scoreboardteambase.getDeathMessageVisibility() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) { |
505 505 | this.ci = packetplayinsettings.d(); |
506 506 | |
507 507 | |
508 508 | @Nullable |
509 509 | public IChatBaseComponent getPlayerListName() { |
510 510 | - return null; |
511 511 | + return listName; // CraftBukkit |
512 512 | } |
513 513 | |
514 514 | public void a(EnumHand enumhand) { |
515 - | |
515 + | |
516 516 | } |
517 517 | |
518 518 | public void M() { |
519 519 | + if (!CraftEventFactory.callToggleGlideEvent(this, true).isCancelled()) // CraftBukkit |
520 520 | this.setFlag(7, true); |
521 521 | } |
522 522 | |
523 523 | public void N() { |
524 524 | - this.setFlag(7, true); |
525 525 | - this.setFlag(7, false); |
608 608 | + public void resetPlayerWeather() { |
609 609 | + this.weather = null; |
610 610 | + this.setPlayerWeather(this.world.getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false); |
611 611 | + } |
612 612 | + |
613 613 | + @Override |
614 614 | + public String toString() { |
615 615 | + return super.toString() + "(" + this.getName() + " at " + this.locX + "," + this.locY + "," + this.locZ + ")"; |
616 616 | + } |
617 617 | + |
618 + | + // SPIGOT-1903, MC-98153 |
619 + | + public void forceSetPositionRotation(double x, double y, double z, float yaw, float pitch) { |
620 + | + this.setPositionRotation(x, y, z, yaw, pitch); |
621 + | + this.playerConnection.d(); |
622 + | + } |
623 + | + |
618 624 | + public void reset() { |
619 625 | + float exp = 0; |
620 626 | + boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory"); |
621 627 | + |
622 628 | + if (this.keepLevel || keepInventory) { |
623 629 | + exp = this.exp; |
624 630 | + this.newTotalExp = this.expTotal; |
625 631 | + this.newLevel = this.expLevel; |
626 632 | + } |
627 633 | + |