logging changes

This commit is contained in:
nossr50 2024-02-17 16:19:46 -08:00
parent 3bc7b8eee7
commit 37949d07f6
3 changed files with 10 additions and 14 deletions

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.levelup;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.LogUtils;
import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
@ -28,13 +29,13 @@ public class LevelUpCommandManager {
public void registerCommand(@NotNull SkillLevelUpCommand skillLevelUpCommand) {
requireNonNull(skillLevelUpCommand, "skillLevelUpCommand cannot be null");
skillLevelCommands.add(skillLevelUpCommand);
mcMMO.p.getLogger().info("Registered level up command - SkillLevelUpCommand: " + skillLevelUpCommand);
LogUtils.debug(mcMMO.p.getLogger(), "Registered level up command - SkillLevelUpCommand: " + skillLevelUpCommand);
}
public void registerCommand(@NotNull PowerLevelUpCommand powerLevelUpCommand) {
requireNonNull(powerLevelUpCommand, "powerLevelUpCommand cannot be null");
powerLevelUpCommands.add(powerLevelUpCommand);
mcMMO.p.getLogger().info("Registered level up command - PowerLevelUpCommand: " + powerLevelUpCommand);
LogUtils.debug(mcMMO.p.getLogger(), "Registered level up command - PowerLevelUpCommand: " + powerLevelUpCommand);
}
/**

View File

@ -44,15 +44,12 @@ public class PowerLevelUpCommand implements CommandsOnLevel {
}
public void executeCommand(McMMOPlayer player, int level) {
// TODO: Change this to debug later
mcMMO.p.getLogger().info("Executing commands for level up: " + commands);
LogUtils.debug(mcMMO.p.getLogger(), "Executing commands for level up: " + commands);
for (String command : commands) {
// TODO: Change this to debug later
mcMMO.p.getLogger().info("Executing command: " + command);
LogUtils.debug(mcMMO.p.getLogger(), "Executing command: " + command);
String injectedCommand = injectedCommand(command, player, level);
// TODO: Remove verbose logging later
if (!injectedCommand.equalsIgnoreCase(command)) {
mcMMO.p.getLogger().info(("Command has been injected with new values: " + injectedCommand));
LogUtils.debug(mcMMO.p.getLogger(), ("Command has been injected with new values: " + injectedCommand));
}
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), injectedCommand);
}
@ -61,6 +58,7 @@ public class PowerLevelUpCommand implements CommandsOnLevel {
private String injectedCommand(String command, McMMOPlayer player, int level) {
// replace %player% with player name, %skill% with skill name, and %level% with level
command = safeReplace(command, "%player%", player.getPlayer().getName());
command = safeReplace(command, "%power_level%", "power level");
command = safeReplace(command, "%skill%", "power level");
command = safeReplace(command, "%level%", String.valueOf(level));
return command;

View File

@ -45,15 +45,12 @@ public class SkillLevelUpCommand implements CommandsOnLevel {
}
public void executeCommand(McMMOPlayer player, PrimarySkillType primarySkillType, int level) {
// TODO: Change this to debug later
mcMMO.p.getLogger().info("Executing commands for level up: " + commands);
LogUtils.debug(mcMMO.p.getLogger(), "Executing commands for level up: " + commands);
for (String command : commands) {
// TODO: Change this to debug later
mcMMO.p.getLogger().info("Executing command: " + command);
LogUtils.debug(mcMMO.p.getLogger(), "Executing command: " + command);
String injectedCommand = injectedCommand(command, player, primarySkillType, level);
// TODO: Remove verbose logging later
if (!injectedCommand.equalsIgnoreCase(command)) {
mcMMO.p.getLogger().info(("Command has been injected with new values: " + injectedCommand));
LogUtils.debug(mcMMO.p.getLogger(), ("Command has been injected with new values: " + injectedCommand));
}
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), injectedCommand);
}