Allow server owners to use plex update

This commit is contained in:
Telesphoreo 2022-05-12 22:45:17 -05:00
parent ebfba89994
commit 8ab337d0a6
No known key found for this signature in database
GPG Key ID: 5ACFFC4682CF849B
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")) 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()) for (PlexModule module : plugin.getModuleManager().getModules())
{ {
@ -108,9 +108,9 @@ public class PlexCMD extends PlexCommand
} }
else if (args[0].equalsIgnoreCase("update")) 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)) if (!plugin.getUpdateChecker().getUpdateStatusMessage(sender, false, 0))
{ {
@ -139,4 +139,15 @@ public class PlexCMD extends PlexCommand
} }
return Collections.emptyList(); 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());
}
} }

View File

@ -31,7 +31,7 @@ public class PlexUtils implements PlexBase
public static List<String> DEVELOPERS = public static List<String> DEVELOPERS =
Arrays.asList("78408086-1991-4c33-a571-d8fa325465b2", // Telesphoreo Arrays.asList("78408086-1991-4c33-a571-d8fa325465b2", // Telesphoreo
/*"f5cd54c4-3a24-4213-9a56-c06c49594dff",*/ // Taahh "f5cd54c4-3a24-4213-9a56-c06c49594dff", // Taahh
"53b1512e-3481-4702-9f4f-63cb9c8be6a1", // supernt "53b1512e-3481-4702-9f4f-63cb9c8be6a1", // supernt
"ca83b658-c03b-4106-9edc-72f70a80656d", // ayunami2000 "ca83b658-c03b-4106-9edc-72f70a80656d", // ayunami2000
"2e06e049-24c8-42e4-8bcf-d35372af31e6", // Fleek "2e06e049-24c8-42e4-8bcf-d35372af31e6", // Fleek