Use broadcastPacket whenever possible

This commit is contained in:
themode 2021-12-24 08:43:52 +01:00 committed by TheMode
parent 5d4dd1f9f4
commit 40a2168d52
2 changed files with 4 additions and 7 deletions

View File

@ -188,8 +188,7 @@ public final class MinecraftServer {
*/ */
public static void setBrandName(@NotNull String brandName) { public static void setBrandName(@NotNull String brandName) {
MinecraftServer.brandName = brandName; MinecraftServer.brandName = brandName;
PacketUtils.broadcastPacket(PluginMessagePacket.getBrandPacket());
PacketUtils.sendGroupedPacket(connectionManager.getOnlinePlayers(), PluginMessagePacket.getBrandPacket());
} }
/** /**
@ -245,8 +244,7 @@ public final class MinecraftServer {
*/ */
public static void setDifficulty(@NotNull Difficulty difficulty) { public static void setDifficulty(@NotNull Difficulty difficulty) {
MinecraftServer.difficulty = difficulty; MinecraftServer.difficulty = difficulty;
// Send the packet to all online players PacketUtils.broadcastPacket(new ServerDifficultyPacket(difficulty, true));
PacketUtils.sendGroupedPacket(connectionManager.getOnlinePlayers(), new ServerDifficultyPacket(difficulty, true));
} }
/** /**

View File

@ -41,8 +41,7 @@ public final class TeamManager {
*/ */
protected void registerNewTeam(@NotNull Team team) { protected void registerNewTeam(@NotNull Team team) {
this.teams.add(team); this.teams.add(team);
PacketUtils.broadcastPacket(team.createTeamsCreationPacket());
PacketUtils.sendGroupedPacket(MinecraftServer.getConnectionManager().getOnlinePlayers(), team.createTeamsCreationPacket());
} }
/** /**
@ -65,7 +64,7 @@ public final class TeamManager {
*/ */
public boolean deleteTeam(@NotNull Team team) { public boolean deleteTeam(@NotNull Team team) {
// Sends to all online players a team destroy packet // Sends to all online players a team destroy packet
PacketUtils.sendGroupedPacket(CONNECTION_MANAGER.getOnlinePlayers(), team.createTeamDestructionPacket()); PacketUtils.broadcastPacket(team.createTeamDestructionPacket());
return this.teams.remove(team); return this.teams.remove(team);
} }