mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-07-28 23:15:47 -04:00
There are some outlier commands that don't follow the assumed convention of "admin" ability + godLevel, for example /setGodMode does not require the "admin" ability, but neither does it have a godLevel. So without manually checking in that instance, any player could grant themselves god mode and have access to low level admin commands. In order for admins to gain access to most of their commands, they must call the /setGodMode command. This command gives them the "admin" ability, and this ability works in tandem with their godLevel (which is determined by their access level). Adds a minor implementation for abilities to enable the admin system to work. This implementation should come in handy in GU3 when we start on combat, since it will automatically prevent players from calling combat commands that they do not have the ability to call.
20 lines
785 B
JavaScript
20 lines
785 B
JavaScript
var execute = function(galManager, player, target, args) {
|
|
//TODO: Move to java callback
|
|
if(player.getAccessLevel() == (Java.type('resources.player.AccessLevel')).PLAYER){
|
|
intentFactory.sendSystemMessage(player, "Players cannot use this command :(");
|
|
return;
|
|
}
|
|
|
|
var creatureObject = player.getCreatureObject();
|
|
if(target){
|
|
creatureObject = target.getCreatureObject();
|
|
}
|
|
|
|
if(creatureObject.hasAbility("admin")){
|
|
creatureObject.removeAbility("admin");
|
|
intentFactory.sendSystemMessage(player, "God Mode Disabled");//TODO: See if there's an STF to send
|
|
}else{
|
|
creatureObject.addAbility("admin");
|
|
intentFactory.sendSystemMessage(player, "God Mode Enabled");//TODO: See if there's an STF to send
|
|
}
|
|
} |