本文整理汇总了Java中com.mojang.authlib.ProfileLookupCallback.onProfileLookupSucceeded方法的典型用法代码示例。如果您正苦于以下问题:Java ProfileLookupCallback.onProfileLookupSucceeded方法的具体用法?Java ProfileLookupCallback.onProfileLookupSucceeded怎么用?Java ProfileLookupCallback.onProfileLookupSucceeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mojang.authlib.ProfileLookupCallback
的用法示例。
在下文中一共展示了ProfileLookupCallback.onProfileLookupSucceeded方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookupNames
import com.mojang.authlib.ProfileLookupCallback; //导入方法依赖的package包/类
private static void lookupNames(MinecraftServer server, Collection<String> names, ProfileLookupCallback callback)
{
String[] astring = (String[])Iterators.toArray(Iterators.filter(names.iterator(), new Predicate<String>()
{
public boolean apply(String p_apply_1_)
{
return !StringUtils.isNullOrEmpty(p_apply_1_);
}
}), String.class);
if (server.isServerInOnlineMode())
{
server.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback);
}
else
{
for (String s : astring)
{
UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, s));
GameProfile gameprofile = new GameProfile(uuid, s);
callback.onProfileLookupSucceeded(gameprofile);
}
}
}
示例2: getGameProfile
import com.mojang.authlib.ProfileLookupCallback; //导入方法依赖的package包/类
/**
* Get a GameProfile given the MinecraftServer and the player's username.
* The UUID of the GameProfile will <b>not</b> be null. If the server is offline, a UUID based on the hash of the
* username will be used.
*/
private static GameProfile getGameProfile(MinecraftServer server, String username)
{
final GameProfile[] agameprofile = new GameProfile[1];
ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback()
{
public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_)
{
agameprofile[0] = p_onProfileLookupSucceeded_1_;
}
public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_)
{
agameprofile[0] = null;
}
};
server.getGameProfileRepository().findProfilesByNames(new String[] {username}, Agent.MINECRAFT, profilelookupcallback);
if (!server.isServerInOnlineMode() && agameprofile[0] == null)
{
UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, username));
GameProfile gameprofile = new GameProfile(uuid, username);
profilelookupcallback.onProfileLookupSucceeded(gameprofile);
}
return agameprofile[0];
}
示例3: lookupNames
import com.mojang.authlib.ProfileLookupCallback; //导入方法依赖的package包/类
private static void lookupNames(MinecraftServer server, Collection<String> names, ProfileLookupCallback callback)
{
String[] astring = (String[])Iterators.toArray(Iterators.filter(names.iterator(), new Predicate<String>()
{
public boolean apply(@Nullable String p_apply_1_)
{
return !StringUtils.isNullOrEmpty(p_apply_1_);
}
}), String.class);
if (server.isServerInOnlineMode())
{
server.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback);
}
else
{
for (String s : astring)
{
UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, s));
GameProfile gameprofile = new GameProfile(uuid, s);
callback.onProfileLookupSucceeded(gameprofile);
}
}
}
示例4: lookupProfile
import com.mojang.authlib.ProfileLookupCallback; //导入方法依赖的package包/类
private static GameProfile lookupProfile(GameProfileRepository profileRepoIn, String name)
{
final GameProfile[] agameprofile = new GameProfile[1];
ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback()
{
public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_)
{
agameprofile[0] = p_onProfileLookupSucceeded_1_;
}
public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_)
{
agameprofile[0] = null;
}
};
profileRepoIn.findProfilesByNames(new String[] {name}, Agent.MINECRAFT, profilelookupcallback);
if (!isOnlineMode() && agameprofile[0] == null)
{
UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, name));
GameProfile gameprofile = new GameProfile(uuid, name);
profilelookupcallback.onProfileLookupSucceeded(gameprofile);
}
return agameprofile[0];
}
示例5: func_152650_a
import com.mojang.authlib.ProfileLookupCallback; //导入方法依赖的package包/类
private static GameProfile func_152650_a(MinecraftServer p_152650_0_, String p_152650_1_)
{
final GameProfile[] agameprofile = new GameProfile[1];
ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback()
{
private static final String __OBFID = "CL_00001887";
public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_)
{
agameprofile[0] = p_onProfileLookupSucceeded_1_;
}
public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_)
{
agameprofile[0] = null;
}
};
p_152650_0_.func_152359_aw().findProfilesByNames(new String[] {p_152650_1_}, Agent.MINECRAFT, profilelookupcallback);
if (!p_152650_0_.isServerInOnlineMode() && agameprofile[0] == null)
{
UUID uuid = EntityPlayer.func_146094_a(new GameProfile((UUID)null, p_152650_1_));
GameProfile gameprofile = new GameProfile(uuid, p_152650_1_);
profilelookupcallback.onProfileLookupSucceeded(gameprofile);
}
return agameprofile[0];
}
示例6: func_152717_a
import com.mojang.authlib.ProfileLookupCallback; //导入方法依赖的package包/类
private static void func_152717_a(MinecraftServer p_152717_0_, Collection p_152717_1_, ProfileLookupCallback p_152717_2_)
{
String[] astring = (String[])Iterators.toArray(Iterators.filter(p_152717_1_.iterator(), new Predicate()
{
private static final String __OBFID = "CL_00001881";
public boolean func_152733_a(String p_152733_1_)
{
return !StringUtils.isNullOrEmpty(p_152733_1_);
}
public boolean apply(Object p_apply_1_)
{
return this.func_152733_a((String)p_apply_1_);
}
}), String.class);
if (p_152717_0_.isServerInOnlineMode())
{
p_152717_0_.func_152359_aw().findProfilesByNames(astring, Agent.MINECRAFT, p_152717_2_);
}
else
{
String[] astring1 = astring;
int i = astring.length;
for (int j = 0; j < i; ++j)
{
String s = astring1[j];
UUID uuid = EntityPlayer.func_146094_a(new GameProfile((UUID)null, s));
GameProfile gameprofile = new GameProfile(uuid, s);
p_152717_2_.onProfileLookupSucceeded(gameprofile);
}
}
}