Removed /plan dev

This commit is contained in:
Risto Lahtela 2020-05-16 09:59:36 +03:00
parent 53e1539da9
commit 0dff590f63
2 changed files with 2 additions and 88 deletions

View File

@ -19,7 +19,6 @@ package com.djrapitops.plan.commands;
import com.djrapitops.plan.commands.subcommands.*; import com.djrapitops.plan.commands.subcommands.*;
import com.djrapitops.plan.settings.Permissions; import com.djrapitops.plan.settings.Permissions;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.PluginSettings;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.lang.DeepHelpLang; import com.djrapitops.plan.settings.locale.lang.DeepHelpLang;
import com.djrapitops.plugin.command.ColorScheme; import com.djrapitops.plugin.command.ColorScheme;
@ -50,7 +49,6 @@ public class OldPlanCommand extends TreeCmdNode {
private final InfoCommand infoCommand; private final InfoCommand infoCommand;
private final ReloadCommand reloadCommand; private final ReloadCommand reloadCommand;
private final Lazy<ManageCommand> manageCommand; private final Lazy<ManageCommand> manageCommand;
private final DevCommand devCommand;
private boolean commandsRegistered; private boolean commandsRegistered;
@ -69,8 +67,7 @@ public class OldPlanCommand extends TreeCmdNode {
// Group 3 // Group 3
InfoCommand infoCommand, InfoCommand infoCommand,
ReloadCommand reloadCommand, ReloadCommand reloadCommand,
Lazy<ManageCommand> manageCommand, Lazy<ManageCommand> manageCommand
DevCommand devCommand
) { ) {
super("plan", "", CommandType.CONSOLE, null); super("plan", "", CommandType.CONSOLE, null);
this.unregisterCommand = unregisterCommand; this.unregisterCommand = unregisterCommand;
@ -85,7 +82,6 @@ public class OldPlanCommand extends TreeCmdNode {
this.infoCommand = infoCommand; this.infoCommand = infoCommand;
this.reloadCommand = reloadCommand; this.reloadCommand = reloadCommand;
this.manageCommand = manageCommand; this.manageCommand = manageCommand;
this.devCommand = devCommand;
getHelpCommand().setPermission(Permissions.HELP.getPermission()); getHelpCommand().setPermission(Permissions.HELP.getPermission());
setDefaultCommand("inspect"); setDefaultCommand("inspect");
@ -110,8 +106,7 @@ public class OldPlanCommand extends TreeCmdNode {
CommandNode[] manageGroup = { CommandNode[] manageGroup = {
infoCommand, infoCommand,
reloadCommand, reloadCommand,
manageCommand.get(), manageCommand.get()
config.isTrue(PluginSettings.DEV_MODE) ? devCommand : null
}; };
setNodeGroups(analyticsGroup, webGroup, manageGroup); setNodeGroups(analyticsGroup, webGroup, manageGroup);
commandsRegistered = true; commandsRegistered = true;

View File

@ -1,81 +0,0 @@
/*
* This file is part of Player Analytics (Plan).
*
* Plan is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License v3 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Plan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.plan.commands.subcommands;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.lang.CmdHelpLang;
import com.djrapitops.plan.settings.locale.lang.CommandLang;
import com.djrapitops.plan.utilities.chat.ChatFormatter;
import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.utilities.Verify;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.TextStringBuilder;
import javax.inject.Inject;
import java.lang.reflect.Method;
import java.util.Arrays;
/**
* Command used for testing functions that are too difficult to unit test.
*
* @author Rsl1122
*/
public class DevCommand extends CommandNode {
private final Locale locale;
@Inject
public DevCommand(Locale locale) {
super("dev", "plan.*", CommandType.PLAYER_OR_ARGS);
this.locale = locale;
setShortHelp(locale.get(CmdHelpLang.DEV).toString());
setArguments("<feature>");
}
@Override
public void onCommand(Sender sender, String cmd, String[] args) {
Verify.isTrue(args.length >= 1,
() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments()))));
sender.sendMessage(" |space");
sender.sendMessage("§l §r|fat space");
sender.sendMessage(" |space");
sender.sendMessage("§l §r|fat space");
Object actual = sender.getSender();
try {
Method method = actual.getClass().getMethod("sendMessage", String.class);
// int indent = new Random().nextInt(25);
String msg = new TextStringBuilder().appendWithSeparators(args, " ").toString();
// method.invoke(actual, "With indent: " + indent);
// method.invoke(actual, ChatFormatter.leftPad(msg, indent));
// method.invoke(actual, "Centered:");
method.invoke(actual, ChatFormatter.center(msg));
method.invoke(actual, "Table:");
String[] split = StringUtils.split(msg, ':');
int columnCount = split[0].length() - split[0].replace("-", "").length();
method.invoke(actual, ChatFormatter.columns(columnCount, split, "-"));
} catch (Exception e) {
e.printStackTrace();
}
}
}