Add a playerIsOp helper function to ServerUtilities

This commit is contained in:
zontreck 2024-01-09 14:21:40 -07:00
parent 9cbdc6a9c1
commit 2c12935250
2 changed files with 15 additions and 1 deletions

View file

@ -53,7 +53,7 @@ mod_name=Zontreck Library Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPLv3
# The mod version. See https://semver.org/
mod_version=1.10.010924.0329
mod_version=1.10.010924.1421
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View file

@ -82,4 +82,18 @@ public class ServerUtilities
if(LibZontreck.THE_SERVER.getPlayerList().getPlayer(ID) == null) return true;
else return false;
}
/**
* Checks if the user has operator permissions on the server
* @param ID The player ID
* @return True if the player is op
*/
public static boolean playerIsOp(UUID ID)
{
ServerPlayer player = getPlayerByID(ID.toString());
if(player.hasPermissions(player.getServer().getOperatorUserPermissionLevel()))
{
return true;
}else return false;
}
}