Allow server owners to use plex update

This commit is contained in:
2022-05-12 22:45:17 -05:00
parent ebfba89994
commit 8ab337d0a6
2 changed files with 16 additions and 5 deletions

View File

@ -94,9 +94,9 @@ public class PlexCMD extends PlexCommand
}
else if (args[1].equalsIgnoreCase("update"))
{
if (sender instanceof Player && !PlexUtils.DEVELOPERS.contains(playerSender.getUniqueId().toString()))
if (!hasUpdateAccess(playerSender, sender))
{
return messageComponent("noPermissionRank", "a developer");
return messageComponent("noPermissionRank", "an Owner or Developer");
}
for (PlexModule module : plugin.getModuleManager().getModules())
{
@ -108,9 +108,9 @@ public class PlexCMD extends PlexCommand
}
else if (args[0].equalsIgnoreCase("update"))
{
if (sender instanceof Player && !PlexUtils.DEVELOPERS.contains(playerSender.getUniqueId().toString()))
if (!hasUpdateAccess(playerSender, sender))
{
return messageComponent("noPermissionRank", "a developer");
return messageComponent("noPermissionRank", "an Owner or Developer");
}
if (!plugin.getUpdateChecker().getUpdateStatusMessage(sender, false, 0))
{
@ -139,4 +139,15 @@ public class PlexCMD extends PlexCommand
}
return Collections.emptyList();
}
private boolean hasUpdateAccess(Player player, CommandSender sender)
{
if (isConsole(sender))
{
return false;
}
assert player != null;
return PlexUtils.DEVELOPERS.contains(player.getUniqueId().toString())
|| plugin.config.getStringList("titles.owners").contains(player.getName());
}
}