LibsDisguises/src/me/libraryaddict/disguise/utilities/LibsProfileLookupCaller.java
libraryaddict 74d5dbce9e Read desc
Added methods for other plugins to request GameProfiles
Changed GameProfiles to lookup UUID's with a different API as the old
one barfed
2014-04-19 08:14:02 +12:00

34 lines
939 B
Java

package me.libraryaddict.disguise.utilities;
import java.lang.reflect.Field;
import java.util.UUID;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import net.minecraft.util.com.mojang.authlib.ProfileLookupCallback;
public class LibsProfileLookupCaller implements ProfileLookupCallback {
private GameProfile gameProfile;
public GameProfile getGameProfile() {
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) {
gameProfile = profile;
}
}