use of org.bukkit.permissions.PermissionDefault in project LuckPerms by lucko.
the class LPBukkitPlugin method performFinalSetup.
@Override
protected void performFinalSetup() {
// register permissions
try {
PluginManager pm = this.bootstrap.getServer().getPluginManager();
PermissionDefault permDefault = getConfiguration().get(ConfigKeys.COMMANDS_ALLOW_OP) ? PermissionDefault.OP : PermissionDefault.FALSE;
for (CommandPermission p : CommandPermission.values()) {
pm.addPermission(new Permission(p.getPermission(), permDefault));
}
} catch (Exception e) {
// this throws an exception if the plugin is /reloaded, grr
}
if (!getConfiguration().get(ConfigKeys.OPS_ENABLED)) {
this.bootstrap.getScheduler().doSync(() -> this.bootstrap.getServer().getOperators().forEach(o -> o.setOp(false)));
}
// replace the temporary executor when the Bukkit one starts
this.bootstrap.getServer().getScheduler().runTaskAsynchronously(this.bootstrap, () -> this.bootstrap.getScheduler().setUseFallback(false));
// Load any online users (in the case of a reload)
for (Player player : this.bootstrap.getServer().getOnlinePlayers()) {
this.bootstrap.getScheduler().doAsync(() -> {
try {
User user = this.connectionListener.loadUser(player.getUniqueId(), player.getName());
if (user != null) {
this.bootstrap.getScheduler().doSync(() -> {
try {
LPPermissible lpPermissible = new LPPermissible(player, user, this);
PermissibleInjector.inject(player, lpPermissible);
} catch (Throwable t) {
t.printStackTrace();
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
});
}
}
use of org.bukkit.permissions.PermissionDefault in project BKCommonLib by bergerhealer.
the class PluginBase method setPermissions.
private static void setPermissions(ConfigurationNode node) {
for (ConfigurationNode subNode : node.getNodes()) {
setPermissions(subNode);
}
PermissionDefault def = ParseUtil.convert(getNodeStringValue(node, "default"), PermissionDefault.class);
String desc = getNodeStringValue(node, "description");
if (def != null || desc != null) {
Permission permission = getPermission(node.getPath().toLowerCase(Locale.ENGLISH));
if (def != null) {
permission.setDefault(def);
}
if (desc != null) {
permission.setDescription(desc);
}
}
}
use of org.bukkit.permissions.PermissionDefault in project MassiveCore by MassiveCraft.
the class PermissionUtil method setPermissionStandard.
public static boolean setPermissionStandard(Permission permission, PermissionDefault standard) {
if (permission == null)
throw new NullPointerException("permission");
if (standard == null)
return false;
// NoChange
PermissionDefault before = getPermissionStandard(permission);
if (standard == before)
return false;
// Recalculation need created: TRUE
// Recalculation auto-performed: TRUE
permission.setDefault(standard);
return true;
}
Aggregations