Allow setting a connections uuid when in offline mode

This commit is contained in:
Joshua Rodriguez 2015-02-05 20:53:52 -08:00 committed by md_5
parent 3776feb559
commit 415d5860e4
2 changed files with 13 additions and 0 deletions

View File

@ -54,6 +54,11 @@ public interface PendingConnection extends Connection
*/
UUID getUniqueId();
/**
* Set the connection's uuid
*/
void setUniqueId(UUID uuid);
/**
* Get this connection's online mode.
*

View File

@ -571,6 +571,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
this.onlineMode = onlineMode;
}
@Override
public void setUniqueId(UUID uuid)
{
Preconditions.checkState( thisState == State.USERNAME, "Can only set uuid while state is username" );
Preconditions.checkState( !onlineMode, "Can only set uuid when online mode is false" );
this.uniqueId = uuid;
}
@Override
public String getUUID()
{