mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 09:13:43 +01:00 
			
		
		
		
	Make mcMMO quieter by moving most log messages to debug only
This commit is contained in:
		| @@ -1,3 +1,7 @@ | |||||||
|  | Version 2.1.222 | ||||||
|  |     A lot of mcMMO logging was moved from INFO to DEBUG, this should reduce the amount of noise in your logs and console | ||||||
|  |  | ||||||
|  |     NOTES: If you want to see all logging messages, modify config.yml and set General.Verbose_Logging to true | ||||||
| Version 2.1.221 | Version 2.1.221 | ||||||
|     PAPI Support is now built into mcMMO and loads when mcMMO loads (as long as you have PAPI running) |     PAPI Support is now built into mcMMO and loads when mcMMO loads (as long as you have PAPI running) | ||||||
|     Fixed blast mining bonus drops not working (Thanks warriiorrrr) |     Fixed blast mining bonus drops not working (Thanks warriiorrrr) | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | |||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|     <groupId>com.gmail.nossr50.mcMMO</groupId> |     <groupId>com.gmail.nossr50.mcMMO</groupId> | ||||||
|     <artifactId>mcMMO</artifactId> |     <artifactId>mcMMO</artifactId> | ||||||
|     <version>2.1.221</version> |     <version>2.1.222-SNAPSHOT</version> | ||||||
|     <name>mcMMO</name> |     <name>mcMMO</name> | ||||||
|     <url>https://github.com/mcMMO-Dev/mcMMO</url> |     <url>https://github.com/mcMMO-Dev/mcMMO</url> | ||||||
|     <scm> |     <scm> | ||||||
|   | |||||||
| @@ -1,10 +1,8 @@ | |||||||
| package com.gmail.nossr50.api; | package com.gmail.nossr50.api; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; | import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; | ||||||
| import com.gmail.nossr50.events.fake.FakeEvent; |  | ||||||
| import org.bukkit.block.Block; | import org.bukkit.block.Block; | ||||||
| import org.bukkit.entity.Player; | import org.bukkit.entity.Player; | ||||||
| import org.bukkit.event.block.BlockBreakEvent; |  | ||||||
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.NotNull; | ||||||
|  |  | ||||||
| public class TreeFellerBlockBreakEvent extends FakeBlockBreakEvent { | public class TreeFellerBlockBreakEvent extends FakeBlockBreakEvent { | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.config; | package com.gmail.nossr50.config; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.configuration.file.FileConfiguration; | import org.bukkit.configuration.file.FileConfiguration; | ||||||
| import org.bukkit.configuration.file.YamlConfiguration; | import org.bukkit.configuration.file.YamlConfiguration; | ||||||
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.NotNull; | ||||||
| @@ -31,7 +32,7 @@ public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader { | |||||||
|  |  | ||||||
|     protected void saveConfig() { |     protected void saveConfig() { | ||||||
|         try { |         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.options().indent(2); | ||||||
|             config.save(configFile); |             config.save(configFile); | ||||||
|         } catch (IOException e) { |         } catch (IOException e) { | ||||||
| @@ -58,9 +59,9 @@ public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader { | |||||||
|         oldKeys.removeAll(internalConfigKeys); |         oldKeys.removeAll(internalConfigKeys); | ||||||
|  |  | ||||||
|         if (!oldKeys.isEmpty()) { |         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) { |             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) { |         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)); |             config.set(key, internalConfig.get(key)); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.config; | package com.gmail.nossr50.config; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.configuration.InvalidConfigurationException; | import org.bukkit.configuration.InvalidConfigurationException; | ||||||
| import org.bukkit.configuration.file.YamlConfiguration; | import org.bukkit.configuration.file.YamlConfiguration; | ||||||
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.NotNull; | ||||||
| @@ -22,7 +23,7 @@ public abstract class BukkitConfig { | |||||||
|     private boolean savedDefaults = false; |     private boolean savedDefaults = false; | ||||||
|  |  | ||||||
|     public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) { |     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.copyDefaults = copyDefaults; | ||||||
|         this.fileName = fileName; |         this.fileName = fileName; | ||||||
|         this.dataFolder = dataFolder; |         this.dataFolder = dataFolder; | ||||||
| @@ -30,7 +31,7 @@ public abstract class BukkitConfig { | |||||||
|         this.defaultYamlConfig = saveDefaultConfigToDisk(); |         this.defaultYamlConfig = saveDefaultConfigToDisk(); | ||||||
|         this.config = initConfig(); |         this.config = initConfig(); | ||||||
|         updateFile(); |         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) { |     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> |      * Copies the config from the JAR to defaults/<fileName> | ||||||
|      */ |      */ | ||||||
|     YamlConfiguration saveDefaultConfigToDisk() { |     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)) { |         try(InputStream inputStream = mcMMO.p.getResource(fileName)) { | ||||||
|             if(inputStream == null) { |             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; |                 return null; | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -109,11 +110,11 @@ public abstract class BukkitConfig { | |||||||
|  |  | ||||||
|     YamlConfiguration initConfig() { |     YamlConfiguration initConfig() { | ||||||
|         if (!configFile.exists()) { |         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.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(); |         YamlConfiguration config = new YamlConfiguration(); | ||||||
|         config.options().indent(4); |         config.options().indent(4); | ||||||
|  |  | ||||||
| @@ -151,7 +152,7 @@ public abstract class BukkitConfig { | |||||||
|  |  | ||||||
|     protected void validate() { |     protected void validate() { | ||||||
|         if (validateKeys()) { |         if (validateKeys()) { | ||||||
|             mcMMO.p.debug("No errors found in " + fileName + "!"); |             LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!"); | ||||||
|         } else { |         } else { | ||||||
|             mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); |             mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); | ||||||
|             mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); |             mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); | ||||||
| @@ -160,8 +161,8 @@ public abstract class BukkitConfig { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void backup() { |     public void backup() { | ||||||
|         mcMMO.p.getLogger().info("You are using an old version of the " + fileName + " file."); |         LogUtils.debug(mcMMO.p.getLogger(), "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(), "Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version."); | ||||||
|  |  | ||||||
|         configFile.renameTo(new File(configFile.getPath() + ".old")); |         configFile.renameTo(new File(configFile.getPath() + ".old")); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1005,4 +1005,8 @@ public class GeneralConfig extends BukkitConfig { | |||||||
|     public boolean isGreenThumbReplantableCrop(@NotNull Material material) { |     public boolean isGreenThumbReplantableCrop(@NotNull Material material) { | ||||||
|         return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true); |         return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public boolean useVerboseLogging() { | ||||||
|  |         return config.getBoolean("General.Verbose_Logging", false); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.config; | package com.gmail.nossr50.config; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.configuration.file.YamlConfiguration; | import org.bukkit.configuration.file.YamlConfiguration; | ||||||
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.NotNull; | ||||||
|  |  | ||||||
| @@ -46,7 +47,7 @@ public abstract class LegacyConfigLoader { | |||||||
|  |  | ||||||
|     protected void loadFile() { |     protected void loadFile() { | ||||||
|         if (!configFile.exists()) { |         if (!configFile.exists()) { | ||||||
|             mcMMO.p.getLogger().info("Creating mcMMO " + fileName + " File..."); |             LogUtils.debug(mcMMO.p.getLogger(), "Creating mcMMO " + fileName + " File..."); | ||||||
|  |  | ||||||
|             try { |             try { | ||||||
|                 mcMMO.p.saveResource(fileName, false); // Normal files |                 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 |                 mcMMO.p.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|             mcMMO.p.getLogger().info("Loading mcMMO " + fileName + " File..."); |             LogUtils.debug(mcMMO.p.getLogger(), "Loading mcMMO " + fileName + " File..."); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         config = YamlConfiguration.loadConfiguration(configFile); |         config = YamlConfiguration.loadConfiguration(configFile); | ||||||
| @@ -76,7 +77,7 @@ public abstract class LegacyConfigLoader { | |||||||
|  |  | ||||||
|     protected void validate() { |     protected void validate() { | ||||||
|         if (validateKeys()) { |         if (validateKeys()) { | ||||||
|             mcMMO.p.debug("No errors found in " + fileName + "!"); |             LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!"); | ||||||
|         } else { |         } else { | ||||||
|             mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); |             mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); | ||||||
|             mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); |             mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ package com.gmail.nossr50.config; | |||||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||||
| import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; | import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.NotNull; | ||||||
|  |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| @@ -130,7 +131,7 @@ public class RankConfig extends BukkitConfig { | |||||||
|         String key = getRankAddressKey(subSkillType, rank, retroMode); |         String key = getRankAddressKey(subSkillType, rank, retroMode); | ||||||
|         int defaultValue = defaultYamlConfig.getInt(key); |         int defaultValue = defaultYamlConfig.getInt(key); | ||||||
|         config.set(key, defaultValue); |         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()) |         if (badSkillSetup.isEmpty()) | ||||||
|             return; |             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) { |         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); |             fixBadEntries(subSkillType); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -178,7 +179,7 @@ public class RankConfig extends BukkitConfig { | |||||||
|  |  | ||||||
|                 if (prevRank > curRank) { |                 if (prevRank > curRank) { | ||||||
|                     //We're going to allow this but we're going to warn them |                     //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); |                     badSkillSetup.add(subSkillType); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.config; | package com.gmail.nossr50.config; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.sounds.SoundType; | import com.gmail.nossr50.util.sounds.SoundType; | ||||||
|  |  | ||||||
| public class SoundConfig extends BukkitConfig { | public class SoundConfig extends BukkitConfig { | ||||||
| @@ -28,14 +29,14 @@ public class SoundConfig extends BukkitConfig { | |||||||
|     protected boolean validateKeys() { |     protected boolean validateKeys() { | ||||||
|         for (SoundType soundType : SoundType.values()) { |         for (SoundType soundType : SoundType.values()) { | ||||||
|             if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) { |             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; |                 return false; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             //Sounds with custom pitching don't use pitch values |             //Sounds with custom pitching don't use pitch values | ||||||
|             if (!soundType.usesCustomPitch()) { |             if (!soundType.usesCustomPitch()) { | ||||||
|                 if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) { |                 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; |                     return false; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -73,7 +73,8 @@ public class WorldBlacklist { | |||||||
|             closeRead(fileReader); |             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) { |     private void closeRead(Reader reader) { | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ package com.gmail.nossr50.config.skills.alchemy; | |||||||
| import com.gmail.nossr50.config.LegacyConfigLoader; | import com.gmail.nossr50.config.LegacyConfigLoader; | ||||||
| import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion; | import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.ChatColor; | import org.bukkit.ChatColor; | ||||||
| import org.bukkit.Color; | import org.bukkit.Color; | ||||||
| import org.bukkit.Material; | 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 + "."); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ import com.gmail.nossr50.mcMMO; | |||||||
| import com.gmail.nossr50.skills.repair.repairables.Repairable; | import com.gmail.nossr50.skills.repair.repairables.Repairable; | ||||||
| import com.gmail.nossr50.skills.repair.repairables.RepairableFactory; | import com.gmail.nossr50.skills.repair.repairables.RepairableFactory; | ||||||
| import com.gmail.nossr50.util.ItemUtils; | import com.gmail.nossr50.util.ItemUtils; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.Material; | import org.bukkit.Material; | ||||||
| import org.bukkit.configuration.ConfigurationSection; | import org.bukkit.configuration.ConfigurationSection; | ||||||
| import org.bukkit.inventory.ItemStack; | import org.bukkit.inventory.ItemStack; | ||||||
| @@ -48,7 +49,7 @@ public class RepairConfig extends BukkitConfig { | |||||||
|             Material itemMaterial = Material.matchMaterial(key); |             Material itemMaterial = Material.matchMaterial(key); | ||||||
|  |  | ||||||
|             if (itemMaterial == null) { |             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 |                 notSupported.add(key); //Collect names of unsupported items | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
| @@ -160,8 +161,8 @@ public class RepairConfig extends BukkitConfig { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             mcMMO.p.getLogger().info(stringBuilder.toString()); |             LogUtils.debug(mcMMO.p.getLogger(), stringBuilder.toString()); | ||||||
|             mcMMO.p.getLogger().info("Items using materials that are not supported will simply be skipped."); |             LogUtils.debug(mcMMO.p.getLogger(), "Items using materials that are not supported will simply be skipped."); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ import com.gmail.nossr50.mcMMO; | |||||||
| import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; | import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; | ||||||
| import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory; | import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory; | ||||||
| import com.gmail.nossr50.util.ItemUtils; | import com.gmail.nossr50.util.ItemUtils; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.skills.SkillUtils; | import com.gmail.nossr50.util.skills.SkillUtils; | ||||||
| import org.bukkit.Material; | import org.bukkit.Material; | ||||||
| import org.bukkit.configuration.ConfigurationSection; | import org.bukkit.configuration.ConfigurationSection; | ||||||
| @@ -15,6 +16,7 @@ import org.bukkit.inventory.ItemStack; | |||||||
|  |  | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.*; | import java.util.*; | ||||||
|  | import java.util.logging.Level; | ||||||
|  |  | ||||||
| public class SalvageConfig extends BukkitConfig { | public class SalvageConfig extends BukkitConfig { | ||||||
|     private final HashSet<String> notSupported; |     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 |         //Original version of 1.16 support had maximum quantities that were bad, this fixes it | ||||||
|  |  | ||||||
|         if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) { |         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()) { |             for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) { | ||||||
|                 config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); //TODO: Doesn't make sense to default to 4 for everything |                 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 { |             try { | ||||||
|                 config.save(getFile()); |                 config.save(getFile()); | ||||||
|                 mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES); |                 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) { |             } 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(); |                 e.printStackTrace(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -178,8 +180,8 @@ public class SalvageConfig extends BukkitConfig { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             mcMMO.p.getLogger().info(stringBuilder.toString()); |             LogUtils.debug(mcMMO.p.getLogger(), stringBuilder.toString()); | ||||||
|             mcMMO.p.getLogger().info("Items using materials that are not supported will simply be skipped."); |             LogUtils.debug(mcMMO.p.getLogger(), "Items using materials that are not supported will simply be skipped."); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import com.gmail.nossr50.config.BukkitConfig; | |||||||
| import com.gmail.nossr50.datatypes.treasure.*; | import com.gmail.nossr50.datatypes.treasure.*; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
| import com.gmail.nossr50.util.EnchantmentUtils; | import com.gmail.nossr50.util.EnchantmentUtils; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.ChatColor; | import org.bukkit.ChatColor; | ||||||
| import org.bukkit.Material; | import org.bukkit.Material; | ||||||
| import org.bukkit.configuration.ConfigurationSection; | import org.bukkit.configuration.ConfigurationSection; | ||||||
| @@ -332,7 +333,7 @@ public class FishingTreasureConfig extends BukkitConfig { | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (!foundMatch) { |             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); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import com.gmail.nossr50.config.BukkitConfig; | |||||||
| import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; | import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; | ||||||
| import com.gmail.nossr50.datatypes.treasure.HylianTreasure; | import com.gmail.nossr50.datatypes.treasure.HylianTreasure; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.text.StringUtils; | import com.gmail.nossr50.util.text.StringUtils; | ||||||
| import org.bukkit.ChatColor; | import org.bukkit.ChatColor; | ||||||
| import org.bukkit.Material; | import org.bukkit.Material; | ||||||
| @@ -272,14 +273,14 @@ public class TreasureConfig extends BukkitConfig { | |||||||
|             case LEGACY: |             case LEGACY: | ||||||
|                 int legacyDropLevel = getWrongKeyValue(type, treasureName, conversionType); //Legacy only had one value, Retro Mode didn't have a setting |                 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 |                 //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 + 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_RETRO_MODE, legacyDropLevel * 10); //Multiply by 10 for Retro | ||||||
|                 config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel); |                 config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel); | ||||||
|                 shouldWeUpdateTheFile = true; |                 shouldWeUpdateTheFile = true; | ||||||
|                 break; |                 break; | ||||||
|             case WRONG_KEY_STANDARD: |             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); |                 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 |                 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; |                 shouldWeUpdateTheFile = true; | ||||||
|                 break; |                 break; | ||||||
|             case WRONG_KEY_RETRO: |             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); |                 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 |                 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 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package com.gmail.nossr50.database; | |||||||
|  |  | ||||||
| import com.gmail.nossr50.datatypes.database.DatabaseType; | import com.gmail.nossr50.datatypes.database.DatabaseType; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.NotNull; | ||||||
| import org.jetbrains.annotations.Nullable; | import org.jetbrains.annotations.Nullable; | ||||||
|  |  | ||||||
| @@ -16,14 +17,14 @@ public class DatabaseManagerFactory { | |||||||
|                 return createDefaultCustomDatabaseManager(); |                 return createDefaultCustomDatabaseManager(); | ||||||
|             } |             } | ||||||
|             catch (Exception e) { |             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(); |                 e.printStackTrace(); | ||||||
|             } |             } | ||||||
|             catch (Throwable e) { |             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(); |                 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); |         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) { |     public static @Nullable DatabaseManager createDatabaseManager(@NotNull DatabaseType type, @NotNull String userFilePath, @NotNull Logger logger, long purgeTime, int startingLevel) { | ||||||
|         switch (type) { |         switch (type) { | ||||||
|             case FLATFILE: |             case FLATFILE: | ||||||
|                 mcMMO.p.getLogger().info("Using FlatFile Database"); |                 LogUtils.debug(mcMMO.p.getLogger(), "Using FlatFile Database"); | ||||||
|                 return new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel); |                 return new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel); | ||||||
|  |  | ||||||
|             case SQL: |             case SQL: | ||||||
|                 mcMMO.p.getLogger().info("Using SQL Database"); |                 LogUtils.debug(mcMMO.p.getLogger(), "Using SQL Database"); | ||||||
|                 return new SQLDatabaseManager(); |                 return new SQLDatabaseManager(); | ||||||
|  |  | ||||||
|             case CUSTOM: |             case CUSTOM: | ||||||
|                 try { |                 try { | ||||||
|                     mcMMO.p.getLogger().info("Attempting to use Custom Database"); |                     LogUtils.debug(mcMMO.p.getLogger(), "Attempting to use Custom Database"); | ||||||
|                     return createDefaultCustomDatabaseManager(); |                     return createDefaultCustomDatabaseManager(); | ||||||
|                 } |                 } | ||||||
|                 catch (Throwable e) { |                 catch (Throwable e) { | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ import com.gmail.nossr50.datatypes.player.UniqueDataType; | |||||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.Misc; | import com.gmail.nossr50.util.Misc; | ||||||
| import com.gmail.nossr50.util.skills.SkillTools; | import com.gmail.nossr50.util.skills.SkillTools; | ||||||
| import org.bukkit.OfflinePlayer; | import org.bukkit.OfflinePlayer; | ||||||
| @@ -115,7 +116,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager { | |||||||
|     public int purgePowerlessUsers() { |     public int purgePowerlessUsers() { | ||||||
|         int purgedUsers = 0; |         int purgedUsers = 0; | ||||||
|  |  | ||||||
|         logger.info("Purging powerless users..."); |         LogUtils.debug(logger, "Purging powerless users..."); | ||||||
|  |  | ||||||
|         BufferedReader in = null; |         BufferedReader in = null; | ||||||
|         FileWriter out = null; |         FileWriter out = null; | ||||||
| @@ -183,7 +184,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager { | |||||||
|         int removedPlayers = 0; |         int removedPlayers = 0; | ||||||
|         long currentTime = System.currentTimeMillis(); |         long currentTime = System.currentTimeMillis(); | ||||||
|  |  | ||||||
|         logger.info("Purging old users..."); |         LogUtils.debug(logger, "Purging old users..."); | ||||||
|  |  | ||||||
|         BufferedReader in = null; |         BufferedReader in = null; | ||||||
|         FileWriter out = null; |         FileWriter out = null; | ||||||
| @@ -715,7 +716,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager { | |||||||
|                             boolean matchingName = dbPlayerName.equalsIgnoreCase(playerName); |                             boolean matchingName = dbPlayerName.equalsIgnoreCase(playerName); | ||||||
|  |  | ||||||
|                             if (!matchingName) { |                             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+")"); |                                         +") 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); |                                 //logger.info("Name updated for player: " + rawSplitData[USERNAME_INDEX] + " => " + playerName); | ||||||
|                                 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); |                 logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e); | ||||||
|             } |             } | ||||||
|             finally { |             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) { |                 if (in != null) { | ||||||
|                     try { |                     try { | ||||||
|                         in.close(); |                         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); |                 logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e); | ||||||
|             } |             } | ||||||
|             finally { |             finally { | ||||||
|                 logger.info(i + " entries written while saving UUID batch"); |                 LogUtils.debug(logger, i + " entries written while saving UUID batch"); | ||||||
|                 if (in != null) { |                 if (in != null) { | ||||||
|                     try { |                     try { | ||||||
|                         in.close(); |                         in.close(); | ||||||
| @@ -1092,7 +1093,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager { | |||||||
|  |  | ||||||
|     public @Nullable List<FlatFileDataFlag> checkFileHealthAndStructure() { |     public @Nullable List<FlatFileDataFlag> checkFileHealthAndStructure() { | ||||||
|         ArrayList<FlatFileDataFlag> flagsFound = null; |         ArrayList<FlatFileDataFlag> flagsFound = null; | ||||||
|         logger.info("(" + usersFile.getPath() + ") Validating database file.."); |         LogUtils.debug(logger, "(" + usersFile.getPath() + ") Validating database file.."); | ||||||
|         FlatFileDataProcessor dataProcessor = null; |         FlatFileDataProcessor dataProcessor = null; | ||||||
|  |  | ||||||
|         if (usersFile.exists()) { |         if (usersFile.exists()) { | ||||||
| @@ -1127,7 +1128,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager { | |||||||
|                     //Only update the file if needed |                     //Only update the file if needed | ||||||
|                     if(dataProcessor.getFlatFileDataFlags().size() > 0) { |                     if(dataProcessor.getFlatFileDataFlags().size() > 0) { | ||||||
|                         flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags()); |                         flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags()); | ||||||
|                         logger.info("Saving the updated and or repaired FlatFile Database..."); |                         logger.info("Updating FlatFile Database..."); | ||||||
|                         fileWriter = new FileWriter(usersFilePath); |                         fileWriter = new FileWriter(usersFilePath); | ||||||
|                         //Write data to file |                         //Write data to file | ||||||
|                         if(dbCommentDate != null) |                         if(dbCommentDate != null) | ||||||
|   | |||||||
| @@ -11,6 +11,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | |||||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
| import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask; | import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.Misc; | import com.gmail.nossr50.util.Misc; | ||||||
| import com.gmail.nossr50.util.skills.SkillTools; | import com.gmail.nossr50.util.skills.SkillTools; | ||||||
| import org.apache.tomcat.jdbc.pool.DataSource; | import org.apache.tomcat.jdbc.pool.DataSource; | ||||||
| @@ -1013,7 +1014,7 @@ public final class SQLDatabaseManager implements DatabaseManager { | |||||||
|      */ |      */ | ||||||
|     private void checkDatabaseStructure(Connection connection, UpgradeType upgrade) { |     private void checkDatabaseStructure(Connection connection, UpgradeType upgrade) { | ||||||
|         if (!mcMMO.getUpgradeManager().shouldUpgrade(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; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -1577,7 +1578,7 @@ public final class SQLDatabaseManager implements DatabaseManager { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void onDisable() { |     public void onDisable() { | ||||||
|         mcMMO.p.debug("Releasing connection pool resource..."); |         LogUtils.debug(mcMMO.p.getLogger(), "Releasing connection pool resource..."); | ||||||
|         miscPool.close(); |         miscPool.close(); | ||||||
|         loadPool.close(); |         loadPool.close(); | ||||||
|         savePool.close(); |         savePool.close(); | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.datatypes.treasure; | package com.gmail.nossr50.datatypes.treasure; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.enchantments.Enchantment; | import org.bukkit.enchantments.Enchantment; | ||||||
| import org.bukkit.inventory.ItemStack; | import org.bukkit.inventory.ItemStack; | ||||||
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.NotNull; | ||||||
| @@ -26,7 +27,7 @@ public class FishingTreasureBook extends FishingTreasure { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void initLegalEnchantments() { |     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()) { |         for(Enchantment enchantment : Enchantment.values()) { | ||||||
|             if(isEnchantAllowed(enchantment)) { |             if(isEnchantAllowed(enchantment)) { | ||||||
|   | |||||||
| @@ -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.InteractType; | ||||||
| import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction; | import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.event.Event; | import org.bukkit.event.Event; | ||||||
|  |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| @@ -52,7 +53,7 @@ public class InteractionManager { | |||||||
|         //Register in name map |         //Register in name map | ||||||
|         subSkillNameMap.putIfAbsent(lowerCaseName, abstractSubSkill); |         subSkillNameMap.putIfAbsent(lowerCaseName, abstractSubSkill); | ||||||
|  |  | ||||||
|         mcMMO.p.getLogger().info("Registered subskill: "+ abstractSubSkill.getConfigKeyName()); |         LogUtils.debug(mcMMO.p.getLogger(), "Registered subskill: "+ abstractSubSkill.getConfigKeyName()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -958,8 +958,8 @@ public class PlayerListener implements Listener { | |||||||
|         McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(player); |         McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(player); | ||||||
|  |  | ||||||
|         if (mcMMOPlayer == null) { |         if (mcMMOPlayer == null) { | ||||||
|             mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server."); |             LogUtils.debug(mcMMO.p.getLogger(), 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(), "Party & Admin chat will not work properly for this player."); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.locale; | package com.gmail.nossr50.locale; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.text.TextUtils; | import com.gmail.nossr50.util.text.TextUtils; | ||||||
| import net.kyori.adventure.text.TextComponent; | import net.kyori.adventure.text.TextComponent; | ||||||
| import org.bukkit.ChatColor; | import org.bukkit.ChatColor; | ||||||
| @@ -192,7 +193,7 @@ public final class LocaleLoader { | |||||||
|             //Use the new locale file |             //Use the new locale file | ||||||
|             if (Files.exists(overridePath) && Files.isRegularFile(overridePath)) { |             if (Files.exists(overridePath) && Files.isRegularFile(overridePath)) { | ||||||
|                 try (Reader localeReader = Files.newBufferedReader(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); |                     filesystemBundle = new PropertyResourceBundle(localeReader); | ||||||
|                 } catch (IOException e) { |                 } catch (IOException e) { | ||||||
|                     mcMMO.p.getLogger().log(Level.WARNING, "Failed to load locale from " + overridePath, e); |                     mcMMO.p.getLogger().log(Level.WARNING, "Failed to load locale from " + overridePath, e); | ||||||
|   | |||||||
| @@ -164,6 +164,9 @@ public class mcMMO extends JavaPlugin { | |||||||
|     @Override |     @Override | ||||||
|     public void onEnable() { |     public void onEnable() { | ||||||
|         try { |         try { | ||||||
|  |             //Filter out any debug messages (if debug/verbose logging is not enabled) | ||||||
|  |             getLogger().setFilter(new LogFilter(this)); | ||||||
|  |  | ||||||
|             setupFilePaths(); |             setupFilePaths(); | ||||||
|             generalConfig = new GeneralConfig(getDataFolder()); //Load before skillTools |             generalConfig = new GeneralConfig(getDataFolder()); //Load before skillTools | ||||||
|             skillTools = new SkillTools(this); //Load after general config |             skillTools = new SkillTools(this); //Load after general config | ||||||
| @@ -180,9 +183,6 @@ public class mcMMO extends JavaPlugin { | |||||||
|             //metadata service |             //metadata service | ||||||
|             metadataService = new MetadataService(this); |             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); |             MetadataConstants.MCMMO_METADATA_VALUE = new FixedMetadataValue(this, true); | ||||||
|  |  | ||||||
|             PluginManager pluginManager = getServer().getPluginManager(); |             PluginManager pluginManager = getServer().getPluginManager(); | ||||||
| @@ -191,7 +191,6 @@ public class mcMMO extends JavaPlugin { | |||||||
|  |  | ||||||
|             upgradeManager = new UpgradeManager(); |             upgradeManager = new UpgradeManager(); | ||||||
|  |  | ||||||
|  |  | ||||||
|             modManager = new ModManager(); |             modManager = new ModManager(); | ||||||
|  |  | ||||||
|             //Init Material Maps |             //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 |                     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(); |                 scheduleTasks(); | ||||||
|                 CommandRegistrationManager.registerCommands(); |                 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 |         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 |         HandlerList.unregisterAll(this); // Cancel event registrations | ||||||
|  |  | ||||||
|         databaseManager.onDisable(); |         databaseManager.onDisable(); | ||||||
|         debug("Was disabled."); // How informative! |         LogUtils.debug(mcMMO.p.getLogger(), "Was disabled."); // How informative! | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static String getMainDirectory() { |     public static String getMainDirectory() { | ||||||
| @@ -432,10 +431,6 @@ public class mcMMO extends JavaPlugin { | |||||||
|         xpEventEnabled = !xpEventEnabled; |         xpEventEnabled = !xpEventEnabled; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void debug(String message) { |  | ||||||
|         getLogger().info("[Debug] " + message); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public static FormulaManager getFormulaManager() { |     public static FormulaManager getFormulaManager() { | ||||||
|         return formulaManager; |         return formulaManager; | ||||||
|     } |     } | ||||||
| @@ -616,7 +611,7 @@ public class mcMMO extends JavaPlugin { | |||||||
|  |  | ||||||
|         if(CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS)) |         if(CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS)) | ||||||
|         { |         { | ||||||
|             getLogger().info("Enabling Acrobatics Skills"); |             LogUtils.debug(mcMMO.p.getLogger(), "Enabling Acrobatics Skills"); | ||||||
|  |  | ||||||
|             //TODO: Should do this differently |             //TODO: Should do this differently | ||||||
|             Roll roll = new Roll(); |             Roll roll = new Roll(); | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ import com.gmail.nossr50.events.party.McMMOPartyChangeEvent; | |||||||
| import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; | import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; | ||||||
| import com.gmail.nossr50.locale.LocaleLoader; | import com.gmail.nossr50.locale.LocaleLoader; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.Misc; | import com.gmail.nossr50.util.Misc; | ||||||
| import com.gmail.nossr50.util.Permissions; | import com.gmail.nossr50.util.Permissions; | ||||||
| import com.gmail.nossr50.util.player.NotificationManager; | 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) { |             for (Party party : hasAlly) { | ||||||
|                 party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally"))); |                 party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally"))); | ||||||
| @@ -660,7 +661,7 @@ public final class PartyManager { | |||||||
|      * Save party file. |      * Save party file. | ||||||
|      */ |      */ | ||||||
|     public static void saveParties() { |     public static void saveParties() { | ||||||
|         mcMMO.p.debug("[Party Data] Saving..."); |         LogUtils.debug(mcMMO.p.getLogger(), "[Party Data] Saving..."); | ||||||
|  |  | ||||||
|         if (partyFile.exists()) { |         if (partyFile.exists()) { | ||||||
|             if (!partyFile.delete()) { |             if (!partyFile.delete()) { | ||||||
| @@ -768,7 +769,7 @@ public final class PartyManager { | |||||||
| //            parties.add(party); | //            parties.add(party); | ||||||
| //        } | //        } | ||||||
| // | // | ||||||
| //        mcMMO.p.debug("Loaded (" + parties.size() + ") Parties..."); | //        LogUtils.debug(mcMMO.p.getLogger(), "Loaded (" + parties.size() + ") Parties..."); | ||||||
| // | // | ||||||
| //        for (Party party : hasAlly) { | //        for (Party party : hasAlly) { | ||||||
| //            party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally"))); | //            party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally"))); | ||||||
|   | |||||||
| @@ -9,17 +9,15 @@ import com.gmail.nossr50.mcMMO; | |||||||
| import com.gmail.nossr50.util.Permissions; | import com.gmail.nossr50.util.Permissions; | ||||||
| import com.gmail.nossr50.util.player.UserManager; | import com.gmail.nossr50.util.player.UserManager; | ||||||
| import com.gmail.nossr50.util.text.StringUtils; | import com.gmail.nossr50.util.text.StringUtils; | ||||||
|  |  | ||||||
| import me.clip.placeholderapi.PlaceholderAPIPlugin; | import me.clip.placeholderapi.PlaceholderAPIPlugin; | ||||||
|  | import me.clip.placeholderapi.expansion.PlaceholderExpansion; | ||||||
| import org.bukkit.entity.Player; | import org.bukkit.entity.Player; | ||||||
|  | import org.jetbrains.annotations.NotNull; | ||||||
|  | import org.jetbrains.annotations.Nullable; | ||||||
|  |  | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.TreeMap; | 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 { | public class PapiExpansion extends PlaceholderExpansion { | ||||||
|     private final Map<String, Placeholder> placeholders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); |     private final Map<String, Placeholder> placeholders = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,13 +4,14 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer; | |||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
| import com.gmail.nossr50.party.PartyManager; | import com.gmail.nossr50.party.PartyManager; | ||||||
| import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask; | import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.player.UserManager; | import com.gmail.nossr50.util.player.UserManager; | ||||||
| import org.bukkit.scheduler.BukkitRunnable; | import org.bukkit.scheduler.BukkitRunnable; | ||||||
|  |  | ||||||
| public class SaveTimerTask extends BukkitRunnable { | public class SaveTimerTask extends BukkitRunnable { | ||||||
|     @Override |     @Override | ||||||
|     public void run() { |     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 |         // All player data will be saved periodically through this | ||||||
|         int count = 1; |         int count = 1; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.runnables.backups; | package com.gmail.nossr50.runnables.backups; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.scheduler.BukkitRunnable; | import org.bukkit.scheduler.BukkitRunnable; | ||||||
|  |  | ||||||
| import java.io.File; | import java.io.File; | ||||||
| @@ -37,7 +38,7 @@ public class CleanBackupsTask extends BukkitRunnable { | |||||||
|             Date date = getDate(fileName.split("[.]")[0]); |             Date date = getDate(fileName.split("[.]")[0]); | ||||||
|  |  | ||||||
|             if (!fileName.contains(".zip") || date == null) { |             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; |                 continue; | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -74,11 +75,11 @@ public class CleanBackupsTask extends BukkitRunnable { | |||||||
|             return; |             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) { |         for (File file : toDelete) { | ||||||
|             if (file.delete()) { |             if (file.delete()) { | ||||||
|                 mcMMO.p.debug("Deleted: " + file.getName()); |                 LogUtils.debug(mcMMO.p.getLogger(), "Deleted: " + file.getName()); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile; | |||||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||||
| import com.gmail.nossr50.locale.LocaleLoader; | import com.gmail.nossr50.locale.LocaleLoader; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.Misc; | import com.gmail.nossr50.util.Misc; | ||||||
| import com.gmail.nossr50.util.player.UserManager; | import com.gmail.nossr50.util.player.UserManager; | ||||||
| import com.gmail.nossr50.util.skills.SkillTools; | import com.gmail.nossr50.util.skills.SkillTools; | ||||||
| @@ -36,7 +37,7 @@ public class FormulaConversionTask extends BukkitRunnable { | |||||||
|                 profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName); |                 profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName); | ||||||
|  |  | ||||||
|                 if (!profile.isLoaded()) { |                 if (!profile.isLoaded()) { | ||||||
|                     mcMMO.p.debug("Profile not loaded."); |                     LogUtils.debug(mcMMO.p.getLogger(), "Profile not loaded."); | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
| @@ -57,8 +58,8 @@ public class FormulaConversionTask extends BukkitRunnable { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void editValues(PlayerProfile profile) { |     private void editValues(PlayerProfile profile) { | ||||||
|         mcMMO.p.debug("========================================================================"); |         LogUtils.debug(mcMMO.p.getLogger(), "========================================================================"); | ||||||
|         mcMMO.p.debug("Conversion report for " + profile.getPlayerName() + ":"); |         LogUtils.debug(mcMMO.p.getLogger(), "Conversion report for " + profile.getPlayerName() + ":"); | ||||||
|         for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) { |         for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) { | ||||||
|             int oldLevel = profile.getSkillLevel(primarySkillType); |             int oldLevel = profile.getSkillLevel(primarySkillType); | ||||||
|             int oldXPLevel = profile.getSkillXpLevel(primarySkillType); |             int oldXPLevel = profile.getSkillXpLevel(primarySkillType); | ||||||
| @@ -72,17 +73,17 @@ public class FormulaConversionTask extends BukkitRunnable { | |||||||
|             int newLevel = newExperienceValues[0]; |             int newLevel = newExperienceValues[0]; | ||||||
|             int newXPlevel = newExperienceValues[1]; |             int newXPlevel = newExperienceValues[1]; | ||||||
|  |  | ||||||
|             mcMMO.p.debug("  Skill: " + primarySkillType.toString()); |             LogUtils.debug(mcMMO.p.getLogger(), "  Skill: " + primarySkillType.toString()); | ||||||
|  |  | ||||||
|             mcMMO.p.debug("    OLD:"); |             LogUtils.debug(mcMMO.p.getLogger(), "    OLD:"); | ||||||
|             mcMMO.p.debug("      Level: " + oldLevel); |             LogUtils.debug(mcMMO.p.getLogger(), "      Level: " + oldLevel); | ||||||
|             mcMMO.p.debug("      XP " + oldXPLevel); |             LogUtils.debug(mcMMO.p.getLogger(), "      XP " + oldXPLevel); | ||||||
|             mcMMO.p.debug("      Total XP " + totalOldXP); |             LogUtils.debug(mcMMO.p.getLogger(), "      Total XP " + totalOldXP); | ||||||
|  |  | ||||||
|             mcMMO.p.debug("    NEW:"); |             LogUtils.debug(mcMMO.p.getLogger(), "    NEW:"); | ||||||
|             mcMMO.p.debug("      Level " + newLevel); |             LogUtils.debug(mcMMO.p.getLogger(), "      Level " + newLevel); | ||||||
|             mcMMO.p.debug("      XP " + newXPlevel); |             LogUtils.debug(mcMMO.p.getLogger(), "      XP " + newXPlevel); | ||||||
|             mcMMO.p.debug("------------------------------------------------------------------------"); |             LogUtils.debug(mcMMO.p.getLogger(), "------------------------------------------------------------------------"); | ||||||
|  |  | ||||||
|             profile.modifySkill(primarySkillType, newLevel); |             profile.modifySkill(primarySkillType, newLevel); | ||||||
|             profile.setSkillXpLevel(primarySkillType, newXPlevel); |             profile.setSkillXpLevel(primarySkillType, newXPlevel); | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ import com.gmail.nossr50.locale.LocaleLoader; | |||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
| import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask; | import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask; | ||||||
| import com.gmail.nossr50.util.EventUtils; | import com.gmail.nossr50.util.EventUtils; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.Misc; | import com.gmail.nossr50.util.Misc; | ||||||
| import com.gmail.nossr50.util.player.UserManager; | import com.gmail.nossr50.util.player.UserManager; | ||||||
| import com.gmail.nossr50.util.scoreboards.ScoreboardManager; | import com.gmail.nossr50.util.scoreboards.ScoreboardManager; | ||||||
| @@ -37,14 +38,14 @@ public class PlayerProfileLoadingTask extends BukkitRunnable { | |||||||
|  |  | ||||||
|         // Quit if they logged out |         // Quit if they logged out | ||||||
|         if (!player.isOnline()) { |         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; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player); |         PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player); | ||||||
|  |  | ||||||
|         if(!profile.isLoaded()) { |         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 isn't loaded so add as new user | ||||||
|             profile = mcMMO.getDatabaseManager().newUser(player); |             profile = mcMMO.getDatabaseManager().newUser(player); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package com.gmail.nossr50.skills.alchemy; | |||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
| import com.gmail.nossr50.runnables.skills.AlchemyBrewTask; | import com.gmail.nossr50.runnables.skills.AlchemyBrewTask; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.Location; | import org.bukkit.Location; | ||||||
|  |  | ||||||
| import java.util.ArrayList; | 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. |      * Finish all active brews.  Used upon Disable to prevent vanilla potions from being brewed upon next Enable. | ||||||
|      */ |      */ | ||||||
|     public static void finishAllBrews() { |     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()); |         List<AlchemyBrewTask> toFinish = new ArrayList<>(brewingStandMap.values()); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.child; | |||||||
| import com.gmail.nossr50.config.BukkitConfig; | import com.gmail.nossr50.config.BukkitConfig; | ||||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.text.StringUtils; | import com.gmail.nossr50.util.text.StringUtils; | ||||||
| import org.bukkit.configuration.file.YamlConfiguration; | import org.bukkit.configuration.file.YamlConfiguration; | ||||||
|  |  | ||||||
| @@ -22,7 +23,7 @@ public class ChildConfig extends BukkitConfig { | |||||||
|         FamilyTree.clearRegistrations(); // when reloading, need to clear statics |         FamilyTree.clearRegistrations(); // when reloading, need to clear statics | ||||||
|  |  | ||||||
|         for (PrimarySkillType skill : mcMMO.p.getSkillTools().CHILD_SKILLS) { |         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); |             EnumSet<PrimarySkillType> parentSkills = EnumSet.noneOf(PrimarySkillType.class); | ||||||
|             boolean useDefaults = false; // If we had an error we back out and use defaults |             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 |             // Register them | ||||||
|             for (PrimarySkillType parentSkill : parentSkills) { |             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); |                 FamilyTree.registerParent(skill, parentSkill); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ import java.io.*; | |||||||
| public class FixSpellingNetheriteUtil { | public class FixSpellingNetheriteUtil { | ||||||
|  |  | ||||||
|     public static void processFileCheck(mcMMO pluginRef, String fileName, UpgradeType upgradeType) { |     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); |         File configFile = new File(pluginRef.getDataFolder(), fileName); | ||||||
|         if(configFile.exists()) { |         if(configFile.exists()) { | ||||||
|   | |||||||
| @@ -186,14 +186,14 @@ | |||||||
| // | // | ||||||
| //        for (File file : toDelete) { | //        for (File file : toDelete) { | ||||||
| //            if (file.delete()) { | //            if (file.delete()) { | ||||||
| //                mcMMO.p.debug("Deleted: " + file.getName()); | //                LogUtils.debug(mcMMO.p.getLogger(), "Deleted: " + file.getName()); | ||||||
| //            } | //            } | ||||||
| //        } | //        } | ||||||
| //    } | //    } | ||||||
| // | // | ||||||
| //    // This gets called onDisable | //    // This gets called onDisable | ||||||
| //    public void saveAnniversaryFiles() { | //    public void saveAnniversaryFiles() { | ||||||
| //        mcMMO.p.debug("Saving anniversary files..."); | //        LogUtils.debug(mcMMO.p.getLogger(), "Saving anniversary files..."); | ||||||
| //        String anniversaryFilePath = mcMMO.getFlatFileDirectory() + "anniversary." + currentYear + ".yml"; | //        String anniversaryFilePath = mcMMO.getFlatFileDirectory() + "anniversary." + currentYear + ".yml"; | ||||||
| // | // | ||||||
| //        try { | //        try { | ||||||
|   | |||||||
| @@ -5,6 +5,8 @@ import com.gmail.nossr50.mcMMO; | |||||||
| import java.util.logging.Filter; | import java.util.logging.Filter; | ||||||
| import java.util.logging.LogRecord; | import java.util.logging.LogRecord; | ||||||
|  |  | ||||||
|  | import static com.gmail.nossr50.util.LogUtils.DEBUG_STR; | ||||||
|  |  | ||||||
| public class LogFilter implements Filter { | public class LogFilter implements Filter { | ||||||
|     private final boolean debug; |     private final boolean debug; | ||||||
|  |  | ||||||
| @@ -15,6 +17,6 @@ public class LogFilter implements Filter { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean isLoggable(LogRecord record) { |     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 { |         try { | ||||||
|             entitiesFile.save(entityFile); |             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) { |         catch (Exception e) { | ||||||
|             e.printStackTrace(); |             e.printStackTrace(); | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package com.gmail.nossr50.util.compat; | |||||||
|  |  | ||||||
| import com.gmail.nossr50.locale.LocaleLoader; | import com.gmail.nossr50.locale.LocaleLoader; | ||||||
| import com.gmail.nossr50.mcMMO; | 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.AbstractBungeeSerializerCompatibilityLayer; | ||||||
| import com.gmail.nossr50.util.compat.layers.bungee.BungeeLegacySerializerCompatibilityLayer; | import com.gmail.nossr50.util.compat.layers.bungee.BungeeLegacySerializerCompatibilityLayer; | ||||||
| import com.gmail.nossr50.util.compat.layers.bungee.BungeeModernSerializerCompatibilityLayer; | import com.gmail.nossr50.util.compat.layers.bungee.BungeeModernSerializerCompatibilityLayer; | ||||||
| @@ -34,11 +35,11 @@ public class CompatibilityManager { | |||||||
|     private AbstractMasterAnglerCompatibility masterAnglerCompatibility; |     private AbstractMasterAnglerCompatibility masterAnglerCompatibility; | ||||||
|  |  | ||||||
|     public CompatibilityManager(@NotNull MinecraftGameVersion minecraftGameVersion) { |     public CompatibilityManager(@NotNull MinecraftGameVersion minecraftGameVersion) { | ||||||
|         mcMMO.p.getLogger().info("Loading compatibility layers..."); |         LogUtils.debug(mcMMO.p.getLogger(), "Loading compatibility layers..."); | ||||||
|         this.minecraftGameVersion = minecraftGameVersion; |         this.minecraftGameVersion = minecraftGameVersion; | ||||||
|         this.nmsVersion = determineNMSVersion(); |         this.nmsVersion = determineNMSVersion(); | ||||||
|         init(); |         init(); | ||||||
|         mcMMO.p.getLogger().info("Finished loading compatibility layers."); |         LogUtils.debug(mcMMO.p.getLogger(), "Finished loading compatibility layers."); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void init() { |     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.experience.FormulaType; | ||||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import org.bukkit.configuration.file.YamlConfiguration; | import org.bukkit.configuration.file.YamlConfiguration; | ||||||
|  |  | ||||||
| import java.io.File; | import java.io.File; | ||||||
| @@ -224,7 +225,7 @@ public class FormulaManager { | |||||||
|      * Save formula file. |      * Save formula file. | ||||||
|      */ |      */ | ||||||
|     public void saveFormula() { |     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(); |         YamlConfiguration formulasFile = new YamlConfiguration(); | ||||||
|         formulasFile.set("Previous_Formula", previousFormula.toString()); |         formulasFile.set("Previous_Formula", previousFormula.toString()); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.util.platform; | package com.gmail.nossr50.util.platform; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.compat.CompatibilityManager; | import com.gmail.nossr50.util.compat.CompatibilityManager; | ||||||
| import org.bukkit.Bukkit; | import org.bukkit.Bukkit; | ||||||
| import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.NotNull; | ||||||
| @@ -47,7 +48,7 @@ public class PlatformManager { | |||||||
|     private @NotNull MinecraftGameVersion determineGameVersion(String platformVersionString) { |     private @NotNull MinecraftGameVersion determineGameVersion(String platformVersionString) { | ||||||
|         int major = 0, minor = 0, patch = 0; |         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 _ |         // 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); |         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 + "." |                 + major + "." | ||||||
|                 + minor + "." |                 + minor + "." | ||||||
|                 + patch); |                 + patch); | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package com.gmail.nossr50.util.player; | |||||||
|  |  | ||||||
| import com.gmail.nossr50.datatypes.player.McMMOPlayer; | import com.gmail.nossr50.datatypes.player.McMMOPlayer; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.MetadataConstants; | import com.gmail.nossr50.util.MetadataConstants; | ||||||
| import com.google.common.collect.ImmutableList; | import com.google.common.collect.ImmutableList; | ||||||
| import org.bukkit.OfflinePlayer; | import org.bukkit.OfflinePlayer; | ||||||
| @@ -85,7 +86,7 @@ public final class UserManager { | |||||||
|         for (McMMOPlayer playerData : trackedSyncData) { |         for (McMMOPlayer playerData : trackedSyncData) { | ||||||
|             try |             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); |                 playerData.getProfile().save(true); | ||||||
|             } |             } | ||||||
|             catch (Exception e) |             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.events.scoreboard.ScoreboardEventReason; | ||||||
| import com.gmail.nossr50.locale.LocaleLoader; | import com.gmail.nossr50.locale.LocaleLoader; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.Misc; | import com.gmail.nossr50.util.Misc; | ||||||
| import com.gmail.nossr50.util.player.UserManager; | import com.gmail.nossr50.util.player.UserManager; | ||||||
| import com.google.common.collect.ImmutableList; | import com.google.common.collect.ImmutableList; | ||||||
| @@ -204,7 +205,7 @@ public class ScoreboardManager { | |||||||
|     // Called in onDisable() |     // Called in onDisable() | ||||||
|     public static void teardownAll() { |     public static void teardownAll() { | ||||||
|         ImmutableList<Player> onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers()); |         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) { |         for (Player player : onlinePlayers) { | ||||||
|             teardownPlayer(player); |             teardownPlayer(player); | ||||||
|         } |         } | ||||||
| @@ -524,7 +525,7 @@ public class ScoreboardManager { | |||||||
|  |  | ||||||
|             if (objective != null) { |             if (objective != null) { | ||||||
|                 objective.unregister(); |                 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; |             return null; | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ import com.gmail.nossr50.events.scoreboard.ScoreboardObjectiveEventReason; | |||||||
| import com.gmail.nossr50.locale.LocaleLoader; | import com.gmail.nossr50.locale.LocaleLoader; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
| import com.gmail.nossr50.skills.child.FamilyTree; | import com.gmail.nossr50.skills.child.FamilyTree; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.gmail.nossr50.util.Misc; | import com.gmail.nossr50.util.Misc; | ||||||
| import com.gmail.nossr50.util.player.NotificationManager; | import com.gmail.nossr50.util.player.NotificationManager; | ||||||
| import com.gmail.nossr50.util.player.UserManager; | import com.gmail.nossr50.util.player.UserManager; | ||||||
| @@ -260,7 +261,7 @@ public class ScoreboardWrapper { | |||||||
|                 oldBoard = null; |                 oldBoard = null; | ||||||
|             } |             } | ||||||
|             else { |             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) { |             } catch (IllegalStateException e) { | ||||||
|                 McMMOPlayer mmoPlayer = UserManager.getPlayer(player); |                 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()) |                 if(mmoPlayer.isDebugMode()) | ||||||
|                     NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery"); |                     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.config.BukkitConfig; | ||||||
| import com.gmail.nossr50.datatypes.database.UpgradeType; | import com.gmail.nossr50.datatypes.database.UpgradeType; | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
|  |  | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.EnumSet; | import java.util.EnumSet; | ||||||
| @@ -41,7 +42,7 @@ public class UpgradeManager extends BukkitConfig { | |||||||
|             return; |             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); |         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()]))); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.worldguard; | package com.gmail.nossr50.worldguard; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.sk89q.worldedit.bukkit.BukkitAdapter; | import com.sk89q.worldedit.bukkit.BukkitAdapter; | ||||||
| import com.sk89q.worldedit.bukkit.BukkitPlayer; | import com.sk89q.worldedit.bukkit.BukkitPlayer; | ||||||
| import com.sk89q.worldguard.WorldGuard; | import com.sk89q.worldguard.WorldGuard; | ||||||
| @@ -94,7 +95,7 @@ public class WorldGuardManager { | |||||||
|                 registry.register(WorldGuardFlags.MCMMO_ENABLE_WG_FLAG); |                 registry.register(WorldGuardFlags.MCMMO_ENABLE_WG_FLAG); | ||||||
|                 registry.register(WorldGuardFlags.MCMMO_XP_WG_FLAG); |                 registry.register(WorldGuardFlags.MCMMO_XP_WG_FLAG); | ||||||
|                 registry.register(WorldGuardFlags.MCMMO_HARDCORE_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) { |             } catch (FlagConflictException e) { | ||||||
|                 e.printStackTrace(); |                 e.printStackTrace(); | ||||||
|                 mcMMO.p.getLogger().warning("Failed to register WG flags!"); |                 mcMMO.p.getLogger().warning("Failed to register WG flags!"); | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.gmail.nossr50.worldguard; | package com.gmail.nossr50.worldguard; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
| import com.sk89q.worldguard.WorldGuard; | import com.sk89q.worldguard.WorldGuard; | ||||||
| import com.sk89q.worldguard.bukkit.WorldGuardPlugin; | import com.sk89q.worldguard.bukkit.WorldGuardPlugin; | ||||||
| import com.sk89q.worldguard.protection.flags.registry.SimpleFlagRegistry; | import com.sk89q.worldguard.protection.flags.registry.SimpleFlagRegistry; | ||||||
| @@ -67,7 +68,7 @@ public class WorldGuardUtils { | |||||||
|         if(plugin == null) { |         if(plugin == null) { | ||||||
|             //WG is not present |             //WG is not present | ||||||
|             detectedIncompatibleWG = true; |             detectedIncompatibleWG = true; | ||||||
|             mcMMO.p.getLogger().info("WorldGuard was not detected."); |             LogUtils.debug(mcMMO.p.getLogger(), "WorldGuard was not detected."); | ||||||
|         } else { |         } else { | ||||||
|             //Check that its actually of class WorldGuardPlugin |             //Check that its actually of class WorldGuardPlugin | ||||||
|             if(plugin instanceof WorldGuardPlugin) |             if(plugin instanceof WorldGuardPlugin) | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package net.shatteredlands.shatt.backup; | package net.shatteredlands.shatt.backup; | ||||||
|  |  | ||||||
| import com.gmail.nossr50.mcMMO; | import com.gmail.nossr50.mcMMO; | ||||||
|  | import com.gmail.nossr50.util.LogUtils; | ||||||
|  |  | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||||
| @@ -27,13 +28,13 @@ public class ZipLibrary { | |||||||
|  |  | ||||||
|     public static void mcMMOBackup() throws IOException { |     public static void mcMMOBackup() throws IOException { | ||||||
|         if (mcMMO.p.getGeneralConfig().getUseMySQL()) { |         if (mcMMO.p.getGeneralConfig().getUseMySQL()) { | ||||||
|             mcMMO.p.debug("This server is running in SQL Mode."); |             LogUtils.debug(mcMMO.p.getLogger(), "This server is running in SQL Mode."); | ||||||
|             mcMMO.p.debug("Only config files will be backed up."); |             LogUtils.debug(mcMMO.p.getLogger(), "Only config files will be backed up."); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         try { |         try { | ||||||
|             if (BACKUP_DIR.mkdir()) { |             if (BACKUP_DIR.mkdir()) { | ||||||
|                 mcMMO.p.debug("Created Backup Directory."); |                 LogUtils.debug(mcMMO.p.getLogger(), "Created Backup Directory."); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         catch (Exception e) { |         catch (Exception e) { | ||||||
| @@ -60,7 +61,7 @@ public class ZipLibrary { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         // Actually do something |         // Actually do something | ||||||
|         mcMMO.p.debug("Backing up your mcMMO Configuration... "); |         LogUtils.debug(mcMMO.p.getLogger(), "Backing up your mcMMO Configuration... "); | ||||||
|  |  | ||||||
|         packZip(fileZip, sources); |         packZip(fileZip, sources); | ||||||
|     } |     } | ||||||
| @@ -80,7 +81,7 @@ public class ZipLibrary { | |||||||
|  |  | ||||||
|         zipOut.flush(); |         zipOut.flush(); | ||||||
|         zipOut.close(); |         zipOut.close(); | ||||||
|         mcMMO.p.debug("Backup Completed."); |         LogUtils.debug(mcMMO.p.getLogger(), "Backup Completed."); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private static String buildPath(String path, String file) { |     private static String buildPath(String path, String file) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nossr50
					nossr50