Java Code Examples for org.bukkit.event.player.AsyncPlayerPreLoginEvent#getUniqueId()
The following examples show how to use
org.bukkit.event.player.AsyncPlayerPreLoginEvent#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: ListenerLogin.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority=EventPriority.NORMAL, ignoreCancelled=true) public void beforeLogin(AsyncPlayerPreLoginEvent e) { FileConfiguration config = this.expansion.getConfig("citizens-compatibility.yml"); if(!config.getBoolean("prevent-login", false)) return; UUID uuid = e.getUniqueId(); NPCManager npcManager = this.expansion.getNPCManager(); NPC npc = npcManager.getNPC(uuid); if(npc == null) return; String message = this.expansion.getPlugin().getLanguageMessageColored("citizens-join-deny"); e.setKickMessage(message); e.setLoginResult(Result.KICK_OTHER); }
Example 2
Source File: LoginListener.java From ChangeSkin with MIT License | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onPreLogin(AsyncPlayerPreLoginEvent preLoginEvent) { if (preLoginEvent.getLoginResult() != Result.ALLOWED) { //in this event isCancelled option in the annotation doesn't work return; } UUID playerUuid = preLoginEvent.getUniqueId(); String playerName = preLoginEvent.getName(); UserPreference preferences = core.getStorage().getPreferences(playerUuid); if (preferences == null) { return; } plugin.startSession(playerUuid, preferences); Optional<SkinModel> optSkin = preferences.getTargetSkin(); if (optSkin.isPresent()) { SkinModel targetSkin = optSkin.get(); if (!preferences.isKeepSkin()) { targetSkin = core.checkAutoUpdate(targetSkin); } preferences.setTargetSkin(targetSkin); save(preferences); } else if (core.getConfig().getBoolean("restoreSkins")) { refetchSkin(playerName, preferences); } if (!preferences.getTargetSkin().isPresent()) { getRandomSkin().ifPresent(preferences::setTargetSkin); } }
Example 3
Source File: BukkitPlugin.java From ServerListPlus with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerLogin(AsyncPlayerPreLoginEvent event) { if (core == null) return; // Too early, we haven't finished initializing yet UUID uuid = null; try { uuid = event.getUniqueId(); } catch (NoSuchMethodError ignored) {} core.updateClient(event.getAddress(), uuid, event.getName()); }