mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
43702a9e10
By: md_5 <git@md-5.net>
132 lines
6.6 KiB
Diff
132 lines
6.6 KiB
Diff
--- a/net/minecraft/server/ScoreboardServer.java
|
|
+++ b/net/minecraft/server/ScoreboardServer.java
|
|
@@ -34,7 +34,7 @@
|
|
public void onScoreChanged(ScoreboardScore scoreboardscore) {
|
|
super.onScoreChanged(scoreboardscore);
|
|
if (this.trackedObjectives.contains(scoreboardscore.getObjective())) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getOwner(), scoreboardscore.getScore()));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getOwner(), scoreboardscore.getScore()));
|
|
}
|
|
|
|
this.setDirty();
|
|
@@ -43,7 +43,7 @@
|
|
@Override
|
|
public void onPlayerRemoved(String s) {
|
|
super.onPlayerRemoved(s);
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
|
this.setDirty();
|
|
}
|
|
|
|
@@ -51,7 +51,7 @@
|
|
public void onPlayerScoreRemoved(String s, ScoreboardObjective scoreboardobjective) {
|
|
super.onPlayerScoreRemoved(s, scoreboardobjective);
|
|
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
|
}
|
|
|
|
this.setDirty();
|
|
@@ -64,7 +64,7 @@
|
|
super.setDisplayObjective(i, scoreboardobjective);
|
|
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
|
|
if (this.getObjectiveDisplaySlotCount(scoreboardobjective1) > 0) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
|
} else {
|
|
this.stopTrackingObjective(scoreboardobjective1);
|
|
}
|
|
@@ -72,7 +72,7 @@
|
|
|
|
if (scoreboardobjective != null) {
|
|
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
|
} else {
|
|
this.startTrackingObjective(scoreboardobjective);
|
|
}
|
|
@@ -84,7 +84,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));
|
|
this.setDirty();
|
|
return true;
|
|
} else {
|
|
@@ -95,7 +95,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));
|
|
this.setDirty();
|
|
}
|
|
|
|
@@ -109,7 +109,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));
|
|
}
|
|
|
|
this.setDirty();
|
|
@@ -128,21 +128,21 @@
|
|
@Override
|
|
public void onTeamAdded(ScoreboardTeam scoreboardteam) {
|
|
super.onTeamAdded(scoreboardteam);
|
|
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true));
|
|
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true));
|
|
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));
|
|
this.setDirty();
|
|
}
|
|
|
|
@Override
|
|
public void onTeamRemoved(ScoreboardTeam scoreboardteam) {
|
|
super.onTeamRemoved(scoreboardteam);
|
|
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam));
|
|
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam));
|
|
this.setDirty();
|
|
}
|
|
|
|
@@ -189,6 +189,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()) {
|
|
@@ -221,6 +222,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()) {
|
|
@@ -257,6 +259,16 @@
|
|
return this.createData().load(nbttagcompound);
|
|
}
|
|
|
|
+ // 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;
|