本文整理汇总了Java中me.lucko.luckperms.api.DataMutateResult.asBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java DataMutateResult.asBoolean方法的具体用法?Java DataMutateResult.asBoolean怎么用?Java DataMutateResult.asBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.lucko.luckperms.api.DataMutateResult
的用法示例。
在下文中一共展示了DataMutateResult.asBoolean方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
String node = ArgumentUtils.handleString(0, args);
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
if (ArgumentPermissions.checkArguments(plugin, sender, permission, node)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
DataMutateResult result = holder.unsetPermission(NodeFactory.builder(node).withExtraContext(context).build());
if (result.asBoolean()) {
Message.UNSETPERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), CommandUtils.contextSetToString(context));
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("permission", "unset", node, context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.DOES_NOT_HAVE_PERMISSION.send(sender, holder.getFriendlyName(), node, CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}
示例2: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
String node = ArgumentUtils.handleString(0, args);
boolean value = ArgumentUtils.handleBoolean(1, args);
MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin);
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
if (ArgumentPermissions.checkArguments(plugin, sender, permission, node)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
DataMutateResult result = holder.setPermission(NodeFactory.builder(node).setValue(value).withExtraContext(context).build());
if (result.asBoolean()) {
Message.SETPERMISSION_SUCCESS.send(sender, node, value, holder.getFriendlyName(), CommandUtils.contextSetToString(context));
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("permission", "set", node, value, context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.ALREADY_HASPERMISSION.send(sender, holder.getFriendlyName(), node, CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}
示例3: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
String node = ArgumentUtils.handleString(0, args);
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
if (ArgumentPermissions.checkArguments(plugin, sender, permission, node)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
DataMutateResult result = holder.unsetPermission(NodeFactory.builder(node).setExpiry(10L).withExtraContext(context).build());
if (result.asBoolean()) {
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), CommandUtils.contextSetToString(context));
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("permission", "unsettemp", node, context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, holder.getFriendlyName(), node, CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}
示例4: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
int priority = ArgumentUtils.handlePriority(0, args);
String meta = ArgumentUtils.handleString(1, args);
MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin);
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
DataMutateResult result = holder.setPermission(NodeFactory.buildChatMetaNode(this.type, priority, meta).withExtraContext(context).build());
if (result.asBoolean()) {
TextComponent.Builder builder = TextUtils.fromLegacy(Message.ADD_CHATMETA_SUCCESS.asString(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, CommandUtils.contextSetToString(context)), CommandManager.SECTION_CHAR).toBuilder();
HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy(
"¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta,
'¥'
));
builder.applyDeep(c -> c.hoverEvent(event));
sender.sendMessage(builder.build());
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("meta" , "add" + this.type.name().toLowerCase(), priority, meta, context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.ALREADY_HAS_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}
示例5: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
String groupName = ArgumentUtils.handleNameWithSpace(0, args);
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
if (ArgumentPermissions.checkArguments(plugin, sender, permission, groupName)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
DataMutateResult result = holder.unsetPermission(NodeFactory.buildGroupNode(groupName).setExpiry(10L).withExtraContext(context).build());
if (result.asBoolean()) {
Message.UNSET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), groupName, CommandUtils.contextSetToString(context));
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("parent", "removetemp", groupName, context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.DOES_NOT_TEMP_INHERIT.send(sender, holder.getFriendlyName(), groupName, CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}
示例6: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) {
String groupName = args.get(0).toLowerCase();
if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) {
sendDetailedUsage(sender, label);
return CommandResult.INVALID_ARGS;
}
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
Message.DOES_NOT_EXIST.send(sender, groupName);
return CommandResult.INVALID_ARGS;
}
Group group = plugin.getGroupManager().getIfLoaded(groupName);
if (group == null) {
Message.DOES_NOT_EXIST.send(sender, groupName);
return CommandResult.LOADING_ERROR;
}
DataMutateResult result = track.appendGroup(group);
if (result.asBoolean()) {
Message.TRACK_APPEND_SUCCESS.send(sender, group.getName(), track.getName());
if (track.getGroups().size() > 1) {
Message.EMPTY.send(sender, CommandUtils.listToArrowSep(track.getGroups(), group.getName()));
}
ExtendedLogEntry.build().actor(sender).acted(track)
.action("append", group.getName())
.build().submit(plugin, sender);
save(track, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.TRACK_ALREADY_CONTAINS.send(sender, track.getName(), group.getName());
return CommandResult.STATE_ERROR;
}
}
示例7: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) {
String groupName = args.get(0).toLowerCase();
if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) {
sendDetailedUsage(sender, label);
return CommandResult.INVALID_ARGS;
}
DataMutateResult result = track.removeGroup(groupName);
if (result.asBoolean()) {
Message.TRACK_REMOVE_SUCCESS.send(sender, groupName, track.getName());
if (track.getGroups().size() > 1) {
Message.EMPTY.send(sender, CommandUtils.listToArrowSep(track.getGroups()));
}
ExtendedLogEntry.build().actor(sender).acted(track)
.action("remove", groupName)
.build().submit(plugin, sender);
save(track, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.TRACK_DOES_NOT_CONTAIN.send(sender, track.getName(), groupName);
return CommandResult.STATE_ERROR;
}
}
示例8: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
int priority = ArgumentUtils.handlePriority(0, args);
String meta = ArgumentUtils.handleStringOrElse(1, args, "null");
MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin);
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
// Handle bulk removal
if (meta.equalsIgnoreCase("null") || meta.equals("*")) {
holder.removeIf(n ->
this.type.matches(n) &&
this.type.getEntry(n).getKey() == priority &&
!n.isTemporary() &&
n.getFullContexts().makeImmutable().equals(context.makeImmutable())
);
Message.BULK_REMOVE_CHATMETA_SUCCESS.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), priority, CommandUtils.contextSetToString(context));
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("meta" , "remove" + this.type.name().toLowerCase(), priority, "*", context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
}
DataMutateResult result = holder.unsetPermission(NodeFactory.buildChatMetaNode(this.type, priority, meta).withExtraContext(context).build());
if (result.asBoolean()) {
TextComponent.Builder builder = TextUtils.fromLegacy(Message.REMOVE_CHATMETA_SUCCESS.asString(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, CommandUtils.contextSetToString(context)), CommandManager.SECTION_CHAR).toBuilder();
HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy(
"¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta,
'¥'
));
builder.applyDeep(c -> c.hoverEvent(event));
sender.sendMessage(builder.build());
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("meta" , "remove" + this.type.name().toLowerCase(), priority, meta, context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.DOES_NOT_HAVE_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}
示例9: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
int priority = ArgumentUtils.handlePriority(0, args);
String meta = ArgumentUtils.handleStringOrElse(1, args, "null");
MutableContextSet context = ArgumentUtils.handleContext(2, args, plugin);
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
// Handle bulk removal
if (meta.equalsIgnoreCase("null") || meta.equals("*")) {
holder.removeIf(n ->
this.type.matches(n) &&
this.type.getEntry(n).getKey() == priority &&
!n.isPermanent() &&
n.getFullContexts().makeImmutable().equals(context.makeImmutable())
);
Message.BULK_REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), priority, CommandUtils.contextSetToString(context));
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("meta" , "removetemp" + this.type.name().toLowerCase(), priority, "*", context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
}
DataMutateResult result = holder.unsetPermission(NodeFactory.buildChatMetaNode(this.type, priority, meta).setExpiry(10L).withExtraContext(context).build());
if (result.asBoolean()) {
TextComponent.Builder builder = TextUtils.fromLegacy(Message.REMOVE_TEMP_CHATMETA_SUCCESS.asString(plugin.getLocaleManager(), holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, CommandUtils.contextSetToString(context)), CommandManager.SECTION_CHAR).toBuilder();
HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextUtils.fromLegacy(
"¥3Raw " + this.type.name().toLowerCase() + ": ¥r" + meta,
'¥'
));
builder.applyDeep(c -> c.hoverEvent(event));
sender.sendMessage(builder.build());
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("meta" , "removetemp" + this.type.name().toLowerCase(), priority, meta, context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.DOES_NOT_HAVE_TEMP_CHAT_META.send(sender, holder.getFriendlyName(), this.type.name().toLowerCase(), meta, priority, CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}
示例10: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
String groupName = ArgumentUtils.handleNameWithSpace(0, args);
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
if (ArgumentPermissions.checkArguments(plugin, sender, permission, groupName)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
if (holder.getType().isUser()) {
User user = (User) holder;
boolean shouldPrevent = plugin.getConfiguration().get(ConfigKeys.PREVENT_PRIMARY_GROUP_REMOVAL) &&
context.isEmpty() &&
plugin.getConfiguration().get(ConfigKeys.PRIMARY_GROUP_CALCULATION_METHOD).equals("stored") &&
user.getPrimaryGroup().getStoredValue().orElse(NodeFactory.DEFAULT_GROUP_NAME).equalsIgnoreCase(groupName);
if (shouldPrevent) {
Message.USER_REMOVEGROUP_ERROR_PRIMARY.send(sender);
return CommandResult.STATE_ERROR;
}
}
DataMutateResult result = holder.unsetPermission(NodeFactory.buildGroupNode(groupName).withExtraContext(context).build());
if (result.asBoolean()) {
Message.UNSET_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), groupName, CommandUtils.contextSetToString(context));
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("parent", "remove", groupName, context)
.build().submit(plugin, sender);
if (holder.getType().isUser()) {
plugin.getUserManager().giveDefaultIfNeeded(((User) holder), false);
}
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.DOES_NOT_INHERIT.send(sender, holder.getFriendlyName(), groupName, CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}
示例11: execute
import me.lucko.luckperms.api.DataMutateResult; //导入方法依赖的package包/类
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder holder, List<String> args, String label, CommandPermission permission) throws CommandException {
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, holder)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
String groupName = ArgumentUtils.handleName(0, args);
MutableContextSet context = ArgumentUtils.handleContext(1, args, plugin);
if (!plugin.getStorage().loadGroup(groupName).join().isPresent()) {
Message.DOES_NOT_EXIST.send(sender, groupName);
return CommandResult.INVALID_ARGS;
}
Group group = plugin.getGroupManager().getIfLoaded(groupName);
if (group == null) {
Message.DOES_NOT_EXIST.send(sender, groupName);
return CommandResult.LOADING_ERROR;
}
if (ArgumentPermissions.checkContext(plugin, sender, permission, context)) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
if (ArgumentPermissions.checkArguments(plugin, sender, permission, group.getName())) {
Message.COMMAND_NO_PERMISSION.send(sender);
return CommandResult.NO_PERMISSION;
}
DataMutateResult result = holder.setPermission(NodeFactory.buildGroupNode(group.getName()).withExtraContext(context).build());
if (result.asBoolean()) {
Message.SET_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), CommandUtils.contextSetToString(context));
ExtendedLogEntry.build().actor(sender).acted(holder)
.action("parent", "add", group.getName(), context)
.build().submit(plugin, sender);
save(holder, sender, plugin);
return CommandResult.SUCCESS;
} else {
Message.ALREADY_INHERITS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), CommandUtils.contextSetToString(context));
return CommandResult.STATE_ERROR;
}
}