Skip to content
This repository was archived by the owner on Jun 7, 2022. It is now read-only.

Commit 8c58111

Browse files
author
Dytanic
committed
check if the proxyGroup instance not null
1 parent 2760f13 commit 8c58111

File tree

1 file changed

+13
-10
lines changed
  • cloudnet-api/cloudnet-api-bridge/src/main/java/de/dytanic/cloudnet/bridge/internal/listener/proxied

1 file changed

+13
-10
lines changed

cloudnet-api/cloudnet-api-bridge/src/main/java/de/dytanic/cloudnet/bridge/internal/listener/proxied/ProxiedListener.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ public void handleLogin(LoginEvent e)
121121
e.getConnection().getUniqueId(),
122122
e.getConnection().getName(), e.getConnection().getVersion(),
123123
e.getConnection().getAddress().getAddress().getHostAddress(),
124-
e.getConnection().getAddress().getPort(), e.getConnection().isOnlineMode(), e.getConnection().isLegacy()
124+
e.getConnection().getAddress().getPort(), e.getConnection().isOnlineMode(),
125+
e.getConnection().isLegacy()
125126
);
126127

127128
CloudPlayer cloudPlayer = CloudAPI.getInstance().getNetworkConnection().getPacketManager().sendQuery(new PacketOutPlayerLoginRequest(playerConnection),
@@ -157,18 +158,20 @@ public void handleLogin(LoginEvent e)
157158
}
158159

159160
ProxyGroup proxyGroup = CloudProxy.getInstance().getProxyGroup();
160-
if (proxyGroup.getProxyConfig().isEnabled())
161-
if (CloudAPI.getInstance().getOnlineCount() >= CloudProxy.getInstance().getProxyGroup().getProxyConfig().getMaxPlayers())
162-
{
163-
PermissionCheckEvent permissionCheckEvent = new PermissionCheckEvent(cloudCommandSender, "cloudnet.fulljoin", false);
164161

165-
if (!ProxyServer.getInstance().getPluginManager().callEvent(permissionCheckEvent).hasPermission())
162+
if (proxyGroup != null)
163+
if (proxyGroup.getProxyConfig().isEnabled())
164+
if (CloudAPI.getInstance().getOnlineCount() >= CloudProxy.getInstance().getProxyGroup().getProxyConfig().getMaxPlayers())
166165
{
167-
e.setCancelled(true);
168-
e.setCancelReason(ChatColor.translateAlternateColorCodes('&', CloudAPI.getInstance().getCloudNetwork().getMessages().getString("full-join")));
169-
return;
166+
PermissionCheckEvent permissionCheckEvent = new PermissionCheckEvent(cloudCommandSender, "cloudnet.fulljoin", false);
167+
168+
if (!ProxyServer.getInstance().getPluginManager().callEvent(permissionCheckEvent).hasPermission())
169+
{
170+
e.setCancelled(true);
171+
e.setCancelReason(ChatColor.translateAlternateColorCodes('&', CloudAPI.getInstance().getCloudNetwork().getMessages().getString("full-join")));
172+
return;
173+
}
170174
}
171-
}
172175

173176
CloudProxy.getInstance().getCloudPlayers().put(cloudPlayer.getUniqueId(), cloudPlayer);
174177
}

0 commit comments

Comments
 (0)