Handle offline mode in the tab list

This commit is contained in:
Thinkofdeath 2014-08-31 09:25:09 +01:00
parent c822c48fef
commit 1f132876e6
2 changed files with 28 additions and 16 deletions

View File

@ -70,17 +70,23 @@ public class Global extends TabList
item.setUsername( p.getName() );
item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( p.getDisplayName() ) ) );
LoginResult loginResult = ( (UserConnection) p ).getPendingConnection().getLoginProfile();
if ( loginResult != null )
{
String[][] props = new String[ loginResult.getProperties().length ][];
for ( int j = 0; j < props.length; j++ )
{
props[ j] = new String[]
props[ j ] = new String[]
{
loginResult.getProperties()[j].getName(),
loginResult.getProperties()[j].getValue(),
loginResult.getProperties()[j].getSignature()
loginResult.getProperties()[ j ].getName(),
loginResult.getProperties()[ j ].getValue(),
loginResult.getProperties()[ j ].getSignature()
};
}
item.setProperties( props );
} else
{
item.setProperties( new String[0][0] );
}
item.setGamemode( ( (UserConnection) p ).getGamemode() );
item.setPing( p.getPing() );
}

View File

@ -36,17 +36,23 @@ public abstract class TabList
{
item.setUuid( player.getUniqueId() );
LoginResult loginResult = player.getPendingConnection().getLoginProfile();
if ( loginResult != null )
{
String[][] props = new String[ loginResult.getProperties().length ][];
for ( int i = 0; i < props.length; i++ )
{
props[ i] = new String[]
props[ i ] = new String[]
{
loginResult.getProperties()[i].getName(),
loginResult.getProperties()[i].getValue(),
loginResult.getProperties()[i].getSignature()
loginResult.getProperties()[ i ].getName(),
loginResult.getProperties()[ i ].getValue(),
loginResult.getProperties()[ i ].getSignature()
};
}
item.setProperties( props );
} else
{
item.setProperties( new String[ 0 ][ 0 ] );
}
if ( playerListItem.getAction() == PlayerListItem.Action.ADD_PLAYER || playerListItem.getAction() == PlayerListItem.Action.UPDATE_GAMEMODE )
{
player.setGamemode( item.getGamemode() );