Skip to content

Commit

Permalink
feat: 修改了Listeners.java中的条件判断逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
shulng committed Sep 18, 2024
1 parent 7863d28 commit 7240041
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/cc/baka9/catseedlogin/bungee/Listeners.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class Listeners implements Listener {
*/
@EventHandler
public void onChat(ChatEvent event) {
if (!event.isProxyCommand() || !(event.getSender() instanceof ProxiedPlayer)) return;
if (!(event.isProxyCommand() && event.getSender() instanceof ProxiedPlayer)) return;

ProxiedPlayer player = (ProxiedPlayer) event.getSender();
String playerName = player.getName();

Expand All @@ -47,6 +48,7 @@ public void onChat(ChatEvent event) {
public void onServerConnect(ServerConnectEvent event) {
ServerInfo target = event.getTarget();
if (event.isCancelled() || target.getName().equals(Config.LoginServerName)) return;

ProxiedPlayer player = event.getPlayer();
String playerName = player.getName();

Expand Down Expand Up @@ -103,11 +105,11 @@ public void onPreLogin(PreLoginEvent event) {
private void handleLogin(ProxiedPlayer player, String message) {
String playerName = player.getName();
PluginMain.runAsync(() -> {
if (Communication.sendConnectRequest(playerName) == 1) {
loggedInPlayerList.add(playerName);
if (message != null) {
proxyServer.getPluginManager().dispatchCommand(player, message.substring(1));
}
if (Communication.sendConnectRequest(playerName) == 1) {
loggedInPlayerList.add(playerName);
if (message != null) {
proxyServer.getPluginManager().dispatchCommand(player, message.substring(1));
}
}
});
}
Expand Down

0 comments on commit 7240041

Please sign in to comment.