mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-15 15:28:36 +01:00
Return a self constructed gameprofile if profile lookup failed.
This commit is contained in:
parent
8f2c5d6e54
commit
8410904f94
@ -358,7 +358,7 @@ public class DisguiseUtilities {
|
||||
return getProfileFromMojang(playerName, (Object) runnableIfCantReturn);
|
||||
}
|
||||
|
||||
private static WrappedGameProfile getProfileFromMojang(String origName, final Object runnable) {
|
||||
private static WrappedGameProfile getProfileFromMojang(final String origName, final Object runnable) {
|
||||
final String playerName = origName.toLowerCase();
|
||||
if (gameProfiles.containsKey(playerName)) {
|
||||
if (gameProfiles.get(playerName) != null) {
|
||||
@ -379,7 +379,7 @@ public class DisguiseUtilities {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(libsDisguises, new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
final WrappedGameProfile gameProfile = lookupGameProfile(playerName);
|
||||
final WrappedGameProfile gameProfile = lookupGameProfile(origName);
|
||||
Bukkit.getScheduler().runTask(libsDisguises, new Runnable() {
|
||||
public void run() {
|
||||
if (gameProfiles.containsKey(playerName) && gameProfiles.get(playerName) == null) {
|
||||
|
@ -1,8 +1,5 @@
|
||||
package me.libraryaddict.disguise.utilities;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
@ -17,14 +14,6 @@ public class LibsProfileLookupCaller implements ProfileLookupCallback {
|
||||
|
||||
@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
|
||||
|
@ -530,7 +530,10 @@ public class ReflectionManager {
|
||||
.getMethod("findProfilesByNames", String[].class, agent.getClass(),
|
||||
Class.forName("net.minecraft.util.com.mojang.authlib.ProfileLookupCallback"))
|
||||
.invoke(profileRepo, new String[] { playername }, agent, callback);
|
||||
return callback.getGameProfile();
|
||||
if (callback.getGameProfile() != null) {
|
||||
return callback.getGameProfile();
|
||||
}
|
||||
return getGameProfile(null, playername);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user