forked from BLOCKFANTASY/LOOHP-Limbo
Merge pull request #49 from SlenkyDev/master
Added the option to hide IP addresses in logs
This commit is contained in:
commit
cfbd9951af
|
|
@ -59,6 +59,7 @@ public class ServerProperties {
|
||||||
private GameMode defaultGamemode;
|
private GameMode defaultGamemode;
|
||||||
private Location worldSpawn;
|
private Location worldSpawn;
|
||||||
private boolean reducedDebugInfo;
|
private boolean reducedDebugInfo;
|
||||||
|
private boolean logPlayerIPAddresses;
|
||||||
private boolean allowFlight;
|
private boolean allowFlight;
|
||||||
private boolean allowChat;
|
private boolean allowChat;
|
||||||
private Component motd;
|
private Component motd;
|
||||||
|
|
@ -123,6 +124,7 @@ public class ServerProperties {
|
||||||
float pitch = Float.parseFloat(locStr[5]);
|
float pitch = Float.parseFloat(locStr[5]);
|
||||||
worldSpawn = new Location(world, x, y, z, yaw, pitch);
|
worldSpawn = new Location(world, x, y, z, yaw, pitch);
|
||||||
reducedDebugInfo = Boolean.parseBoolean(prop.getProperty("reduced-debug-info"));
|
reducedDebugInfo = Boolean.parseBoolean(prop.getProperty("reduced-debug-info"));
|
||||||
|
logPlayerIPAddresses = Boolean.parseBoolean(prop.getProperty("log-player-ip-addresses"));
|
||||||
allowFlight = Boolean.parseBoolean(prop.getProperty("allow-flight"));
|
allowFlight = Boolean.parseBoolean(prop.getProperty("allow-flight"));
|
||||||
allowChat = Boolean.parseBoolean(prop.getProperty("allow-chat"));
|
allowChat = Boolean.parseBoolean(prop.getProperty("allow-chat"));
|
||||||
String motdJson = prop.getProperty("motd");
|
String motdJson = prop.getProperty("motd");
|
||||||
|
|
@ -257,6 +259,10 @@ public class ServerProperties {
|
||||||
return reducedDebugInfo;
|
return reducedDebugInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLogPlayerIPAddresses() {
|
||||||
|
return logPlayerIPAddresses;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isAllowFlight() {
|
public boolean isAllowFlight() {
|
||||||
return allowFlight;
|
return allowFlight;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -304,9 +304,14 @@ public class ClientConnection extends Thread {
|
||||||
|
|
||||||
//legacy ping
|
//legacy ping
|
||||||
if (handShakeSize == 0xFE) {
|
if (handShakeSize == 0xFE) {
|
||||||
|
ServerProperties properties = Limbo.getInstance().getServerProperties();
|
||||||
|
|
||||||
state = ClientState.LEGACY;
|
state = ClientState.LEGACY;
|
||||||
channel.output.writeByte(255);
|
channel.output.writeByte(255);
|
||||||
String str = inetAddress.getHostName() + ":" + clientSocket.getPort();
|
String str = inetAddress.getHostName() + ":" + clientSocket.getPort();
|
||||||
|
if(!properties.isLogPlayerIPAddresses()) {
|
||||||
|
str = "<ip address withheld>" + ":" + clientSocket.getPort();
|
||||||
|
}
|
||||||
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Legacy Status has pinged");
|
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Legacy Status has pinged");
|
||||||
ServerProperties p = Limbo.getInstance().getServerProperties();
|
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)));
|
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)));
|
||||||
|
|
@ -336,7 +341,12 @@ public class ClientConnection extends Thread {
|
||||||
while (clientSocket.isConnected()) {
|
while (clientSocket.isConnected()) {
|
||||||
PacketIn packetIn = channel.readPacket();
|
PacketIn packetIn = channel.readPacket();
|
||||||
if (packetIn instanceof PacketStatusInRequest) {
|
if (packetIn instanceof PacketStatusInRequest) {
|
||||||
|
ServerProperties properties = Limbo.getInstance().getServerProperties();
|
||||||
|
|
||||||
String str = inetAddress.getHostName() + ":" + clientSocket.getPort();
|
String str = inetAddress.getHostName() + ":" + clientSocket.getPort();
|
||||||
|
if(!properties.isLogPlayerIPAddresses()) {
|
||||||
|
str = "<ip address withheld>" + ":" + clientSocket.getPort();
|
||||||
|
}
|
||||||
if (Limbo.getInstance().getServerProperties().handshakeVerboseEnabled()) {
|
if (Limbo.getInstance().getServerProperties().handshakeVerboseEnabled()) {
|
||||||
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Handshake Status has pinged");
|
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Handshake Status has pinged");
|
||||||
}
|
}
|
||||||
|
|
@ -496,6 +506,9 @@ public class ClientConnection extends Thread {
|
||||||
sendPacket(abilities);
|
sendPacket(abilities);
|
||||||
|
|
||||||
String str = inetAddress.getHostName() + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")";
|
String str = inetAddress.getHostName() + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")";
|
||||||
|
if(!properties.isLogPlayerIPAddresses()) {
|
||||||
|
str = "<ip address withheld>" + ":" + clientSocket.getPort() + "|" + player.getName() + "(" + player.getUniqueId() + ")";
|
||||||
|
}
|
||||||
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had connected to the Limbo server!");
|
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had connected to the Limbo server!");
|
||||||
|
|
||||||
player.playerInteractManager.update();
|
player.playerInteractManager.update();
|
||||||
|
|
@ -664,6 +677,10 @@ public class ClientConnection extends Thread {
|
||||||
Limbo.getInstance().getEventsManager().callEvent(new PlayerQuitEvent(player));
|
Limbo.getInstance().getEventsManager().callEvent(new PlayerQuitEvent(player));
|
||||||
|
|
||||||
str = inetAddress.getHostName() + ":" + clientSocket.getPort() + "|" + player.getName();
|
str = inetAddress.getHostName() + ":" + clientSocket.getPort() + "|" + player.getName();
|
||||||
|
if(!properties.isLogPlayerIPAddresses()) {
|
||||||
|
str = "<ip address withheld>" + ":" + clientSocket.getPort() + clientSocket.getPort() + "|" + player.getName();
|
||||||
|
}
|
||||||
|
|
||||||
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had disconnected!");
|
Limbo.getInstance().getConsole().sendMessage("[/" + str + "] <-> Player had disconnected!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,10 @@ world-spawn=world;20.5;17;22.5;-90;0
|
||||||
#Reduce debug info
|
#Reduce debug info
|
||||||
reduced-debug-info=false
|
reduced-debug-info=false
|
||||||
|
|
||||||
|
#Whether the IP addresseses of players should be logged
|
||||||
|
#If not enabled player IP addresses will be replaced by <ip address withheld> in logs
|
||||||
|
log-player-ip-addresses=true
|
||||||
|
|
||||||
#The view distance of the server
|
#The view distance of the server
|
||||||
view-distance=6
|
view-distance=6
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue