Dont use getters in team packet and add null check to team name

This commit is contained in:
md_5 2013-06-01 18:00:17 +10:00
parent 4f2b98188e
commit c5307c4451
2 changed files with 13 additions and 11 deletions

View File

@ -5,11 +5,13 @@ import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import lombok.Data; import lombok.Data;
import lombok.NonNull;
@Data @Data
public class Team public class Team
{ {
@NonNull
private final String name; private final String name;
private String displayName; private String displayName;
private String prefix; private String prefix;

View File

@ -64,21 +64,21 @@ public class PacketD1Team extends DefinedPacket
@Override @Override
public void write(ByteBuf buf) public void write(ByteBuf buf)
{ {
writeString( getName(), buf ); writeString( name, buf );
buf.writeByte( getMode() ); buf.writeByte( mode );
if ( getMode() == 0 || getMode() == 2 ) if ( mode == 0 || mode == 2 )
{ {
writeString( getDisplayName(), buf ); writeString( displayName, buf );
writeString( getPrefix(), buf ); writeString( prefix, buf );
writeString( getSuffix(), buf ); writeString( suffix, buf );
buf.writeBoolean( isFriendlyFire() ); buf.writeBoolean( friendlyFire );
} }
if ( getMode() == 0 || getMode() == 3 || getMode() == 4 ) if ( mode == 0 || mode == 3 || mode == 4 )
{ {
buf.writeShort( getPlayers().length ); buf.writeShort( players.length );
for ( int i = 0; i < getPlayers().length; i++ ) for ( int i = 0; i < players.length; i++ )
{ {
writeString( getPlayers()[i], buf ); writeString( players[i], buf );
} }
} }
} }