mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Make mcMMO quieter by moving most log messages to debug only
This commit is contained in:
@ -8,7 +8,7 @@ import java.io.*;
|
||||
public class FixSpellingNetheriteUtil {
|
||||
|
||||
public static void processFileCheck(mcMMO pluginRef, String fileName, UpgradeType upgradeType) {
|
||||
pluginRef.getLogger().info("Checking " + fileName + " config material names...");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Checking " + fileName + " config material names...");
|
||||
|
||||
File configFile = new File(pluginRef.getDataFolder(), fileName);
|
||||
if(configFile.exists()) {
|
||||
|
@ -186,14 +186,14 @@
|
||||
//
|
||||
// for (File file : toDelete) {
|
||||
// if (file.delete()) {
|
||||
// mcMMO.p.debug("Deleted: " + file.getName());
|
||||
// LogUtils.debug(mcMMO.p.getLogger(), "Deleted: " + file.getName());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // This gets called onDisable
|
||||
// public void saveAnniversaryFiles() {
|
||||
// mcMMO.p.debug("Saving anniversary files...");
|
||||
// LogUtils.debug(mcMMO.p.getLogger(), "Saving anniversary files...");
|
||||
// String anniversaryFilePath = mcMMO.getFlatFileDirectory() + "anniversary." + currentYear + ".yml";
|
||||
//
|
||||
// try {
|
||||
|
@ -5,6 +5,8 @@ import com.gmail.nossr50.mcMMO;
|
||||
import java.util.logging.Filter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import static com.gmail.nossr50.util.LogUtils.DEBUG_STR;
|
||||
|
||||
public class LogFilter implements Filter {
|
||||
private final boolean debug;
|
||||
|
||||
@ -15,6 +17,6 @@ public class LogFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
return !(record.getMessage().contains("[Debug]") && !debug);
|
||||
return !(record.getMessage().contains(DEBUG_STR) && !debug);
|
||||
}
|
||||
}
|
||||
|
14
src/main/java/com/gmail/nossr50/util/LogUtils.java
Normal file
14
src/main/java/com/gmail/nossr50/util/LogUtils.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class LogUtils {
|
||||
|
||||
public static final String DEBUG_STR = "[D] ";
|
||||
|
||||
public static void debug(@NotNull Logger logger, @NotNull String message) {
|
||||
logger.info(DEBUG_STR + message);
|
||||
}
|
||||
}
|
@ -268,7 +268,7 @@ public class ModManager {
|
||||
|
||||
try {
|
||||
entitiesFile.save(entityFile);
|
||||
mcMMO.p.debug(entity.getType().toString() + " was added to the custom entities file!");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), entity.getType().toString() + " was added to the custom entities file!");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util.compat;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.compat.layers.bungee.AbstractBungeeSerializerCompatibilityLayer;
|
||||
import com.gmail.nossr50.util.compat.layers.bungee.BungeeLegacySerializerCompatibilityLayer;
|
||||
import com.gmail.nossr50.util.compat.layers.bungee.BungeeModernSerializerCompatibilityLayer;
|
||||
@ -34,11 +35,11 @@ public class CompatibilityManager {
|
||||
private AbstractMasterAnglerCompatibility masterAnglerCompatibility;
|
||||
|
||||
public CompatibilityManager(@NotNull MinecraftGameVersion minecraftGameVersion) {
|
||||
mcMMO.p.getLogger().info("Loading compatibility layers...");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Loading compatibility layers...");
|
||||
this.minecraftGameVersion = minecraftGameVersion;
|
||||
this.nmsVersion = determineNMSVersion();
|
||||
init();
|
||||
mcMMO.p.getLogger().info("Finished loading compatibility layers.");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Finished loading compatibility layers.");
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
@ -224,7 +225,7 @@ public class FormulaManager {
|
||||
* Save formula file.
|
||||
*/
|
||||
public void saveFormula() {
|
||||
mcMMO.p.debug("Saving previous XP formula type...");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Saving previous XP formula type...");
|
||||
YamlConfiguration formulasFile = new YamlConfiguration();
|
||||
formulasFile.set("Previous_Formula", previousFormula.toString());
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.util.platform;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.compat.CompatibilityManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -47,7 +48,7 @@ public class PlatformManager {
|
||||
private @NotNull MinecraftGameVersion determineGameVersion(String platformVersionString) {
|
||||
int major = 0, minor = 0, patch = 0;
|
||||
|
||||
mcMMO.p.getLogger().info("Platform String: " + platformVersionString);
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Platform String: " + platformVersionString);
|
||||
|
||||
// Gets two numbers separated by . and optional third number after next dot. Must end with - or _
|
||||
Matcher versionMatch = Pattern.compile("(\\d+)\\.(\\d+)(?:\\.(\\d+))?[-_].*").matcher(platformVersionString);
|
||||
@ -61,7 +62,7 @@ public class PlatformManager {
|
||||
}
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().info("Minecraft version determined to be - "
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Minecraft version determined to be - "
|
||||
+ major + "."
|
||||
+ minor + "."
|
||||
+ patch);
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util.player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.MetadataConstants;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -85,7 +86,7 @@ public final class UserManager {
|
||||
for (McMMOPlayer playerData : trackedSyncData) {
|
||||
try
|
||||
{
|
||||
mcMMO.p.getLogger().info("Saving data for player: "+playerData.getPlayerName());
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Saving data for player: "+playerData.getPlayerName());
|
||||
playerData.getProfile().save(true);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -9,6 +9,7 @@ import com.gmail.nossr50.events.scoreboard.McMMOScoreboardMakeboardEvent;
|
||||
import com.gmail.nossr50.events.scoreboard.ScoreboardEventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -204,7 +205,7 @@ public class ScoreboardManager {
|
||||
// Called in onDisable()
|
||||
public static void teardownAll() {
|
||||
ImmutableList<Player> onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers());
|
||||
mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.size() + ")");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Tearing down scoreboards... (" + onlinePlayers.size() + ")");
|
||||
for (Player player : onlinePlayers) {
|
||||
teardownPlayer(player);
|
||||
}
|
||||
@ -524,7 +525,7 @@ public class ScoreboardManager {
|
||||
|
||||
if (objective != null) {
|
||||
objective.unregister();
|
||||
mcMMO.p.debug("Removed leftover targetBoard objects from Power Level Tags.");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Removed leftover targetBoard objects from Power Level Tags.");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -12,6 +12,7 @@ import com.gmail.nossr50.events.scoreboard.ScoreboardObjectiveEventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@ -260,7 +261,7 @@ public class ScoreboardWrapper {
|
||||
oldBoard = null;
|
||||
}
|
||||
else {
|
||||
mcMMO.p.debug("Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +420,7 @@ public class ScoreboardWrapper {
|
||||
} catch (IllegalStateException e) {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
|
||||
mcMMO.p.debug("Recovering scoreboard for player: " + player.getName());
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Recovering scoreboard for player: " + player.getName());
|
||||
|
||||
if(mmoPlayer.isDebugMode())
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery");
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.util.upgrade;
|
||||
import com.gmail.nossr50.config.BukkitConfig;
|
||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
@ -41,7 +42,7 @@ public class UpgradeManager extends BukkitConfig {
|
||||
return;
|
||||
}
|
||||
|
||||
mcMMO.p.debug("Saving upgrade status for type " + type.toString() + "...");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Saving upgrade status for type " + type.toString() + "...");
|
||||
|
||||
config.set("Upgrades_Finished." + type.toString(), true);
|
||||
|
||||
@ -61,6 +62,6 @@ public class UpgradeManager extends BukkitConfig {
|
||||
}
|
||||
}
|
||||
|
||||
mcMMO.p.debug("Needed upgrades: " + Arrays.toString(setNeededUpgrades.toArray(new UpgradeType[setNeededUpgrades.size()])));
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Needed upgrades: " + Arrays.toString(setNeededUpgrades.toArray(new UpgradeType[setNeededUpgrades.size()])));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user