This commit is contained in:
Telesphoreo 2022-01-29 18:43:44 -06:00
parent 86f3fd8d29
commit 8293b1a879
2 changed files with 11 additions and 7 deletions

View File

@ -165,20 +165,26 @@ public abstract class PlexCommand extends Command
audience.sendMessage(component);
}
protected void checkRank(Player player, Rank rank, String permission)
protected boolean checkRank(Player player, Rank rank, String permission)
{
PlexPlayer plexPlayer = getPlexPlayer(player);
if (plugin.getRanksOrPermissions().equalsIgnoreCase("ranks"))
{
send(player, "test ranks");
if (!plexPlayer.getRank().equals(rank.toString()))
{
send(player, tl("noPermissionRank", rank.toString()));
return true;
}
}
else if (plugin.getRanksOrPermissions().equalsIgnoreCase("permissions"))
{
if (!player.hasPermission(permission))
{
send(player, "test permissions");
send(player, tl("noPermissionNode", permission));
return true;
}
}
return true;
}
protected boolean isAdmin(PlexPlayer plexPlayer)

View File

@ -12,6 +12,7 @@ import java.util.List;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
@ -26,10 +27,7 @@ public class PlexCMD extends PlexCommand {
}
if (args[0].equals("reload"))
{
if (!isSeniorAdmin(sender))
{
return tl("noPermission");
}
checkRank((Player)sender, Rank.SENIOR_ADMIN, "plex.reload");
Plex.get().config.load();
send(sender, "Reloaded config file");
Plex.get().messages.load();