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 {
this.configuration.load(new File(getDataFolder(), configFileName));
} 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 {
this.configuration.save(new File(getDataFolder(), configFileName));
} 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 {
readChangedLanguageStrings(inputStream, language, currentLanguageValues);
} catch (IOException ex) {
ex.printStackTrace();
} catch (IOException exception) {
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"));
} catch (IOException e) {
Stargate.debug("StargateConfig::migrateConfig", "Unable to save old backup and do migration");
e.printStackTrace();
return;
}
@@ -483,7 +482,6 @@ public final class StargateConfig {
ColorConversion.NORMAL);
} catch (IOException e) {
Stargate.debug("StargateConfig::migrateConfig", "Unable to load config migration file");
e.printStackTrace();
return;
}
@@ -511,9 +509,8 @@ public final class StargateConfig {
try {
newConfiguration.save(new File(dataFolderPath, "config.yml"));
} catch (IOException e) {
} catch (IOException exception) {
Stargate.debug("StargateConfig::migrateConfig", "Unable to save migrated config");
e.printStackTrace();
}
Stargate.getInstance().reloadConfig();

View File

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

View File

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

View File

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