2021-01-03 07:21:15 +00:00
|
|
|
package dev.plex.command.impl;
|
2020-10-31 08:55:27 +00:00
|
|
|
|
2021-06-20 08:02:07 +00:00
|
|
|
import dev.plex.Plex;
|
2022-01-04 03:04:39 +00:00
|
|
|
import dev.plex.command.PlexCommand;
|
2021-01-03 07:21:15 +00:00
|
|
|
import dev.plex.command.annotation.CommandParameters;
|
|
|
|
import dev.plex.command.annotation.CommandPermissions;
|
2022-01-04 03:04:39 +00:00
|
|
|
import dev.plex.command.exception.CommandArgumentException;
|
2021-01-03 07:21:15 +00:00
|
|
|
import dev.plex.command.source.CommandSource;
|
|
|
|
import dev.plex.command.source.RequiredCommandSource;
|
|
|
|
import dev.plex.rank.enums.Rank;
|
2021-06-20 08:02:07 +00:00
|
|
|
import org.bukkit.ChatColor;
|
2020-10-31 08:55:27 +00:00
|
|
|
|
2022-01-04 03:04:39 +00:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
|
2020-10-31 08:55:27 +00:00
|
|
|
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
2022-01-04 03:04:39 +00:00
|
|
|
@CommandParameters(usage = "/<command> [reload]", aliases = "plexhelp", description = "Show information about Plex or reload it")
|
|
|
|
public class PlexCMD extends PlexCommand {
|
|
|
|
public PlexCMD() {
|
2020-10-31 08:55:27 +00:00
|
|
|
super("plex");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-01-04 03:04:39 +00:00
|
|
|
public void execute(CommandSource sender, String[] args) {
|
|
|
|
if (args.length == 0) {
|
|
|
|
send(ChatColor.LIGHT_PURPLE + "Plex. The long awaited TotalFreedomMod rewrite starts here...");
|
|
|
|
send(ChatColor.LIGHT_PURPLE + "Plugin version: " + ChatColor.GOLD + "1.0");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (args[0].equals("reload"))
|
|
|
|
{
|
|
|
|
if (!plugin.getRankManager().isSeniorAdmin(sender.getPlexPlayer()))
|
|
|
|
{
|
|
|
|
send(tl("noPermission"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Plex.get().config.load();
|
|
|
|
send("Reloaded config file");
|
|
|
|
Plex.get().messages.load();
|
|
|
|
send("Reloaded messages file");
|
|
|
|
Plex.get().getRankManager().importDefaultRanks();
|
|
|
|
send("Imported ranks");
|
|
|
|
send("Plex successfully reloaded.");
|
|
|
|
} else {
|
|
|
|
throw new CommandArgumentException();
|
|
|
|
}
|
2020-10-31 08:55:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-01-04 03:04:39 +00:00
|
|
|
public List<String> onTabComplete(CommandSource sender, String[] args) {
|
|
|
|
return List.of("reload");
|
2020-10-31 08:55:27 +00:00
|
|
|
}
|
2020-11-06 03:50:16 +00:00
|
|
|
}
|