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

View File

@ -41,8 +41,7 @@ public final class TeamManager {
*/
protected void registerNewTeam(@NotNull Team team) {
this.teams.add(team);
PacketUtils.sendGroupedPacket(MinecraftServer.getConnectionManager().getOnlinePlayers(), team.createTeamsCreationPacket());
PacketUtils.broadcastPacket(team.createTeamsCreationPacket());
}
/**
@ -65,7 +64,7 @@ public final class TeamManager {
*/
public boolean deleteTeam(@NotNull Team team) {
// 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);
}