From 21a20af6670212e6666be5d09f9a29a5c012b61d Mon Sep 17 00:00:00 2001 From: LOOHP Date: Mon, 8 Aug 2022 00:38:24 +0800 Subject: [PATCH] Clean up --- pom.xml | 2 +- .../loohp/limbo/network/ClientConnection.java | 23 ++++--------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index c286a19..7b313a9 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ com.loohp Limbo Limbo - 0.6.17-ALPHA + 0.6.18-ALPHA Standalone Limbo Minecraft Server. https://github.com/LOOHP/Limbo diff --git a/src/main/java/com/loohp/limbo/network/ClientConnection.java b/src/main/java/com/loohp/limbo/network/ClientConnection.java index 055540a..1d7ef3f 100644 --- a/src/main/java/com/loohp/limbo/network/ClientConnection.java +++ b/src/main/java/com/loohp/limbo/network/ClientConnection.java @@ -308,10 +308,7 @@ public void run() { state = ClientState.LEGACY; channel.output.writeByte(255); - String str = inetAddress.getHostName() + ":" + clientSocket.getPort(); - if(!properties.isLogPlayerIPAddresses()) { - str = "" + ":" + clientSocket.getPort(); - } + String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "") + ":" + clientSocket.getPort(); Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Legacy Status has pinged"); ServerProperties p = Limbo.getInstance().getServerProperties(); StatusPingEvent event = Limbo.getInstance().getEventsManager().callEvent(new StatusPingEvent(this, p.getVersionString(), p.getProtocol(), p.getMotd(), p.getMaxPlayers(), Limbo.getInstance().getPlayers().size(), p.getFavicon().orElse(null))); @@ -343,10 +340,7 @@ public void run() { if (packetIn instanceof PacketStatusInRequest) { ServerProperties properties = Limbo.getInstance().getServerProperties(); - String str = inetAddress.getHostName() + ":" + clientSocket.getPort(); - if(!properties.isLogPlayerIPAddresses()) { - str = "" + ":" + clientSocket.getPort(); - } + String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "") + ":" + clientSocket.getPort(); if (Limbo.getInstance().getServerProperties().handshakeVerboseEnabled()) { Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Handshake Status has pinged"); } @@ -505,10 +499,7 @@ public void run() { PacketPlayOutPlayerAbilities abilities = new PacketPlayOutPlayerAbilities(0.05F, 0.1F, flags.toArray(new PlayerAbilityFlags[flags.size()])); sendPacket(abilities); - String str = inetAddress.getHostName() + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")"; - if(!properties.isLogPlayerIPAddresses()) { - str = "" + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")"; - } + String str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "") + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")"; Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had connected to the Limbo server!"); player.playerInteractManager.update(); @@ -676,15 +667,9 @@ public void run() { Limbo.getInstance().getEventsManager().callEvent(new PlayerQuitEvent(player)); - str = inetAddress.getHostName() + ":" + clientSocket.getPort() + "|" + player.getName(); - if(!properties.isLogPlayerIPAddresses()) { - str = "" + ":" + clientSocket.getPort() + clientSocket.getPort() + "|" + player.getName(); - } - + str = (properties.isLogPlayerIPAddresses() ? inetAddress.getHostName() : "") + ":" + clientSocket.getPort() + "|" + player.getName(); Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had disconnected!"); - } - } catch (Exception ignored) { }