mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-28 20:17:55 +01:00
Fix NodeFactory#nodeAsCommand when unsetting meta nodes, fix meta unset command
This commit is contained in:
parent
649748c2d3
commit
81cf50520b
@ -70,14 +70,18 @@ public class MetaUnset extends SharedSubCommand {
|
||||
return CommandResult.NO_PERMISSION;
|
||||
}
|
||||
|
||||
holder.clearMetaKeys(key, context, false);
|
||||
Message.UNSET_META_SUCCESS.send(sender, key, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||
if (holder.clearMetaKeys(key, context, false)) {
|
||||
Message.UNSET_META_SUCCESS.send(sender, key, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||
|
||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||
.action("meta unset " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
||||
.build().submit(plugin, sender);
|
||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||
.action("meta unset " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
save(holder, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
save(holder, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOESNT_HAVE_META.send(sender, holder.getFriendlyName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,14 +70,18 @@ public class MetaUnsetTemp extends SharedSubCommand {
|
||||
return CommandResult.NO_PERMISSION;
|
||||
}
|
||||
|
||||
holder.clearMetaKeys(key, context, true);
|
||||
Message.UNSET_META_TEMP_SUCCESS.send(sender, key, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||
if (holder.clearMetaKeys(key, context, true)) {
|
||||
Message.UNSET_META_TEMP_SUCCESS.send(sender, key, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||
|
||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||
.action("meta unsettemp " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
||||
.build().submit(plugin, sender);
|
||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||
.action("meta unsettemp " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
save(holder, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
save(holder, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOESNT_HAVE_META.send(sender, holder.getFriendlyName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,13 +265,15 @@ public enum Message {
|
||||
REMOVE_TEMP_CHATMETA_SUCCESS("&b{0}&a had temporary {1} &f\"{2}&f\"&a at priority &b{3}&a removed in context {4}&a.", true),
|
||||
BULK_REMOVE_TEMP_CHATMETA_SUCCESS("&b{0}&a had all temporary {1}es at priority &b{2}&a removed in context {3}&a.", true),
|
||||
|
||||
ALREADY_HAS_META("{0} already has that meta key value pair set.", true),
|
||||
ALREADY_HAS_META("{0} already has that meta pair set.", true),
|
||||
|
||||
SET_META_SUCCESS("&aSet meta value for key &f\"{0}&f\"&a to &f\"{1}&f\"&a for &b{2}&a in context {3}&a.", true),
|
||||
SET_META_TEMP_SUCCESS("&aSet meta value for key &f\"{0}&f\"&a to &f\"{1}&f\"&a for &b{2}&a for a duration of &b{3}&a in context {4}&a.", true),
|
||||
UNSET_META_SUCCESS("&aUnset meta value with key &f\"{0}&f\"&a for &b{1}&a in context {2}&a.", true),
|
||||
UNSET_META_TEMP_SUCCESS("&aUnset temporary meta value with key &f\"{0}&f\"&a for &b{1}&a in context {2}&a.", true),
|
||||
|
||||
DOESNT_HAVE_META("{0} does not have that meta pair set.", true),
|
||||
|
||||
BULK_UPDATE_INVALID_DATA_TYPE("Invalid type. Was expecting 'all', 'users' or 'groups'.", true),
|
||||
BULK_UPDATE_INVALID_CONSTRAINT("Invalid constraint &4{0}&c. Constraints should be in the format '&f<field> <comparison operator> <value>&c'.", true),
|
||||
BULK_UPDATE_INVALID_COMPARISON("Invalid comparison operator '&4{0}&c'. Expected one of the following: &f== != ~~ ~!", true),
|
||||
|
@ -180,16 +180,18 @@ public class NodeFactory {
|
||||
sb.append(node.getMeta().getKey());
|
||||
}
|
||||
|
||||
sb.append(" ");
|
||||
if (set) {
|
||||
sb.append(" ");
|
||||
|
||||
if (node.getMeta().getValue().contains(" ")) {
|
||||
sb.append("\"").append(node.getMeta().getValue()).append("\"");
|
||||
} else {
|
||||
sb.append(node.getMeta().getValue());
|
||||
}
|
||||
if (node.getMeta().getValue().contains(" ")) {
|
||||
sb.append("\"").append(node.getMeta().getValue()).append("\"");
|
||||
} else {
|
||||
sb.append(node.getMeta().getValue());
|
||||
}
|
||||
|
||||
if (node.isTemporary()) {
|
||||
sb.append(" ").append(node.getExpiryUnixTime());
|
||||
if (node.isTemporary()) {
|
||||
sb.append(" ").append(node.getExpiryUnixTime());
|
||||
}
|
||||
}
|
||||
|
||||
return appendContextToCommand(sb, node).toString();
|
||||
|
Loading…
Reference in New Issue
Block a user