59 lines
2.2 KiB
Java
59 lines
2.2 KiB
Java
package com.onarandombox.MultiverseCore.commands;
|
|
|
|
import co.aikar.commands.CommandIssuer;
|
|
import co.aikar.commands.annotation.CommandAlias;
|
|
import co.aikar.commands.annotation.CommandCompletion;
|
|
import co.aikar.commands.annotation.CommandPermission;
|
|
import co.aikar.commands.annotation.Conditions;
|
|
import co.aikar.commands.annotation.Description;
|
|
import co.aikar.commands.annotation.Subcommand;
|
|
import co.aikar.commands.annotation.Syntax;
|
|
import com.dumptruckman.minecraft.util.Logging;
|
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
|
import com.onarandombox.MultiverseCore.messaging.CoreMessageKeys;
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
@CommandAlias("mv")
|
|
public class DebugCommand extends MultiverseCoreCommand {
|
|
|
|
public DebugCommand(MultiverseCore plugin) {
|
|
super(plugin);
|
|
}
|
|
|
|
@Subcommand("debug")
|
|
@CommandPermission("multiverse.core.debug")
|
|
@Description("{@@mv-core.debug_info_description}")
|
|
public void onShowDebugCommand(@NotNull CommandIssuer issuer) {
|
|
this.displayDebugMode(issuer);
|
|
}
|
|
|
|
@Subcommand("debug")
|
|
@CommandPermission("multiverse.core.debug")
|
|
@Syntax("<{@@mv-core.debug_change_syntax}>")
|
|
@CommandCompletion("@range:3")
|
|
@Description("{@@mv-core.debug_change_description}")
|
|
public void onChangeDebugCommand(@NotNull CommandIssuer issuer,
|
|
|
|
@Conditions("debuglevel")
|
|
@Syntax("<{@@mv-core.debug_change_syntax}>")
|
|
@Description("{@@mv-core.debug_change_level_description}")
|
|
int level) {
|
|
|
|
this.plugin.getMVConfig().setGlobalDebug(level);
|
|
this.saveMVConfigs(issuer);
|
|
this.displayDebugMode(issuer);
|
|
}
|
|
|
|
private void displayDebugMode(@NotNull CommandIssuer issuer) {
|
|
final int debugLevel = this.plugin.getMVConfig().getGlobalDebug();
|
|
if (debugLevel == 0) {
|
|
issuer.sendInfo(CoreMessageKeys.DEBUG_INFO_OFF);
|
|
return;
|
|
}
|
|
issuer.sendInfo(CoreMessageKeys.DEBUG_INFO_ON, "{level}", String.valueOf(debugLevel));
|
|
Logging.fine("Multiverse Debug ENABLED.");
|
|
}
|
|
}
|