Added a debug option

This commit is contained in:
Telesphoreo 2022-01-27 01:00:03 -06:00
parent f2bbf6f6dc
commit 5c15d25ef7
3 changed files with 17 additions and 3 deletions

View File

@ -19,7 +19,7 @@ public class GameRuleService extends AbstractService
for (World world : Bukkit.getWorlds()) for (World world : Bukkit.getWorlds())
{ {
commitGameRules(world); commitGameRules(world);
PlexLog.log("Set gamerules for world: " + world); PlexLog.debug("Set gamerules for world: " + world.getName());
} }
} }

View File

@ -1,10 +1,13 @@
package dev.plex.util; package dev.plex.util;
import dev.plex.Plex;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public class PlexLog public class PlexLog
{ {
private static final boolean debugEnabled = Plex.get().config.getBoolean("debug");
public static void log(String message) public static void log(String message)
{ {
Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.YELLOW + "[Plex] " + ChatColor.GRAY + "%s", message)); Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.YELLOW + "[Plex] " + ChatColor.GRAY + "%s", message));
@ -12,6 +15,14 @@ public class PlexLog
public static void error(String message) public static void error(String message)
{ {
Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.RED + "[Plex Error]" + ChatColor.GOLD + "%s", message)); Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.RED + "[Plex Error] " + ChatColor.GOLD + "%s", message));
}
public static void debug(String message)
{
if (debugEnabled)
{
Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.DARK_PURPLE + "[Plex Debug] " + ChatColor.GOLD + "%s", message));
}
} }
} }

View File

@ -40,4 +40,7 @@ worlds:
grass_block: 1 grass_block: 1
dirt: 32 dirt: 32
stone: 16 stone: 16
bedrock: 1 bedrock: 1
# Additional logging for debugging
debug: false