Java Code Examples for org.bukkit.Bukkit#createProfile()
The following examples show how to use
org.bukkit.Bukkit#createProfile() .
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: PaperPlayerInfo.java From AntiVPN with MIT License | 6 votes |
private static String nameExpensive(UUID uuid) throws IOException { // Currently-online lookup Player player = Bukkit.getPlayer(uuid); if (player != null) { nameCache.put(player.getName(), uuid); return player.getName(); } // Cached profile lookup PlayerProfile profile = Bukkit.createProfile(uuid); if ((profile.isComplete() || profile.completeFromCache()) && profile.getName() != null && profile.getId() != null) { nameCache.put(profile.getName(), profile.getId()); return profile.getName(); } // Network lookup if (profile.complete(false) && profile.getName() != null && profile.getId() != null) { nameCache.put(profile.getName(), profile.getId()); return profile.getName(); } // Sorry, nada throw new IOException("Could not load player data from Mojang (rate-limited?)"); }
Example 2
Source File: PaperPlayerInfo.java From AntiVPN with MIT License | 6 votes |
private static UUID uuidExpensive(String name) throws IOException { // Currently-online lookup Player player = Bukkit.getPlayer(name); if (player != null) { uuidCache.put(player.getUniqueId(), name); return player.getUniqueId(); } // Cached profile lookup PlayerProfile profile = Bukkit.createProfile(name); if ((profile.isComplete() || profile.completeFromCache()) && profile.getName() != null && profile.getId() != null) { uuidCache.put(profile.getId(), profile.getName()); return profile.getId(); } // Network lookup if (profile.complete(false) && profile.getName() != null && profile.getId() != null) { uuidCache.put(profile.getId(), profile.getName()); return profile.getId(); } // Sorry, nada throw new IOException("Could not load player data from Mojang (rate-limited?)"); }
Example 3
Source File: PlayerProfileTypeAdapter.java From VoxelGamesLibv2 with MIT License | 6 votes |
@Override public PlayerProfile deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { Dummy dummy = jsonDeserializationContext.deserialize(jsonElement, Dummy.class); PlayerProfile playerProfile; if (dummy.id != null) { playerProfile = Bukkit.createProfile(dummy.id); } else if (dummy.name != null) { playerProfile = Bukkit.createProfile(dummy.name); } else { throw new VoxelGameLibException("Could not parse player profile! " + jsonElement); } playerProfile.setProperties(dummy.properties); playerProfile.setId(dummy.id); playerProfile.setName(dummy.name); return playerProfile; }
Example 4
Source File: TextureHandler.java From VoxelGamesLibv2 with MIT License | 5 votes |
@Override public void enable() { if (!skinsFolder.exists()) { log.warning("Skins folder doesn't exit, creating"); skinsFolder.mkdirs(); } File[] files = skinsFolder.listFiles(); if (files != null) { Arrays.stream(files).map(file -> file.getName().replace(".json", "")).forEach(this::loadSkin); } log.info("Loaded " + loadedSkins.size() + " skins"); fetchSkin(118300, null); // loading skins 0-9A-Z from provided ids try { InputStreamReader reader = new InputStreamReader(voxelGamesLib.getResource("ids.json")); //noinspection unchecked Map<String, Double> ids = gson.fromJson(reader, Map.class); ids.forEach((key, value) -> fetchSkin(value.intValue(), key, null)); reader.close(); } catch (IOException e) { log.warning("Error while loading skins, some features of VGL might not work as expected!"); e.printStackTrace(); } cache.init(); // setup error profile errorProfile = Bukkit.createProfile("MHF_Question"); VoxelGamesLib.newChain().async(() -> cache.fill(errorProfile)).execute(); }
Example 5
Source File: AsyncPlayerPreLoginEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
public AsyncPlayerPreLoginEvent(final String name, final InetAddress ipAddress, final UUID uniqueId) { // Paper start this(name, ipAddress, uniqueId, Bukkit.createProfile(uniqueId, name)); }
Example 6
Source File: TextureHandler.java From VoxelGamesLibv2 with MIT License | 4 votes |
public PlayerProfile getPlayerProfile(Skin skin) { PlayerProfile playerProfile = Bukkit.createProfile(skin.data.uuid, skin.name); playerProfile.setProperty(new ProfileProperty("textures", skin.data.texture.value, skin.data.texture.signature)); return playerProfile; }
Example 7
Source File: TextureCache.java From VoxelGamesLibv2 with MIT License | 4 votes |
public PlayerProfile get(String name) { PlayerProfile playerProfile = Bukkit.createProfile(name); currentNames.add(name); fill(playerProfile); return playerProfile; }
Example 8
Source File: TextureCache.java From VoxelGamesLibv2 with MIT License | 4 votes |
public PlayerProfile get(UUID id) { PlayerProfile playerProfile = Bukkit.createProfile(id); currentUUIDs.add(id); fill(playerProfile); return playerProfile; }