From c5307c4451a92306f7074fbda4a55e25202f418d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 1 Jun 2013 18:00:17 +1000 Subject: [PATCH] Dont use getters in team packet and add null check to team name --- .../net/md_5/bungee/api/scoreboard/Team.java | 2 ++ .../bungee/protocol/packet/PacketD1Team.java | 22 +++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/scoreboard/Team.java b/api/src/main/java/net/md_5/bungee/api/scoreboard/Team.java index 8142bc03f..b756f8554 100644 --- a/api/src/main/java/net/md_5/bungee/api/scoreboard/Team.java +++ b/api/src/main/java/net/md_5/bungee/api/scoreboard/Team.java @@ -5,11 +5,13 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; import lombok.Data; +import lombok.NonNull; @Data public class Team { + @NonNull private final String name; private String displayName; private String prefix; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PacketD1Team.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PacketD1Team.java index 40884387c..32d4556e5 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PacketD1Team.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PacketD1Team.java @@ -64,21 +64,21 @@ public class PacketD1Team extends DefinedPacket @Override public void write(ByteBuf buf) { - writeString( getName(), buf ); - buf.writeByte( getMode() ); - if ( getMode() == 0 || getMode() == 2 ) + writeString( name, buf ); + buf.writeByte( mode ); + if ( mode == 0 || mode == 2 ) { - writeString( getDisplayName(), buf ); - writeString( getPrefix(), buf ); - writeString( getSuffix(), buf ); - buf.writeBoolean( isFriendlyFire() ); + writeString( displayName, buf ); + writeString( prefix, buf ); + writeString( suffix, buf ); + buf.writeBoolean( friendlyFire ); } - if ( getMode() == 0 || getMode() == 3 || getMode() == 4 ) + if ( mode == 0 || mode == 3 || mode == 4 ) { - buf.writeShort( getPlayers().length ); - for ( int i = 0; i < getPlayers().length; i++ ) + buf.writeShort( players.length ); + for ( int i = 0; i < players.length; i++ ) { - writeString( getPlayers()[i], buf ); + writeString( players[i], buf ); } } }