public boolean apply() {
try {
lock.lock();
Player player = getPlayer();
if (player == null) return false;
permissionAttachment = player.addAttachment(instance);
for (Map.Entry<String, Boolean> effectivePerm : getEffectivePermissions().entrySet()) {
permissionAttachment.setPermission(effectivePerm.getKey(), effectivePerm.getValue());
}
return true;
} catch (Exception ex) {
ex.printStackTrace();
return false;
} finally {
lock.unlock();
}
}
Comments