mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 02:04:44 +02:00
@ -39,6 +39,7 @@ public class Config extends ConfigLoader {
|
||||
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
|
||||
public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
|
||||
public boolean getBackupsEnabled() { return config.getBoolean("General.Generate_Backups", true); }
|
||||
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
|
||||
public boolean getPartyDisplayNames() { return config.getBoolean("Commands.p.Use_Display_Names", true); }
|
||||
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.a.Use_Display_Names", true); }
|
||||
|
||||
|
@ -51,6 +51,7 @@ import com.gmail.nossr50.skills.runnables.SkillMonitor;
|
||||
import com.gmail.nossr50.spout.SpoutConfig;
|
||||
import com.gmail.nossr50.spout.SpoutTools;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.LogFilter;
|
||||
import com.gmail.nossr50.util.UpdateCheck;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@ -97,6 +98,7 @@ public class mcMMO extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
p = this;
|
||||
getLogger().setFilter(new LogFilter(this));
|
||||
entityMetadata = new FixedMetadataValue(mcMMO.p, true);
|
||||
setupFilePaths();
|
||||
setupSpout();
|
||||
@ -451,4 +453,8 @@ public class mcMMO extends JavaPlugin {
|
||||
public void toggleXpEventEnabled() {
|
||||
xpEventEnabled = !xpEventEnabled;
|
||||
}
|
||||
|
||||
public void debug(String message) {
|
||||
getLogger().info("[Debug] " + message);
|
||||
}
|
||||
}
|
||||
|
25
src/main/java/com/gmail/nossr50/util/LogFilter.java
Normal file
25
src/main/java/com/gmail/nossr50/util/LogFilter.java
Normal file
@ -0,0 +1,25 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import java.util.logging.Filter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class LogFilter implements Filter {
|
||||
private boolean debug;
|
||||
|
||||
public LogFilter(mcMMO plugin) {
|
||||
// Doing a config loading lite here, because we can't depend on the config loader to have loaded before any debug messages are sent
|
||||
debug = plugin.getConfig().getBoolean("General.Verbose_Logging");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
if(record.getMessage().contains("[Debug]") && !debug) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user