// Report to dB
dB.report(scriptEntry, getName(), action.debug() + permission.debug()
+ (group != null ? group.debug() : "") + (world != null ? world.debug(): ""));
World bukkitWorld = null;
if (world != null)
bukkitWorld = world.getWorld();
OfflinePlayer player = ((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getOfflinePlayer() : null;
switch (Action.valueOf(action.asString().toUpperCase())) {
case ADD:
if (group != null) {
if (Depends.permissions.groupHas(bukkitWorld, group.asString(), permission.asString()))
dB.echoDebug(scriptEntry, "Group " + group + " already has permission " + permission);
else
Depends.permissions.groupAdd(bukkitWorld, group.asString(), permission.asString());
} else {
if(Depends.permissions.playerHas(bukkitWorld == null ? null: bukkitWorld.getName(), player, permission.asString()))
dB.echoDebug(scriptEntry, "Player " + player.getName() + " already has permission " + permission);
else
Depends.permissions.playerAdd(bukkitWorld == null ? null: bukkitWorld.getName(), player, permission.asString());
}
return;
case REMOVE:
if (group != null) {
if(!Depends.permissions.groupHas(bukkitWorld, group.asString(), permission.asString()))
dB.echoDebug(scriptEntry, "Group " + group + " does not have access to permission " + permission);
else
Depends.permissions.groupRemove(bukkitWorld, group.asString(), permission.asString());
} else {
if(!Depends.permissions.playerHas(bukkitWorld == null ? null: bukkitWorld.getName(), player, permission.asString()))
dB.echoDebug(scriptEntry, "Player " + player.getName() + " does not have access to permission " + permission);
else
Depends.permissions.playerRemove(bukkitWorld == null ? null: bukkitWorld.getName(), player, permission.asString());
}
return;
}
}