mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-20 19:52:45 +02:00
Updated commands to new APF 3.2.0 commands, better help formatting
This commit is contained in:
parent
58592f0777
commit
a27175e136
|
@ -29,7 +29,7 @@
|
|||
<dependency>
|
||||
<groupId>com.djrapitops</groupId>
|
||||
<artifactId>AbstractPluginFramework</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- SoftDepended Plugins -->
|
||||
<dependency>
|
||||
|
|
|
@ -102,29 +102,8 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void log(String level, String msg) {
|
||||
switch (level.toUpperCase()) {
|
||||
case "INFO_COLOR":
|
||||
case "INFO":
|
||||
case "I":
|
||||
logger.info(msg);
|
||||
break;
|
||||
case "W":
|
||||
case "WARN":
|
||||
case "WARNING":
|
||||
logger.warn(msg);
|
||||
break;
|
||||
case "E":
|
||||
case "ERR":
|
||||
case "ERROR":
|
||||
case "SEVERE":
|
||||
logger.error(msg);
|
||||
break;
|
||||
default:
|
||||
logger.info(msg);
|
||||
break;
|
||||
}
|
||||
|
||||
public Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,9 +6,10 @@ import com.djrapitops.plan.command.commands.manage.ManageConDebugCommand;
|
|||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.TreeCommand;
|
||||
import com.djrapitops.plugin.command.defaultcmds.StatusCommand;
|
||||
import com.djrapitops.plugin.command.TreeCmdNode;
|
||||
import com.djrapitops.plugin.command.defaultcmds.StatusCommandNode;
|
||||
|
||||
/**
|
||||
* TreeCommand for the /plan command, and all subcommands.
|
||||
|
@ -18,7 +19,7 @@ import com.djrapitops.plugin.command.defaultcmds.StatusCommand;
|
|||
* @author Rsl1122
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class PlanBungeeCommand extends TreeCommand<PlanBungee> {
|
||||
public class PlanBungeeCommand extends TreeCmdNode {
|
||||
|
||||
/**
|
||||
* CommandExecutor class Constructor.
|
||||
|
@ -28,31 +29,27 @@ public class PlanBungeeCommand extends TreeCommand<PlanBungee> {
|
|||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public PlanBungeeCommand(PlanBungee plugin) {
|
||||
super(plugin, "planbungee", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), "", "planbungee");
|
||||
super.setDefaultCommand("help");
|
||||
super("planbungee", Permissions.MANAGE.getPermission(), CommandType.CONSOLE, null);
|
||||
super.setColorScheme(plugin.getColorScheme());
|
||||
}
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_PLAN).toArray());
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_PLAN).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands() {
|
||||
add(
|
||||
new ReloadCommand(plugin),
|
||||
new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()),
|
||||
new ListCommand(),
|
||||
new BungeeSetupToggleCommand()
|
||||
);
|
||||
RegisterCommand registerCommand = new RegisterCommand();
|
||||
add(
|
||||
registerCommand,
|
||||
new WebUserCommand(plugin, registerCommand),
|
||||
new NetworkCommand(),
|
||||
new ListServersCommand(plugin),
|
||||
new ManageConDebugCommand()
|
||||
setNodeGroups(
|
||||
new CommandNode[]{
|
||||
new NetworkCommand(),
|
||||
new ListServersCommand(plugin),
|
||||
new ListCommand(),
|
||||
},
|
||||
new CommandNode[]{
|
||||
registerCommand,
|
||||
new WebUserCommand(plugin, registerCommand, this),
|
||||
},
|
||||
new CommandNode[]{
|
||||
new ManageConDebugCommand(),
|
||||
new BungeeSetupToggleCommand(),
|
||||
new ReloadCommand(plugin),
|
||||
new StatusCommandNode<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,10 @@ import com.djrapitops.plan.system.settings.Permissions;
|
|||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.TreeCommand;
|
||||
import com.djrapitops.plugin.command.defaultcmds.StatusCommand;
|
||||
import com.djrapitops.plugin.command.TreeCmdNode;
|
||||
import com.djrapitops.plugin.command.defaultcmds.StatusCommandNode;
|
||||
|
||||
/**
|
||||
* TreeCommand for the /plan command, and all SubCommands.
|
||||
|
@ -18,41 +19,35 @@ import com.djrapitops.plugin.command.defaultcmds.StatusCommand;
|
|||
* @author Rsl1122
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class PlanCommand extends TreeCommand<Plan> {
|
||||
public class PlanCommand extends TreeCmdNode {
|
||||
|
||||
public PlanCommand(Plan plugin) {
|
||||
super(plugin, "plan", CommandType.CONSOLE, "", "", "plan");
|
||||
super("plan", "", CommandType.CONSOLE, null);
|
||||
super.setDefaultCommand("inspect");
|
||||
super.setColorScheme(plugin.getColorScheme());
|
||||
}
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_PLAN).toArray());
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_PLAN).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands() {
|
||||
add(
|
||||
new InspectCommand(),
|
||||
new QInspectCommand(plugin),
|
||||
new AnalyzeCommand(),
|
||||
new SearchCommand(),
|
||||
new InfoCommand(plugin),
|
||||
new ReloadCommand(plugin),
|
||||
new ManageCommand(plugin),
|
||||
new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()),
|
||||
new ListCommand()
|
||||
);
|
||||
RegisterCommand registerCommand = new RegisterCommand();
|
||||
add(
|
||||
registerCommand,
|
||||
new WebUserCommand(plugin, registerCommand),
|
||||
new NetworkCommand(),
|
||||
new ListServersCommand(plugin));
|
||||
|
||||
if (Settings.DEV_MODE.isTrue()) {
|
||||
add(new DevCommand());
|
||||
}
|
||||
setNodeGroups(
|
||||
new CommandNode[]{
|
||||
new InspectCommand(),
|
||||
new QInspectCommand(plugin),
|
||||
new SearchCommand(),
|
||||
new ListCommand(),
|
||||
new AnalyzeCommand(),
|
||||
new NetworkCommand(),
|
||||
},
|
||||
new CommandNode[]{
|
||||
new WebUserCommand(plugin, registerCommand, this),
|
||||
registerCommand
|
||||
},
|
||||
new CommandNode[]{
|
||||
new InfoCommand(plugin),
|
||||
new ReloadCommand(plugin),
|
||||
new ManageCommand(plugin, this),
|
||||
new StatusCommandNode<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()),
|
||||
(Settings.DEV_MODE.isTrue() ? new DevCommand() : null)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ import com.djrapitops.plan.system.settings.locale.Msg;
|
|||
import com.djrapitops.plan.system.webserver.WebServerSystem;
|
||||
import com.djrapitops.plan.utilities.analysis.Analysis;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -30,23 +30,17 @@ import java.util.UUID;
|
|||
* @author Rsl1122
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class AnalyzeCommand extends SubCommand {
|
||||
public class AnalyzeCommand extends CommandNode {
|
||||
|
||||
public AnalyzeCommand() {
|
||||
super("analyze, analyse, analysis, a",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.ANALYZE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_ANALYZE).parse(),
|
||||
"[ServerName or ID]");
|
||||
super("analyze|analyse|analysis|a", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_ANALYZE).parse());
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_ANALYZE).toArray());
|
||||
setArguments("[server/id]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_ANALYZE).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
sender.sendMessage(Locale.get(Msg.CMD_INFO_FETCH_DATA).toString());
|
||||
|
||||
Processing.submitNonCritical(() -> {
|
||||
|
@ -63,7 +57,6 @@ public class AnalyzeCommand extends SubCommand {
|
|||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendLink(Server server, ISender sender) {
|
||||
|
|
|
@ -6,25 +6,26 @@ package com.djrapitops.plan.command.commands;
|
|||
|
||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
|
||||
/**
|
||||
* Command for Toggling whether or not BungeeCord accepts set up requests.
|
||||
*
|
||||
* <p>
|
||||
* This was added as a security measure against unwanted MySQL snooping.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class BungeeSetupToggleCommand extends SubCommand {
|
||||
public class BungeeSetupToggleCommand extends CommandNode {
|
||||
|
||||
public BungeeSetupToggleCommand() {
|
||||
super("setup", CommandType.ALL, Permissions.MANAGE.getPermission(), "Toggle Setup mode for Bungee");
|
||||
super("setup", Permissions.MANAGE.getPermission(), CommandType.ALL);
|
||||
setShortHelp("Toggle Setup mode for Bungee");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String s, String[] strings) {
|
||||
public void onCommand(ISender sender, String s, String[] strings) {
|
||||
boolean setupAllowed = ConnectionSystem.isSetupAllowed();
|
||||
ConnectionSystem connectionSystem = ConnectionSystem.getInstance();
|
||||
|
||||
|
@ -35,6 +36,5 @@ public class BungeeSetupToggleCommand extends SubCommand {
|
|||
}
|
||||
String msg = !setupAllowed ? "§aSet-up is now Allowed" : "§cSet-up is now Forbidden";
|
||||
sender.sendMessage(msg);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -8,25 +8,25 @@ import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
|||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
|
||||
/**
|
||||
* Command used for testing functions that are too difficult to unit test.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class DevCommand extends SubCommand {
|
||||
public class DevCommand extends CommandNode {
|
||||
|
||||
public DevCommand() {
|
||||
super("dev", CommandType.PLAYER_OR_ARGS, "plan.*", "Test Plugin functions not testable with unit tests.", "<feature to test>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String cmd, String[] args) {
|
||||
public void onCommand(ISender sender, String cmd, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString(), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
String feature = args[0];
|
||||
switch (feature) {
|
||||
|
@ -45,6 +45,5 @@ public class DevCommand extends SubCommand {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -6,9 +6,9 @@ import com.djrapitops.plan.system.settings.Permissions;
|
|||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.settings.ColorScheme;
|
||||
|
||||
/**
|
||||
|
@ -17,21 +17,18 @@ import com.djrapitops.plugin.settings.ColorScheme;
|
|||
* @author Rsl1122
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class InfoCommand extends SubCommand {
|
||||
public class InfoCommand extends CommandNode {
|
||||
|
||||
private final Plan plugin;
|
||||
|
||||
public InfoCommand(Plan plugin) {
|
||||
super("info",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.INFO.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_INFO).toString());
|
||||
|
||||
super("info", Permissions.INFO.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_INFO).toString());
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
ColorScheme cs = plugin.getColorScheme();
|
||||
String mColor = cs.getMainColor();
|
||||
String sColor = cs.getSecondaryColor();
|
||||
|
@ -47,7 +44,6 @@ public class InfoCommand extends SubCommand {
|
|||
Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()
|
||||
};
|
||||
sender.sendMessage(messages);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ import com.djrapitops.plan.utilities.Condition;
|
|||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
@ -30,27 +30,20 @@ import java.util.UUID;
|
|||
* @author Rsl1122
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class InspectCommand extends SubCommand {
|
||||
public class InspectCommand extends CommandNode {
|
||||
|
||||
public InspectCommand() {
|
||||
super("inspect",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.INSPECT.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_INSPECT).toString(),
|
||||
"<player>");
|
||||
super("inspect", Permissions.INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setArguments("<player>");
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_INSPECT).toString());
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_INSPECT).toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_INSPECT).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
String playerName = MiscUtils.getPlayerName(args, sender);
|
||||
|
||||
runInspectTask(playerName, sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runInspectTask(String playerName, ISender sender) {
|
||||
|
|
|
@ -4,10 +4,10 @@ import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
|||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
|
||||
/**
|
||||
* Command used to display url to the player list page.
|
||||
|
@ -15,22 +15,17 @@ import com.djrapitops.plugin.command.SubCommand;
|
|||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
public class ListCommand extends SubCommand {
|
||||
public class ListCommand extends CommandNode {
|
||||
|
||||
public ListCommand() {
|
||||
super("list, pl, playerlist, players", CommandType.CONSOLE, Permissions.INSPECT_OTHER.getPermission(), Locale.get(Msg.CMD_USG_LIST).toString(), "");
|
||||
super("players|pl|playerlist|list", Permissions.INSPECT_OTHER.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_LIST).toString());
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_LIST).toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_LIST).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
sendListMsg(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendListMsg(ISender sender) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import com.djrapitops.plan.system.settings.Permissions;
|
|||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.settings.ColorScheme;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ListServersCommand extends SubCommand {
|
||||
public class ListServersCommand extends CommandNode {
|
||||
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
|
@ -28,13 +28,14 @@ public class ListServersCommand extends SubCommand {
|
|||
super("servers, serverlist, listservers, sl",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
"List servers in the network");
|
||||
"List servers in the network",
|
||||
"");
|
||||
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
ColorScheme colorScheme = plugin.getColorScheme();
|
||||
String mCol = colorScheme.getMainColor();
|
||||
String sCol = colorScheme.getSecondaryColor();
|
||||
|
@ -50,7 +51,6 @@ public class ListServersCommand extends SubCommand {
|
|||
sender.sendMessage("§cDatabase Exception occurred.");
|
||||
Log.toLog(this.getClass(), e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,8 +5,9 @@ import com.djrapitops.plan.command.commands.manage.*;
|
|||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.TreeCommand;
|
||||
import com.djrapitops.plugin.command.TreeCmdNode;
|
||||
|
||||
/**
|
||||
* This SubCommand is used to manage the the plugin's database and components.
|
||||
|
@ -14,31 +15,27 @@ import com.djrapitops.plugin.command.TreeCommand;
|
|||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageCommand extends TreeCommand<Plan> {
|
||||
public class ManageCommand extends TreeCmdNode {
|
||||
|
||||
public ManageCommand(Plan plugin) {
|
||||
super(plugin, "manage,m", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Locale.get(Msg.CMD_USG_MANAGE).toString(), "plan m");
|
||||
public ManageCommand(Plan plugin, CommandNode parent) {
|
||||
super("manage|m", Permissions.MANAGE.getPermission(), CommandType.CONSOLE, parent);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE).toString());
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE).toArray());
|
||||
super.setColorScheme(plugin.getColorScheme());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_MANAGE).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands() {
|
||||
add(
|
||||
new ManageMoveCommand(),
|
||||
new ManageHotswapCommand(plugin),
|
||||
new ManageBackupCommand(),
|
||||
new ManageRestoreCommand(plugin),
|
||||
new ManageImportCommand(),
|
||||
new ManageRemoveCommand(),
|
||||
new ManageClearCommand(plugin),
|
||||
new ManageSetupCommand(),
|
||||
new ManageDisableCommand(),
|
||||
new ManageConDebugCommand()
|
||||
setNodeGroups(
|
||||
new CommandNode[]{
|
||||
new ManageMoveCommand(),
|
||||
new ManageBackupCommand(),
|
||||
new ManageRestoreCommand(plugin),
|
||||
new ManageHotswapCommand(plugin),
|
||||
new ManageClearCommand(plugin),
|
||||
},
|
||||
new CommandNode[]{
|
||||
new ManageSetupCommand(),
|
||||
new ManageConDebugCommand(),
|
||||
new ManageImportCommand(),
|
||||
new ManageDisableCommand()
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,29 +4,27 @@ import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
|||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
|
||||
/**
|
||||
* Command used to display url to the network page.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class NetworkCommand extends SubCommand {
|
||||
public class NetworkCommand extends CommandNode {
|
||||
|
||||
public NetworkCommand() {
|
||||
super("network, n, netw",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.ANALYZE.getPermission(),
|
||||
"Get the link to the network page");
|
||||
super("network|n|netw",
|
||||
Permissions.ANALYZE.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp("View the network page");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
sendNetworkMsg(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendNetworkMsg(ISender sender) {
|
||||
|
|
|
@ -13,9 +13,9 @@ import com.djrapitops.plan.utilities.FormatUtils;
|
|||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.settings.ColorScheme;
|
||||
import com.djrapitops.plugin.settings.DefaultMessages;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
@ -30,7 +30,7 @@ import java.util.UUID;
|
|||
* @author Rsl1122
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class QInspectCommand extends SubCommand {
|
||||
public class QInspectCommand extends CommandNode {
|
||||
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
|
@ -40,27 +40,19 @@ public class QInspectCommand extends SubCommand {
|
|||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public QInspectCommand(PlanPlugin plugin) {
|
||||
super("qinspect",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.QUICK_INSPECT.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_QINSPECT).toString(),
|
||||
"<player>");
|
||||
|
||||
super("qinspect", Permissions.QUICK_INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setArguments("<player>");
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_QINSPECT).toString());
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_QINSPECT).toArray());
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_QINSPECT).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
String playerName = MiscUtils.getPlayerName(args, sender, Permissions.QUICK_INSPECT_OTHER);
|
||||
|
||||
runInspectTask(playerName, sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runInspectTask(String playerName, ISender sender) {
|
||||
|
|
|
@ -9,13 +9,15 @@ import com.djrapitops.plan.utilities.Condition;
|
|||
import com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||
import com.djrapitops.plugin.api.Check;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Command for registering web users.
|
||||
* <p>
|
||||
|
@ -27,27 +29,23 @@ import com.djrapitops.plugin.task.RunnableFactory;
|
|||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
public class RegisterCommand extends SubCommand {
|
||||
public class RegisterCommand extends CommandNode {
|
||||
|
||||
public RegisterCommand() {
|
||||
super("register",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
"", // No Permission Requirement
|
||||
Locale.get(Msg.CMD_USG_WEB_REGISTER).toString(),
|
||||
"<password> [name] [access lvl]");
|
||||
"<password> [name] [lvl]");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_WEB_REGISTER).toArray());
|
||||
if (Check.isBukkitAvailable()) {
|
||||
setupFilter();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_WEB_REGISTER).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
String notEnoughArgsMsg = Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse("(3) " + super.getArguments());
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
String notEnoughArgsMsg = Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse("(3) " + Arrays.toString(getArguments()));
|
||||
String hashErrorMsg = "§cPassword hash error.";
|
||||
String permLvlErrorMsg = "§cIncorrect perm level, not a number: ";
|
||||
try {
|
||||
|
@ -65,7 +63,6 @@ public class RegisterCommand extends SubCommand {
|
|||
} catch (Exception e) {
|
||||
Log.toLog(this.getClass().getSimpleName(), e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void consoleRegister(String[] args, ISender sender, String notEnoughArgsMsg) throws PassEncryptUtil.CannotPerformOperationException {
|
||||
|
|
|
@ -5,9 +5,9 @@ import com.djrapitops.plan.system.settings.Permissions;
|
|||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
|
||||
/**
|
||||
* This SubCommand is used to reload the plugin.
|
||||
|
@ -15,21 +15,18 @@ import com.djrapitops.plugin.command.SubCommand;
|
|||
* @author Rsl1122
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class ReloadCommand extends SubCommand {
|
||||
public class ReloadCommand extends CommandNode {
|
||||
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
public ReloadCommand(PlanPlugin plugin) {
|
||||
super("reload",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_RELOAD).toString());
|
||||
|
||||
super("reload", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_RELOAD).toString());
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
try {
|
||||
plugin.reloadPlugin(true);
|
||||
} catch (Exception e) {
|
||||
|
@ -37,7 +34,5 @@ public class ReloadCommand extends SubCommand {
|
|||
sender.sendMessage("§cSomething went wrong during reload of the plugin, a restart is recommended.");
|
||||
}
|
||||
sender.sendMessage(Locale.get(Msg.CMD_INFO_RELOAD_COMPLETE).toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import com.djrapitops.plan.system.settings.locale.Locale;
|
|||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.utilities.FormatUtils;
|
||||
|
@ -22,31 +22,25 @@ import java.util.List;
|
|||
* @author Rsl1122
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class SearchCommand extends SubCommand {
|
||||
public class SearchCommand extends CommandNode {
|
||||
|
||||
public SearchCommand() {
|
||||
super("search",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.SEARCH.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_SEARCH).toString(),
|
||||
"<part of playername>");
|
||||
|
||||
"<text>");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_SEARCH).toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_SEARCH).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString(), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(Locale.get(Msg.CMD_INFO_SEARCHING).toString());
|
||||
|
||||
runSearchTask(args, sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runSearchTask(String[] args, ISender sender) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.djrapitops.plan.command.commands;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.command.commands.webuser.WebCheckCommand;
|
||||
import com.djrapitops.plan.command.commands.webuser.WebDeleteCommand;
|
||||
|
@ -10,8 +8,9 @@ import com.djrapitops.plan.command.commands.webuser.WebListUsersCommand;
|
|||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.TreeCommand;
|
||||
import com.djrapitops.plugin.command.TreeCmdNode;
|
||||
|
||||
/**
|
||||
* Web subcommand used to manage Web users.
|
||||
|
@ -19,39 +18,21 @@ import com.djrapitops.plugin.command.TreeCommand;
|
|||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
public class WebUserCommand extends TreeCommand<PlanPlugin> {
|
||||
public class WebUserCommand extends TreeCmdNode {
|
||||
|
||||
public WebUserCommand(Plan plugin, RegisterCommand register) {
|
||||
super(plugin, "webuser, web",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE_WEB.getPerm(),
|
||||
Locale.get(Msg.CMD_USG_WEB).toString(),
|
||||
"plan web");
|
||||
public WebUserCommand(PlanPlugin plugin, RegisterCommand register, CommandNode parent) {
|
||||
super("webuser|web", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE, parent);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_WEB).toString());
|
||||
super.setColorScheme(plugin.getColorScheme());
|
||||
add(register);
|
||||
}
|
||||
|
||||
public WebUserCommand(PlanBungee plugin, RegisterCommand register) {
|
||||
super(plugin, "webuser, web",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE_WEB.getPerm(),
|
||||
Locale.get(Msg.CMD_USG_WEB).toString(),
|
||||
"planbungee web");
|
||||
add(register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_WEB).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands() {
|
||||
add(
|
||||
new WebLevelCommand(plugin),
|
||||
new WebListUsersCommand(plugin),
|
||||
new WebCheckCommand(),
|
||||
new WebDeleteCommand()
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_WEB).toArray());
|
||||
setNodeGroups(
|
||||
new CommandNode[]{
|
||||
register,
|
||||
new WebLevelCommand(plugin),
|
||||
new WebListUsersCommand(plugin),
|
||||
new WebCheckCommand(),
|
||||
new WebDeleteCommand()
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ import com.djrapitops.plan.system.settings.locale.Msg;
|
|||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plan.utilities.ManageUtils;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
@ -22,7 +22,7 @@ import com.djrapitops.plugin.utilities.Verify;
|
|||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageBackupCommand extends SubCommand {
|
||||
public class ManageBackupCommand extends CommandNode {
|
||||
|
||||
public ManageBackupCommand() {
|
||||
super("backup",
|
||||
|
@ -34,16 +34,16 @@ public class ManageBackupCommand extends SubCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
try {
|
||||
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(this.getArguments()), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
String dbName = args[0].toLowerCase();
|
||||
boolean isCorrectDB = "sqlite".equals(dbName) || "mysql".equals(dbName);
|
||||
if (!Condition.isTrue(isCorrectDB, Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + dbName, sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
final Database database = DBSystem.getActiveDatabaseByName(dbName);
|
||||
|
@ -51,7 +51,7 @@ public class ManageBackupCommand extends SubCommand {
|
|||
// If DB is null return
|
||||
if (!Condition.isTrue(Verify.notNull(database), Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString(), sender)) {
|
||||
Log.error(dbName + " was null!");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
Log.debug("Backup", "Start");
|
||||
runBackupTask(sender, args, database);
|
||||
|
@ -60,7 +60,6 @@ public class ManageBackupCommand extends SubCommand {
|
|||
} finally {
|
||||
Log.logDebug("Backup");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runBackupTask(ISender sender, String[] args, final Database database) {
|
||||
|
|
|
@ -14,9 +14,9 @@ import com.djrapitops.plan.system.settings.locale.Msg;
|
|||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
@ -27,7 +27,7 @@ import com.djrapitops.plugin.utilities.Verify;
|
|||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageClearCommand extends SubCommand {
|
||||
public class ManageClearCommand extends CommandNode {
|
||||
|
||||
private final Plan plugin;
|
||||
|
||||
|
@ -38,30 +38,26 @@ public class ManageClearCommand extends SubCommand {
|
|||
Locale.get(Msg.CMD_USG_MANAGE_CLEAR).toString(),
|
||||
"<DB> [-a]");
|
||||
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_CLEAR).toArray());
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_MANAGE_CLEAR).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString(), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
String dbName = args[0].toLowerCase();
|
||||
boolean isCorrectDB = "sqlite".equals(dbName) || "mysql".equals(dbName);
|
||||
|
||||
if (!Condition.isTrue(isCorrectDB, Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + dbName, sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Condition.isTrue(Verify.contains("-a", args), Locale.get(Msg.MANAGE_FAIL_CONFIRM).parse(Locale.get(Msg.MANAGE_NOTIFY_REMOVE).parse(args[0])), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -70,7 +66,6 @@ public class ManageClearCommand extends SubCommand {
|
|||
} catch (DBInitException e) {
|
||||
sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runClearTask(ISender sender, Database database) {
|
||||
|
|
|
@ -10,13 +10,11 @@ import com.djrapitops.plan.system.info.server.Server;
|
|||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.Processing;
|
||||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.system.webserver.WebServerSystem;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.settings.ColorScheme;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -28,7 +26,7 @@ import java.util.UUID;
|
|||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageConDebugCommand extends SubCommand {
|
||||
public class ManageConDebugCommand extends CommandNode {
|
||||
|
||||
private final ColorScheme cs;
|
||||
|
||||
|
@ -38,25 +36,17 @@ public class ManageConDebugCommand extends SubCommand {
|
|||
Permissions.MANAGE.getPermission(),
|
||||
"Debug Bukkit-Bungee Connections",
|
||||
"");
|
||||
|
||||
cs = PlanPlugin.getInstance().getColorScheme();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!WebServerSystem.isWebServerEnabled()) {
|
||||
sender.sendMessage("§cWebServer is not enabled on this server.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
Processing.submitNonCritical(() -> testServers(sender));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void testServers(ISender sender) {
|
||||
|
|
|
@ -5,9 +5,9 @@ import com.djrapitops.plan.system.settings.Permissions;
|
|||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
|
||||
/**
|
||||
* This manage SubCommand is used to disable some features of the plugin temporarily.
|
||||
|
@ -15,7 +15,7 @@ import com.djrapitops.plugin.command.SubCommand;
|
|||
* @author Rsl1122
|
||||
* @since 4.0.4
|
||||
*/
|
||||
public class ManageDisableCommand extends SubCommand {
|
||||
public class ManageDisableCommand extends CommandNode {
|
||||
/**
|
||||
* Class Constructor.
|
||||
*/
|
||||
|
@ -23,14 +23,14 @@ public class ManageDisableCommand extends SubCommand {
|
|||
super("disable",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
"Used to disable some features of the Plugin temporarily",
|
||||
"Disable a feature temporarily",
|
||||
"<feature>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(this.getArguments()), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "kickcount":
|
||||
|
@ -40,6 +40,5 @@ public class ManageDisableCommand extends SubCommand {
|
|||
default:
|
||||
sender.sendMessage("§eDefine a feature to disable! (currently supports only kickCount)");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ import com.djrapitops.plan.system.settings.locale.Locale;
|
|||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ import com.djrapitops.plugin.utilities.Verify;
|
|||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageHotswapCommand extends SubCommand {
|
||||
public class ManageHotswapCommand extends CommandNode {
|
||||
|
||||
private final Plan plugin;
|
||||
|
||||
|
@ -31,30 +31,25 @@ public class ManageHotswapCommand extends SubCommand {
|
|||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_HOTSWAP).toString(),
|
||||
"<DB>");
|
||||
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray());
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString(), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
String dbName = args[0].toLowerCase();
|
||||
boolean isCorrectDB = "sqlite".equals(dbName) || "mysql".equals(dbName);
|
||||
|
||||
if (!Condition.isTrue(isCorrectDB, Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + dbName, sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Condition.isTrue(dbName.equals(Database.getActive().getConfigName()), Locale.get(Msg.MANAGE_FAIL_SAME_DB).toString(), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -63,22 +58,21 @@ public class ManageHotswapCommand extends SubCommand {
|
|||
// If DB is null return
|
||||
if (!Condition.isTrue(Verify.notNull(database), Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString(), sender)) {
|
||||
Log.error(dbName + " was null!");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!database.isOpen()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString());
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
Settings.DB_TYPE.set(dbName);
|
||||
|
||||
Settings.save();
|
||||
plugin.reloadPlugin(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,19 +6,21 @@ import com.djrapitops.plan.system.settings.Permissions;
|
|||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* This manage SubCommand is used to import data from 3rd party plugins.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageImportCommand extends SubCommand {
|
||||
public class ManageImportCommand extends CommandNode {
|
||||
|
||||
public ManageImportCommand() {
|
||||
super("import",
|
||||
|
@ -26,17 +28,13 @@ public class ManageImportCommand extends SubCommand {
|
|||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_IMPORT).toString(),
|
||||
"<plugin>/list [import args]");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_IMPORT).toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_MANAGE_IMPORT).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG) + " " + this.getArguments(), sender)) {
|
||||
return true;
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG) + " " + Arrays.toString(this.getArguments()), sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String importArg = args[0];
|
||||
|
@ -47,13 +45,13 @@ public class ManageImportCommand extends SubCommand {
|
|||
.map(Importer::getNames)
|
||||
.map(list -> list.get(0))
|
||||
.forEach(name -> sender.sendMessage("- " + name));
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
Importer importer = ImporterManager.getImporter(importArg);
|
||||
if (importer == null) {
|
||||
sender.sendMessage("§eImporter '" + importArg + "' doesn't exist");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
RunnableFactory.createNew("Import:" + importArg, new AbsRunnable() {
|
||||
|
@ -66,6 +64,5 @@ public class ManageImportCommand extends SubCommand {
|
|||
}
|
||||
}
|
||||
}).runTaskAsynchronously();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,9 @@ import com.djrapitops.plan.system.settings.locale.Msg;
|
|||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plan.utilities.ManageUtils;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
@ -23,7 +23,7 @@ import com.djrapitops.plugin.utilities.Verify;
|
|||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageMoveCommand extends SubCommand {
|
||||
public class ManageMoveCommand extends CommandNode {
|
||||
|
||||
public ManageMoveCommand() {
|
||||
super("move",
|
||||
|
@ -34,31 +34,31 @@ public class ManageMoveCommand extends SubCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 2, Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(this.getArguments()), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
String fromDB = args[0].toLowerCase();
|
||||
boolean isCorrectDB = "sqlite".equals(fromDB) || "mysql".equals(fromDB);
|
||||
|
||||
if (!Condition.isTrue(isCorrectDB, Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + fromDB, sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
String toDB = args[1].toLowerCase();
|
||||
isCorrectDB = "sqlite".equals(toDB) || "mysql".equals(toDB);
|
||||
|
||||
if (!Condition.isTrue(isCorrectDB, Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + toDB, sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Condition.isTrue(!Verify.equalsIgnoreCase(fromDB, toDB), Locale.get(Msg.MANAGE_FAIL_SAME_DB).toString(), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Condition.isTrue(Verify.contains("-a", args), Locale.get(Msg.MANAGE_FAIL_CONFIRM).parse(Locale.get(Msg.MANAGE_NOTIFY_REMOVE).parse(args[1])), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -69,7 +69,6 @@ public class ManageMoveCommand extends SubCommand {
|
|||
} catch (Exception e) {
|
||||
sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runMoveTask(final Database fromDatabase, final Database toDatabase, ISender sender) {
|
||||
|
|
|
@ -10,9 +10,9 @@ import com.djrapitops.plan.system.settings.locale.Msg;
|
|||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plan.utilities.ManageUtils;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
@ -25,7 +25,7 @@ import java.io.File;
|
|||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ManageRestoreCommand extends SubCommand {
|
||||
public class ManageRestoreCommand extends CommandNode {
|
||||
|
||||
private final Plan plugin;
|
||||
|
||||
|
@ -40,20 +40,20 @@ public class ManageRestoreCommand extends SubCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 2, Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(this.getArguments()), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
String db = args[1].toLowerCase();
|
||||
boolean isCorrectDB = "sqlite".equals(db) || "mysql".equals(db);
|
||||
|
||||
if (!Condition.isTrue(isCorrectDB, Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + db, sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Condition.isTrue(Verify.contains("-a", args), Locale.get(Msg.MANAGE_FAIL_CONFIRM).parse(Locale.get(Msg.MANAGE_NOTIFY_REWRITE).parse(args[1])), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -63,7 +63,6 @@ public class ManageRestoreCommand extends SubCommand {
|
|||
} catch (Exception e) {
|
||||
sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runRestoreTask(String[] args, ISender sender, final Database database) {
|
||||
|
|
|
@ -10,9 +10,9 @@ import com.djrapitops.plan.system.settings.locale.Msg;
|
|||
import com.djrapitops.plan.system.webserver.WebServerSystem;
|
||||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
|
||||
/**
|
||||
* This manage SubCommand is used to request settings from Bungee so that connection can be established.
|
||||
|
@ -20,42 +20,36 @@ import com.djrapitops.plugin.command.SubCommand;
|
|||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageSetupCommand extends SubCommand {
|
||||
public class ManageSetupCommand extends CommandNode {
|
||||
|
||||
public ManageSetupCommand() {
|
||||
super("setup",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
"Set-Up Bungee WebServer connection",
|
||||
"<Bungee WebServer address>");
|
||||
"Set-Up Bungee connection",
|
||||
"<BungeeAddress>");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString(), sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (!WebServerSystem.isWebServerEnabled()) {
|
||||
sender.sendMessage("§cWebServer is not enabled on this server! Make sure it enables on boot!");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
String address = args[0].toLowerCase();
|
||||
if (!address.startsWith("http") || address.endsWith("://")) {
|
||||
sender.sendMessage("§cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (address.endsWith("/")) {
|
||||
address = address.substring(0, address.length() - 1);
|
||||
}
|
||||
|
||||
requestSetup(sender, address);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void requestSetup(ISender sender, String address) {
|
||||
|
|
|
@ -7,9 +7,9 @@ import com.djrapitops.plan.system.settings.locale.Locale;
|
|||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -20,20 +20,18 @@ import org.bukkit.ChatColor;
|
|||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
public class WebCheckCommand extends SubCommand {
|
||||
public class WebCheckCommand extends CommandNode {
|
||||
|
||||
public WebCheckCommand() {
|
||||
super("check",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE_WEB.getPerm(),
|
||||
Locale.get(Msg.CMD_USG_WEB_CHECK).toString(),
|
||||
"<username>");
|
||||
super("check", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_WEB_CHECK).toString());
|
||||
setArguments("<username>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).parse() + " <username>", sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
Database database = Database.getActive();
|
||||
String user = args[0];
|
||||
|
@ -55,7 +53,6 @@ public class WebCheckCommand extends SubCommand {
|
|||
}
|
||||
}
|
||||
}).runTaskAsynchronously();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import com.djrapitops.plan.system.settings.locale.Locale;
|
|||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.utilities.Condition;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
@ -19,20 +19,18 @@ import net.md_5.bungee.api.ChatColor;
|
|||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
public class WebDeleteCommand extends SubCommand {
|
||||
public class WebDeleteCommand extends CommandNode {
|
||||
|
||||
public WebDeleteCommand() {
|
||||
super("delete, remove",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE_WEB.getPerm(),
|
||||
Locale.get(Msg.CMD_USG_WEB_DELETE).toString(),
|
||||
"<username>");
|
||||
super("delete|remove", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_WEB_DELETE).toString());
|
||||
setArguments("<username>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
if (!Condition.isTrue(args.length >= 1, Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).parse() + " <username>", sender)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
Database database = Database.getActive();
|
||||
String user = args[0];
|
||||
|
@ -54,7 +52,6 @@ public class WebDeleteCommand extends SubCommand {
|
|||
}
|
||||
}
|
||||
}).runTaskAsynchronously();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import com.djrapitops.plan.PlanPlugin;
|
|||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.settings.ColorScheme;
|
||||
|
||||
/**
|
||||
|
@ -15,20 +15,18 @@ import com.djrapitops.plugin.settings.ColorScheme;
|
|||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
public class WebLevelCommand extends SubCommand {
|
||||
public class WebLevelCommand extends CommandNode {
|
||||
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
public WebLevelCommand(PlanPlugin plugin) {
|
||||
super("level",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE_WEB.getPerm(),
|
||||
Locale.get(Msg.CMD_USG_WEB_LEVEL).toString());
|
||||
super("level", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_WEB_LEVEL).toString());
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
ColorScheme cs = plugin.getColorScheme();
|
||||
String sCol = cs.getSecondaryColor();
|
||||
String cmdBall = Locale.get(Msg.CMD_CONSTANT_LIST_BALL).parse();
|
||||
|
@ -44,7 +42,6 @@ public class WebLevelCommand extends SubCommand {
|
|||
};
|
||||
|
||||
sender.sendMessage(messages);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,9 +8,9 @@ import com.djrapitops.plan.system.settings.locale.Locale;
|
|||
import com.djrapitops.plan.system.settings.locale.Msg;
|
||||
import com.djrapitops.plan.utilities.comparators.WebUserComparator;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.ISender;
|
||||
import com.djrapitops.plugin.command.SubCommand;
|
||||
import com.djrapitops.plugin.settings.ColorScheme;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
|
@ -23,17 +23,18 @@ import java.util.List;
|
|||
* @author Rsl1122
|
||||
* @since 3.5.2
|
||||
*/
|
||||
public class WebListUsersCommand extends SubCommand {
|
||||
public class WebListUsersCommand extends CommandNode {
|
||||
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
public WebListUsersCommand(PlanPlugin plugin) {
|
||||
super("list", CommandType.CONSOLE, Permissions.MANAGE_WEB.getPerm(), "List registered web users & permission levels.");
|
||||
super("list", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE);
|
||||
setShortHelp("List registered web users & permission levels.");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
public void onCommand(ISender sender, String commandLabel, String[] args) {
|
||||
RunnableFactory.createNew(new AbsRunnable("Webuser List Task") {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -55,7 +56,6 @@ public class WebListUsersCommand extends SubCommand {
|
|||
}
|
||||
}
|
||||
}).runTaskAsynchronously();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -203,35 +203,33 @@ public class Locale {
|
|||
add(Msg.CMD_USG_QANALYZE, "View the Server Analysis as Text");
|
||||
add(Msg.CMD_USG_HELP, "Show command list.");
|
||||
add(Msg.CMD_USG_INFO, "Check the version of Plan");
|
||||
add(Msg.CMD_USG_INSPECT, "Inspect Player's Data");
|
||||
add(Msg.CMD_USG_QINSPECT, "Inspect Player's Data as Text");
|
||||
add(Msg.CMD_USG_INSPECT, "Inspect player's data");
|
||||
add(Msg.CMD_USG_QINSPECT, "Inspect player's data in game");
|
||||
add(Msg.CMD_USG_LIST, "List to all cached players");
|
||||
add(Msg.CMD_USG_MANAGE, "Database management command");
|
||||
add(Msg.CMD_USG_MANAGE_BACKUP, "Backup a database to .db file");
|
||||
add(Msg.CMD_USG_MANAGE_CLEAN, "Clear old data from the database");
|
||||
add(Msg.CMD_USG_MANAGE_CLEAR, "Clear ALL data from the database");
|
||||
add(Msg.CMD_USG_MANAGE_DUMP, "Create a Hastebin log for Dev for easier Issue reporting.");
|
||||
add(Msg.CMD_USG_MANAGE_HOTSWAP, "Hotswap to another database & restart the plugin");
|
||||
add(Msg.CMD_USG_MANAGE_IMPORT, "Import Data from supported plugins to Active Database.");
|
||||
add(Msg.CMD_USG_MANAGE_MOVE, "Copy data from one database to another & overwrite values");
|
||||
add(Msg.CMD_USG_MANAGE_HOTSWAP, "Hotswap database & restart the plugin");
|
||||
add(Msg.CMD_USG_MANAGE_IMPORT, "Import Data from plugins");
|
||||
add(Msg.CMD_USG_MANAGE_MOVE, "Move data between databases");
|
||||
add(Msg.CMD_USG_MANAGE_REMOVE, "Remove players's data from the Active Database.");
|
||||
add(Msg.CMD_USG_MANAGE_RESTORE, "Restore a database from a backup file");
|
||||
add(Msg.CMD_USG_MANAGE_RESTORE, "Restore a database");
|
||||
add(Msg.CMD_USG_RELOAD, "Restart the Plugin (Reloads config)");
|
||||
add(Msg.CMD_USG_SEARCH, "Search for player");
|
||||
add(Msg.CMD_USG_WEB, "Manage Webusers");
|
||||
add(Msg.CMD_USG_WEB_CHECK, "Check a webuser and their permission level.");
|
||||
add(Msg.CMD_USG_WEB_DELETE, "Delete a webuser");
|
||||
add(Msg.CMD_USG_WEB, "Manage Web users");
|
||||
add(Msg.CMD_USG_WEB_CHECK, "Check a web user's permission level.");
|
||||
add(Msg.CMD_USG_WEB_DELETE, "Delete a web user");
|
||||
add(Msg.CMD_USG_WEB_LEVEL, "Info about permission levels.");
|
||||
add(Msg.CMD_USG_WEB_REGISTER, "Register a user for the webserver");
|
||||
add(Msg.CMD_USG_WEB_REGISTER, "Register a web user");
|
||||
|
||||
add(Msg.CMD_HELP_ANALYZE, mCol + "Analysis Command"
|
||||
+ "\\" + tCol + " Used to Refresh analysis cache & Access the result page"
|
||||
+ "\\" + sCol + " /plan status can be used to check status of analysis while it is running."
|
||||
+ "\\" + sCol + " Aliases: analyze, analyse, analysis, a");
|
||||
+ "\\" + sCol + " /plan status can be used to check status of analysis while it is running.");
|
||||
add(Msg.CMD_HELP_QANALYZE, mCol + "Quick Analysis command"
|
||||
+ "\\" + tCol + " Used to get in game info about analysis."
|
||||
+ "\\" + sCol + " Has less info than full Analysis web page."
|
||||
+ "\\" + sCol + " Aliases: qanalyze, ganalyse, qanalysis, qa");
|
||||
+ "\\" + sCol + " Has less info than full Analysis web page.");
|
||||
add(Msg.CMD_HELP_PLAN, mCol + "/plan - Main Command"
|
||||
+ "\\" + tCol + " Used to access all SubCommands & help"
|
||||
+ "\\" + sCol + " /plan - List subcommands"
|
||||
|
@ -242,21 +240,17 @@ public class Locale {
|
|||
+ "\\" + sCol + " Alias: /plan <name>");
|
||||
add(Msg.CMD_HELP_QINSPECT, mCol + "Quick Inspect command"
|
||||
+ "\\" + tCol + " Used to get some inspect info in game."
|
||||
+ "\\" + sCol + " Has less info than full Inspect web page."
|
||||
+ "\\" + sCol + " Alias: /plan qi");
|
||||
+ "\\" + sCol + " Has less info than full Inspect web page.");
|
||||
add(Msg.CMD_HELP_LIST, mCol + "List command"
|
||||
+ "\\" + tCol + " Used to get a link to players page."
|
||||
+ "\\" + sCol + " Players page contains links to all cached inspect pages."
|
||||
+ "\\" + sCol + " Alias: /plan pl");
|
||||
+ "\\" + sCol + " Players page contains links to all cached inspect pages.");
|
||||
add(Msg.CMD_HELP_MANAGE, mCol + "Manage command\\"
|
||||
+ tCol + " Used to Manage Database of the plugin."
|
||||
+ "\\" + sCol + " Alias: /plan m"
|
||||
+ "\\" + sCol + " /plan m - List subcommands"
|
||||
+ "\\" + sCol + " /plan m <subcommand> ? - in depth help");
|
||||
add(Msg.CMD_HELP_MANAGE_CLEAR, mCol + "Manage Clear command"
|
||||
+ "\\" + tCol + " Used to delete ALL data in the active database."
|
||||
+ "\\" + sCol + " Plugin should be reloaded after successful clear."
|
||||
+ "\\" + sCol + " Alias: /plan pl");
|
||||
+ "\\" + sCol + " Plugin should be reloaded after successful clear.");
|
||||
add(Msg.CMD_HELP_MANAGE_DUMP, mCol + "Manage Dump command"
|
||||
+ "\\" + tCol + " Used to dump important data for bug reporting to hastebin.");
|
||||
add(Msg.CMD_HELP_MANAGE_HOTSWAP, mCol + "Manage Hotswap command"
|
||||
|
@ -275,8 +269,7 @@ public class Locale {
|
|||
+ "\\" + sCol + " Users have a permission level:"
|
||||
+ "\\" + tCol + " 0 - Access to all pages"
|
||||
+ "\\" + tCol + " 1 - Access to /players & all inspect pages"
|
||||
+ "\\" + tCol + " 2 - Access to own inspect page"
|
||||
+ "\\" + sCol + " Alias: /plan web");
|
||||
+ "\\" + tCol + " 2 - Access to own inspect page");
|
||||
add(Msg.CMD_HELP_WEB_REGISTER, mCol + "Web Register command"
|
||||
+ "\\" + tCol + " Used to register a new user for the webserver."
|
||||
+ "\\" + sCol + " Registering a user for another player requires " + Permissions.MANAGE_WEB.getPerm() + " permission."
|
||||
|
|
Loading…
Reference in New Issue
Block a user