LeonTG77

UBL UUID Lookup

Aug 3rd, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.62 KB | None | 0 0
  1.  @EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true)
  2.   public void onLogin(AsyncPlayerPreLoginEvent event)
  3.   {
  4.     if (!this.plugin.isReady())
  5.     {
  6.       event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "AutoUBL is not ready");
  7.       return;
  8.     }
  9.     if (this.plugin.isUUIDReady()) {
  10.       try
  11.       {
  12.         if (this.plugin.isBanned(event.getName(), event.getUniqueId())) {
  13.           event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, this.plugin.getBanMessage(event.getUniqueId()));
  14.         }
  15.         return;
  16.       }
  17.       catch (NoSuchMethodError ex)
  18.       {
  19.         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");
  20.         try
  21.         {
  22.           String ign = event.getName();
  23.           UUID uuid = UUIDFetcher.getUUIDOf(ign);
  24.           if (this.plugin.isBanned(ign, uuid)) {
  25.             event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, this.plugin.getBanMessage(uuid));
  26.           }
  27.         }
  28.         catch (Exception ex1)
  29.         {
  30.           this.plugin.getLogger().log(Level.WARNING, "Failed to lookup UUID of " + event.getName(), ex1);
  31.           event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "Authentication failed due to " + ex1.getLocalizedMessage());
  32.         }
  33.         return;
  34.       }
  35.     }
  36.     if (this.plugin.isBanned(event.getName())) {
  37.       event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, this.plugin.getBanMessage(event.getName()));
  38.     }
  39.   }
Advertisement
Add Comment
Please, Sign In to add comment