2014-04-18 22:14:02 +02:00
|
|
|
package me.libraryaddict.disguise.utilities;
|
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
2014-06-04 22:40:15 +02:00
|
|
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
|
|
|
|
2014-04-18 22:14:02 +02:00
|
|
|
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|
|
|
import net.minecraft.util.com.mojang.authlib.ProfileLookupCallback;
|
|
|
|
|
|
|
|
public class LibsProfileLookupCaller implements ProfileLookupCallback {
|
2014-06-04 22:40:15 +02:00
|
|
|
private WrappedGameProfile gameProfile;
|
2014-04-18 22:14:02 +02:00
|
|
|
|
2014-06-04 22:40:15 +02:00
|
|
|
public WrappedGameProfile getGameProfile() {
|
2014-04-18 22:14:02 +02:00
|
|
|
return gameProfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onProfileLookupFailed(GameProfile gameProfile, Exception arg1) {
|
|
|
|
try {
|
|
|
|
Field field = GameProfile.class.getDeclaredField("id");
|
|
|
|
field.setAccessible(true);
|
|
|
|
field.set(gameProfile, UUID.randomUUID());
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
this.onProfileLookupSucceeded(gameProfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onProfileLookupSucceeded(GameProfile profile) {
|
2014-06-04 22:40:15 +02:00
|
|
|
gameProfile = WrappedGameProfile.fromHandle(profile);
|
2014-04-18 22:14:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|