mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Refactor blank message sending
This commit is contained in:
parent
420ec2bf1a
commit
98ea255667
@ -32,7 +32,6 @@ import me.lucko.luckperms.common.command.abstraction.CommandException;
|
|||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.tabcomplete.TabCompletions;
|
import me.lucko.luckperms.common.command.tabcomplete.TabCompletions;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
import me.lucko.luckperms.common.commands.group.CreateGroup;
|
import me.lucko.luckperms.common.commands.group.CreateGroup;
|
||||||
import me.lucko.luckperms.common.commands.group.DeleteGroup;
|
import me.lucko.luckperms.common.commands.group.DeleteGroup;
|
||||||
import me.lucko.luckperms.common.commands.group.GroupMainCommand;
|
import me.lucko.luckperms.common.commands.group.GroupMainCommand;
|
||||||
@ -167,7 +166,7 @@ public class CommandManager {
|
|||||||
|
|
||||||
// Handle no arguments
|
// Handle no arguments
|
||||||
if (arguments.isEmpty() || (arguments.size() == 1 && arguments.get(0).trim().isEmpty())) {
|
if (arguments.isEmpty() || (arguments.size() == 1 && arguments.get(0).trim().isEmpty())) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&2Running &bLuckPerms v" + this.plugin.getBootstrap().getVersion() + "&2.");
|
Message.BLANK.send(sender, "&2Running &bLuckPerms v" + this.plugin.getBootstrap().getVersion() + "&2.");
|
||||||
if (hasPermissionForAny(sender)) {
|
if (hasPermissionForAny(sender)) {
|
||||||
Message.VIEW_AVAILABLE_COMMANDS_PROMPT.send(sender, label);
|
Message.VIEW_AVAILABLE_COMMANDS_PROMPT.send(sender, label);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
@ -271,7 +270,7 @@ public class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendCommandUsage(Sender sender, String label) {
|
private void sendCommandUsage(Sender sender, String label) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&2Running &bLuckPerms v" + this.plugin.getBootstrap().getVersion() + "&2.");
|
Message.BLANK.send(sender, "&2Running &bLuckPerms v" + this.plugin.getBootstrap().getVersion() + "&2.");
|
||||||
this.mainCommands.stream()
|
this.mainCommands.stream()
|
||||||
.filter(Command::shouldDisplay)
|
.filter(Command::shouldDisplay)
|
||||||
.filter(c -> c.isAuthorized(sender))
|
.filter(c -> c.isAuthorized(sender))
|
||||||
|
@ -40,17 +40,6 @@ import java.util.Map;
|
|||||||
public final class MessageUtils {
|
public final class MessageUtils {
|
||||||
private MessageUtils() {}
|
private MessageUtils() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends a message to the sender, formatted with the plugin prefix and color scheme
|
|
||||||
*
|
|
||||||
* @param sender the sender to send the message to
|
|
||||||
* @param message the message content
|
|
||||||
*/
|
|
||||||
public static void sendPluginMessage(Sender sender, String message) {
|
|
||||||
String prefix = Message.PREFIX.asString(sender.getPlugin().getLocaleManager());
|
|
||||||
sender.sendMessage(Message.colorize(prefix + message));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toCommaSep(Collection<String> strings) {
|
public static String toCommaSep(Collection<String> strings) {
|
||||||
if (strings.isEmpty()) {
|
if (strings.isEmpty()) {
|
||||||
return "&bNone";
|
return "&bNone";
|
||||||
|
@ -69,7 +69,7 @@ public class TrackAppend extends SubCommand<Track> {
|
|||||||
if (result.asBoolean()) {
|
if (result.asBoolean()) {
|
||||||
Message.TRACK_APPEND_SUCCESS.send(sender, group.getName(), track.getName());
|
Message.TRACK_APPEND_SUCCESS.send(sender, group.getName(), track.getName());
|
||||||
if (track.getGroups().size() > 1) {
|
if (track.getGroups().size() > 1) {
|
||||||
Message.EMPTY.send(sender, MessageUtils.listToArrowSep(track.getGroups(), group.getName()));
|
Message.BLANK.send(sender, MessageUtils.listToArrowSep(track.getGroups(), group.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track)
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
|
@ -78,7 +78,7 @@ public class TrackInsert extends SubCommand<Track> {
|
|||||||
if (result.asBoolean()) {
|
if (result.asBoolean()) {
|
||||||
Message.TRACK_INSERT_SUCCESS.send(sender, group.getName(), track.getName(), pos);
|
Message.TRACK_INSERT_SUCCESS.send(sender, group.getName(), track.getName(), pos);
|
||||||
if (track.getGroups().size() > 1) {
|
if (track.getGroups().size() > 1) {
|
||||||
Message.EMPTY.send(sender, MessageUtils.listToArrowSep(track.getGroups(), group.getName()));
|
Message.BLANK.send(sender, MessageUtils.listToArrowSep(track.getGroups(), group.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track)
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
|
@ -63,7 +63,7 @@ public class TrackRemove extends SubCommand<Track> {
|
|||||||
if (result.asBoolean()) {
|
if (result.asBoolean()) {
|
||||||
Message.TRACK_REMOVE_SUCCESS.send(sender, groupName, track.getName());
|
Message.TRACK_REMOVE_SUCCESS.send(sender, groupName, track.getName());
|
||||||
if (track.getGroups().size() > 1) {
|
if (track.getGroups().size() > 1) {
|
||||||
Message.EMPTY.send(sender, MessageUtils.listToArrowSep(track.getGroups()));
|
Message.BLANK.send(sender, MessageUtils.listToArrowSep(track.getGroups()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track)
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
|
@ -130,7 +130,7 @@ public class UserDemote extends SubCommand<User> {
|
|||||||
|
|
||||||
Message.USER_DEMOTE_SUCCESS.send(sender, user.getFormattedDisplayName(), track.getName(), groupFrom, groupTo, MessageUtils.contextSetToString(plugin.getLocaleManager(), context));
|
Message.USER_DEMOTE_SUCCESS.send(sender, user.getFormattedDisplayName(), track.getName(), groupFrom, groupTo, MessageUtils.contextSetToString(plugin.getLocaleManager(), context));
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
Message.EMPTY.send(sender, MessageUtils.listToArrowSep(track.getGroups(), groupTo, groupFrom, true));
|
Message.BLANK.send(sender, MessageUtils.listToArrowSep(track.getGroups(), groupTo, groupFrom, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(user)
|
ExtendedLogEntry.build().actor(sender).acted(user)
|
||||||
|
@ -130,7 +130,7 @@ public class UserPromote extends SubCommand<User> {
|
|||||||
|
|
||||||
Message.USER_PROMOTE_SUCCESS.send(sender, user.getFormattedDisplayName(), track.getName(), groupFrom, groupTo, MessageUtils.contextSetToString(plugin.getLocaleManager(), context));
|
Message.USER_PROMOTE_SUCCESS.send(sender, user.getFormattedDisplayName(), track.getName(), groupFrom, groupTo, MessageUtils.contextSetToString(plugin.getLocaleManager(), context));
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
Message.EMPTY.send(sender, MessageUtils.listToArrowSep(track.getGroups(), groupFrom, groupTo, false));
|
Message.BLANK.send(sender, MessageUtils.listToArrowSep(track.getGroups(), groupFrom, groupTo, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(user)
|
ExtendedLogEntry.build().actor(sender).acted(user)
|
||||||
|
@ -60,7 +60,7 @@ public enum Message {
|
|||||||
false
|
false
|
||||||
),
|
),
|
||||||
|
|
||||||
EMPTY("{}", true),
|
BLANK("{}", true),
|
||||||
PLAYER_ONLINE("&aOnline", false),
|
PLAYER_ONLINE("&aOnline", false),
|
||||||
PLAYER_OFFLINE("&cOffline", false),
|
PLAYER_OFFLINE("&cOffline", false),
|
||||||
LOADING_DATABASE_ERROR("&cA database error occurred whilst loading permissions data. Please try again later.", true),
|
LOADING_DATABASE_ERROR("&cA database error occurred whilst loading permissions data. Please try again later.", true),
|
||||||
|
@ -30,9 +30,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -50,10 +50,10 @@ public class OptionClear extends SubCommand<LPSubjectData> {
|
|||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
||||||
if (contextSet.isEmpty()) {
|
if (contextSet.isEmpty()) {
|
||||||
subjectData.clearOptions();
|
subjectData.clearOptions();
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCleared options matching contexts &bANY&a.");
|
Message.BLANK.send(sender, "&aCleared options matching contexts &bANY&a.");
|
||||||
} else {
|
} else {
|
||||||
subjectData.clearOptions(contextSet);
|
subjectData.clearOptions(contextSet);
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCleared options matching contexts &b" + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
Message.BLANK.send(sender, "&aCleared options matching contexts &b" + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
||||||
}
|
}
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -52,26 +52,26 @@ public class OptionInfo extends SubCommand<LPSubjectData> {
|
|||||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) {
|
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) {
|
||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
||||||
if (contextSet.isEmpty()) {
|
if (contextSet.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aShowing options matching contexts &bANY&a.");
|
Message.BLANK.send(sender, "&aShowing options matching contexts &bANY&a.");
|
||||||
Map<ImmutableContextSet, ImmutableMap<String, String>> options = subjectData.getAllOptions();
|
Map<ImmutableContextSet, ImmutableMap<String, String>> options = subjectData.getAllOptions();
|
||||||
if (options.isEmpty()) {
|
if (options.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "That subject does not have any options defined.");
|
Message.BLANK.send(sender, "That subject does not have any options defined.");
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<ImmutableContextSet, ImmutableMap<String, String>> e : options.entrySet()) {
|
for (Map.Entry<ImmutableContextSet, ImmutableMap<String, String>> e : options.entrySet()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&3>> &bContext: " + SpongeCommandUtils.contextToString(e.getKey(), plugin.getLocaleManager()) + "\n" + SpongeCommandUtils.optionsToString(e.getValue()));
|
Message.BLANK.send(sender, "&3>> &bContext: " + SpongeCommandUtils.contextToString(e.getKey(), plugin.getLocaleManager()) + "\n" + SpongeCommandUtils.optionsToString(e.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Map<String, String> options = subjectData.getOptions(contextSet);
|
Map<String, String> options = subjectData.getOptions(contextSet);
|
||||||
if (options.isEmpty()) {
|
if (options.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "That subject does not have any options defined in those contexts.");
|
Message.BLANK.send(sender, "That subject does not have any options defined in those contexts.");
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtils.sendPluginMessage(sender, "&aShowing options matching contexts &b" +
|
Message.BLANK.send(sender, "&aShowing options matching contexts &b" +
|
||||||
SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()) + "&a.\n" + SpongeCommandUtils.optionsToString(options));
|
SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()) + "&a.\n" + SpongeCommandUtils.optionsToString(options));
|
||||||
|
|
||||||
}
|
}
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
|
@ -30,9 +30,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -52,9 +52,9 @@ public class OptionSet extends SubCommand<LPSubjectData> {
|
|||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(2, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(2, args);
|
||||||
|
|
||||||
if (subjectData.setOption(contextSet, key, value).join()) {
|
if (subjectData.setOption(contextSet, key, value).join()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aSet &f\"" + key + "&f\"&a to &f\"" + value + "&f\"&a in context " + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
Message.BLANK.send(sender, "&aSet &f\"" + key + "&f\"&a to &f\"" + value + "&f\"&a in context " + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
||||||
} else {
|
} else {
|
||||||
MessageUtils.sendPluginMessage(sender, "Unable to set option. Does the Subject already have it set?");
|
Message.BLANK.send(sender, "Unable to set option. Does the Subject already have it set?");
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
|
@ -30,9 +30,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -51,9 +51,9 @@ public class OptionUnset extends SubCommand<LPSubjectData> {
|
|||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(1, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(1, args);
|
||||||
|
|
||||||
if (subjectData.unsetOption(contextSet, key).join()) {
|
if (subjectData.unsetOption(contextSet, key).join()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aUnset &f\"" + key + "&f\"&a in context " + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
Message.BLANK.send(sender, "&aUnset &f\"" + key + "&f\"&a in context " + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
||||||
} else {
|
} else {
|
||||||
MessageUtils.sendPluginMessage(sender, "Unable to unset option. Are you sure the Subject has it set?");
|
Message.BLANK.send(sender, "Unable to unset option. Are you sure the Subject has it set?");
|
||||||
}
|
}
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -50,10 +50,10 @@ public class ParentClear extends SubCommand<LPSubjectData> {
|
|||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
||||||
if (contextSet.isEmpty()) {
|
if (contextSet.isEmpty()) {
|
||||||
subjectData.clearParents();
|
subjectData.clearParents();
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCleared parents matching contexts &bANY&a.");
|
Message.BLANK.send(sender, "&aCleared parents matching contexts &bANY&a.");
|
||||||
} else {
|
} else {
|
||||||
subjectData.clearParents(contextSet);
|
subjectData.clearParents(contextSet);
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCleared parents matching contexts &b" + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
Message.BLANK.send(sender, "&aCleared parents matching contexts &b" + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
||||||
}
|
}
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -53,26 +53,26 @@ public class ParentInfo extends SubCommand<LPSubjectData> {
|
|||||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) {
|
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) {
|
||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
||||||
if (contextSet.isEmpty()) {
|
if (contextSet.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aShowing parents matching contexts &bANY&a.");
|
Message.BLANK.send(sender, "&aShowing parents matching contexts &bANY&a.");
|
||||||
Map<ImmutableContextSet, ImmutableList<LPSubjectReference>> parents = subjectData.getAllParents();
|
Map<ImmutableContextSet, ImmutableList<LPSubjectReference>> parents = subjectData.getAllParents();
|
||||||
if (parents.isEmpty()) {
|
if (parents.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "That subject does not have any parents defined.");
|
Message.BLANK.send(sender, "That subject does not have any parents defined.");
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<ImmutableContextSet, ImmutableList<LPSubjectReference>> e : parents.entrySet()) {
|
for (Map.Entry<ImmutableContextSet, ImmutableList<LPSubjectReference>> e : parents.entrySet()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&3>> &bContext: " + SpongeCommandUtils.contextToString(e.getKey(), plugin.getLocaleManager()) + "\n" + SpongeCommandUtils.parentsToString(e.getValue()));
|
Message.BLANK.send(sender, "&3>> &bContext: " + SpongeCommandUtils.contextToString(e.getKey(), plugin.getLocaleManager()) + "\n" + SpongeCommandUtils.parentsToString(e.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
List<LPSubjectReference> parents = subjectData.getParents(contextSet);
|
List<LPSubjectReference> parents = subjectData.getParents(contextSet);
|
||||||
if (parents.isEmpty()) {
|
if (parents.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "That subject does not have any parents defined in those contexts.");
|
Message.BLANK.send(sender, "That subject does not have any parents defined in those contexts.");
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtils.sendPluginMessage(sender, "&aShowing parents matching contexts &b" +
|
Message.BLANK.send(sender, "&aShowing parents matching contexts &b" +
|
||||||
SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()) + "&a.\n" + SpongeCommandUtils.parentsToString(parents));
|
SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()) + "&a.\n" + SpongeCommandUtils.parentsToString(parents));
|
||||||
|
|
||||||
}
|
}
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
|
@ -30,9 +30,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -58,21 +58,21 @@ public class ParentRemove extends SubCommand<LPSubjectData> {
|
|||||||
|
|
||||||
LPPermissionService service = Sponge.getServiceManager().provideUnchecked(LPPermissionService.class);
|
LPPermissionService service = Sponge.getServiceManager().provideUnchecked(LPPermissionService.class);
|
||||||
if (service.getLoadedCollections().keySet().stream().map(String::toLowerCase).noneMatch(s -> s.equalsIgnoreCase(collection))) {
|
if (service.getLoadedCollections().keySet().stream().map(String::toLowerCase).noneMatch(s -> s.equalsIgnoreCase(collection))) {
|
||||||
MessageUtils.sendPluginMessage(sender, "Warning: SubjectCollection '&4" + collection + "&c' doesn't exist.");
|
Message.BLANK.send(sender, "Warning: SubjectCollection '&4" + collection + "&c' doesn't exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
LPSubjectCollection c = service.getCollection(collection);
|
LPSubjectCollection c = service.getCollection(collection);
|
||||||
if (!c.hasRegistered(name).join()) {
|
if (!c.hasRegistered(name).join()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "Warning: Subject '&4" + name + "&c' doesn't exist.");
|
Message.BLANK.send(sender, "Warning: Subject '&4" + name + "&c' doesn't exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
LPSubject subject = c.loadSubject(name).join();
|
LPSubject subject = c.loadSubject(name).join();
|
||||||
|
|
||||||
if (subjectData.removeParent(contextSet, subject.toReference()).join()) {
|
if (subjectData.removeParent(contextSet, subject.toReference()).join()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aRemoved parent &b" + subject.getParentCollection().getIdentifier() +
|
Message.BLANK.send(sender, "&aRemoved parent &b" + subject.getParentCollection().getIdentifier() +
|
||||||
"&a/&b" + subject.getIdentifier() + "&a in context " + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
"&a/&b" + subject.getIdentifier() + "&a in context " + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
||||||
} else {
|
} else {
|
||||||
MessageUtils.sendPluginMessage(sender, "Unable to remove parent. Are you sure the Subject has it added?");
|
Message.BLANK.send(sender, "Unable to remove parent. Are you sure the Subject has it added?");
|
||||||
}
|
}
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -50,10 +50,10 @@ public class PermissionClear extends SubCommand<LPSubjectData> {
|
|||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
||||||
if (contextSet.isEmpty()) {
|
if (contextSet.isEmpty()) {
|
||||||
subjectData.clearPermissions();
|
subjectData.clearPermissions();
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCleared permissions matching contexts &bANY&a.");
|
Message.BLANK.send(sender, "&aCleared permissions matching contexts &bANY&a.");
|
||||||
} else {
|
} else {
|
||||||
subjectData.clearPermissions(contextSet);
|
subjectData.clearPermissions(contextSet);
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCleared permissions matching contexts &b" + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
Message.BLANK.send(sender, "&aCleared permissions matching contexts &b" + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
||||||
}
|
}
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ import me.lucko.luckperms.common.command.CommandResult;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -52,26 +52,26 @@ public class PermissionInfo extends SubCommand<LPSubjectData> {
|
|||||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) {
|
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, List<String> args, String label) {
|
||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(0, args);
|
||||||
if (contextSet.isEmpty()) {
|
if (contextSet.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aShowing permissions matching contexts &bANY&a.");
|
Message.BLANK.send(sender, "&aShowing permissions matching contexts &bANY&a.");
|
||||||
Map<ImmutableContextSet, ImmutableMap<String, Boolean>> permissions = subjectData.getAllPermissions();
|
Map<ImmutableContextSet, ImmutableMap<String, Boolean>> permissions = subjectData.getAllPermissions();
|
||||||
if (permissions.isEmpty()) {
|
if (permissions.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "That subject does not have any permissions defined.");
|
Message.BLANK.send(sender, "That subject does not have any permissions defined.");
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<ImmutableContextSet, ImmutableMap<String, Boolean>> e : permissions.entrySet()) {
|
for (Map.Entry<ImmutableContextSet, ImmutableMap<String, Boolean>> e : permissions.entrySet()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&3>> &bContext: " + SpongeCommandUtils.contextToString(e.getKey(), plugin.getLocaleManager()) + "\n" + SpongeCommandUtils.nodesToString(e.getValue()));
|
Message.BLANK.send(sender, "&3>> &bContext: " + SpongeCommandUtils.contextToString(e.getKey(), plugin.getLocaleManager()) + "\n" + SpongeCommandUtils.nodesToString(e.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Map<String, Boolean> permissions = subjectData.getPermissions(contextSet);
|
Map<String, Boolean> permissions = subjectData.getPermissions(contextSet);
|
||||||
if (permissions.isEmpty()) {
|
if (permissions.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "That subject does not have any permissions defined in those contexts.");
|
Message.BLANK.send(sender, "That subject does not have any permissions defined in those contexts.");
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUtils.sendPluginMessage(sender, "&aShowing permissions matching contexts &b" +
|
Message.BLANK.send(sender, "&aShowing permissions matching contexts &b" +
|
||||||
SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()) + "&a.\n" + SpongeCommandUtils.nodesToString(permissions));
|
SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()) + "&a.\n" + SpongeCommandUtils.nodesToString(permissions));
|
||||||
|
|
||||||
}
|
}
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
|
@ -32,9 +32,9 @@ import me.lucko.luckperms.common.command.abstraction.CommandException;
|
|||||||
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
import me.lucko.luckperms.common.command.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||||
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
import me.lucko.luckperms.common.command.utils.ArgumentParser;
|
||||||
import me.lucko.luckperms.common.command.utils.MessageUtils;
|
|
||||||
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.message.Message;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.sender.Sender;
|
import me.lucko.luckperms.common.sender.Sender;
|
||||||
import me.lucko.luckperms.common.util.Predicates;
|
import me.lucko.luckperms.common.util.Predicates;
|
||||||
@ -54,9 +54,9 @@ public class PermissionSet extends SubCommand<LPSubjectData> {
|
|||||||
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(2, args);
|
ImmutableContextSet contextSet = ArgumentParser.parseContextSponge(2, args);
|
||||||
|
|
||||||
if (subjectData.setPermission(contextSet, node, tristate).join()) {
|
if (subjectData.setPermission(contextSet, node, tristate).join()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aSet &b" + node + "&a to &b" + tristate.toString().toLowerCase() + "&a in context " + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
Message.BLANK.send(sender, "&aSet &b" + node + "&a to &b" + tristate.toString().toLowerCase() + "&a in context " + SpongeCommandUtils.contextToString(contextSet, plugin.getLocaleManager()));
|
||||||
} else {
|
} else {
|
||||||
MessageUtils.sendPluginMessage(sender, "Unable to set permission. Does the Subject already have it set?");
|
Message.BLANK.send(sender, "Unable to set permission. Does the Subject already have it set?");
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
|
@ -96,25 +96,24 @@ public class SpongeMainCommand extends Command<Void, LPSubjectData> {
|
|||||||
LuckPermsService service = this.plugin.getService();
|
LuckPermsService service = this.plugin.getService();
|
||||||
|
|
||||||
if (args.size() < 1) {
|
if (args.size() < 1) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCurrent Subject Collections:\n" +
|
Message.BLANK.send(sender, "&aCurrent Subject Collections:\n" +
|
||||||
MessageUtils.toCommaSep(service.getLoadedCollections().keySet().stream()
|
MessageUtils.toCommaSep(service.getLoadedCollections().keySet().stream()
|
||||||
.filter(s -> !s.equalsIgnoreCase("user") && !s.equalsIgnoreCase("group"))
|
.filter(s -> !s.equalsIgnoreCase("user") && !s.equalsIgnoreCase("group"))
|
||||||
.sorted()
|
.sorted()
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
)
|
));
|
||||||
);
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
String subjectCollection = args.get(0);
|
String subjectCollection = args.get(0);
|
||||||
|
|
||||||
if (subjectCollection.equalsIgnoreCase("user") || subjectCollection.equalsIgnoreCase("group")) {
|
if (subjectCollection.equalsIgnoreCase("user") || subjectCollection.equalsIgnoreCase("group")) {
|
||||||
MessageUtils.sendPluginMessage(sender, "Please use the main LuckPerms commands to edit users and groups.");
|
Message.BLANK.send(sender, "Please use the main LuckPerms commands to edit users and groups.");
|
||||||
return CommandResult.STATE_ERROR;
|
return CommandResult.STATE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service.getLoadedCollections().keySet().stream().map(String::toLowerCase).noneMatch(s -> s.equalsIgnoreCase(subjectCollection))) {
|
if (service.getLoadedCollections().keySet().stream().map(String::toLowerCase).noneMatch(s -> s.equalsIgnoreCase(subjectCollection))) {
|
||||||
MessageUtils.sendPluginMessage(sender, "Warning: SubjectCollection '&4" + subjectCollection + "&c' doesn't already exist. Creating it now.");
|
Message.BLANK.send(sender, "Warning: SubjectCollection '&4" + subjectCollection + "&c' doesn't already exist. Creating it now.");
|
||||||
}
|
}
|
||||||
|
|
||||||
LPSubjectCollection collection = service.getCollection(subjectCollection);
|
LPSubjectCollection collection = service.getCollection(subjectCollection);
|
||||||
@ -128,9 +127,9 @@ public class SpongeMainCommand extends Command<Void, LPSubjectData> {
|
|||||||
List<String> extra = subjects.subList(50, subjects.size());
|
List<String> extra = subjects.subList(50, subjects.size());
|
||||||
int overflow = extra.size();
|
int overflow = extra.size();
|
||||||
extra.clear();
|
extra.clear();
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCurrent Subjects:\n" + MessageUtils.toCommaSep(subjects) + "&b ... and &a" + overflow + " &bmore.");
|
Message.BLANK.send(sender, "&aCurrent Subjects:\n" + MessageUtils.toCommaSep(subjects) + "&b ... and &a" + overflow + " &bmore.");
|
||||||
} else {
|
} else {
|
||||||
MessageUtils.sendPluginMessage(sender, "&aCurrent Subjects:\n" + MessageUtils.toCommaSep(subjects));
|
Message.BLANK.send(sender, "&aCurrent Subjects:\n" + MessageUtils.toCommaSep(subjects));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
@ -181,7 +180,7 @@ public class SpongeMainCommand extends Command<Void, LPSubjectData> {
|
|||||||
|
|
||||||
String subjectId = args.get(1);
|
String subjectId = args.get(1);
|
||||||
if (!collection.hasRegistered(subjectId).join()) {
|
if (!collection.hasRegistered(subjectId).join()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "Warning: Subject '&4" + subjectId + "&c' doesn't already exist. Creating it now.");
|
Message.BLANK.send(sender, "Warning: Subject '&4" + subjectId + "&c' doesn't already exist. Creating it now.");
|
||||||
}
|
}
|
||||||
|
|
||||||
LPSubject subject = collection.loadSubject(subjectId).join();
|
LPSubject subject = collection.loadSubject(subjectId).join();
|
||||||
@ -198,19 +197,19 @@ public class SpongeMainCommand extends Command<Void, LPSubjectData> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendUsage(Sender sender, String label) {
|
public void sendUsage(Sender sender, String label) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&3> &a" + String.format(getUsage(), label));
|
Message.BLANK.send(sender, "&3> &a" + String.format(getUsage(), label));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendDetailedUsage(Sender sender, String label) {
|
public void sendDetailedUsage(Sender sender, String label) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&b" + getName() + " Sub Commands: &7(" + String.format("/%s sponge <collection> <subject> [-transient]", label) + " ...)");
|
Message.BLANK.send(sender, "&b" + getName() + " Sub Commands: &7(" + String.format("/%s sponge <collection> <subject> [-transient]", label) + " ...)");
|
||||||
for (String s : Arrays.asList("Permission", "Parent", "Option")) {
|
for (String s : Arrays.asList("Permission", "Parent", "Option")) {
|
||||||
List<Command> subs = this.subCommands.get(s.toLowerCase()).stream()
|
List<Command> subs = this.subCommands.get(s.toLowerCase()).stream()
|
||||||
.filter(sub -> sub.isAuthorized(sender))
|
.filter(sub -> sub.isAuthorized(sender))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!subs.isEmpty()) {
|
if (!subs.isEmpty()) {
|
||||||
MessageUtils.sendPluginMessage(sender, "&3>> &b" + s);
|
Message.BLANK.send(sender, "&3>> &b" + s);
|
||||||
for (Command sub : subs) {
|
for (Command sub : subs) {
|
||||||
sub.sendUsage(sender, label);
|
sub.sendUsage(sender, label);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user