Refactor Contexts class
This commit is contained in:
+2
-1
@@ -28,6 +28,7 @@ package me.lucko.luckperms.bukkit.calculators;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.api.Contexts;
|
||||
import me.lucko.luckperms.api.LookupSetting;
|
||||
import me.lucko.luckperms.bukkit.LPBukkitPlugin;
|
||||
import me.lucko.luckperms.bukkit.processors.ChildProcessor;
|
||||
import me.lucko.luckperms.bukkit.processors.DefaultsProcessor;
|
||||
@@ -67,7 +68,7 @@ public class BukkitCalculatorFactory extends AbstractCalculatorFactory {
|
||||
}
|
||||
|
||||
if (this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS) && metadata.getHolderType() == HolderType.USER) {
|
||||
processors.add(new DefaultsProcessor(this.plugin, contexts.isOp()));
|
||||
processors.add(new DefaultsProcessor(this.plugin, contexts.hasSetting(LookupSetting.IS_OP)));
|
||||
}
|
||||
|
||||
return registerCalculator(new PermissionCalculator(this.plugin, metadata, processors.build()));
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BukkitContextManager extends AbstractContextManager<Player> {
|
||||
|
||||
@Override
|
||||
public Contexts formContexts(Player subject, ImmutableContextSet contextSet) {
|
||||
return new Contexts(
|
||||
return Contexts.of(
|
||||
contextSet,
|
||||
this.plugin.getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_PERMS),
|
||||
this.plugin.getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_WORLD_PERMS),
|
||||
|
||||
@@ -326,6 +326,6 @@ public class VaultChatHook extends AbstractVaultChat {
|
||||
context.add(Contexts.WORLD_KEY, world.toLowerCase());
|
||||
}
|
||||
context.add(Contexts.SERVER_KEY, this.permissionHook.getVaultServer());
|
||||
return new Contexts(context.build(), this.permissionHook.isIncludeGlobal(), true, true, true, true, false);
|
||||
return Contexts.of(context.build(), this.permissionHook.isIncludeGlobal(), true, true, true, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ public class VaultPermissionHook extends AbstractVaultPermission {
|
||||
}
|
||||
}
|
||||
|
||||
return new Contexts(context, isIncludeGlobal(), true, true, true, true, false);
|
||||
return Contexts.of(context, isIncludeGlobal(), true, true, true, true, false);
|
||||
}
|
||||
|
||||
// utility methods for modifying the state of PermissionHolders
|
||||
|
||||
Reference in New Issue
Block a user