本文整理汇总了Java中com.mojang.authlib.exceptions.AuthenticationUnavailableException类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationUnavailableException类的具体用法?Java AuthenticationUnavailableException怎么用?Java AuthenticationUnavailableException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationUnavailableException类属于com.mojang.authlib.exceptions包,在下文中一共展示了AuthenticationUnavailableException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasJoinedServer
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public GameProfile hasJoinedServer(GameProfile user, String serverId, InetAddress address) throws AuthenticationUnavailableException {
Map<String, Object> arguments = new HashMap();
arguments.put("username", user.getName());
arguments.put("serverId", serverId);
if (address != null) {
arguments.put("ip", address.getHostAddress());
}
URL url = HttpAuthenticationService.concatenateURL(CHECK_URL, HttpAuthenticationService.buildQuery(arguments));
try {
HasJoinedMinecraftServerResponse response = (HasJoinedMinecraftServerResponse)this.getAuthenticationService().makeRequest(url, (Object)null, HasJoinedMinecraftServerResponse.class);
if (response != null && response.getId() != null) {
GameProfile result = new GameProfile(response.getId(), user.getName());
if (response.getProperties() != null) {
result.getProperties().putAll(response.getProperties());
}
return result;
} else {
return null;
}
} catch (AuthenticationUnavailableException var8) {
throw var8;
} catch (AuthenticationException var9) {
return null;
}
}
示例2: handleEncryptionRequest
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void handleEncryptionRequest(S01PacketEncryptionRequest p_147389_1_)
{
final SecretKey var2 = CryptManager.createNewSharedKey();
String var3 = p_147389_1_.func_149609_c();
PublicKey var4 = p_147389_1_.func_149608_d();
String var5 = (new BigInteger(CryptManager.getServerIdHash(var3, var4, var2))).toString(16);
try
{
this.func_147391_c().joinServer(this.field_147394_b.getSession().func_148256_e(), this.field_147394_b.getSession().getToken(), var5);
}
catch (AuthenticationUnavailableException var7)
{
this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
return;
}
catch (InvalidCredentialsException var8)
{
this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
return;
}
catch (AuthenticationException var9)
{
this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {var9.getMessage()}));
return;
}
this.field_147393_d.scheduleOutboundPacket(new C01PacketEncryptionResponse(var2, var4, p_147389_1_.func_149607_e()), new GenericFutureListener[] {new GenericFutureListener()
{
private static final String __OBFID = "CL_00000877";
public void operationComplete(Future p_operationComplete_1_)
{
NetHandlerLoginClient.this.field_147393_d.enableEncryption(var2);
}
}
});
}
示例3: run
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
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
}
}
示例4: processEncryptionResponse
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void processEncryptionResponse(C01PacketEncryptionResponse packetIn)
{
Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
PrivateKey privatekey = this.server.getKeyPair().getPrivate();
if (!Arrays.equals(this.verifyToken, packetIn.getVerifyToken(privatekey)))
{
throw new IllegalStateException("Invalid nonce!");
}
else
{
this.secretKey = packetIn.getSecretKey(privatekey);
this.currentLoginState = NetHandlerLoginServer.LoginState.AUTHENTICATING;
this.networkManager.enableEncryption(this.secretKey);
(new Thread("User Authenticator #" + AUTHENTICATOR_THREAD_ID.incrementAndGet())
{
public void run()
{
GameProfile gameprofile = NetHandlerLoginServer.this.loginGameProfile;
try
{
String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.this.serverId, NetHandlerLoginServer.this.server.getKeyPair().getPublic(), NetHandlerLoginServer.this.secretKey))).toString(16);
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);
if (NetHandlerLoginServer.this.loginGameProfile != null)
{
NetHandlerLoginServer.logger.info("UUID of player " + NetHandlerLoginServer.this.loginGameProfile.getName() + " is " + NetHandlerLoginServer.this.loginGameProfile.getId());
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else if (NetHandlerLoginServer.this.server.isSinglePlayer())
{
NetHandlerLoginServer.logger.warn("Failed to verify username but will let them in anyway!");
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else
{
NetHandlerLoginServer.this.closeConnection("Failed to verify username!");
NetHandlerLoginServer.logger.error("Username \'" + NetHandlerLoginServer.this.loginGameProfile.getName() + "\' tried to join with an invalid session");
}
}
catch (AuthenticationUnavailableException var3)
{
if (NetHandlerLoginServer.this.server.isSinglePlayer())
{
NetHandlerLoginServer.logger.warn("Authentication servers are down but will let them in anyway!");
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else
{
NetHandlerLoginServer.this.closeConnection("Authentication servers are down. Please try again later, sorry!");
NetHandlerLoginServer.logger.error("Couldn\'t verify username because servers are unavailable");
}
}
}
}).start();
}
}
示例5: handleEncryptionRequest
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void handleEncryptionRequest(S01PacketEncryptionRequest packetIn)
{
final SecretKey secretkey = CryptManager.createNewSharedKey();
String s = packetIn.getServerId();
PublicKey publickey = packetIn.getPublicKey();
String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().func_181041_d())
{
try
{
this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
}
catch (AuthenticationException var10)
{
logger.warn("Couldn\'t connect to auth servers but will continue to join LAN");
}
}
else
{
try
{
this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
}
catch (AuthenticationUnavailableException var7)
{
this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
return;
}
catch (InvalidCredentialsException var8)
{
this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
return;
}
catch (AuthenticationException authenticationexception)
{
this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
return;
}
}
this.networkManager.sendPacket(new C01PacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future <? super Void >> ()
{
public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception
{
NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey);
}
}, new GenericFutureListener[0]);
}
示例6: handleEncryptionRequest
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void handleEncryptionRequest(SPacketEncryptionRequest packetIn)
{
final SecretKey secretkey = CryptManager.createNewSharedKey();
String s = packetIn.getServerId();
PublicKey publickey = packetIn.getPublicKey();
String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().isOnLAN())
{
try
{
this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
}
catch (AuthenticationException var10)
{
LOGGER.warn("Couldn\'t connect to auth servers but will continue to join LAN");
}
}
else
{
try
{
this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
}
catch (AuthenticationUnavailableException var7)
{
this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
return;
}
catch (InvalidCredentialsException var8)
{
this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
return;
}
catch (AuthenticationException authenticationexception)
{
this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
return;
}
}
this.networkManager.sendPacket(new CPacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future <? super Void >> ()
{
public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception
{
NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey);
}
}, new GenericFutureListener[0]);
}
示例7: processEncryptionResponse
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void processEncryptionResponse(CPacketEncryptionResponse packetIn)
{
Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
PrivateKey privatekey = this.server.getKeyPair().getPrivate();
if (!Arrays.equals(this.verifyToken, packetIn.getVerifyToken(privatekey)))
{
throw new IllegalStateException("Invalid nonce!");
}
else
{
this.secretKey = packetIn.getSecretKey(privatekey);
this.currentLoginState = NetHandlerLoginServer.LoginState.AUTHENTICATING;
this.networkManager.enableEncryption(this.secretKey);
(new Thread("User Authenticator #" + AUTHENTICATOR_THREAD_ID.incrementAndGet())
{
public void run()
{
GameProfile gameprofile = NetHandlerLoginServer.this.loginGameProfile;
try
{
String s = (new BigInteger(CryptManager.getServerIdHash("", NetHandlerLoginServer.this.server.getKeyPair().getPublic(), NetHandlerLoginServer.this.secretKey))).toString(16);
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a());
if (NetHandlerLoginServer.this.loginGameProfile != null)
{
NetHandlerLoginServer.LOGGER.info("UUID of player {} is {}", new Object[] {NetHandlerLoginServer.this.loginGameProfile.getName(), NetHandlerLoginServer.this.loginGameProfile.getId()});
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else if (NetHandlerLoginServer.this.server.isSinglePlayer())
{
NetHandlerLoginServer.LOGGER.warn("Failed to verify username but will let them in anyway!");
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else
{
NetHandlerLoginServer.this.closeConnection("Failed to verify username!");
NetHandlerLoginServer.LOGGER.error("Username \'{}\' tried to join with an invalid session", new Object[] {gameprofile.getName()});
}
}
catch (AuthenticationUnavailableException var3)
{
if (NetHandlerLoginServer.this.server.isSinglePlayer())
{
NetHandlerLoginServer.LOGGER.warn("Authentication servers are down but will let them in anyway!");
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else
{
NetHandlerLoginServer.this.closeConnection("Authentication servers are down. Please try again later, sorry!");
NetHandlerLoginServer.LOGGER.error("Couldn\'t verify username because servers are unavailable");
}
}
}
@Nullable
private InetAddress func_191235_a()
{
SocketAddress socketaddress = NetHandlerLoginServer.this.networkManager.getRemoteAddress();
return NetHandlerLoginServer.this.server.func_190518_ac() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress)socketaddress).getAddress() : null;
}
}).start();
}
}
示例8: processEncryptionResponse
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void processEncryptionResponse(CPacketEncryptionResponse packetIn)
{
Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
PrivateKey privatekey = this.server.getKeyPair().getPrivate();
if (!Arrays.equals(this.verifyToken, packetIn.getVerifyToken(privatekey)))
{
throw new IllegalStateException("Invalid nonce!");
}
else
{
this.secretKey = packetIn.getSecretKey(privatekey);
this.currentLoginState = NetHandlerLoginServer.LoginState.AUTHENTICATING;
this.networkManager.enableEncryption(this.secretKey);
(new Thread("User Authenticator #" + AUTHENTICATOR_THREAD_ID.incrementAndGet())
{
public void run()
{
GameProfile gameprofile = NetHandlerLoginServer.this.loginGameProfile;
try
{
String s = (new BigInteger(CryptManager.getServerIdHash("", NetHandlerLoginServer.this.server.getKeyPair().getPublic(), NetHandlerLoginServer.this.secretKey))).toString(16);
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);
if (NetHandlerLoginServer.this.loginGameProfile != null)
{
NetHandlerLoginServer.LOGGER.info("UUID of player {} is {}", new Object[] {NetHandlerLoginServer.this.loginGameProfile.getName(), NetHandlerLoginServer.this.loginGameProfile.getId()});
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else if (NetHandlerLoginServer.this.server.isSinglePlayer())
{
NetHandlerLoginServer.LOGGER.warn("Failed to verify username but will let them in anyway!");
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else
{
NetHandlerLoginServer.this.closeConnection("Failed to verify username!");
NetHandlerLoginServer.LOGGER.error("Username \'{}\' tried to join with an invalid session", new Object[] {gameprofile.getName()});
}
}
catch (AuthenticationUnavailableException var3)
{
if (NetHandlerLoginServer.this.server.isSinglePlayer())
{
NetHandlerLoginServer.LOGGER.warn("Authentication servers are down but will let them in anyway!");
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else
{
NetHandlerLoginServer.this.closeConnection("Authentication servers are down. Please try again later, sorry!");
NetHandlerLoginServer.LOGGER.error("Couldn\'t verify username because servers are unavailable");
}
}
}
}).start();
}
}
示例9: run
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
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
}
}
示例10: run
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
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);
NetHandlerLoginServer.processPlayerLoginGameProfile(this.field_151292_a, this.mcServer.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s));
if (NetHandlerLoginServer.getGameProfile(this.field_151292_a) != null)
{
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
}
}
示例11: handleEncryptionRequest
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void handleEncryptionRequest(S01PacketEncryptionRequest p_147389_1_)
{
final SecretKey secretkey = CryptManager.createNewSharedKey();
String s = p_147389_1_.func_149609_c();
PublicKey publickey = p_147389_1_.func_149608_d();
String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
boolean flag = this.field_147394_b.func_147104_D() == null || !this.field_147394_b.func_147104_D().func_152585_d();
try
{
this.func_147391_c().joinServer(this.field_147394_b.getSession().func_148256_e(), this.field_147394_b.getSession().getToken(), s1);
}
catch (AuthenticationUnavailableException authenticationunavailableexception)
{
if (flag)
{
this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
return;
}
}
catch (InvalidCredentialsException invalidcredentialsexception)
{
if (flag)
{
this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
return;
}
}
catch (AuthenticationException authenticationexception)
{
if (flag)
{
this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
return;
}
}
this.field_147393_d.scheduleOutboundPacket(new C01PacketEncryptionResponse(secretkey, publickey, p_147389_1_.func_149607_e()), new GenericFutureListener[] {new GenericFutureListener()
{
private static final String __OBFID = "CL_00000877";
public void operationComplete(Future p_operationComplete_1_)
{
NetHandlerLoginClient.this.field_147393_d.enableEncryption(secretkey);
}
}
});
}
示例12: processEncryptionResponse
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void processEncryptionResponse(C01PacketEncryptionResponse p_147315_1_)
{
Validate.validState(this.field_147328_g == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
PrivateKey privatekey = this.field_147327_f.getKeyPair().getPrivate();
if (!Arrays.equals(this.field_147330_e, p_147315_1_.func_149299_b(privatekey)))
{
throw new IllegalStateException("Invalid nonce!");
}
else
{
this.field_147335_k = p_147315_1_.func_149300_a(privatekey);
this.field_147328_g = NetHandlerLoginServer.LoginState.AUTHENTICATING;
this.field_147333_a.enableEncryption(this.field_147335_k);
(new Thread("User Authenticator #" + field_147331_b.incrementAndGet())
{
private static final String __OBFID = "CL_00001459";
public void run()
{
GameProfile gameprofile = NetHandlerLoginServer.this.field_147337_i;
try
{
String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.this.field_147334_j, NetHandlerLoginServer.this.field_147327_f.getKeyPair().getPublic(), NetHandlerLoginServer.this.field_147335_k))).toString(16);
NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);
if (NetHandlerLoginServer.this.field_147337_i != null)
{
NetHandlerLoginServer.logger.info("UUID of player " + NetHandlerLoginServer.this.field_147337_i.getName() + " is " + NetHandlerLoginServer.this.field_147337_i.getId());
NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else if (NetHandlerLoginServer.this.field_147327_f.isSinglePlayer())
{
NetHandlerLoginServer.logger.warn("Failed to verify username but will let them in anyway!");
NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.func_152506_a(gameprofile);
NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else
{
NetHandlerLoginServer.this.func_147322_a("Failed to verify username!");
NetHandlerLoginServer.logger.error("Username \'" + NetHandlerLoginServer.this.field_147337_i.getName() + "\' tried to join with an invalid session");
}
}
catch (AuthenticationUnavailableException authenticationunavailableexception)
{
if (NetHandlerLoginServer.this.field_147327_f.isSinglePlayer())
{
NetHandlerLoginServer.logger.warn("Authentication servers are down but will let them in anyway!");
NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.func_152506_a(gameprofile);
NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
else
{
NetHandlerLoginServer.this.func_147322_a("Authentication servers are down. Please try again later, sorry!");
NetHandlerLoginServer.logger.error("Couldn\'t verify username because servers are unavailable");
}
}
}
}).start();
}
}
示例13: a
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
public void a(PacketLoginInEncryptionBegin packetlogininencryptionbegin) {
Validate.validState(this.g == LoginListener.EnumProtocolState.KEY, "Unexpected key packet", new Object[0]);
PrivateKey privatekey = this.server.O().getPrivate();
if (!Arrays.equals(this.e, packetlogininencryptionbegin.b(privatekey))) {
throw new IllegalStateException("Invalid nonce!");
} else {
this.loginKey = packetlogininencryptionbegin.a(privatekey);
this.g = LoginListener.EnumProtocolState.AUTHENTICATING;
this.networkManager.a(this.loginKey);
(new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
public void run() {
GameProfile gameprofile = LoginListener.this.i;
try {
String s = (new BigInteger(MinecraftEncryption.a(LoginListener.this.j, LoginListener.this.server.O().getPublic(), LoginListener.this.loginKey))).toString(16);
LoginListener.this.i = LoginListener.this.server.ay().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s);
if (LoginListener.this.i != null) {
// CraftBukkit start - fire PlayerPreLoginEvent
if (!networkManager.isConnected()) {
return;
}
new LoginHandler().fireEvents();
} else if (LoginListener.this.server.R()) {
LoginListener.c.warn("Failed to verify username but will let them in anyway!");
LoginListener.this.i = LoginListener.this.a(gameprofile);
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else {
LoginListener.this.disconnect("Failed to verify username!");
LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer
}
} catch (AuthenticationUnavailableException authenticationunavailableexception) {
if (LoginListener.this.server.R()) {
LoginListener.c.warn("Authentication servers are down but will let them in anyway!");
LoginListener.this.i = LoginListener.this.a(gameprofile);
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else {
LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!");
LoginListener.c.error("Couldn\'t verify username because servers are unavailable");
}
// CraftBukkit start - catch all exceptions
} catch (Exception exception) {
disconnect("Failed to verify username!");
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception);
// CraftBukkit end
}
}
}).start();
}
}
示例14: hasJoinedServer
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; //导入依赖的package包/类
@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);
}
}