Updated logging

This commit is contained in:
LabodiDavid 2025-03-29 19:43:49 +01:00
parent 76afccf285
commit 054ea4931d
5 changed files with 17 additions and 12 deletions

View File

@ -126,8 +126,8 @@ public final class STPlugin extends JavaPlugin implements CommandExecutor, Liste
return false; return false;
} }
} catch (Exception e) { } catch (Exception e) {
this.log.warning("[SimplifyTools] - INITIALIZATION ERROR: " + e.getMessage()); this.log.warning(ChatColor.stripColor(this.getPrefix()) + "INITIALIZATION ERROR: " + e.getMessage());
this.log.warning("[SimplifyTools] - Plugin disabled!"); this.log.warning(ChatColor.stripColor(this.getPrefix()) + "Plugin disabled!");
this.setEnabled(false); this.setEnabled(false);
return false; return false;
} }
@ -202,7 +202,7 @@ public final class STPlugin extends JavaPlugin implements CommandExecutor, Liste
out.write(buffer, 0, length); out.write(buffer, 0, length);
} }
} catch (IOException e) { } catch (IOException e) {
getLogger().warning(e.getMessage()); this.log.warning(ChatColor.stripColor(this.getPrefix()) + e.getMessage());
} }
} }
} }
@ -244,14 +244,14 @@ public final class STPlugin extends JavaPlugin implements CommandExecutor, Liste
} }
ConfigUpdater.update(this, "config.yml", configFile, Collections.emptyList()); ConfigUpdater.update(this, "config.yml", configFile, Collections.emptyList());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); this.log.warning(ChatColor.stripColor(this.getPrefix()) + e.getMessage());
} }
reloadConfig(); reloadConfig();
this.config = getConfig(); this.config = getConfig();
try { try {
this.initLocalization(); this.initLocalization();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); this.log.warning(ChatColor.stripColor(this.getPrefix()) + e.getMessage());
} }

View File

@ -39,9 +39,10 @@ public class TabHandler {
if(this.init()){ if(this.init()){
if (headerComponents.isEmpty() && footerComponents.isEmpty()){ if (headerComponents.isEmpty() && footerComponents.isEmpty()){
plugin.getLogger().warning(plugin.getPrefix()+"TAB customization disabled because empty customization config or feature related errors!"); plugin.getLogger().warning(ChatColor.stripColor(plugin.getPrefix()) + "TAB customization disabled because empty customization config or feature related errors!");
return; return;
} }
plugin.getLogger().info("- TAB customization enabled!");
this.updateTab(); this.updateTab();
} }
@ -149,7 +150,7 @@ public class TabHandler {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); plugin.getLogger().warning(ChatColor.stripColor(plugin.getPrefix()) + e.getMessage());
} }
},0,Math.convert(Math.Convert.SECONDS,Math.Convert.TICKS,this.refreshRate)); },0,Math.convert(Math.Convert.SECONDS,Math.Convert.TICKS,this.refreshRate));
@ -184,7 +185,7 @@ public class TabHandler {
} }
} catch (Exception e){ } catch (Exception e){
e.printStackTrace(); plugin.getLogger().warning(ChatColor.stripColor(plugin.getPrefix()) + e.getMessage());
} }
} }

View File

@ -1,7 +1,5 @@
package hu.ditservices.utils; package hu.ditservices.utils;
import java.io.IOException;
public class Math { public class Math {
public enum Convert { public enum Convert {
TICKS,SECONDS,MINUTES,HOURS TICKS,SECONDS,MINUTES,HOURS

View File

@ -1,6 +1,8 @@
package hu.ditservices.utils; package hu.ditservices.utils;
import hu.ditservices.STPlugin;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.lang.Math; import java.lang.Math;
@ -50,7 +52,8 @@ public class Server {
} }
return player.getPing(); return player.getPing();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); STPlugin plugin = STPlugin.getInstance();
plugin.getLogger().warning(ChatColor.stripColor(plugin.getPrefix()) + e.getMessage());
return -1; return -1;
} }
} }

View File

@ -1,6 +1,8 @@
package hu.ditservices.utils; package hu.ditservices.utils;
import hu.ditservices.STPlugin;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -91,7 +93,8 @@ public class Version {
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
// The method doesn't exist in this server version; fall back below. // The method doesn't exist in this server version; fall back below.
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); STPlugin plugin = STPlugin.getInstance();
plugin.getLogger().warning(ChatColor.stripColor(plugin.getPrefix()) + e.getMessage());
} }
// Fallback: use Bukkit version if no version was obtained or it's empty. // Fallback: use Bukkit version if no version was obtained or it's empty.