Plex/src/main/java/dev/plex/command/impl/PlexCMD.java

53 lines
1.8 KiB
Java
Raw Normal View History

2021-01-03 07:21:15 +00:00
package dev.plex.command.impl;
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;
2022-01-04 03:04:39 +00:00
import java.util.Arrays;
import java.util.List;
@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() {
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();
}
}
@Override
2022-01-04 03:04:39 +00:00
public List<String> onTabComplete(CommandSource sender, String[] args) {
return List.of("reload");
}
}