Java Code Examples for com.mojang.authlib.GameProfile#getId()
The following examples show how to use
com.mojang.authlib.GameProfile#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TileEntityGlassesBridge.java From OpenPeripheral-Addons with MIT License | 6 votes |
private void queueEvent(String event, EntityPlayer user, IEventArgsSource source) { final GameProfile gameProfile = user.getGameProfile(); final UUID userId = gameProfile.getId(); final String idString = userId != null? userId.toString() : null; final String userName = gameProfile.getName(); for (IArchitectureAccess computer : computers) { final Object[] extra = source.getArgs(computer); final Object[] args = new Object[3 + extra.length]; System.arraycopy(extra, 0, args, 3, extra.length); args[0] = computer.peripheralName(); args[1] = userName; args[2] = idString; computer.signal(event, args); } }
Example 2
Source File: ResourceManager.java From The-5zig-Mod with MIT License | 6 votes |
public void loadPlayerTextures(final GameProfile gameProfile) { if (gameProfile == null || gameProfile.getId() == null) { return; } PlayerResource playerResource; if (playerProfile.getName().equals(gameProfile.getName())) { if (ownPlayerResource == null) { ownPlayerResource = loadPlayerResource(playerProfile); } } else { playerResource = playerResources.getIfPresent(gameProfile.getId()); if (playerResource != null) { MinecraftFactory.getClassProxyCallback().getLogger().debug("Loaded player resource textures from cache for player " + gameProfile.getName()); } else { playerResources.put(gameProfile.getId(), loadPlayerResource(gameProfile)); } } }
Example 3
Source File: ResourceManager.java From The-5zig-Mod with MIT License | 5 votes |
public void loadPlayerTextures(final GameProfile gameProfile) { if (gameProfile == null || gameProfile.getId() == null) { return; } PlayerResource playerResource; if (playerProfile.getName().equals(gameProfile.getName())) { if (ownPlayerResource != null) { playerResource = ownPlayerResource; } else { playerResource = ownPlayerResource = loadPlayerResource(playerProfile); } } else { playerResource = playerResources.getIfPresent(gameProfile.getId()); if (playerResource != null) { MinecraftFactory.getClassProxyCallback().getLogger().debug("Loaded player resource textures from cache for player " + gameProfile.getName()); } else { playerResources.put(gameProfile.getId(), loadPlayerResource(gameProfile)); } } if (playerResource == null) { return; } if (playerResource.getItemModelResources() != null) { for (ItemModelResource itemModelResource : playerResource.getItemModelResources()) { ResourceLocation resourceLocation = (ResourceLocation) itemModelResource.getResourceLocation(); if (((Variables) MinecraftFactory.getVars()).getTextureManager().b(resourceLocation) == null) { ((Variables) MinecraftFactory.getVars()).getTextureManager().a(resourceLocation, (SimpleTexture) itemModelResource.getSimpleTexture()); } } } }
Example 4
Source File: FaweForge.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public UUID getUUID(String name) { try { GameProfile profile = MinecraftServer.getServer().getPlayerProfileCache().getGameProfileForUsername(name); return profile.getId(); } catch (Throwable e) { return null; } }
Example 5
Source File: CraftPlayerProfile.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override public String setName(@Nullable String name) { GameProfile prev = this.profile; this.profile = new GameProfile(prev.getId(), name); copyProfileProperties(prev, this.profile); return prev.getName(); }
Example 6
Source File: CraftPlayerProfile.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override public UUID setId(@Nullable UUID uuid) { GameProfile prev = this.profile; this.profile = new GameProfile(uuid, prev.getName()); copyProfileProperties(prev, this.profile); return prev.getId(); }
Example 7
Source File: UUIDUtil.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public static UUID getClientUUID() { GameProfile profile = Minecraft.getMinecraft().getSession().getProfile(); if (profile != null) { UUID id = profile.getId(); if (id != null) return id; } EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; if (thePlayer != null) return thePlayer.getUniqueID(); return null; }
Example 8
Source File: PacketPlayOutPlayerInfo.java From TAB with Apache License 2.0 | 5 votes |
public static PlayerInfoData fromNMS(Object nmsData) throws Exception{ int ping = PING.getInt(nmsData); EnumGamemode gamemode = EnumGamemode.fromNMS(GAMEMODE.get(nmsData)); GameProfile profile = (GameProfile) PROFILE.get(nmsData); Object nmsComponent = LISTNAME.get(nmsData); IChatBaseComponent listName = IChatBaseComponent.fromString(MethodAPI.getInstance().componentToString(nmsComponent)); return new PlayerInfoData(profile.getName(), profile.getId(), profile.getProperties(), ping, gamemode, listName); }
Example 9
Source File: FaweForge.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public UUID getUUID(String name) { try { GameProfile profile = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache().getGameProfileForUsername(name); return profile.getId(); } catch (Throwable e) { return null; } }
Example 10
Source File: ResourceManager.java From The-5zig-Mod with MIT License | 5 votes |
public void loadPlayerTextures(final GameProfile gameProfile) { if (gameProfile == null || gameProfile.getId() == null) { return; } PlayerResource playerResource = null; if (playerProfile.getName().equals(gameProfile.getName())) { if (ownPlayerResource != null) { playerResource = ownPlayerResource; } else { playerResource = ownPlayerResource = loadPlayerResource(playerProfile); } } else { playerResource = playerResources.getIfPresent(gameProfile.getId()); if (playerResource != null) { MinecraftFactory.getClassProxyCallback().getLogger().debug("Loaded player resource textures from cache for player " + gameProfile.getName()); } else { playerResources.put(gameProfile.getId(), loadPlayerResource(gameProfile)); } } if (playerResource == null) { return; } if (playerResource.getItemModelResources() != null) { for (ItemModelResource itemModelResource : playerResource.getItemModelResources()) { ResourceLocation resourceLocation = (ResourceLocation) itemModelResource.getResourceLocation(); if (((Variables) MinecraftFactory.getVars()).getTextureManager().b(resourceLocation) == null) { ((Variables) MinecraftFactory.getVars()).getTextureManager().a(resourceLocation, (SimpleTexture) itemModelResource.getSimpleTexture()); } } } }
Example 11
Source File: ResourceManager.java From The-5zig-Mod with MIT License | 5 votes |
public void loadPlayerTextures(final GameProfile gameProfile) { if (gameProfile == null || gameProfile.getId() == null) { return; } PlayerResource playerResource; if (playerProfile.getName().equals(gameProfile.getName())) { if (ownPlayerResource != null) { playerResource = ownPlayerResource; } else { playerResource = ownPlayerResource = loadPlayerResource(playerProfile); } } else { playerResource = playerResources.getIfPresent(gameProfile.getId()); if (playerResource != null) { MinecraftFactory.getClassProxyCallback().getLogger().debug("Loaded player resource textures from cache for player " + gameProfile.getName()); } else { playerResources.put(gameProfile.getId(), loadPlayerResource(gameProfile)); } } if (playerResource == null) { return; } if (playerResource.getItemModelResources() != null) { for (ItemModelResource itemModelResource : playerResource.getItemModelResources()) { ResourceLocation resourceLocation = (ResourceLocation) itemModelResource.getResourceLocation(); if (((Variables) MinecraftFactory.getVars()).getTextureManager().b(resourceLocation) == null) { ((Variables) MinecraftFactory.getVars()).getTextureManager().a(resourceLocation, (SimpleTexture) itemModelResource.getSimpleTexture()); } } } }
Example 12
Source File: FaweForge.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public UUID getUUID(String name) { try { GameProfile profile = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache().getGameProfileForUsername(name); return profile.getId(); } catch (Throwable e) { return null; } }
Example 13
Source File: FaweForge.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Override public UUID getUUID(String name) { try { GameProfile profile = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerProfileCache().getGameProfileForUsername(name); return profile.getId(); } catch (Throwable e) { return null; } }
Example 14
Source File: TileEntitySecurityStation.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public boolean isPlayerOnWhiteList(EntityPlayer player){ for(int i = 0; i < sharedUsers.size(); i++) { GameProfile user = sharedUsers.get(i); if(gameProfileEquals(user, player.getGameProfile())) { if(user.getId() == null && player.getGameProfile().getId() != null) { sharedUsers.set(i, player.getGameProfile()); Log.info("Legacy conversion: Security Station shared username '" + player.getCommandSenderName() + "' is now using UUID '" + player.getGameProfile().getId() + "'."); } return true; } } return false; }
Example 15
Source File: ResourceManager.java From The-5zig-Mod with MIT License | 5 votes |
public void loadPlayerTextures(final GameProfile gameProfile) { if (gameProfile == null || gameProfile.getId() == null) { return; } PlayerResource playerResource; if (playerProfile.getName().equals(gameProfile.getName())) { if (ownPlayerResource != null) { playerResource = ownPlayerResource; } else { playerResource = ownPlayerResource = loadPlayerResource(playerProfile); } } else { playerResource = playerResources.getIfPresent(gameProfile.getId()); if (playerResource != null) { MinecraftFactory.getClassProxyCallback().getLogger().debug("Loaded player resource textures from cache for player " + gameProfile.getName()); } else { playerResources.put(gameProfile.getId(), loadPlayerResource(gameProfile)); } } if (playerResource == null) { return; } if (playerResource.getItemModelResources() != null) { for (ItemModelResource itemModelResource : playerResource.getItemModelResources()) { ResourceLocation resourceLocation = (ResourceLocation) itemModelResource.getResourceLocation(); if (((Variables) MinecraftFactory.getVars()).getTextureManager().b(resourceLocation) == null) { ((Variables) MinecraftFactory.getVars()).getTextureManager().a(resourceLocation, (SimpleTexture) itemModelResource.getSimpleTexture()); } } } }
Example 16
Source File: TileEntitySecurityStation.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public boolean hasPlayerHacked(EntityPlayer player){ for(int i = 0; i < hackedUsers.size(); i++) { GameProfile user = hackedUsers.get(i); if(gameProfileEquals(user, player.getGameProfile())) { if(user.getId() == null && player.getGameProfile().getId() != null) { hackedUsers.set(i, player.getGameProfile()); Log.info("Legacy conversion: Security Station hacked username '" + player.getCommandSenderName() + "' is now using UUID '" + player.getGameProfile().getId() + "'."); } return true; } } return false; }
Example 17
Source File: CartTools.java From NEI-Integration with MIT License | 5 votes |
/** * Sets a carts owner. * <p/> * The is really only needed by the bukkit ports. * * @param cart * @param owner */ public static void setCartOwner(EntityMinecart cart, GameProfile owner) { if (!cart.worldObj.isRemote) { NBTTagCompound data = cart.getEntityData(); if (owner.getName() != null) data.setString("owner", owner.getName()); if (owner.getId() != null) data.setString("ownerId", owner.getId().toString()); } }
Example 18
Source File: AdapterSkull.java From OpenPeripheral-Integration with MIT License | 5 votes |
@MultipleReturn @ScriptCallable(returnTypes = { ReturnType.STRING, ReturnType.STRING }) public Object[] getPlayer(TileEntitySkull skull) { if (skull.func_145904_a() != 3) return new Object[] { null, null }; GameProfile profile = skull.func_152108_a(); if (profile == null) return new Object[] { null, null }; return new Object[] { profile.getId(), profile.getName() }; }
Example 19
Source File: TofuVillage.java From TofuCraftReload with MIT License | 4 votes |
private UUID findUUID(String name) { if (this.world == null || this.world.getMinecraftServer() == null) return EntityPlayer.getOfflineUUID(name); GameProfile profile = this.world.getMinecraftServer().getPlayerProfileCache().getGameProfileForUsername(name); return profile == null ? EntityPlayer.getOfflineUUID(name) : profile.getId(); }
Example 20
Source File: CraftPlayerProfile.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static PlayerProfile asBukkitCopy(GameProfile gameProfile) { CraftPlayerProfile profile = new CraftPlayerProfile(gameProfile.getId(), gameProfile.getName()); copyProfileProperties(gameProfile, profile.profile); return profile; }