2021-01-03 07:21:15 +00:00
|
|
|
package dev.plex.command.impl;
|
2020-10-31 08:55:27 +00:00
|
|
|
|
2022-01-27 09:00:50 +00:00
|
|
|
import com.google.common.collect.ImmutableList;
|
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.RequiredCommandSource;
|
|
|
|
import dev.plex.rank.enums.Rank;
|
2022-01-27 09:00:50 +00:00
|
|
|
import net.kyori.adventure.text.Component;
|
2021-06-20 08:02:07 +00:00
|
|
|
import org.bukkit.ChatColor;
|
2022-01-27 09:00:50 +00:00
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
2020-10-31 08:55:27 +00:00
|
|
|
|
2022-01-04 03:04:39 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2020-10-31 08:55:27 +00:00
|
|
|
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
2022-01-27 09:00:50 +00:00
|
|
|
@CommandParameters(name = "plex", usage = "/<command> [reload]", aliases = "plexhelp", description = "Show information about Plex or reload it")
|
2022-01-04 03:04:39 +00:00
|
|
|
public class PlexCMD extends PlexCommand {
|
2020-10-31 08:55:27 +00:00
|
|
|
|
|
|
|
@Override
|
2022-01-27 05:28:30 +00:00
|
|
|
public Component execute(CommandSender sender, String[] args) {
|
2022-01-04 03:04:39 +00:00
|
|
|
if (args.length == 0) {
|
2022-01-27 09:00:50 +00:00
|
|
|
send(sender, ChatColor.LIGHT_PURPLE + "Plex. The long awaited TotalFreedomMod rewrite starts here...");
|
|
|
|
return componentFromString(ChatColor.LIGHT_PURPLE + "Plugin version: " + ChatColor.GOLD + "1.0");
|
2022-01-04 03:04:39 +00:00
|
|
|
}
|
|
|
|
if (args[0].equals("reload"))
|
|
|
|
{
|
2022-01-27 09:00:50 +00:00
|
|
|
if (!isSeniorAdmin(sender))
|
2022-01-04 03:04:39 +00:00
|
|
|
{
|
2022-01-27 09:00:50 +00:00
|
|
|
return tl("noPermission");
|
2022-01-04 03:04:39 +00:00
|
|
|
}
|
|
|
|
Plex.get().config.load();
|
2022-01-27 09:00:50 +00:00
|
|
|
send(sender, "Reloaded config file");
|
2022-01-04 03:04:39 +00:00
|
|
|
Plex.get().messages.load();
|
2022-01-27 09:00:50 +00:00
|
|
|
send(sender, "Reloaded messages file");
|
2022-01-04 03:04:39 +00:00
|
|
|
Plex.get().getRankManager().importDefaultRanks();
|
2022-01-27 09:00:50 +00:00
|
|
|
send(sender, "Imported ranks");
|
|
|
|
send(sender, "Plex successfully reloaded.");
|
2022-01-04 03:04:39 +00:00
|
|
|
} else {
|
|
|
|
throw new CommandArgumentException();
|
|
|
|
}
|
2022-01-27 09:00:50 +00:00
|
|
|
return null;
|
2020-10-31 08:55:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-01-27 09:00:50 +00:00
|
|
|
public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
|
|
|
|
{
|
|
|
|
return ImmutableList.of("reload");
|
2020-10-31 08:55:27 +00:00
|
|
|
}
|
2022-01-27 09:00:50 +00:00
|
|
|
|
2020-11-06 03:50:16 +00:00
|
|
|
}
|