From e2d6e695dcad27186414d262535c6aee155fb492 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Thu, 28 Apr 2022 21:54:51 -0400 Subject: [PATCH] Bug fixes & class updates --- src/main/java/emu/grasscutter/game/Account.java | 2 +- src/main/java/emu/grasscutter/plugin/api/ServerHook.java | 8 ++++---- .../emu/grasscutter/server/dispatch/DispatchServer.java | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/Account.java b/src/main/java/emu/grasscutter/game/Account.java index dbd6ef854..97ad428fe 100644 --- a/src/main/java/emu/grasscutter/game/Account.java +++ b/src/main/java/emu/grasscutter/game/Account.java @@ -104,7 +104,7 @@ public class Account { } public boolean hasPermission(String permission) { - return this.permissions.contains(permission) || this.permissions.contains("*") ? true : false; + return this.permissions.contains(permission) || this.permissions.contains("*"); } public boolean removePermission(String permission) { diff --git a/src/main/java/emu/grasscutter/plugin/api/ServerHook.java b/src/main/java/emu/grasscutter/plugin/api/ServerHook.java index 8346903f4..a37abfb62 100644 --- a/src/main/java/emu/grasscutter/plugin/api/ServerHook.java +++ b/src/main/java/emu/grasscutter/plugin/api/ServerHook.java @@ -2,7 +2,7 @@ package emu.grasscutter.plugin.api; import emu.grasscutter.command.Command; import emu.grasscutter.command.CommandHandler; -import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.player.Player; import emu.grasscutter.server.dispatch.DispatchServer; import emu.grasscutter.server.game.GameServer; @@ -33,7 +33,7 @@ public final class ServerHook { public ServerHook(GameServer gameServer, DispatchServer dispatchServer) { this.gameServer = gameServer; this.dispatchServer = dispatchServer; - + instance = this; } @@ -50,12 +50,12 @@ public final class ServerHook { public DispatchServer getDispatchServer() { return this.dispatchServer; } - + /** * Gets all online players. * @return Players connected to the server. */ - public List getOnlinePlayers() { + public List getOnlinePlayers() { return new LinkedList<>(this.gameServer.getPlayers().values()); } diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index 99c5e4f8d..e8fd5a4ea 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -209,7 +209,7 @@ public final class DispatchServer { return null; } - private KeyManagerFactory createKeyManagerFactory(File keystore, String password) throws Exception { + private KeyManagerFactory createKeyManagerFactory(File keystore, String password) { char[] pass = password.toCharArray(); KeyManagerFactory kmf = null; @@ -220,8 +220,8 @@ public final class DispatchServer { kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, pass); - } catch (Exception e) { - throw e; + } catch (Exception exception) { + Grasscutter.getLogger().error("Unable to load keystore.", exception); } return kmf; @@ -257,7 +257,7 @@ public final class DispatchServer { server = this.safelyCreateServer(this.getAddress()); } - HttpsServer httpsServer = null; + HttpsServer httpsServer; try { httpsServer = HttpsServer.create(getAddress(), 0);