Make mcMMO quieter by moving most log messages to debug only

This commit is contained in:
nossr50
2023-06-19 16:26:30 -07:00
parent e39022cc64
commit 019d22d92a
46 changed files with 175 additions and 125 deletions

View File

@ -1,10 +1,8 @@
package com.gmail.nossr50.api;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakeEvent;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.jetbrains.annotations.NotNull;
public class TreeFellerBlockBreakEvent extends FakeBlockBreakEvent {

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
@ -31,7 +32,7 @@ public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
protected void saveConfig() {
try {
mcMMO.p.getLogger().info("Saving changes to config file - " + fileName);
LogUtils.debug(mcMMO.p.getLogger(), "Saving changes to config file - " + fileName);
config.options().indent(2);
config.save(configFile);
} catch (IOException e) {
@ -58,9 +59,9 @@ public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
oldKeys.removeAll(internalConfigKeys);
if (!oldKeys.isEmpty()) {
mcMMO.p.debug("old key(s) in \"" + fileName + "\"");
LogUtils.debug(mcMMO.p.getLogger(), "old key(s) in \"" + fileName + "\"");
for (String key : oldKeys) {
mcMMO.p.debug(" old-key:" + key);
LogUtils.debug(mcMMO.p.getLogger(), " old-key:" + key);
}
}
@ -73,7 +74,7 @@ public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
}
for (String key : newKeys) {
mcMMO.p.debug("Adding new key: " + key + " = " + internalConfig.get(key));
LogUtils.debug(mcMMO.p.getLogger(), "Adding new key: " + key + " = " + internalConfig.get(key));
config.set(key, internalConfig.get(key));
}

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
@ -22,7 +23,7 @@ public abstract class BukkitConfig {
private boolean savedDefaults = false;
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) {
mcMMO.p.getLogger().info("[config] Initializing config: " + fileName);
LogUtils.debug(mcMMO.p.getLogger(), "Initializing config: " + fileName);
this.copyDefaults = copyDefaults;
this.fileName = fileName;
this.dataFolder = dataFolder;
@ -30,7 +31,7 @@ public abstract class BukkitConfig {
this.defaultYamlConfig = saveDefaultConfigToDisk();
this.config = initConfig();
updateFile();
mcMMO.p.getLogger().info("[config] Config initialized: " + fileName);
LogUtils.debug(mcMMO.p.getLogger(), "Config initialized: " + fileName);
}
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
@ -81,10 +82,10 @@ public abstract class BukkitConfig {
* Copies the config from the JAR to defaults/<fileName>
*/
YamlConfiguration saveDefaultConfigToDisk() {
mcMMO.p.getLogger().info("[config] Copying default config to disk: " + fileName + " to defaults/" + fileName);
LogUtils.debug(mcMMO.p.getLogger(), "Copying default config to disk: " + fileName + " to defaults/" + fileName);
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
if(inputStream == null) {
mcMMO.p.getLogger().severe("[config] Unable to copy default config: " + fileName);
mcMMO.p.getLogger().severe("Unable to copy default config: " + fileName);
return null;
}
@ -109,11 +110,11 @@ public abstract class BukkitConfig {
YamlConfiguration initConfig() {
if (!configFile.exists()) {
mcMMO.p.getLogger().info("[config] User config file not found, copying a default config to disk: " + fileName);
LogUtils.debug(mcMMO.p.getLogger(), "User config file not found, copying a default config to disk: " + fileName);
mcMMO.p.saveResource(fileName, false);
}
mcMMO.p.getLogger().info("[config] Loading config from disk: " + fileName);
LogUtils.debug(mcMMO.p.getLogger(), "Loading config from disk: " + fileName);
YamlConfiguration config = new YamlConfiguration();
config.options().indent(4);
@ -151,7 +152,7 @@ public abstract class BukkitConfig {
protected void validate() {
if (validateKeys()) {
mcMMO.p.debug("No errors found in " + fileName + "!");
LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
} else {
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
@ -160,8 +161,8 @@ public abstract class BukkitConfig {
}
public void backup() {
mcMMO.p.getLogger().info("You are using an old version of the " + fileName + " file.");
mcMMO.p.getLogger().info("Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
LogUtils.debug(mcMMO.p.getLogger(), "You are using an old version of the " + fileName + " file.");
LogUtils.debug(mcMMO.p.getLogger(), "Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
configFile.renameTo(new File(configFile.getPath() + ".old"));

View File

@ -1005,4 +1005,8 @@ public class GeneralConfig extends BukkitConfig {
public boolean isGreenThumbReplantableCrop(@NotNull Material material) {
return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true);
}
public boolean useVerboseLogging() {
return config.getBoolean("General.Verbose_Logging", false);
}
}

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
@ -46,7 +47,7 @@ public abstract class LegacyConfigLoader {
protected void loadFile() {
if (!configFile.exists()) {
mcMMO.p.getLogger().info("Creating mcMMO " + fileName + " File...");
LogUtils.debug(mcMMO.p.getLogger(), "Creating mcMMO " + fileName + " File...");
try {
mcMMO.p.saveResource(fileName, false); // Normal files
@ -54,7 +55,7 @@ public abstract class LegacyConfigLoader {
mcMMO.p.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files
}
} else {
mcMMO.p.getLogger().info("Loading mcMMO " + fileName + " File...");
LogUtils.debug(mcMMO.p.getLogger(), "Loading mcMMO " + fileName + " File...");
}
config = YamlConfiguration.loadConfiguration(configFile);
@ -76,7 +77,7 @@ public abstract class LegacyConfigLoader {
protected void validate() {
if (validateKeys()) {
mcMMO.p.debug("No errors found in " + fileName + "!");
LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
} else {
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.config;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@ -130,7 +131,7 @@ public class RankConfig extends BukkitConfig {
String key = getRankAddressKey(subSkillType, rank, retroMode);
int defaultValue = defaultYamlConfig.getInt(key);
config.set(key, defaultValue);
mcMMO.p.getLogger().info(key + " SET -> " + defaultValue);
LogUtils.debug(mcMMO.p.getLogger(), key + " SET -> " + defaultValue);
}
/**
@ -147,10 +148,10 @@ public class RankConfig extends BukkitConfig {
if (badSkillSetup.isEmpty())
return;
mcMMO.p.getLogger().info("(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
for (SubSkillType subSkillType : badSkillSetup) {
mcMMO.p.getLogger().info("(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString());
LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString());
fixBadEntries(subSkillType);
}
}
@ -178,7 +179,7 @@ public class RankConfig extends BukkitConfig {
if (prevRank > curRank) {
//We're going to allow this but we're going to warn them
mcMMO.p.getLogger().info("(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements");
LogUtils.debug(mcMMO.p.getLogger(), "(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements");
badSkillSetup.add(subSkillType);
}
}

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.sounds.SoundType;
public class SoundConfig extends BukkitConfig {
@ -28,14 +29,14 @@ public class SoundConfig extends BukkitConfig {
protected boolean validateKeys() {
for (SoundType soundType : SoundType.values()) {
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
mcMMO.p.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType);
LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound volume cannot be below 0 for " + soundType);
return false;
}
//Sounds with custom pitching don't use pitch values
if (!soundType.usesCustomPitch()) {
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
mcMMO.p.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType);
LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound pitch cannot be below 0 for " + soundType);
return false;
}
}

View File

@ -73,7 +73,8 @@ public class WorldBlacklist {
closeRead(fileReader);
}
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
if(blacklist.size() > 0)
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
}
private void closeRead(Reader reader) {

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.config.skills.alchemy;
import com.gmail.nossr50.config.LegacyConfigLoader;
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
@ -100,7 +101,7 @@ public class PotionConfig extends LegacyConfigLoader {
}
}
mcMMO.p.debug("Loaded " + pass + " Alchemy potions, skipped " + fail + ".");
LogUtils.debug(mcMMO.p.getLogger(), "Loaded " + pass + " Alchemy potions, skipped " + fail + ".");
}
/**

View File

@ -7,6 +7,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
@ -48,7 +49,7 @@ public class RepairConfig extends BukkitConfig {
Material itemMaterial = Material.matchMaterial(key);
if (itemMaterial == null) {
//mcMMO.p.getLogger().info("No support for repair item "+key+ " in this version of Minecraft, skipping.");
//LogUtils.debug(mcMMO.p.getLogger(), "No support for repair item "+key+ " in this version of Minecraft, skipping.");
notSupported.add(key); //Collect names of unsupported items
continue;
}
@ -160,8 +161,8 @@ public class RepairConfig extends BukkitConfig {
}
}
mcMMO.p.getLogger().info(stringBuilder.toString());
mcMMO.p.getLogger().info("Items using materials that are not supported will simply be skipped.");
LogUtils.debug(mcMMO.p.getLogger(), stringBuilder.toString());
LogUtils.debug(mcMMO.p.getLogger(), "Items using materials that are not supported will simply be skipped.");
}
}

View File

@ -8,6 +8,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
@ -15,6 +16,7 @@ import org.bukkit.inventory.ItemStack;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
public class SalvageConfig extends BukkitConfig {
private final HashSet<String> notSupported;
@ -41,7 +43,7 @@ public class SalvageConfig extends BukkitConfig {
//Original version of 1.16 support had maximum quantities that were bad, this fixes it
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
mcMMO.p.getLogger().info("Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
mcMMO.p.getLogger().log(Level.INFO, "Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); //TODO: Doesn't make sense to default to 4 for everything
}
@ -49,9 +51,9 @@ public class SalvageConfig extends BukkitConfig {
try {
config.save(getFile());
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES);
mcMMO.p.getLogger().info("Fixed incorrect Salvage quantities for Netherite gear!");
LogUtils.debug(mcMMO.p.getLogger(), "Fixed incorrect Salvage quantities for Netherite gear!");
} catch (IOException e) {
mcMMO.p.getLogger().info("Unable to fix Salvage config, please delete the salvage yml file to generate a new one.");
LogUtils.debug(mcMMO.p.getLogger(), "Unable to fix Salvage config, please delete the salvage yml file to generate a new one.");
e.printStackTrace();
}
}
@ -178,8 +180,8 @@ public class SalvageConfig extends BukkitConfig {
}
}
mcMMO.p.getLogger().info(stringBuilder.toString());
mcMMO.p.getLogger().info("Items using materials that are not supported will simply be skipped.");
LogUtils.debug(mcMMO.p.getLogger(), stringBuilder.toString());
LogUtils.debug(mcMMO.p.getLogger(), "Items using materials that are not supported will simply be skipped.");
}
}

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.config.BukkitConfig;
import com.gmail.nossr50.datatypes.treasure.*;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EnchantmentUtils;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
@ -332,7 +333,7 @@ public class FishingTreasureConfig extends BukkitConfig {
}
if (!foundMatch) {
mcMMO.p.getLogger().info("[Fishing Treasure Init] Could not find any enchantments which matched the user defined enchantment named: " + str);
LogUtils.debug(mcMMO.p.getLogger(), "[Fishing Treasure Init] Could not find any enchantments which matched the user defined enchantment named: " + str);
}
}
}

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.config.BukkitConfig;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -272,14 +273,14 @@ public class TreasureConfig extends BukkitConfig {
case LEGACY:
int legacyDropLevel = getWrongKeyValue(type, treasureName, conversionType); //Legacy only had one value, Retro Mode didn't have a setting
//Config needs to be updated to be more specific
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: Legacy] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
LogUtils.debug(mcMMO.p.getLogger(), "(" + treasureName + ") [Fixing bad address: Legacy] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
config.set(type + "." + treasureName + LEGACY_DROP_LEVEL, null); //Remove legacy entry
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, legacyDropLevel * 10); //Multiply by 10 for Retro
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel);
shouldWeUpdateTheFile = true;
break;
case WRONG_KEY_STANDARD:
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: STANDARD] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
LogUtils.debug(mcMMO.p.getLogger(), "(" + treasureName + ") [Fixing bad address: STANDARD] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
int wrongKeyValueStandard = getWrongKeyValue(type, treasureName, conversionType);
config.set(type + "." + treasureName + WRONG_KEY_ROOT, null); //We also kill the Retro key here as we have enough information for setting in values if needed
@ -291,7 +292,7 @@ public class TreasureConfig extends BukkitConfig {
shouldWeUpdateTheFile = true;
break;
case WRONG_KEY_RETRO:
mcMMO.p.getLogger().info("(" + treasureName + ") [Fixing bad address: RETRO] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
LogUtils.debug(mcMMO.p.getLogger(), "(" + treasureName + ") [Fixing bad address: RETRO] Converting Drop_Level to Level_Requirement in treasures.yml for treasure to match new expected format");
int wrongKeyValueRetro = getWrongKeyValue(type, treasureName, conversionType);
config.set(type + "." + treasureName + WRONG_KEY_ROOT, null); //We also kill the Retro key here as we have enough information for setting in values if needed

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.database;
import com.gmail.nossr50.datatypes.database.DatabaseType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -16,14 +17,14 @@ public class DatabaseManagerFactory {
return createDefaultCustomDatabaseManager();
}
catch (Exception e) {
mcMMO.p.debug("Could not create custom database manager");
LogUtils.debug(mcMMO.p.getLogger(), "Could not create custom database manager");
e.printStackTrace();
}
catch (Throwable e) {
mcMMO.p.debug("Failed to create custom database manager");
LogUtils.debug(mcMMO.p.getLogger(), "Failed to create custom database manager");
e.printStackTrace();
}
mcMMO.p.debug("Falling back on " + (mcMMO.p.getGeneralConfig().getUseMySQL() ? "SQL" : "Flatfile") + " database");
LogUtils.debug(mcMMO.p.getLogger(), "Falling back on " + (mcMMO.p.getGeneralConfig().getUseMySQL() ? "SQL" : "Flatfile") + " database");
}
return mcMMO.p.getGeneralConfig().getUseMySQL() ? new SQLDatabaseManager() : new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
@ -62,16 +63,16 @@ public class DatabaseManagerFactory {
public static @Nullable DatabaseManager createDatabaseManager(@NotNull DatabaseType type, @NotNull String userFilePath, @NotNull Logger logger, long purgeTime, int startingLevel) {
switch (type) {
case FLATFILE:
mcMMO.p.getLogger().info("Using FlatFile Database");
LogUtils.debug(mcMMO.p.getLogger(), "Using FlatFile Database");
return new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
case SQL:
mcMMO.p.getLogger().info("Using SQL Database");
LogUtils.debug(mcMMO.p.getLogger(), "Using SQL Database");
return new SQLDatabaseManager();
case CUSTOM:
try {
mcMMO.p.getLogger().info("Attempting to use Custom Database");
LogUtils.debug(mcMMO.p.getLogger(), "Attempting to use Custom Database");
return createDefaultCustomDatabaseManager();
}
catch (Throwable e) {

View File

@ -9,6 +9,7 @@ import com.gmail.nossr50.datatypes.player.UniqueDataType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.SkillTools;
import org.bukkit.OfflinePlayer;
@ -115,7 +116,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
public int purgePowerlessUsers() {
int purgedUsers = 0;
logger.info("Purging powerless users...");
LogUtils.debug(logger, "Purging powerless users...");
BufferedReader in = null;
FileWriter out = null;
@ -183,7 +184,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
int removedPlayers = 0;
long currentTime = System.currentTimeMillis();
logger.info("Purging old users...");
LogUtils.debug(logger, "Purging old users...");
BufferedReader in = null;
FileWriter out = null;
@ -715,7 +716,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
boolean matchingName = dbPlayerName.equalsIgnoreCase(playerName);
if (!matchingName) {
logger.info("When loading user: "+playerName +" with UUID of (" + uuid.toString()
logger.warning("When loading user: "+playerName +" with UUID of (" + uuid.toString()
+") we found a mismatched name, the name in the DB will be replaced (DB name: "+dbPlayerName+")");
//logger.info("Name updated for player: " + rawSplitData[USERNAME_INDEX] + " => " + playerName);
rawSplitData[USERNAME_INDEX] = playerName;
@ -840,7 +841,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
}
finally {
logger.info(i + " entries written while saving UUID for " + userName);
LogUtils.debug(logger, i + " entries written while saving UUID for " + userName);
if (in != null) {
try {
in.close();
@ -898,7 +899,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
}
finally {
logger.info(i + " entries written while saving UUID batch");
LogUtils.debug(logger, i + " entries written while saving UUID batch");
if (in != null) {
try {
in.close();
@ -1092,7 +1093,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
public @Nullable List<FlatFileDataFlag> checkFileHealthAndStructure() {
ArrayList<FlatFileDataFlag> flagsFound = null;
logger.info("(" + usersFile.getPath() + ") Validating database file..");
LogUtils.debug(logger, "(" + usersFile.getPath() + ") Validating database file..");
FlatFileDataProcessor dataProcessor = null;
if (usersFile.exists()) {
@ -1127,7 +1128,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
//Only update the file if needed
if(dataProcessor.getFlatFileDataFlags().size() > 0) {
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
logger.info("Saving the updated and or repaired FlatFile Database...");
logger.info("Updating FlatFile Database...");
fileWriter = new FileWriter(usersFilePath);
//Write data to file
if(dbCommentDate != null)

View File

@ -11,6 +11,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.SkillTools;
import org.apache.tomcat.jdbc.pool.DataSource;
@ -1013,7 +1014,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
*/
private void checkDatabaseStructure(Connection connection, UpgradeType upgrade) {
if (!mcMMO.getUpgradeManager().shouldUpgrade(upgrade)) {
mcMMO.p.debug("Skipping " + upgrade.name() + " upgrade (unneeded)");
LogUtils.debug(mcMMO.p.getLogger(), "Skipping " + upgrade.name() + " upgrade (unneeded)");
return;
}
@ -1577,7 +1578,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
@Override
public void onDisable() {
mcMMO.p.debug("Releasing connection pool resource...");
LogUtils.debug(mcMMO.p.getLogger(), "Releasing connection pool resource...");
miscPool.close();
loadPool.close();
savePool.close();

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.datatypes.treasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -26,7 +27,7 @@ public class FishingTreasureBook extends FishingTreasure {
}
private void initLegalEnchantments() {
mcMMO.p.getLogger().info("Registering enchantments for Fishing Book...");
LogUtils.debug(mcMMO.p.getLogger(), "Registering enchantments for Fishing Book...");
for(Enchantment enchantment : Enchantment.values()) {
if(isEnchantAllowed(enchantment)) {

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType;
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.event.Event;
import java.util.ArrayList;
@ -52,7 +53,7 @@ public class InteractionManager {
//Register in name map
subSkillNameMap.putIfAbsent(lowerCaseName, abstractSubSkill);
mcMMO.p.getLogger().info("Registered subskill: "+ abstractSubSkill.getConfigKeyName());
LogUtils.debug(mcMMO.p.getLogger(), "Registered subskill: "+ abstractSubSkill.getConfigKeyName());
}
/**

View File

@ -958,8 +958,8 @@ public class PlayerListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(player);
if (mcMMOPlayer == null) {
mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server.");
mcMMO.p.debug("Party & Admin chat will not work properly for this player.");
LogUtils.debug(mcMMO.p.getLogger(), player.getName() + "is chatting, but is currently not logged in to the server.");
LogUtils.debug(mcMMO.p.getLogger(), "Party & Admin chat will not work properly for this player.");
return;
}

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.locale;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.text.TextUtils;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.ChatColor;
@ -192,7 +193,7 @@ public final class LocaleLoader {
//Use the new locale file
if (Files.exists(overridePath) && Files.isRegularFile(overridePath)) {
try (Reader localeReader = Files.newBufferedReader(overridePath)) {
mcMMO.p.getLogger().log(Level.INFO, "Loading locale from {0}", overridePath);
LogUtils.debug(mcMMO.p.getLogger(), "Loading locale from " + overridePath.toString());
filesystemBundle = new PropertyResourceBundle(localeReader);
} catch (IOException e) {
mcMMO.p.getLogger().log(Level.WARNING, "Failed to load locale from " + overridePath, e);

View File

@ -164,6 +164,9 @@ public class mcMMO extends JavaPlugin {
@Override
public void onEnable() {
try {
//Filter out any debug messages (if debug/verbose logging is not enabled)
getLogger().setFilter(new LogFilter(this));
setupFilePaths();
generalConfig = new GeneralConfig(getDataFolder()); //Load before skillTools
skillTools = new SkillTools(this); //Load after general config
@ -180,9 +183,6 @@ public class mcMMO extends JavaPlugin {
//metadata service
metadataService = new MetadataService(this);
//Filter out any debug messages (if debug/verbose logging is not enabled)
getLogger().setFilter(new LogFilter(this));
MetadataConstants.MCMMO_METADATA_VALUE = new FixedMetadataValue(this, true);
PluginManager pluginManager = getServer().getPluginManager();
@ -191,7 +191,6 @@ public class mcMMO extends JavaPlugin {
upgradeManager = new UpgradeManager();
modManager = new ModManager();
//Init Material Maps
@ -256,7 +255,7 @@ public class mcMMO extends JavaPlugin {
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
debug("Version " + getDescription().getVersion() + " is enabled!");
LogUtils.debug(mcMMO.p.getLogger(), "Version " + getDescription().getVersion() + " is enabled!");
scheduleTasks();
CommandRegistrationManager.registerCommands();
@ -391,13 +390,13 @@ public class mcMMO extends JavaPlugin {
}
}
debug("Canceling all tasks...");
LogUtils.debug(mcMMO.p.getLogger(), "Canceling all tasks...");
getServer().getScheduler().cancelTasks(this); // This removes our tasks
debug("Unregister all events...");
LogUtils.debug(mcMMO.p.getLogger(), "Unregister all events...");
HandlerList.unregisterAll(this); // Cancel event registrations
databaseManager.onDisable();
debug("Was disabled."); // How informative!
LogUtils.debug(mcMMO.p.getLogger(), "Was disabled."); // How informative!
}
public static String getMainDirectory() {
@ -432,10 +431,6 @@ public class mcMMO extends JavaPlugin {
xpEventEnabled = !xpEventEnabled;
}
public void debug(String message) {
getLogger().info("[Debug] " + message);
}
public static FormulaManager getFormulaManager() {
return formulaManager;
}
@ -616,7 +611,7 @@ public class mcMMO extends JavaPlugin {
if(CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS))
{
getLogger().info("Enabling Acrobatics Skills");
LogUtils.debug(mcMMO.p.getLogger(), "Enabling Acrobatics Skills");
//TODO: Should do this differently
Roll roll = new Roll();

View File

@ -12,6 +12,7 @@ import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
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.Permissions;
import com.gmail.nossr50.util.player.NotificationManager;
@ -644,7 +645,7 @@ public final class PartyManager {
}
}
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
LogUtils.debug(mcMMO.p.getLogger(), "Loaded (" + parties.size() + ") Parties...");
for (Party party : hasAlly) {
party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
@ -660,7 +661,7 @@ public final class PartyManager {
* Save party file.
*/
public static void saveParties() {
mcMMO.p.debug("[Party Data] Saving...");
LogUtils.debug(mcMMO.p.getLogger(), "[Party Data] Saving...");
if (partyFile.exists()) {
if (!partyFile.delete()) {
@ -768,7 +769,7 @@ public final class PartyManager {
// parties.add(party);
// }
//
// mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
// LogUtils.debug(mcMMO.p.getLogger(), "Loaded (" + parties.size() + ") Parties...");
//
// for (Party party : hasAlly) {
// party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));

View File

@ -9,17 +9,15 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.text.StringUtils;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
import java.util.TreeMap;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class PapiExpansion extends PlaceholderExpansion {
private final Map<String, Placeholder> placeholders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);

View File

@ -4,13 +4,14 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.scheduler.BukkitRunnable;
public class SaveTimerTask extends BukkitRunnable {
@Override
public void run() {
mcMMO.p.debug("[User Data] Saving...");
LogUtils.debug(mcMMO.p.getLogger(), "[User Data] Saving...");
// All player data will be saved periodically through this
int count = 1;

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.runnables.backups;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
@ -37,7 +38,7 @@ public class CleanBackupsTask extends BukkitRunnable {
Date date = getDate(fileName.split("[.]")[0]);
if (!fileName.contains(".zip") || date == null) {
mcMMO.p.debug("Could not determine date for file: " + fileName);
LogUtils.debug(mcMMO.p.getLogger(), "Could not determine date for file: " + fileName);
continue;
}
@ -74,11 +75,11 @@ public class CleanBackupsTask extends BukkitRunnable {
return;
}
mcMMO.p.getLogger().info("Cleaned backup files. Deleted " + amountDeleted + " of " + amountTotal + " files.");
LogUtils.debug(mcMMO.p.getLogger(), "Cleaned backup files. Deleted " + amountDeleted + " of " + amountTotal + " files.");
for (File file : toDelete) {
if (file.delete()) {
mcMMO.p.debug("Deleted: " + file.getName());
LogUtils.debug(mcMMO.p.getLogger(), "Deleted: " + file.getName());
}
}
}

View File

@ -8,6 +8,7 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
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.gmail.nossr50.util.skills.SkillTools;
@ -36,7 +37,7 @@ public class FormulaConversionTask extends BukkitRunnable {
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
if (!profile.isLoaded()) {
mcMMO.p.debug("Profile not loaded.");
LogUtils.debug(mcMMO.p.getLogger(), "Profile not loaded.");
continue;
}
@ -57,8 +58,8 @@ public class FormulaConversionTask extends BukkitRunnable {
}
private void editValues(PlayerProfile profile) {
mcMMO.p.debug("========================================================================");
mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":");
LogUtils.debug(mcMMO.p.getLogger(), "========================================================================");
LogUtils.debug(mcMMO.p.getLogger(), "Conversion report for " + profile.getPlayerName() + ":");
for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) {
int oldLevel = profile.getSkillLevel(primarySkillType);
int oldXPLevel = profile.getSkillXpLevel(primarySkillType);
@ -72,17 +73,17 @@ public class FormulaConversionTask extends BukkitRunnable {
int newLevel = newExperienceValues[0];
int newXPlevel = newExperienceValues[1];
mcMMO.p.debug(" Skill: " + primarySkillType.toString());
LogUtils.debug(mcMMO.p.getLogger(), " Skill: " + primarySkillType.toString());
mcMMO.p.debug(" OLD:");
mcMMO.p.debug(" Level: " + oldLevel);
mcMMO.p.debug(" XP " + oldXPLevel);
mcMMO.p.debug(" Total XP " + totalOldXP);
LogUtils.debug(mcMMO.p.getLogger(), " OLD:");
LogUtils.debug(mcMMO.p.getLogger(), " Level: " + oldLevel);
LogUtils.debug(mcMMO.p.getLogger(), " XP " + oldXPLevel);
LogUtils.debug(mcMMO.p.getLogger(), " Total XP " + totalOldXP);
mcMMO.p.debug(" NEW:");
mcMMO.p.debug(" Level " + newLevel);
mcMMO.p.debug(" XP " + newXPlevel);
mcMMO.p.debug("------------------------------------------------------------------------");
LogUtils.debug(mcMMO.p.getLogger(), " NEW:");
LogUtils.debug(mcMMO.p.getLogger(), " Level " + newLevel);
LogUtils.debug(mcMMO.p.getLogger(), " XP " + newXPlevel);
LogUtils.debug(mcMMO.p.getLogger(), "------------------------------------------------------------------------");
profile.modifySkill(primarySkillType, newLevel);
profile.setSkillXpLevel(primarySkillType, newXPlevel);

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
@ -37,14 +38,14 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
// Quit if they logged out
if (!player.isOnline()) {
mcMMO.p.getLogger().info("Aborting profile loading recovery for " + player.getName() + " - player logged out");
LogUtils.debug(mcMMO.p.getLogger(), "Aborting profile loading recovery for " + player.getName() + " - player logged out");
return;
}
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player);
if(!profile.isLoaded()) {
mcMMO.p.getLogger().info("Creating new data for player: "+player.getName());
LogUtils.debug(mcMMO.p.getLogger(), "Creating new data for player: "+player.getName());
//Profile isn't loaded so add as new user
profile = mcMMO.getDatabaseManager().newUser(player);
}

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.skills.alchemy;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
import com.gmail.nossr50.util.LogUtils;
import org.bukkit.Location;
import java.util.ArrayList;
@ -58,7 +59,7 @@ public final class Alchemy {
* Finish all active brews. Used upon Disable to prevent vanilla potions from being brewed upon next Enable.
*/
public static void finishAllBrews() {
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
LogUtils.debug(mcMMO.p.getLogger(), "Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
List<AlchemyBrewTask> toFinish = new ArrayList<>(brewingStandMap.values());

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.child;
import com.gmail.nossr50.config.BukkitConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.configuration.file.YamlConfiguration;
@ -22,7 +23,7 @@ public class ChildConfig extends BukkitConfig {
FamilyTree.clearRegistrations(); // when reloading, need to clear statics
for (PrimarySkillType skill : mcMMO.p.getSkillTools().CHILD_SKILLS) {
mcMMO.p.debug("Finding parents of " + skill.name());
LogUtils.debug(mcMMO.p.getLogger(), "Finding parents of " + skill.name());
EnumSet<PrimarySkillType> parentSkills = EnumSet.noneOf(PrimarySkillType.class);
boolean useDefaults = false; // If we had an error we back out and use defaults
@ -53,7 +54,7 @@ public class ChildConfig extends BukkitConfig {
// Register them
for (PrimarySkillType parentSkill : parentSkills) {
mcMMO.p.debug("Registering " + parentSkill.name() + " as parent of " + skill.name());
LogUtils.debug(mcMMO.p.getLogger(), "Registering " + parentSkill.name() + " as parent of " + skill.name());
FamilyTree.registerParent(skill, parentSkill);
}
}

View File

@ -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()) {

View File

@ -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 {

View File

@ -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);
}
}

View 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);
}
}

View File

@ -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();

View File

@ -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() {

View File

@ -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());

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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");

View File

@ -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()])));
}
}

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.worldguard;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldguard.WorldGuard;
@ -94,7 +95,7 @@ public class WorldGuardManager {
registry.register(WorldGuardFlags.MCMMO_ENABLE_WG_FLAG);
registry.register(WorldGuardFlags.MCMMO_XP_WG_FLAG);
registry.register(WorldGuardFlags.MCMMO_HARDCORE_WG_FLAG);
mcMMO.p.getLogger().info("Registered WG flags successfully!");
LogUtils.debug(mcMMO.p.getLogger(), "Registered WG flags successfully!");
} catch (FlagConflictException e) {
e.printStackTrace();
mcMMO.p.getLogger().warning("Failed to register WG flags!");

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.worldguard;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.flags.registry.SimpleFlagRegistry;
@ -67,7 +68,7 @@ public class WorldGuardUtils {
if(plugin == null) {
//WG is not present
detectedIncompatibleWG = true;
mcMMO.p.getLogger().info("WorldGuard was not detected.");
LogUtils.debug(mcMMO.p.getLogger(), "WorldGuard was not detected.");
} else {
//Check that its actually of class WorldGuardPlugin
if(plugin instanceof WorldGuardPlugin)