mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
8a3c8cfcd4
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
|
|
@@ -37,7 +37,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();
|
|
@@ -46,7 +46,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();
|
|
}
|
|
|
|
@@ -54,7 +54,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();
|
|
@@ -67,7 +67,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));
|
|
} else {
|
|
this.stopTrackingObjective(scoreboardobjective1);
|
|
}
|
|
@@ -75,7 +75,7 @@
|
|
|
|
if (scoreboardobjective != null) {
|
|
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
|
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
|
|
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
|
|
} else {
|
|
this.startTrackingObjective(scoreboardobjective);
|
|
}
|
|
@@ -87,7 +87,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 {
|
|
@@ -98,7 +98,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();
|
|
}
|
|
|
|
@@ -112,7 +112,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();
|
|
@@ -131,21 +131,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();
|
|
}
|
|
|
|
@@ -196,6 +196,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()) {
|
|
@@ -232,6 +233,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()) {
|
|
@@ -276,6 +278,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;
|