Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true)
- public void onLogin(AsyncPlayerPreLoginEvent event)
- {
- if (!this.plugin.isReady())
- {
- event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "AutoUBL is not ready");
- return;
- }
- if (this.plugin.isUUIDReady()) {
- try
- {
- if (this.plugin.isBanned(event.getName(), event.getUniqueId())) {
- event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, this.plugin.getBanMessage(event.getUniqueId()));
- }
- return;
- }
- catch (NoSuchMethodError ex)
- {
- this.plugin.getLogger().warning("This server is outdated so we are forced to fall back on a slow inefficient method fetcher player UUIDs from Mojangs API server. Please consider updating to at least the latest CB 1.7.5-R0.1-SNAPSHOT or later");
- try
- {
- String ign = event.getName();
- UUID uuid = UUIDFetcher.getUUIDOf(ign);
- if (this.plugin.isBanned(ign, uuid)) {
- event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, this.plugin.getBanMessage(uuid));
- }
- }
- catch (Exception ex1)
- {
- this.plugin.getLogger().log(Level.WARNING, "Failed to lookup UUID of " + event.getName(), ex1);
- event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "Authentication failed due to " + ex1.getLocalizedMessage());
- }
- return;
- }
- }
- if (this.plugin.isBanned(event.getName())) {
- event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, this.plugin.getBanMessage(event.getName()));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment