Makes the stargate logger private

This commit is contained in:
2021-10-23 14:25:46 +02:00
parent 7cc8685e26
commit deba2e5c2c
14 changed files with 60 additions and 41 deletions

View File

@ -66,7 +66,7 @@ public final class BungeeHelper {
dataOutputStream.writeBytes(message);
player.sendPluginMessage(Stargate.stargate, bungeeChannel, byteArrayOutputStream.toByteArray());
} catch (IOException ex) {
Stargate.logger.severe(Stargate.getString("prefix") + "Error sending BungeeCord teleport packet");
Stargate.getConsoleLogger().severe(Stargate.getString("prefix") + "Error sending BungeeCord teleport packet");
ex.printStackTrace();
return false;
}
@ -90,7 +90,8 @@ public final class BungeeHelper {
player.sendPluginMessage(Stargate.stargate, bungeeChannel, byteArrayOutputStream.toByteArray());
byteArrayOutputStream.reset();
} catch (IOException ex) {
Stargate.logger.severe(Stargate.getString("prefix") + "Error sending BungeeCord connect packet");
Stargate.getConsoleLogger().severe(Stargate.getString("prefix") +
"Error sending BungeeCord connect packet");
ex.printStackTrace();
return false;
}
@ -117,7 +118,8 @@ public final class BungeeHelper {
data = new byte[dataLength];
dataInputStream.readFully(data);
} catch (IOException ex) {
Stargate.logger.severe(Stargate.getString("prefix") + "Error receiving BungeeCord message");
Stargate.getConsoleLogger().severe(Stargate.getString("prefix") +
"Error receiving BungeeCord message");
ex.printStackTrace();
return null;
}
@ -145,7 +147,8 @@ public final class BungeeHelper {
Portal destinationPortal = PortalHandler.getBungeePortal(destination);
// Specified an invalid gate. For now, we'll just let them connect at their current location
if (destinationPortal == null) {
Stargate.logger.info(Stargate.getString("prefix") + "Bungee gate " + destination + " does not exist");
Stargate.getConsoleLogger().info(Stargate.getString("prefix") + "Bungee gate " +
destination + " does not exist");
return;
}
new PlayerTeleporter(destinationPortal, player).teleport(destinationPortal, null);

View File

@ -55,7 +55,7 @@ public final class GateReader {
}
}
} catch (Exception ex) {
Stargate.logger.log(Level.SEVERE, "Could not load Gate " + fileName + " - " + ex.getMessage());
Stargate.getConsoleLogger().log(Level.SEVERE, "Could not load Gate " + fileName + " - " + ex.getMessage());
return -1;
} finally {
if (scanner != null) {
@ -90,8 +90,8 @@ public final class GateReader {
for (Character symbol : line.toCharArray()) {
//Refuse read gate designs with unknown characters
if (symbol.equals('?') || (!characterMaterialMap.containsKey(symbol))) {
Stargate.logger.log(Level.SEVERE, "Could not load Gate " + fileName + " - Unknown symbol '" +
symbol + "' in diagram");
Stargate.getConsoleLogger().log(Level.SEVERE, "Could not load Gate " + fileName +
" - Unknown symbol '" + symbol + "' in diagram");
return -1;
}
//Add the read character to the row
@ -148,7 +148,7 @@ public final class GateReader {
try {
return Integer.parseInt(config.get(key));
} catch (NumberFormatException ex) {
Stargate.logger.log(Level.WARNING, String.format("%s reading %s: %s is not numeric",
Stargate.getConsoleLogger().log(Level.WARNING, String.format("%s reading %s: %s is not numeric",
ex.getClass().getName(), fileName, key));
}
}
@ -172,8 +172,8 @@ public final class GateReader {
if (material != null) {
return material;
} else {
Stargate.logger.log(Level.WARNING, String.format("Error reading %s: %s is not a material", fileName,
key));
Stargate.getConsoleLogger().log(Level.WARNING, String.format("Error reading %s: %s is not a material",
fileName, key));
}
}
return defaultMaterial;

View File

@ -53,7 +53,8 @@ public final class PortalFileHelper {
bufferedWriter.close();
} catch (Exception e) {
Stargate.logger.log(Level.SEVERE, "Exception while writing stargates to " + saveFileLocation + ": " + e);
Stargate.getConsoleLogger().log(Level.SEVERE, "Exception while writing stargates to " +
saveFileLocation + ": " + e);
}
}
@ -131,7 +132,7 @@ public final class PortalFileHelper {
if (database.exists()) {
return loadPortals(world, database);
} else {
Stargate.logger.info(Stargate.getString("prefix") + "{" + world.getName() +
Stargate.getConsoleLogger().info(Stargate.getString("prefix") + "{" + world.getName() +
"} No stargates for world ");
}
return false;
@ -158,8 +159,8 @@ public final class PortalFileHelper {
doPostLoadTasks(world);
return true;
} catch (Exception e) {
Stargate.logger.log(Level.SEVERE, "Exception while reading stargates from " + database.getName() +
": " + lineIndex);
Stargate.getConsoleLogger().log(Level.SEVERE, "Exception while reading stargates from " +
database.getName() + ": " + lineIndex);
e.printStackTrace();
}
return false;
@ -183,7 +184,7 @@ public final class PortalFileHelper {
//Check if the min. required portal data is present
String[] portalData = line.split(":");
if (portalData.length < 8) {
Stargate.logger.info(Stargate.getString("prefix") + "Invalid line - " + lineIndex);
Stargate.getConsoleLogger().info(Stargate.getString("prefix") + "Invalid line - " + lineIndex);
return;
}
@ -206,7 +207,7 @@ public final class PortalFileHelper {
int openCount = PortalHandler.openAlwaysOpenPortals();
//Print info about loaded stargates so that admins can see if all stargates loaded
Stargate.logger.info(String.format("%s{%s} Loaded %d stargates with %d set as always-on",
Stargate.getConsoleLogger().info(String.format("%s{%s} Loaded %d stargates with %d set as always-on",
Stargate.getString("prefix"), world.getName(), portalCount, openCount));
//Re-draw the signs in case a bug in the config prevented the portal from loading and has been fixed since
@ -270,7 +271,7 @@ public final class PortalFileHelper {
Stargate.setLine(sign, 3, Stargate.getString("signInvalidGate"));
sign.update();
Stargate.logger.info(Stargate.getString("prefix") + "Gate layout on line " + lineIndex +
Stargate.getConsoleLogger().info(Stargate.getString("prefix") + "Gate layout on line " + lineIndex +
" does not exist [" + gateName + "]");
}