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;
}
} catch (Exception e) {
this.log.warning("[SimplifyTools] - INITIALIZATION ERROR: " + e.getMessage());
this.log.warning("[SimplifyTools] - Plugin disabled!");
this.log.warning(ChatColor.stripColor(this.getPrefix()) + "INITIALIZATION ERROR: " + e.getMessage());
this.log.warning(ChatColor.stripColor(this.getPrefix()) + "Plugin disabled!");
this.setEnabled(false);
return false;
}
@ -202,7 +202,7 @@ public final class STPlugin extends JavaPlugin implements CommandExecutor, Liste
out.write(buffer, 0, length);
}
} 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());
} catch (IOException e) {
e.printStackTrace();
this.log.warning(ChatColor.stripColor(this.getPrefix()) + e.getMessage());
}
reloadConfig();
this.config = getConfig();
try {
this.initLocalization();
} 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 (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;
}
plugin.getLogger().info("- TAB customization enabled!");
this.updateTab();
}
@ -149,7 +150,7 @@ public class TabHandler {
}
} 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));
@ -184,7 +185,7 @@ public class TabHandler {
}
} catch (Exception e){
e.printStackTrace();
plugin.getLogger().warning(ChatColor.stripColor(plugin.getPrefix()) + e.getMessage());
}
}

View File

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

View File

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

View File

@ -1,6 +1,8 @@
package hu.ditservices.utils;
import hu.ditservices.STPlugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import java.lang.reflect.Method;
import java.util.regex.Pattern;
@ -91,7 +93,8 @@ public class Version {
} catch (NoSuchMethodException e) {
// The method doesn't exist in this server version; fall back below.
} 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.