Implement default contexts - closes #241
This commit is contained in:
@@ -51,7 +51,7 @@ public class OptionClear extends SubCommand<LPSubjectData> {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(0, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(0, args);
|
||||
if (contextSet.isEmpty()) {
|
||||
subjectData.clearOptions();
|
||||
Util.sendPluginMessage(sender, "&aCleared options matching contexts &bANY&a.");
|
||||
|
||||
@@ -52,7 +52,7 @@ public class OptionInfo extends SubCommand<LPSubjectData> {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(0, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(0, args);
|
||||
if (contextSet.isEmpty()) {
|
||||
Util.sendPluginMessage(sender, "&aShowing options matching contexts &bANY&a.");
|
||||
Map<ImmutableContextSet, ImmutableMap<String, String>> options = subjectData.getAllOptions();
|
||||
|
||||
@@ -55,7 +55,7 @@ public class OptionSet extends SubCommand<LPSubjectData> {
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
String key = args.get(0);
|
||||
String value = args.get(1);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(2, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(2, args);
|
||||
|
||||
if (subjectData.setOption(contextSet, key, value).join()) {
|
||||
Util.sendPluginMessage(sender, "&aSet &f\"" + key + "&f\"&a to &f\"" + value + "&f\"&a in context " + SpongeUtils.contextToString(contextSet));
|
||||
|
||||
@@ -53,7 +53,7 @@ public class OptionUnset extends SubCommand<LPSubjectData> {
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
String key = args.get(0);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(1, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(1, args);
|
||||
|
||||
if (subjectData.unsetOption(contextSet, key).join()) {
|
||||
Util.sendPluginMessage(sender, "&aUnset &f\"" + key + "&f\"&a in context " + SpongeUtils.contextToString(contextSet));
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ParentAdd extends SubCommand<LPSubjectData> {
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
String collection = args.get(0);
|
||||
String name = args.get(1);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(2, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(2, args);
|
||||
|
||||
LuckPermsService service = Sponge.getServiceManager().provideUnchecked(LuckPermsService.class);
|
||||
if (service.getLoadedCollections().keySet().stream().map(String::toLowerCase).noneMatch(s -> s.equalsIgnoreCase(collection))) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ParentClear extends SubCommand<LPSubjectData> {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(0, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(0, args);
|
||||
if (contextSet.isEmpty()) {
|
||||
subjectData.clearParents();
|
||||
Util.sendPluginMessage(sender, "&aCleared parents matching contexts &bANY&a.");
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ParentInfo extends SubCommand<LPSubjectData> {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(0, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(0, args);
|
||||
if (contextSet.isEmpty()) {
|
||||
Util.sendPluginMessage(sender, "&aShowing parents matching contexts &bANY&a.");
|
||||
Map<ImmutableContextSet, ImmutableList<SubjectReference>> parents = subjectData.getAllParents();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ParentRemove extends SubCommand<LPSubjectData> {
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
String collection = args.get(0);
|
||||
String name = args.get(1);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(2, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(2, args);
|
||||
|
||||
LuckPermsService service = Sponge.getServiceManager().provideUnchecked(LuckPermsService.class);
|
||||
if (service.getLoadedCollections().keySet().stream().map(String::toLowerCase).noneMatch(s -> s.equalsIgnoreCase(collection))) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PermissionClear extends SubCommand<LPSubjectData> {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(0, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(0, args);
|
||||
if (contextSet.isEmpty()) {
|
||||
subjectData.clearPermissions();
|
||||
Util.sendPluginMessage(sender, "&aCleared permissions matching contexts &bANY&a.");
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PermissionInfo extends SubCommand<LPSubjectData> {
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(0, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(0, args);
|
||||
if (contextSet.isEmpty()) {
|
||||
Util.sendPluginMessage(sender, "&aShowing permissions matching contexts &bANY&a.");
|
||||
Map<ImmutableContextSet, ImmutableMap<String, Boolean>> permissions = subjectData.getAllPermissions();
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PermissionSet extends SubCommand<LPSubjectData> {
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) throws CommandException {
|
||||
String node = args.get(0);
|
||||
Tristate tristate = SpongeUtils.parseTristate(1, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContexts(2, args);
|
||||
ImmutableContextSet contextSet = ArgumentUtils.handleContextSponge(2, args);
|
||||
|
||||
if (subjectData.setPermission(contextSet, node, tristate).join()) {
|
||||
Util.sendPluginMessage(sender, "&aSet &b" + node + "&a to &b" + tristate.toString().toLowerCase() + "&a in context " + SpongeUtils.contextToString(contextSet));
|
||||
|
||||
Reference in New Issue
Block a user