Handle offline mode in the tab list
This commit is contained in:
parent
c822c48fef
commit
1f132876e6
@ -70,17 +70,23 @@ public class Global extends TabList
|
|||||||
item.setUsername( p.getName() );
|
item.setUsername( p.getName() );
|
||||||
item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( p.getDisplayName() ) ) );
|
item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( p.getDisplayName() ) ) );
|
||||||
LoginResult loginResult = ( (UserConnection) p ).getPendingConnection().getLoginProfile();
|
LoginResult loginResult = ( (UserConnection) p ).getPendingConnection().getLoginProfile();
|
||||||
|
if ( loginResult != null )
|
||||||
|
{
|
||||||
String[][] props = new String[ loginResult.getProperties().length ][];
|
String[][] props = new String[ loginResult.getProperties().length ][];
|
||||||
for ( int j = 0; j < props.length; j++ )
|
for ( int j = 0; j < props.length; j++ )
|
||||||
{
|
{
|
||||||
props[ j] = new String[]
|
props[ j ] = new String[]
|
||||||
{
|
{
|
||||||
loginResult.getProperties()[j].getName(),
|
loginResult.getProperties()[ j ].getName(),
|
||||||
loginResult.getProperties()[j].getValue(),
|
loginResult.getProperties()[ j ].getValue(),
|
||||||
loginResult.getProperties()[j].getSignature()
|
loginResult.getProperties()[ j ].getSignature()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
item.setProperties( props );
|
item.setProperties( props );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
item.setProperties( new String[0][0] );
|
||||||
|
}
|
||||||
item.setGamemode( ( (UserConnection) p ).getGamemode() );
|
item.setGamemode( ( (UserConnection) p ).getGamemode() );
|
||||||
item.setPing( p.getPing() );
|
item.setPing( p.getPing() );
|
||||||
}
|
}
|
||||||
|
@ -36,17 +36,23 @@ public abstract class TabList
|
|||||||
{
|
{
|
||||||
item.setUuid( player.getUniqueId() );
|
item.setUuid( player.getUniqueId() );
|
||||||
LoginResult loginResult = player.getPendingConnection().getLoginProfile();
|
LoginResult loginResult = player.getPendingConnection().getLoginProfile();
|
||||||
|
if ( loginResult != null )
|
||||||
|
{
|
||||||
String[][] props = new String[ loginResult.getProperties().length ][];
|
String[][] props = new String[ loginResult.getProperties().length ][];
|
||||||
for ( int i = 0; i < props.length; i++ )
|
for ( int i = 0; i < props.length; i++ )
|
||||||
{
|
{
|
||||||
props[ i] = new String[]
|
props[ i ] = new String[]
|
||||||
{
|
{
|
||||||
loginResult.getProperties()[i].getName(),
|
loginResult.getProperties()[ i ].getName(),
|
||||||
loginResult.getProperties()[i].getValue(),
|
loginResult.getProperties()[ i ].getValue(),
|
||||||
loginResult.getProperties()[i].getSignature()
|
loginResult.getProperties()[ i ].getSignature()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
item.setProperties( props );
|
item.setProperties( props );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
item.setProperties( new String[ 0 ][ 0 ] );
|
||||||
|
}
|
||||||
if ( playerListItem.getAction() == PlayerListItem.Action.ADD_PLAYER || playerListItem.getAction() == PlayerListItem.Action.UPDATE_GAMEMODE )
|
if ( playerListItem.getAction() == PlayerListItem.Action.ADD_PLAYER || playerListItem.getAction() == PlayerListItem.Action.UPDATE_GAMEMODE )
|
||||||
{
|
{
|
||||||
player.setGamemode( item.getGamemode() );
|
player.setGamemode( item.getGamemode() );
|
||||||
|
Loading…
Reference in New Issue
Block a user