mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-21 21:16:16 +00:00
133 lines
7.0 KiB
Diff
133 lines
7.0 KiB
Diff
--- a/net/minecraft/server/ScoreboardServer.java
|
|
+++ b/net/minecraft/server/ScoreboardServer.java
|
|
@@ -42,7 +42,7 @@
|
|
protected void onScoreChanged(ScoreHolder scoreholder, ScoreboardObjective scoreboardobjective, ScoreboardScore scoreboardscore) {
|
|
super.onScoreChanged(scoreholder, scoreboardobjective, scoreboardscore);
|
|
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), Optional.ofNullable(scoreboardscore.display()), Optional.ofNullable(scoreboardscore.numberFormat())));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardScore(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), Optional.ofNullable(scoreboardscore.display()), Optional.ofNullable(scoreboardscore.numberFormat()))); // CraftBukkit
|
|
}
|
|
|
|
this.setDirty();
|
|
@@ -57,7 +57,7 @@
|
|
@Override
|
|
public void onPlayerRemoved(ScoreHolder scoreholder) {
|
|
super.onPlayerRemoved(scoreholder);
|
|
- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null));
|
|
+ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null)); // CraftBukkit
|
|
this.setDirty();
|
|
}
|
|
|
|
@@ -65,7 +65,7 @@
|
|
public void onPlayerScoreRemoved(ScoreHolder scoreholder, ScoreboardObjective scoreboardobjective) {
|
|
super.onPlayerScoreRemoved(scoreholder, scoreboardobjective);
|
|
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
|
- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), scoreboardobjective.getName()));
|
|
+ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), scoreboardobjective.getName())); // CraftBukkit
|
|
}
|
|
|
|
this.setDirty();
|
|
@@ -78,7 +78,7 @@
|
|
super.setDisplayObjective(displayslot, scoreboardobjective);
|
|
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
|
|
if (this.getObjectiveDisplaySlotCount(scoreboardobjective1) > 0) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective)); // CraftBukkit
|
|
} else {
|
|
this.stopTrackingObjective(scoreboardobjective1);
|
|
}
|
|
@@ -86,7 +86,7 @@
|
|
|
|
if (scoreboardobjective != null) {
|
|
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective)); // CraftBukkit
|
|
} else {
|
|
this.startTrackingObjective(scoreboardobjective);
|
|
}
|
|
@@ -98,7 +98,7 @@
|
|
@Override
|
|
public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
|
|
if (super.addPlayerToTeam(s, scoreboardteam)) {
|
|
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
|
|
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD)); // CraftBukkit
|
|
this.setDirty();
|
|
return true;
|
|
} else {
|
|
@@ -109,7 +109,7 @@
|
|
@Override
|
|
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
|
|
super.removePlayerFromTeam(s, scoreboardteam);
|
|
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
|
|
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE)); // CraftBukkit
|
|
this.setDirty();
|
|
}
|
|
|
|
@@ -123,7 +123,7 @@
|
|
public void onObjectiveChanged(ScoreboardObjective scoreboardobjective) {
|
|
super.onObjectiveChanged(scoreboardobjective);
|
|
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2)); // CraftBukkit
|
|
}
|
|
|
|
this.setDirty();
|
|
@@ -142,21 +142,21 @@
|
|
@Override
|
|
public void onTeamAdded(ScoreboardTeam scoreboardteam) {
|
|
super.onTeamAdded(scoreboardteam);
|
|
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true));
|
|
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true)); // CraftBukkit
|
|
this.setDirty();
|
|
}
|
|
|
|
@Override
|
|
public void onTeamChanged(ScoreboardTeam scoreboardteam) {
|
|
super.onTeamChanged(scoreboardteam);
|
|
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, false));
|
|
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, false)); // CraftBukkit
|
|
this.setDirty();
|
|
}
|
|
|
|
@Override
|
|
public void onTeamRemoved(ScoreboardTeam scoreboardteam) {
|
|
super.onTeamRemoved(scoreboardteam);
|
|
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam));
|
|
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam)); // CraftBukkit
|
|
this.setDirty();
|
|
}
|
|
|
|
@@ -207,6 +207,7 @@
|
|
|
|
while (iterator.hasNext()) {
|
|
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
|
+ if (entityplayer.getBukkitEntity().getScoreboard().getHandle() != this) continue; // CraftBukkit - Only players on this board
|
|
Iterator iterator1 = list.iterator();
|
|
|
|
while (iterator1.hasNext()) {
|
|
@@ -243,6 +244,7 @@
|
|
|
|
while (iterator.hasNext()) {
|
|
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
|
+ if (entityplayer.getBukkitEntity().getScoreboard().getHandle() != this) continue; // CraftBukkit - Only players on this board
|
|
Iterator iterator1 = list.iterator();
|
|
|
|
while (iterator1.hasNext()) {
|
|
@@ -287,6 +289,16 @@
|
|
return this.createData().load(nbttagcompound, holderlookup_a);
|
|
}
|
|
|
|
+ // CraftBukkit start - Send to players
|
|
+ private void broadcastAll(Packet packet) {
|
|
+ for (EntityPlayer entityplayer : (List<EntityPlayer>) this.server.getPlayerList().players) {
|
|
+ if (entityplayer.getBukkitEntity().getScoreboard().getHandle() == this) {
|
|
+ entityplayer.connection.send(packet);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public static enum Action {
|
|
|
|
CHANGE, REMOVE;
|