Java Code Examples for com.velocitypowered.api.proxy.Player#getUniqueId()
The following examples show how to use
com.velocitypowered.api.proxy.Player#getUniqueId() .
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: PlayerOnlineListener.java From Plan with GNU Lesser General Public License v3.0 | 6 votes |
public void actOnServerSwitch(ServerConnectedEvent event) { Player player = event.getPlayer(); String playerName = player.getUsername(); UUID playerUUID = player.getUniqueId(); long time = System.currentTimeMillis(); // Replaces the current session in the cache. Session session = new Session(playerUUID, serverInfo.getServerUUID(), time, null, null); session.putRawData(SessionKeys.NAME, playerName); session.putRawData(SessionKeys.SERVER_NAME, "Proxy Server"); sessionCache.cacheSession(playerUUID, session); if (config.isTrue(ExportSettings.EXPORT_ON_ONLINE_STATUS_CHANGE)) { processing.submitNonCritical(() -> exporter.exportPlayerPage(playerUUID, playerName)); } JSONCache.invalidate(DataID.SERVERS); }
Example 2
Source File: TabPlayer.java From TAB with Apache License 2.0 | 5 votes |
public TabPlayer(Player p, String server) { player = p; world = server; channel = ((ConnectedPlayer)player).getConnection().getChannel(); tablistId = UUID.nameUUIDFromBytes(("OfflinePlayer:" + p.getUsername()).getBytes(Charsets.UTF_8)); uniqueId = p.getUniqueId(); name = p.getUsername(); version = ProtocolVersion.fromNumber(player.getProtocolVersion().getProtocol()); init(); }
Example 3
Source File: PlayerOnlineListener.java From Plan with GNU Lesser General Public License v3.0 | 5 votes |
public void actOnLogin(PostLoginEvent event) { Player player = event.getPlayer(); UUID playerUUID = player.getUniqueId(); String playerName = player.getUsername(); InetAddress address = player.getRemoteAddress().getAddress(); long time = System.currentTimeMillis(); Session session = new Session(playerUUID, serverInfo.getServerUUID(), time, null, null); session.putRawData(SessionKeys.NAME, playerName); session.putRawData(SessionKeys.SERVER_NAME, "Proxy Server"); sessionCache.cacheSession(playerUUID, session); Database database = dbSystem.getDatabase(); boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS); if (gatheringGeolocations) { database.executeTransaction( new GeoInfoStoreTransaction(playerUUID, address, time, geolocationCache::getCountry) ); } database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName)); processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_JOIN)); if (config.isTrue(ExportSettings.EXPORT_ON_ONLINE_STATUS_CHANGE)) { processing.submitNonCritical(() -> exporter.exportPlayerPage(playerUUID, playerName)); } UUID serverUUID = serverInfo.getServerUUID(); JSONCache.invalidateMatching(DataID.SERVER_OVERVIEW); JSONCache.invalidate(DataID.GRAPH_ONLINE, serverUUID); JSONCache.invalidate(DataID.SERVERS); JSONCache.invalidate(DataID.SESSIONS); }
Example 4
Source File: PlayerOnlineListener.java From Plan with GNU Lesser General Public License v3.0 | 5 votes |
@Subscribe(order = PostOrder.NORMAL) public void beforeLogout(DisconnectEvent event) { Player player = event.getPlayer(); UUID playerUUID = player.getUniqueId(); String playerName = player.getUsername(); processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID, playerName, CallEvents.PLAYER_LEAVE)); }
Example 5
Source File: PlayerOnlineListener.java From Plan with GNU Lesser General Public License v3.0 | 5 votes |
public void actOnLogout(DisconnectEvent event) { Player player = event.getPlayer(); String playerName = player.getUsername(); UUID playerUUID = player.getUniqueId(); sessionCache.endSession(playerUUID, System.currentTimeMillis()); if (config.isTrue(ExportSettings.EXPORT_ON_ONLINE_STATUS_CHANGE)) { processing.submitNonCritical(() -> exporter.exportPlayerPage(playerUUID, playerName)); } processing.submit(() -> { JSONCache.invalidateMatching( DataID.SERVER_OVERVIEW, DataID.SESSIONS, DataID.GRAPH_WORLD_PIE, DataID.GRAPH_PUNCHCARD, DataID.KILLS, DataID.ONLINE_OVERVIEW, DataID.SESSIONS_OVERVIEW, DataID.PVP_PVE, DataID.GRAPH_UNIQUE_NEW, DataID.GRAPH_CALENDAR ); UUID serverUUID = serverInfo.getServerUUID(); JSONCache.invalidate(DataID.GRAPH_ONLINE, serverUUID); JSONCache.invalidate(DataID.SERVERS); }); }
Example 6
Source File: VelocityContextManager.java From LuckPerms with MIT License | 4 votes |
@Override public UUID getUniqueId(Player player) { return player.getUniqueId(); }