com.mojang.authlib.exceptions.AuthenticationUnavailableException Java Examples
The following examples show how to use
com.mojang.authlib.exceptions.AuthenticationUnavailableException.
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: YggdrasilMinecraftSessionService.java From Launcher with GNU General Public License v3.0 | 8 votes |
@Override public GameProfile hasJoinedServer(GameProfile profile, String serverID) throws AuthenticationUnavailableException { String username = profile.getName(); if (LogHelper.isDebugEnabled()) { LogHelper.debug("checkServer, Username: '%s', Server ID: %s", username, serverID); } // Make checkServer request PlayerProfile pp; try { pp = new CheckServerRequest(username, serverID).request().playerProfile; } catch (Exception e) { LogHelper.error(e); throw new AuthenticationUnavailableException(e); } // Return profile if found return pp == null ? null : toGameProfile(pp); }
Example #2
Source File: YggdrasilMinecraftSessionService.java From Launcher with GNU General Public License v3.0 | 6 votes |
@Override public void joinServer(GameProfile profile, String accessToken, String serverID) throws AuthenticationException { // Join server String username = profile.getName(); if (LogHelper.isDebugEnabled()) { LogHelper.debug("joinServer, Username: '%s', Access token: %s, Server ID: %s", username, accessToken, serverID); } // Make joinServer request boolean success; try { success = new JoinServerRequest(username, accessToken, serverID).request().allow; } catch (Exception e) { LogHelper.error(e); throw new AuthenticationUnavailableException(e); } // Verify is success if (!success) throw new AuthenticationException("Bad Login (Clientside)"); }
Example #3
Source File: YggdrasilMinecraftSessionService.java From Launcher with GNU General Public License v3.0 | 4 votes |
@Override public GameProfile hasJoinedServer(GameProfile profile, String serverID, InetAddress address) throws AuthenticationUnavailableException { return hasJoinedServer(profile, serverID); }
Example #4
Source File: ThreadPlayerLookupUUID.java From Thermos with GNU General Public License v3.0 | 4 votes |
public void run() { GameProfile gameprofile = NetHandlerLoginServer.getGameProfile(this.field_151292_a); try { // Spigot Start if (!this.mcServer.isServerInOnlineMode()) { this.field_151292_a.initUUID(); fireLoginEvents(); return; } // Spigot End String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.getLoginServerId(this.field_151292_a), this.mcServer.getKeyPair().getPublic(), NetHandlerLoginServer.getSecretKey(this.field_151292_a)))).toString(16); GameProfile profile = this.mcServer.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s); if (profile != null) { NetHandlerLoginServer.processPlayerLoginGameProfile(this.field_151292_a, profile); fireLoginEvents(); // Spigot } else if (this.mcServer.isSinglePlayer()) { NetHandlerLoginServer.getLogger().warn("Failed to verify username but will let them in anyway!"); NetHandlerLoginServer.processPlayerLoginGameProfile(this.field_151292_a, this.field_151292_a.func_152506_a(gameprofile)); NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT); } else { this.field_151292_a.func_147322_a("Failed to verify username!"); NetHandlerLoginServer.getLogger().error("Username \'" + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + "\' tried to join with an invalid session"); } } catch (AuthenticationUnavailableException authenticationunavailableexception) { if (this.mcServer.isSinglePlayer()) { NetHandlerLoginServer.getLogger().warn("Authentication servers are down but will let them in anyway!"); NetHandlerLoginServer.processPlayerLoginGameProfile(this.field_151292_a, this.field_151292_a.func_152506_a(gameprofile)); NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT); } else { this.field_151292_a.func_147322_a("Authentication servers are down. Please try again later, sorry!"); NetHandlerLoginServer.getLogger().error("Couldn\'t verify username because servers are unavailable"); } // CraftBukkit start - catch all exceptions } catch (Exception exception) { this.field_151292_a.func_147322_a("Failed to verify username!"); this.mcServer.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName(), exception); // CraftBukkit end } }
Example #5
Source File: NMSAuthService.java From AlwaysOnline with GNU General Public License v2.0 | 3 votes |
@Override public GameProfile hasJoinedServer(GameProfile user, String serverId) throws AuthenticationUnavailableException { if (AlwaysOnline.MOJANG_OFFLINE_MODE) { UUID uuid = this.database.getUUID(user.getName()); if (uuid != null) { return new GameProfile(uuid, user.getName()); } else { SpigotLoader.getPlugin(SpigotLoader.class).log(Level.INFO, user.getName() + " " + "never joined this server before when mojang servers were online. Denying their access."); throw new AuthenticationUnavailableException("Mojang servers are offline and we can't authenticate the player with our own system."); } } else { return super.hasJoinedServer(user, serverId); } }