Fix bukkit defaults still being applied to subscriptions when disabled

This commit is contained in:
Luck 2017-06-30 19:32:12 +01:00
parent 5cd5186092
commit b8e65c4f26
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -82,8 +82,6 @@ public class LPPermissible extends PermissibleBase {
this.parent = parent; this.parent = parent;
this.plugin = plugin; this.plugin = plugin;
this.subscriptions = new SubscriptionManager(this); this.subscriptions = new SubscriptionManager(this);
// recalculatePermissions();
} }
public void updateSubscriptionsAsync() { public void updateSubscriptionsAsync() {
@ -106,10 +104,12 @@ public class LPPermissible extends PermissibleBase {
Set<String> ent = new HashSet<>(cache.getPermissionData(calculateContexts()).getImmutableBacking().keySet()); Set<String> ent = new HashSet<>(cache.getPermissionData(calculateContexts()).getImmutableBacking().keySet());
if (parent.isOp()) { if (plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) {
ent.addAll(plugin.getDefaultsProvider().getOpDefaults().keySet()); if (parent.isOp()) {
} else { ent.addAll(plugin.getDefaultsProvider().getOpDefaults().keySet());
ent.addAll(plugin.getDefaultsProvider().getNonOpDefaults().keySet()); } else {
ent.addAll(plugin.getDefaultsProvider().getNonOpDefaults().keySet());
}
} }
subscriptions.subscribe(ent); subscriptions.subscribe(ent);
@ -171,7 +171,11 @@ public class LPPermissible extends PermissibleBase {
return ts.asBoolean(); return ts.asBoolean();
} }
return perm.getDefault().getValue(isOp()); if (!plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) {
return Permission.DEFAULT_PERMISSION.getValue(isOp());
} else {
return perm.getDefault().getValue(isOp());
}
} }
@Override @Override
@ -291,9 +295,6 @@ public class LPPermissible extends PermissibleBase {
Bukkit.getServer().getPluginManager().unsubscribeFromPermission(name, parent); Bukkit.getServer().getPluginManager().unsubscribeFromPermission(name, parent);
} }
// Bukkit.getServer().getPluginManager().unsubscribeFromDefaultPerms(false, parent);
// Bukkit.getServer().getPluginManager().unsubscribeFromDefaultPerms(true, parent);
attachmentPermissions.clear(); attachmentPermissions.clear();
} }