Removes stack trace printing

This commit is contained in:
2023-04-21 14:03:33 +02:00
parent fab067c94b
commit 05fadfa558
6 changed files with 15 additions and 23 deletions

View File

@@ -355,7 +355,7 @@ public class Stargate extends JavaPlugin {
try { try {
this.configuration.load(new File(getDataFolder(), configFileName)); this.configuration.load(new File(getDataFolder(), configFileName));
} catch (IOException | InvalidConfigurationException e) { } catch (IOException | InvalidConfigurationException e) {
e.printStackTrace(); logSevere("Unable to load the configuration! Message: " + e.getMessage());
} }
} }
@@ -365,7 +365,7 @@ public class Stargate extends JavaPlugin {
try { try {
this.configuration.save(new File(getDataFolder(), configFileName)); this.configuration.save(new File(getDataFolder(), configFileName));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); logSevere("Unable to save the configuration! Message: " + e.getMessage());
} }
} }

View File

@@ -120,8 +120,8 @@ public final class LanguageLoader {
try { try {
readChangedLanguageStrings(inputStream, language, currentLanguageValues); readChangedLanguageStrings(inputStream, language, currentLanguageValues);
} catch (IOException ex) { } catch (IOException exception) {
ex.printStackTrace(); Stargate.logSevere("Unable to read language strings! Message: " + exception.getMessage());
} }
} }

View File

@@ -464,7 +464,6 @@ public final class StargateConfig {
currentConfiguration.save(new File(dataFolderPath, "config.yml.old")); currentConfiguration.save(new File(dataFolderPath, "config.yml.old"));
} catch (IOException e) { } catch (IOException e) {
Stargate.debug("StargateConfig::migrateConfig", "Unable to save old backup and do migration"); Stargate.debug("StargateConfig::migrateConfig", "Unable to save old backup and do migration");
e.printStackTrace();
return; return;
} }
@@ -483,7 +482,6 @@ public final class StargateConfig {
ColorConversion.NORMAL); ColorConversion.NORMAL);
} catch (IOException e) { } catch (IOException e) {
Stargate.debug("StargateConfig::migrateConfig", "Unable to load config migration file"); Stargate.debug("StargateConfig::migrateConfig", "Unable to load config migration file");
e.printStackTrace();
return; return;
} }
@@ -511,9 +509,8 @@ public final class StargateConfig {
try { try {
newConfiguration.save(new File(dataFolderPath, "config.yml")); newConfiguration.save(new File(dataFolderPath, "config.yml"));
} catch (IOException e) { } catch (IOException exception) {
Stargate.debug("StargateConfig::migrateConfig", "Unable to save migrated config"); Stargate.debug("StargateConfig::migrateConfig", "Unable to save migrated config");
e.printStackTrace();
} }
Stargate.getInstance().reloadConfig(); Stargate.getInstance().reloadConfig();

View File

@@ -310,9 +310,8 @@ public class Gate {
layout.saveLayout(bufferedWriter); layout.saveLayout(bufferedWriter);
bufferedWriter.close(); bufferedWriter.close();
} catch (IOException ex) { } catch (IOException exception) {
Stargate.logSevere(String.format("Could not save Gate %s - %s", filename, ex.getMessage())); Stargate.logSevere(String.format("Could not save Gate %s - %s", filename, exception.getMessage()));
ex.printStackTrace();
} }
} }

View File

@@ -82,8 +82,7 @@ public final class BungeeHelper {
//Send the plugin message //Send the plugin message
player.sendPluginMessage(Stargate.getInstance(), bungeeChannel, byteArrayOutputStream.toByteArray()); player.sendPluginMessage(Stargate.getInstance(), bungeeChannel, byteArrayOutputStream.toByteArray());
} catch (IOException ex) { } catch (IOException ex) {
Stargate.logSevere("Error sending BungeeCord teleport packet"); Stargate.logSevere("Error sending BungeeCord teleport packet! Message: " + ex.getMessage());
ex.printStackTrace();
return false; return false;
} }
return true; return true;
@@ -107,9 +106,8 @@ public final class BungeeHelper {
//Send the plugin message //Send the plugin message
player.sendPluginMessage(Stargate.getInstance(), bungeeChannel, byteArrayOutputStream.toByteArray()); player.sendPluginMessage(Stargate.getInstance(), bungeeChannel, byteArrayOutputStream.toByteArray());
} catch (IOException ex) { } catch (IOException exception) {
Stargate.logSevere("Error sending BungeeCord connect packet"); Stargate.logSevere("Error sending BungeeCord connect packet! Message: " + exception.getMessage());
ex.printStackTrace();
return false; return false;
} }
return true; return true;
@@ -137,9 +135,8 @@ public final class BungeeHelper {
data = new byte[dataLength]; data = new byte[dataLength];
//Read the message to the prepared array //Read the message to the prepared array
dataInputStream.readFully(data); dataInputStream.readFully(data);
} catch (IOException ex) { } catch (IOException exception) {
Stargate.logSevere("Error receiving BungeeCord message"); Stargate.logSevere("Error receiving BungeeCord message. Message: " + exception.getMessage());
ex.printStackTrace();
return null; return null;
} }
return new String(data); return new String(data);

View File

@@ -170,10 +170,9 @@ public final class PortalFileHelper {
"Starting post loading tasks", world)); "Starting post loading tasks", world));
doPostLoadTasks(world, needsToSaveDatabase); doPostLoadTasks(world, needsToSaveDatabase);
return true; return true;
} catch (Exception e) { } catch (Exception exception) {
Stargate.logSevere(String.format("Exception while reading stargates from %s: %d", database.getName(), Stargate.logSevere(String.format("Exception while reading stargates from %s: %d! Message: %s",
lineIndex)); database.getName(), lineIndex, exception.getMessage()));
e.printStackTrace();
} }
return false; return false;
} }