mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
logging changes
This commit is contained in:
parent
3bc7b8eee7
commit
37949d07f6
@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.levelup;
|
|||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
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.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -28,13 +29,13 @@ public class LevelUpCommandManager {
|
|||||||
public void registerCommand(@NotNull SkillLevelUpCommand skillLevelUpCommand) {
|
public void registerCommand(@NotNull SkillLevelUpCommand skillLevelUpCommand) {
|
||||||
requireNonNull(skillLevelUpCommand, "skillLevelUpCommand cannot be null");
|
requireNonNull(skillLevelUpCommand, "skillLevelUpCommand cannot be null");
|
||||||
skillLevelCommands.add(skillLevelUpCommand);
|
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) {
|
public void registerCommand(@NotNull PowerLevelUpCommand powerLevelUpCommand) {
|
||||||
requireNonNull(powerLevelUpCommand, "powerLevelUpCommand cannot be null");
|
requireNonNull(powerLevelUpCommand, "powerLevelUpCommand cannot be null");
|
||||||
powerLevelUpCommands.add(powerLevelUpCommand);
|
powerLevelUpCommands.add(powerLevelUpCommand);
|
||||||
mcMMO.p.getLogger().info("Registered level up command - PowerLevelUpCommand: " + powerLevelUpCommand);
|
LogUtils.debug(mcMMO.p.getLogger(), "Registered level up command - PowerLevelUpCommand: " + powerLevelUpCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,15 +44,12 @@ public class PowerLevelUpCommand implements CommandsOnLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void executeCommand(McMMOPlayer player, int level) {
|
public void executeCommand(McMMOPlayer player, int level) {
|
||||||
// TODO: Change this to debug later
|
LogUtils.debug(mcMMO.p.getLogger(), "Executing commands for level up: " + commands);
|
||||||
mcMMO.p.getLogger().info("Executing commands for level up: " + commands);
|
|
||||||
for (String command : commands) {
|
for (String command : commands) {
|
||||||
// TODO: Change this to debug later
|
LogUtils.debug(mcMMO.p.getLogger(), "Executing command: " + command);
|
||||||
mcMMO.p.getLogger().info("Executing command: " + command);
|
|
||||||
String injectedCommand = injectedCommand(command, player, level);
|
String injectedCommand = injectedCommand(command, player, level);
|
||||||
// TODO: Remove verbose logging later
|
|
||||||
if (!injectedCommand.equalsIgnoreCase(command)) {
|
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);
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), injectedCommand);
|
||||||
}
|
}
|
||||||
@ -61,6 +58,7 @@ public class PowerLevelUpCommand implements CommandsOnLevel {
|
|||||||
private String injectedCommand(String command, McMMOPlayer player, int level) {
|
private String injectedCommand(String command, McMMOPlayer player, int level) {
|
||||||
// replace %player% with player name, %skill% with skill name, and %level% with level
|
// replace %player% with player name, %skill% with skill name, and %level% with level
|
||||||
command = safeReplace(command, "%player%", player.getPlayer().getName());
|
command = safeReplace(command, "%player%", player.getPlayer().getName());
|
||||||
|
command = safeReplace(command, "%power_level%", "power level");
|
||||||
command = safeReplace(command, "%skill%", "power level");
|
command = safeReplace(command, "%skill%", "power level");
|
||||||
command = safeReplace(command, "%level%", String.valueOf(level));
|
command = safeReplace(command, "%level%", String.valueOf(level));
|
||||||
return command;
|
return command;
|
||||||
|
@ -45,15 +45,12 @@ public class SkillLevelUpCommand implements CommandsOnLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void executeCommand(McMMOPlayer player, PrimarySkillType primarySkillType, int level) {
|
public void executeCommand(McMMOPlayer player, PrimarySkillType primarySkillType, int level) {
|
||||||
// TODO: Change this to debug later
|
LogUtils.debug(mcMMO.p.getLogger(), "Executing commands for level up: " + commands);
|
||||||
mcMMO.p.getLogger().info("Executing commands for level up: " + commands);
|
|
||||||
for (String command : commands) {
|
for (String command : commands) {
|
||||||
// TODO: Change this to debug later
|
LogUtils.debug(mcMMO.p.getLogger(), "Executing command: " + command);
|
||||||
mcMMO.p.getLogger().info("Executing command: " + command);
|
|
||||||
String injectedCommand = injectedCommand(command, player, primarySkillType, level);
|
String injectedCommand = injectedCommand(command, player, primarySkillType, level);
|
||||||
// TODO: Remove verbose logging later
|
|
||||||
if (!injectedCommand.equalsIgnoreCase(command)) {
|
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);
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), injectedCommand);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user