mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Cleanup chat meta commands
This commit is contained in:
parent
fe0e82f285
commit
f5e41f7e7e
@ -34,8 +34,6 @@ import me.lucko.luckperms.common.locale.command.CommandSpec;
|
|||||||
import me.lucko.luckperms.common.model.HolderType;
|
import me.lucko.luckperms.common.model.HolderType;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
|
|
||||||
import net.luckperms.api.node.ChatMetaType;
|
|
||||||
|
|
||||||
public class CommandMeta<T extends PermissionHolder> extends GenericParentCommand<T> {
|
public class CommandMeta<T extends PermissionHolder> extends GenericParentCommand<T> {
|
||||||
public CommandMeta(LocaleManager locale, HolderType type) {
|
public CommandMeta(LocaleManager locale, HolderType type) {
|
||||||
super(CommandSpec.META.localize(locale), "Meta", type, ImmutableList.<GenericChildCommand>builder()
|
super(CommandSpec.META.localize(locale), "Meta", type, ImmutableList.<GenericChildCommand>builder()
|
||||||
@ -44,18 +42,18 @@ public class CommandMeta<T extends PermissionHolder> extends GenericParentComman
|
|||||||
.add(new MetaUnset(locale))
|
.add(new MetaUnset(locale))
|
||||||
.add(new MetaSetTemp(locale))
|
.add(new MetaSetTemp(locale))
|
||||||
.add(new MetaUnsetTemp(locale))
|
.add(new MetaUnsetTemp(locale))
|
||||||
.add(new MetaAddChatMeta(locale, ChatMetaType.PREFIX))
|
.add(MetaAddChatMeta.forPrefix(locale))
|
||||||
.add(new MetaAddChatMeta(locale, ChatMetaType.SUFFIX))
|
.add(MetaAddChatMeta.forSuffix(locale))
|
||||||
.add(new MetaSetChatMeta(locale, ChatMetaType.PREFIX))
|
.add(MetaSetChatMeta.forPrefix(locale))
|
||||||
.add(new MetaSetChatMeta(locale, ChatMetaType.SUFFIX))
|
.add(MetaSetChatMeta.forSuffix(locale))
|
||||||
.add(new MetaRemoveChatMeta(locale, ChatMetaType.PREFIX))
|
.add(MetaRemoveChatMeta.forPrefix(locale))
|
||||||
.add(new MetaRemoveChatMeta(locale, ChatMetaType.SUFFIX))
|
.add(MetaRemoveChatMeta.forSuffix(locale))
|
||||||
.add(new MetaAddTempChatMeta(locale, ChatMetaType.PREFIX))
|
.add(MetaAddTempChatMeta.forPrefix(locale))
|
||||||
.add(new MetaAddTempChatMeta(locale, ChatMetaType.SUFFIX))
|
.add(MetaAddTempChatMeta.forSuffix(locale))
|
||||||
.add(new MetaSetTempChatMeta(locale, ChatMetaType.PREFIX))
|
.add(MetaSetTempChatMeta.forPrefix(locale))
|
||||||
.add(new MetaSetTempChatMeta(locale, ChatMetaType.SUFFIX))
|
.add(MetaSetTempChatMeta.forSuffix(locale))
|
||||||
.add(new MetaRemoveTempChatMeta(locale, ChatMetaType.PREFIX))
|
.add(MetaRemoveTempChatMeta.forPrefix(locale))
|
||||||
.add(new MetaRemoveTempChatMeta(locale, ChatMetaType.SUFFIX))
|
.add(MetaRemoveTempChatMeta.forSuffix(locale))
|
||||||
.add(new MetaClear(locale))
|
.add(new MetaClear(locale))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|||||||
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||||
|
import me.lucko.luckperms.common.locale.command.LocalizedCommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.message.Message;
|
import me.lucko.luckperms.common.locale.message.Message;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
@ -55,16 +56,31 @@ import net.luckperms.api.node.ChatMetaType;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MetaAddChatMeta extends GenericChildCommand {
|
public class MetaAddChatMeta extends GenericChildCommand {
|
||||||
|
|
||||||
|
public static MetaAddChatMeta forPrefix(LocaleManager locale) {
|
||||||
|
return new MetaAddChatMeta(
|
||||||
|
ChatMetaType.PREFIX,
|
||||||
|
CommandSpec.META_ADDPREFIX.localize(locale),
|
||||||
|
"addprefix",
|
||||||
|
CommandPermission.USER_META_ADD_PREFIX,
|
||||||
|
CommandPermission.GROUP_META_ADD_PREFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MetaAddChatMeta forSuffix(LocaleManager locale) {
|
||||||
|
return new MetaAddChatMeta(
|
||||||
|
ChatMetaType.SUFFIX,
|
||||||
|
CommandSpec.META_ADDSUFFIX.localize(locale),
|
||||||
|
"addsuffix",
|
||||||
|
CommandPermission.USER_META_ADD_SUFFIX,
|
||||||
|
CommandPermission.GROUP_META_ADD_SUFFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
|
|
||||||
public MetaAddChatMeta(LocaleManager locale, ChatMetaType type) {
|
private MetaAddChatMeta(ChatMetaType type, LocalizedCommandSpec spec, String name, CommandPermission userPermission, CommandPermission groupPermission) {
|
||||||
super(
|
super(spec, name, userPermission, groupPermission, Predicates.inRange(0, 1));
|
||||||
type == ChatMetaType.PREFIX ? CommandSpec.META_ADDPREFIX.localize(locale) : CommandSpec.META_ADDSUFFIX.localize(locale),
|
|
||||||
"add" + type.name().toLowerCase(),
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.USER_META_ADD_PREFIX : CommandPermission.USER_META_ADD_SUFFIX,
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.GROUP_META_ADD_PREFIX : CommandPermission.GROUP_META_ADD_SUFFIX,
|
|
||||||
Predicates.inRange(0, 1)
|
|
||||||
);
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
|||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||||
|
import me.lucko.luckperms.common.locale.command.LocalizedCommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.message.Message;
|
import me.lucko.luckperms.common.locale.message.Message;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
@ -59,16 +60,31 @@ import java.time.Duration;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MetaAddTempChatMeta extends GenericChildCommand {
|
public class MetaAddTempChatMeta extends GenericChildCommand {
|
||||||
|
|
||||||
|
public static MetaAddTempChatMeta forPrefix(LocaleManager locale) {
|
||||||
|
return new MetaAddTempChatMeta(
|
||||||
|
ChatMetaType.PREFIX,
|
||||||
|
CommandSpec.META_ADDTEMP_PREFIX.localize(locale),
|
||||||
|
"addtempprefix",
|
||||||
|
CommandPermission.USER_META_ADD_TEMP_PREFIX,
|
||||||
|
CommandPermission.GROUP_META_ADD_TEMP_PREFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MetaAddTempChatMeta forSuffix(LocaleManager locale) {
|
||||||
|
return new MetaAddTempChatMeta(
|
||||||
|
ChatMetaType.SUFFIX,
|
||||||
|
CommandSpec.META_ADDTEMP_SUFFIX.localize(locale),
|
||||||
|
"addtempsuffix",
|
||||||
|
CommandPermission.USER_META_ADD_TEMP_SUFFIX,
|
||||||
|
CommandPermission.GROUP_META_ADD_TEMP_SUFFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
|
|
||||||
public MetaAddTempChatMeta(LocaleManager locale, ChatMetaType type) {
|
private MetaAddTempChatMeta(ChatMetaType type, LocalizedCommandSpec spec, String name, CommandPermission userPermission, CommandPermission groupPermission) {
|
||||||
super(
|
super(spec, name, userPermission, groupPermission, Predicates.inRange(0, 2));
|
||||||
type == ChatMetaType.PREFIX ? CommandSpec.META_ADDTEMP_PREFIX.localize(locale) : CommandSpec.META_ADDTEMP_SUFFIX.localize(locale),
|
|
||||||
"addtemp" + type.name().toLowerCase(),
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.USER_META_ADD_TEMP_PREFIX : CommandPermission.USER_META_ADD_TEMP_SUFFIX,
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.GROUP_META_ADD_TEMP_PREFIX : CommandPermission.GROUP_META_ADD_TEMP_SUFFIX,
|
|
||||||
Predicates.inRange(0, 2)
|
|
||||||
);
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +68,6 @@ import java.util.TreeSet;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class MetaInfo extends GenericChildCommand {
|
public class MetaInfo extends GenericChildCommand {
|
||||||
private static String processLocation(Node node, PermissionHolder holder) {
|
|
||||||
String location = node.metadata(InheritanceOriginMetadata.KEY).getOrigin().getName();
|
|
||||||
return location.equalsIgnoreCase(holder.getObjectName()) ? "self" : location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MetaInfo(LocaleManager locale) {
|
public MetaInfo(LocaleManager locale) {
|
||||||
super(CommandSpec.META_INFO.localize(locale), "info", CommandPermission.USER_META_INFO, CommandPermission.GROUP_META_INFO, Predicates.alwaysFalse());
|
super(CommandSpec.META_INFO.localize(locale), "info", CommandPermission.USER_META_INFO, CommandPermission.GROUP_META_INFO, Predicates.alwaysFalse());
|
||||||
}
|
}
|
||||||
@ -129,6 +124,11 @@ public class MetaInfo extends GenericChildCommand {
|
|||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String processLocation(Node node, PermissionHolder holder) {
|
||||||
|
String location = node.metadata(InheritanceOriginMetadata.KEY).getOrigin().getName();
|
||||||
|
return location.equalsIgnoreCase(holder.getObjectName()) ? "self" : location;
|
||||||
|
}
|
||||||
|
|
||||||
private static void sendMetaMessage(Set<MetaNode> meta, Sender sender, PermissionHolder holder, String label) {
|
private static void sendMetaMessage(Set<MetaNode> meta, Sender sender, PermissionHolder holder, String label) {
|
||||||
for (MetaNode m : meta) {
|
for (MetaNode m : meta) {
|
||||||
String location = processLocation(m, holder);
|
String location = processLocation(m, holder);
|
||||||
|
@ -38,6 +38,7 @@ import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|||||||
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||||
|
import me.lucko.luckperms.common.locale.command.LocalizedCommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.message.Message;
|
import me.lucko.luckperms.common.locale.message.Message;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
@ -55,16 +56,31 @@ import net.luckperms.api.node.ChatMetaType;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MetaRemoveChatMeta extends GenericChildCommand {
|
public class MetaRemoveChatMeta extends GenericChildCommand {
|
||||||
|
|
||||||
|
public static MetaRemoveChatMeta forPrefix(LocaleManager locale) {
|
||||||
|
return new MetaRemoveChatMeta(
|
||||||
|
ChatMetaType.PREFIX,
|
||||||
|
CommandSpec.META_REMOVEPREFIX.localize(locale),
|
||||||
|
"removeprefix",
|
||||||
|
CommandPermission.USER_META_REMOVE_PREFIX,
|
||||||
|
CommandPermission.GROUP_META_REMOVE_PREFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MetaRemoveChatMeta forSuffix(LocaleManager locale) {
|
||||||
|
return new MetaRemoveChatMeta(
|
||||||
|
ChatMetaType.SUFFIX,
|
||||||
|
CommandSpec.META_REMOVESUFFIX.localize(locale),
|
||||||
|
"removesuffix",
|
||||||
|
CommandPermission.USER_META_REMOVE_SUFFIX,
|
||||||
|
CommandPermission.GROUP_META_REMOVE_SUFFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
|
|
||||||
public MetaRemoveChatMeta(LocaleManager locale, ChatMetaType type) {
|
private MetaRemoveChatMeta(ChatMetaType type, LocalizedCommandSpec spec, String name, CommandPermission userPermission, CommandPermission groupPermission) {
|
||||||
super(
|
super(spec, name, userPermission, groupPermission, Predicates.is(0));
|
||||||
type == ChatMetaType.PREFIX ? CommandSpec.META_REMOVEPREFIX.localize(locale) : CommandSpec.META_REMOVESUFFIX.localize(locale),
|
|
||||||
"remove" + type.name().toLowerCase(),
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.USER_META_REMOVE_PREFIX : CommandPermission.USER_META_REMOVE_SUFFIX,
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.GROUP_META_REMOVE_PREFIX : CommandPermission.GROUP_META_REMOVE_SUFFIX,
|
|
||||||
Predicates.is(0)
|
|
||||||
);
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|||||||
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||||
|
import me.lucko.luckperms.common.locale.command.LocalizedCommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.message.Message;
|
import me.lucko.luckperms.common.locale.message.Message;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
@ -55,16 +56,31 @@ import net.luckperms.api.node.ChatMetaType;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
||||||
|
|
||||||
|
public static MetaRemoveTempChatMeta forPrefix(LocaleManager locale) {
|
||||||
|
return new MetaRemoveTempChatMeta(
|
||||||
|
ChatMetaType.PREFIX,
|
||||||
|
CommandSpec.META_REMOVETEMP_PREFIX.localize(locale),
|
||||||
|
"removetempprefix",
|
||||||
|
CommandPermission.USER_META_REMOVE_TEMP_PREFIX,
|
||||||
|
CommandPermission.GROUP_META_REMOVE_TEMP_PREFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MetaRemoveTempChatMeta forSuffix(LocaleManager locale) {
|
||||||
|
return new MetaRemoveTempChatMeta(
|
||||||
|
ChatMetaType.SUFFIX,
|
||||||
|
CommandSpec.META_REMOVETEMP_SUFFIX.localize(locale),
|
||||||
|
"removetempsuffix",
|
||||||
|
CommandPermission.USER_META_REMOVE_TEMP_SUFFIX,
|
||||||
|
CommandPermission.GROUP_META_REMOVE_TEMP_SUFFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
|
|
||||||
public MetaRemoveTempChatMeta(LocaleManager locale, ChatMetaType type) {
|
private MetaRemoveTempChatMeta(ChatMetaType type, LocalizedCommandSpec spec, String name, CommandPermission userPermission, CommandPermission groupPermission) {
|
||||||
super(
|
super(spec, name, userPermission, groupPermission, Predicates.is(0));
|
||||||
type == ChatMetaType.PREFIX ? CommandSpec.META_REMOVETEMP_PREFIX.localize(locale) : CommandSpec.META_REMOVETEMP_SUFFIX.localize(locale),
|
|
||||||
"removetemp" + type.name().toLowerCase(),
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.USER_META_REMOVE_TEMP_PREFIX : CommandPermission.USER_META_REMOVE_TEMP_SUFFIX,
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.GROUP_META_REMOVE_TEMP_PREFIX : CommandPermission.GROUP_META_REMOVE_TEMP_SUFFIX,
|
|
||||||
Predicates.is(0)
|
|
||||||
);
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|||||||
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||||
|
import me.lucko.luckperms.common.locale.command.LocalizedCommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.message.Message;
|
import me.lucko.luckperms.common.locale.message.Message;
|
||||||
import me.lucko.luckperms.common.model.Group;
|
import me.lucko.luckperms.common.model.Group;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
@ -59,16 +60,31 @@ import java.util.List;
|
|||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
public class MetaSetChatMeta extends GenericChildCommand {
|
public class MetaSetChatMeta extends GenericChildCommand {
|
||||||
|
|
||||||
|
public static MetaSetChatMeta forPrefix(LocaleManager locale) {
|
||||||
|
return new MetaSetChatMeta(
|
||||||
|
ChatMetaType.PREFIX,
|
||||||
|
CommandSpec.META_SETPREFIX.localize(locale),
|
||||||
|
"setprefix",
|
||||||
|
CommandPermission.USER_META_SET_PREFIX,
|
||||||
|
CommandPermission.GROUP_META_SET_PREFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MetaSetChatMeta forSuffix(LocaleManager locale) {
|
||||||
|
return new MetaSetChatMeta(
|
||||||
|
ChatMetaType.SUFFIX,
|
||||||
|
CommandSpec.META_SETSUFFIX.localize(locale),
|
||||||
|
"setsuffix",
|
||||||
|
CommandPermission.USER_META_SET_SUFFIX,
|
||||||
|
CommandPermission.GROUP_META_SET_SUFFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
|
|
||||||
public MetaSetChatMeta(LocaleManager locale, ChatMetaType type) {
|
private MetaSetChatMeta(ChatMetaType type, LocalizedCommandSpec spec, String name, CommandPermission userPermission, CommandPermission groupPermission) {
|
||||||
super(
|
super(spec, name, userPermission, groupPermission, Predicates.is(0));
|
||||||
type == ChatMetaType.PREFIX ? CommandSpec.META_SETPREFIX.localize(locale) : CommandSpec.META_SETSUFFIX.localize(locale),
|
|
||||||
"set" + type.name().toLowerCase(),
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.USER_META_SET_PREFIX : CommandPermission.USER_META_SET_SUFFIX,
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.GROUP_META_SET_PREFIX : CommandPermission.GROUP_META_SET_SUFFIX,
|
|
||||||
Predicates.is(0)
|
|
||||||
);
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ import me.lucko.luckperms.common.command.utils.StorageAssistant;
|
|||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
import me.lucko.luckperms.common.locale.command.CommandSpec;
|
||||||
|
import me.lucko.luckperms.common.locale.command.LocalizedCommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.message.Message;
|
import me.lucko.luckperms.common.locale.message.Message;
|
||||||
import me.lucko.luckperms.common.model.Group;
|
import me.lucko.luckperms.common.model.Group;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
@ -63,16 +64,31 @@ import java.util.List;
|
|||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
public class MetaSetTempChatMeta extends GenericChildCommand {
|
public class MetaSetTempChatMeta extends GenericChildCommand {
|
||||||
|
|
||||||
|
public static MetaSetTempChatMeta forPrefix(LocaleManager locale) {
|
||||||
|
return new MetaSetTempChatMeta(
|
||||||
|
ChatMetaType.PREFIX,
|
||||||
|
CommandSpec.META_SETTEMP_PREFIX.localize(locale),
|
||||||
|
"settempprefix",
|
||||||
|
CommandPermission.USER_META_SET_TEMP_PREFIX,
|
||||||
|
CommandPermission.GROUP_META_SET_TEMP_PREFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MetaSetTempChatMeta forSuffix(LocaleManager locale) {
|
||||||
|
return new MetaSetTempChatMeta(
|
||||||
|
ChatMetaType.SUFFIX,
|
||||||
|
CommandSpec.META_SETTEMP_SUFFIX.localize(locale),
|
||||||
|
"settempsuffix",
|
||||||
|
CommandPermission.USER_META_SET_TEMP_SUFFIX,
|
||||||
|
CommandPermission.GROUP_META_SET_TEMP_SUFFIX
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
|
|
||||||
public MetaSetTempChatMeta(LocaleManager locale, ChatMetaType type) {
|
private MetaSetTempChatMeta(ChatMetaType type, LocalizedCommandSpec spec, String name, CommandPermission userPermission, CommandPermission groupPermission) {
|
||||||
super(
|
super(spec, name, userPermission, groupPermission, Predicates.inRange(0, 1));
|
||||||
type == ChatMetaType.PREFIX ? CommandSpec.META_SETTEMP_PREFIX.localize(locale) : CommandSpec.META_SETTEMP_SUFFIX.localize(locale),
|
|
||||||
"settemp" + type.name().toLowerCase(),
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.USER_META_SET_TEMP_PREFIX : CommandPermission.USER_META_SET_TEMP_SUFFIX,
|
|
||||||
type == ChatMetaType.PREFIX ? CommandPermission.GROUP_META_SET_TEMP_PREFIX : CommandPermission.GROUP_META_SET_TEMP_SUFFIX,
|
|
||||||
Predicates.inRange(0, 1)
|
|
||||||
);
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user