SPIGOT-1725: Fix dynamic scoreboard criteria on non-main scoreboards

This commit is contained in:
md_5 2016-03-12 17:57:40 +11:00
parent 4a8818c5fd
commit 0619f0eb3b
2 changed files with 32 additions and 24 deletions

View File

@ -142,7 +142,22 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
@@ -301,30 +376,79 @@
@@ -247,12 +322,11 @@
}
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
- Collection collection = this.getScoreboard().getObjectivesForCriteria(iscoreboardcriteria);
+ Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getName(), new java.util.ArrayList<ScoreboardScore>()); // CraftBukkit - Use our scores instead
Iterator iterator = collection.iterator();
while (iterator.hasNext()) {
- ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
- ScoreboardScore scoreboardscore = this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective);
+ ScoreboardScore scoreboardscore = (ScoreboardScore) iterator.next(); // CraftBukkit - Use our scores instead
scoreboardscore.setScore(i);
}
@@ -301,30 +375,79 @@
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
this.playerConnection.sendPacket(new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, flag));
@ -235,7 +250,7 @@
scoreboardscore.incrementScore();
}
@@ -381,7 +505,8 @@
@@ -381,7 +504,8 @@
}
private boolean canPvP() {
@ -245,7 +260,7 @@
}
public Entity c(int i) {
@@ -407,7 +532,10 @@
@@ -407,7 +531,10 @@
this.b((Statistic) AchievementList.y);
}
@ -257,7 +272,7 @@
this.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1032, BlockPosition.ZERO, 0, false));
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
@@ -452,6 +580,7 @@
@@ -452,6 +579,7 @@
}
public void a(boolean flag, boolean flag1, boolean flag2) {
@ -265,7 +280,7 @@
if (this.isSleeping()) {
this.x().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
}
@@ -530,23 +659,48 @@
@@ -530,23 +658,48 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@ -323,7 +338,7 @@
if (iinventory instanceof ILootable && ((ILootable) iinventory).b() != null && this.isSpectator()) {
this.sendMessage((new ChatMessage("container.spectatorCantOpen", new Object[0])).setChatModifier((new ChatModifier()).setColor(EnumChatFormat.RED)));
} else {
@@ -560,18 +714,21 @@
@@ -560,18 +713,21 @@
if (itileinventory.x_() && !this.a(itileinventory.y_()) && !this.isSpectator()) {
this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), (byte) 2));
this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.W, SoundCategory.BLOCKS, this.locX, this.locY, this.locZ, 1.0F, 1.0F));
@ -347,7 +362,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -579,8 +736,14 @@
@@ -579,8 +735,14 @@
}
public void openTrade(IMerchant imerchant) {
@ -363,7 +378,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).e();
@@ -599,14 +762,21 @@
@@ -599,14 +761,21 @@
}
@ -387,7 +402,7 @@
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -646,6 +816,11 @@
@@ -646,6 +815,11 @@
public void a(Container container, List<ItemStack> list) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, list));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@ -399,7 +414,7 @@
}
public void setContainerData(Container container, int i, int j) {
@@ -660,6 +835,7 @@
@@ -660,6 +834,7 @@
}
public void closeInventory() {
@ -407,7 +422,7 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.s();
}
@@ -741,7 +917,16 @@
@@ -741,7 +916,16 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@ -424,7 +439,7 @@
public void b(IChatBaseComponent ichatbasecomponent) {
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent));
@@ -802,6 +987,8 @@
@@ -802,6 +986,8 @@
}
public void a(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
@ -433,7 +448,7 @@
this.playerInteractManager.setGameMode(worldsettings_enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) worldsettings_enumgamemode.getId()));
if (worldsettings_enumgamemode == WorldSettings.EnumGamemode.SPECTATOR) {
@@ -812,6 +999,7 @@
@@ -812,6 +998,7 @@
this.updateAbilities();
this.cq();
@ -441,7 +456,7 @@
}
public boolean isSpectator() {
@@ -827,6 +1015,7 @@
@@ -827,6 +1014,7 @@
}
public boolean a(int i, String s) {
@ -449,7 +464,7 @@
if ("seed".equals(s) && !this.server.aa()) {
return true;
} else if (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) && !"trigger".equals(s)) {
@@ -840,6 +1029,12 @@
@@ -840,6 +1028,12 @@
} else {
return true;
}
@ -462,7 +477,7 @@
}
public String A() {
@@ -938,7 +1133,7 @@
@@ -938,7 +1132,7 @@
}
public IChatBaseComponent getPlayerListName() {
@ -471,7 +486,7 @@
}
public void a(EnumHand enumhand) {
@@ -962,4 +1157,127 @@
@@ -962,4 +1156,127 @@
this.setFlag(7, true);
this.setFlag(7, false);
}

View File

@ -108,11 +108,4 @@ public final class CraftScoreboardManager implements ScoreboardManager {
}
return collection;
}
// CraftBukkit method
public void updateAllScoresForList(IScoreboardCriteria criteria, String name, List<EntityPlayer> of) {
for (ScoreboardScore score : getScoreboardScores(criteria, name, new ArrayList<ScoreboardScore>())) {
// PAIL: FIXME score.updateForList((List) of);
}
}
}