mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-26 11:08:08 +01:00
Removed deprecated APF code usage
This commit is contained in:
parent
a27175e136
commit
4b4594d9b8
@ -22,7 +22,7 @@ import org.spongepowered.api.plugin.Plugin;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Plugin(id = "plan", name = "Plan", version = "4.2.0")
|
||||
@Plugin(id = "plan", name = "Plan", version = "4.2.0", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"})
|
||||
public class PlanSponge extends SpongePlugin implements PlanPlugin {
|
||||
|
||||
@Inject
|
||||
@ -90,7 +90,6 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin {
|
||||
return PlanColorScheme.create();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onReload() {
|
||||
|
||||
|
@ -9,7 +9,7 @@ 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.TreeCmdNode;
|
||||
import com.djrapitops.plugin.command.defaultcmds.StatusCommandNode;
|
||||
import com.djrapitops.plugin.command.defaultcmds.StatusCommand;
|
||||
|
||||
/**
|
||||
* TreeCommand for the /plan command, and all subcommands.
|
||||
@ -48,7 +48,7 @@ public class PlanBungeeCommand extends TreeCmdNode {
|
||||
new ManageConDebugCommand(),
|
||||
new BungeeSetupToggleCommand(),
|
||||
new ReloadCommand(plugin),
|
||||
new StatusCommandNode<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()),
|
||||
new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ 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.TreeCmdNode;
|
||||
import com.djrapitops.plugin.command.defaultcmds.StatusCommandNode;
|
||||
import com.djrapitops.plugin.command.defaultcmds.StatusCommand;
|
||||
|
||||
/**
|
||||
* TreeCommand for the /plan command, and all SubCommands.
|
||||
@ -45,7 +45,7 @@ public class PlanCommand extends TreeCmdNode {
|
||||
new InfoCommand(plugin),
|
||||
new ReloadCommand(plugin),
|
||||
new ManageCommand(plugin, this),
|
||||
new StatusCommandNode<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()),
|
||||
new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()),
|
||||
(Settings.DEV_MODE.isTrue() ? new DevCommand() : null)
|
||||
}
|
||||
);
|
||||
|
@ -20,7 +20,9 @@ import com.djrapitops.plugin.command.ISender;
|
||||
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>");
|
||||
super("dev", "plan.*", CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp("Test Plugin functions not testable with unit tests.");
|
||||
setArguments("<feature>");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,11 +25,8 @@ public class ListServersCommand extends CommandNode {
|
||||
private final PlanPlugin plugin;
|
||||
|
||||
public ListServersCommand(PlanPlugin plugin) {
|
||||
super("servers, serverlist, listservers, sl",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
"List servers in the network",
|
||||
"");
|
||||
super("servers|serverlist|listservers|sl|ls", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp("List servers in the network");
|
||||
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
@ -27,7 +27,8 @@ public class ManageCommand extends TreeCmdNode {
|
||||
new ManageMoveCommand(),
|
||||
new ManageBackupCommand(),
|
||||
new ManageRestoreCommand(plugin),
|
||||
new ManageHotswapCommand(plugin),
|
||||
new ManageRemoveCommand(),
|
||||
new ManageHotSwapCommand(plugin),
|
||||
new ManageClearCommand(plugin),
|
||||
},
|
||||
new CommandNode[]{
|
||||
|
@ -17,8 +17,7 @@ import com.djrapitops.plugin.command.ISender;
|
||||
public class NetworkCommand extends CommandNode {
|
||||
|
||||
public NetworkCommand() {
|
||||
super("network|n|netw",
|
||||
Permissions.ANALYZE.getPermission(), CommandType.CONSOLE);
|
||||
super("network|n|netw", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp("View the network page");
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,10 @@ import java.util.Arrays;
|
||||
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] [lvl]");
|
||||
// No Permission Requirement
|
||||
super("register", "", CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_WEB_REGISTER).toString());
|
||||
setArguments("<password>", "[name]", "[lvl]");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_WEB_REGISTER).toArray());
|
||||
if (Check.isBukkitAvailable()) {
|
||||
setupFilter();
|
||||
|
@ -25,11 +25,9 @@ import java.util.List;
|
||||
public class SearchCommand extends CommandNode {
|
||||
|
||||
public SearchCommand() {
|
||||
super("search",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.SEARCH.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_SEARCH).toString(),
|
||||
"<text>");
|
||||
super("search", Permissions.SEARCH.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_SEARCH).toString());
|
||||
setArguments("<text>");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_SEARCH).toArray());
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,9 @@ import com.djrapitops.plugin.utilities.Verify;
|
||||
public class ManageBackupCommand extends CommandNode {
|
||||
|
||||
public ManageBackupCommand() {
|
||||
super("backup",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_BACKUP).toString(),
|
||||
"<DB>");
|
||||
super("backup", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_BACKUP).toString());
|
||||
setArguments("<DB>");
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,9 @@ public class ManageClearCommand extends CommandNode {
|
||||
private final Plan plugin;
|
||||
|
||||
public ManageClearCommand(Plan plugin) {
|
||||
super("clear",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_CLEAR).toString(),
|
||||
"<DB> [-a]");
|
||||
|
||||
super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_CLEAR).toString());
|
||||
setArguments("<DB>", "[-a]");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_CLEAR).toArray());
|
||||
this.plugin = plugin;
|
||||
|
||||
|
@ -31,11 +31,8 @@ public class ManageConDebugCommand extends CommandNode {
|
||||
private final ColorScheme cs;
|
||||
|
||||
public ManageConDebugCommand() {
|
||||
super("con",
|
||||
CommandType.ALL,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
"Debug Bukkit-Bungee Connections",
|
||||
"");
|
||||
super("con", Permissions.MANAGE.getPermission(), CommandType.ALL);
|
||||
setShortHelp("Debug Bukkit-Bungee Connections");
|
||||
cs = PlanPlugin.getInstance().getColorScheme();
|
||||
}
|
||||
|
||||
|
@ -20,11 +20,9 @@ public class ManageDisableCommand extends CommandNode {
|
||||
* Class Constructor.
|
||||
*/
|
||||
public ManageDisableCommand() {
|
||||
super("disable",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
"Disable a feature temporarily",
|
||||
"<feature>");
|
||||
super("disable", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp("Disable a feature temporarily");
|
||||
setArguments("<feature>");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,16 +21,14 @@ import com.djrapitops.plugin.utilities.Verify;
|
||||
* @author Rsl1122
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class ManageHotswapCommand extends CommandNode {
|
||||
public class ManageHotSwapCommand extends CommandNode {
|
||||
|
||||
private final Plan plugin;
|
||||
|
||||
public ManageHotswapCommand(Plan plugin) {
|
||||
super("hotswap",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_HOTSWAP).toString(),
|
||||
"<DB>");
|
||||
public ManageHotSwapCommand(Plan plugin) {
|
||||
super("hotswap", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_HOTSWAP).toString());
|
||||
setArguments("<DB>");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray());
|
||||
this.plugin = plugin;
|
||||
|
@ -23,11 +23,9 @@ import java.util.Arrays;
|
||||
public class ManageImportCommand extends CommandNode {
|
||||
|
||||
public ManageImportCommand() {
|
||||
super("import",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_IMPORT).toString(),
|
||||
"<plugin>/list [import args]");
|
||||
super("import", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_IMPORT).toString());
|
||||
setArguments("<plugin>/list", "[import args]");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_IMPORT).toArray());
|
||||
}
|
||||
|
||||
|
@ -26,11 +26,9 @@ import com.djrapitops.plugin.utilities.Verify;
|
||||
public class ManageMoveCommand extends CommandNode {
|
||||
|
||||
public ManageMoveCommand() {
|
||||
super("move",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_MOVE).toString(),
|
||||
"<fromDB> <toDB> [-a]");
|
||||
super("move", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_MOVE).toString());
|
||||
setArguments("<fromDB>", "<toDB>", "[-a]");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.djrapitops.plan.command.commands.manage;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.system.cache.SessionCache;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.settings.Permissions;
|
||||
import com.djrapitops.plan.system.settings.locale.Locale;
|
||||
@ -11,49 +9,39 @@ 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.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;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.bukkit.Bukkit.getPlayer;
|
||||
|
||||
/**
|
||||
* This manage subcommand is used to remove a single player's data from the
|
||||
* database.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ManageRemoveCommand extends SubCommand {
|
||||
public class ManageRemoveCommand extends CommandNode {
|
||||
|
||||
public ManageRemoveCommand() {
|
||||
super("remove",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_REMOVE).toString(),
|
||||
"<player> [-a]");
|
||||
super("remove|delete", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_REMOVE).toString());
|
||||
setArguments("<player>", "[-a]");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_REMOVE).toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] addHelp() {
|
||||
return Locale.get(Msg.CMD_HELP_MANAGE_REMOVE).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 playerName = MiscUtils.getPlayerName(args, sender, Permissions.MANAGE);
|
||||
|
||||
runRemoveTask(playerName, sender, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runRemoveTask(String playerName, ISender sender, String[] args) {
|
||||
@ -83,11 +71,6 @@ public class ManageRemoveCommand extends SubCommand {
|
||||
|
||||
database.remove().player(uuid);
|
||||
|
||||
Player player = getPlayer(uuid);
|
||||
if (player != null) {
|
||||
SessionCache.getActiveSessions().remove(uuid);
|
||||
SessionCache.getInstance().cacheSession(uuid, new Session(MiscUtils.getTime(), player.getWorld().getName(), player.getGameMode().name()));
|
||||
}
|
||||
sender.sendMessage(Locale.get(Msg.MANAGE_INFO_REMOVE_SUCCESS).parse(playerName, Database.getActive().getConfigName()));
|
||||
} catch (DBException e) {
|
||||
Log.toLog(this.getClass(), e);
|
||||
|
@ -18,6 +18,7 @@ import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* This manage SubCommand is used to restore a backup.db file in the
|
||||
@ -30,18 +31,16 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
private final Plan plugin;
|
||||
|
||||
public ManageRestoreCommand(Plan plugin) {
|
||||
super("restore",
|
||||
CommandType.CONSOLE,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
Locale.get(Msg.CMD_USG_MANAGE_RESTORE).toString(),
|
||||
"<Filename.db> <dbTo> [-a]");
|
||||
super("restore", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_RESTORE).toString());
|
||||
setArguments("<Filename.db>", "<dbTo>", "[-a]");
|
||||
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
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)) {
|
||||
if (!Condition.isTrue(args.length >= 2, Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(Arrays.toString(this.getArguments())), sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,9 @@ import com.djrapitops.plugin.command.ISender;
|
||||
public class ManageSetupCommand extends CommandNode {
|
||||
|
||||
public ManageSetupCommand() {
|
||||
super("setup",
|
||||
CommandType.PLAYER_OR_ARGS,
|
||||
Permissions.MANAGE.getPermission(),
|
||||
"Set-Up Bungee connection",
|
||||
"<BungeeAddress>");
|
||||
super("setup", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
setShortHelp("Set-Up Bungee connection");
|
||||
setArguments("<BungeeAddress>");
|
||||
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user