mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-09-10 04:48:07 +02:00
Add helpful message for users on first startup
This commit is contained in:
parent
c780266139
commit
c1e0b874d8
@ -60,6 +60,7 @@ import me.lucko.luckperms.common.commands.track.TrackMainCommand;
|
||||
import me.lucko.luckperms.common.commands.user.UserMainCommand;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.message.Message;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.common.utils.TextUtils;
|
||||
@ -69,6 +70,7 @@ import net.kyori.text.event.ClickEvent;
|
||||
import net.kyori.text.event.HoverEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
@ -172,7 +174,12 @@ public class CommandManager {
|
||||
if (this.mainCommands.stream().anyMatch(c -> c.shouldDisplay() && c.isAuthorized(sender))) {
|
||||
Message.VIEW_AVAILABLE_COMMANDS_PROMPT.send(sender, label);
|
||||
} else {
|
||||
Message.NO_PERMISSION_FOR_SUBCOMMANDS.send(sender);
|
||||
Collection<? extends Group> groups = plugin.getGroupManager().getAll().values();
|
||||
if (groups.size() <= 1 && groups.stream().allMatch(g -> g.getOwnNodes().isEmpty())) {
|
||||
Message.FIRST_TIME_SETUP.send(sender, label, sender.getName());
|
||||
} else {
|
||||
Message.NO_PERMISSION_FOR_SUBCOMMANDS.send(sender);
|
||||
}
|
||||
}
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
@ -38,50 +38,61 @@ import java.util.List;
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public enum CommandSpec {
|
||||
|
||||
USER("User commands", "/%s user <user>"),
|
||||
GROUP("Group commands", "/%s group <group>"),
|
||||
TRACK("Track commands", "/%s track <track>"),
|
||||
LOG("Log commands", "/%s log"),
|
||||
USER("A set of commands for managing users within LuckPerms. " +
|
||||
"(A 'user' in LuckPerms is just a player, and can refer to a UUID or username)",
|
||||
"/%s user <user>"
|
||||
),
|
||||
GROUP("A set of commands for managing groups within LuckPerms. " +
|
||||
"Groups are just collections of permission assignments that can be given to users. " +
|
||||
"New groups are made using the 'creategroup' command.",
|
||||
"/%s group <group>"
|
||||
),
|
||||
TRACK("A set of commands for managing tracks within LuckPerms. " +
|
||||
"Tracks are a ordered collection of groups which can be used for defining " +
|
||||
"promotions and demotions.",
|
||||
"/%s track <track>"
|
||||
),
|
||||
LOG("A set of commands for managing the logging functionality within LuckPerms.", "/%s log"),
|
||||
|
||||
SYNC("Sync changes with the storage", "/%s sync"),
|
||||
INFO("Print general plugin info", "/%s info"),
|
||||
EDITOR("Creates a new editor session", "/%s editor [type]",
|
||||
SYNC("Reloads all data from the plugins storage into memory, and applies any changes that are detected.", "/%s sync"),
|
||||
INFO("Prints general information about the active plugin instance.", "/%s info"),
|
||||
EDITOR("Creates a new web editor session", "/%s editor [type]",
|
||||
Argument.list(
|
||||
Argument.create("type", false, "the types to load into the editor. ('all', 'users' or 'groups')")
|
||||
)
|
||||
),
|
||||
DEBUG("Produce debugging output", "/%s debug"),
|
||||
VERBOSE("Manage verbose permission checking", "/%s verbose <on|record|off|upload> [filter]",
|
||||
DEBUG("Produces a set of internal debugging output", "/%s debug"),
|
||||
VERBOSE("Controls the plugins verbose permission check monitoring system.", "/%s verbose <on|record|off|upload> [filter]",
|
||||
Argument.list(
|
||||
Argument.create("on|record|off|upload", true, "whether to enable/disable logging, or to upload the logged output"),
|
||||
Argument.create("filter", false, "the filter to match entries against")
|
||||
)
|
||||
),
|
||||
TREE("Generate a tree view of permissions", "/%s tree [scope] [player]",
|
||||
TREE("Generates a tree view (ordered list hierarchy) of all permissions known to LuckPerms.", "/%s tree [scope] [player]",
|
||||
Argument.list(
|
||||
Argument.create("scope", false, "the root of the tree. specify \".\" to include all permissions"),
|
||||
Argument.create("player", false, "the name of an online player to check against")
|
||||
)
|
||||
),
|
||||
SEARCH("Search for users/groups with a specific permission", "/%s search <permission>",
|
||||
SEARCH("Searchs for all of the users/groups with a specific permission", "/%s search <permission>",
|
||||
Argument.list(
|
||||
Argument.create("permission", true, "the permission to search for"),
|
||||
Argument.create("page", false, "the page to view")
|
||||
)
|
||||
),
|
||||
CHECK("Perform a standard permission check on an online player", "/%s check <user> <permission>",
|
||||
CHECK("Performs a 'mock' permission check for an online player", "/%s check <user> <permission>",
|
||||
Argument.list(
|
||||
Argument.create("user", true, "the user to check"),
|
||||
Argument.create("permission", true, "the permission to check for")
|
||||
)
|
||||
),
|
||||
NETWORK_SYNC("Sync changes with the storage and request that all other servers on the network do the same", "/%s networksync"),
|
||||
IMPORT("Import data from a file", "/%s import <file>",
|
||||
IMPORT("Imports data from a (previously created) export file", "/%s import <file>",
|
||||
Argument.list(
|
||||
Argument.create("file", true, "the file to import from")
|
||||
)
|
||||
),
|
||||
EXPORT("Export data to a file", "/%s export <file>",
|
||||
EXPORT("Exports all permissions data to an 'export' file. Be be re-imported at a later time.", "/%s export <file>",
|
||||
Argument.list(
|
||||
Argument.create("file", true, "the file to export to")
|
||||
)
|
||||
|
@ -50,6 +50,15 @@ public enum Message {
|
||||
|
||||
VIEW_AVAILABLE_COMMANDS_PROMPT("&3Use &a/{} help &3to view available commands.", true),
|
||||
NO_PERMISSION_FOR_SUBCOMMANDS("&3You do not have permission to use any sub commands.", true),
|
||||
FIRST_TIME_SETUP(
|
||||
"{PREFIX}&3It seems that no permissions have been setup yet!" + "\n" +
|
||||
"{PREFIX}&3Before you can use any of the LuckPerms commands in-game, you need to use the console to give yourself access." + "\n" +
|
||||
"{PREFIX}&3Open your console and run:" + "\n" +
|
||||
"{PREFIX} &3&l> &a{} user {} permission set luckperms.* true" + "\n\n" +
|
||||
"{PREFIX}&3After you've done this, you can begin to define your permission assignments and groups." + "\n" +
|
||||
"{PREFIX}&3Don't know where to start? Check here: &7https://github.com/lucko/LuckPerms/wiki/Usage",
|
||||
false
|
||||
),
|
||||
|
||||
EMPTY("{}", true),
|
||||
PLAYER_ONLINE("&aOnline", false),
|
||||
|
@ -42,6 +42,8 @@ import me.lucko.luckperms.common.managers.group.GroupManager;
|
||||
import me.lucko.luckperms.common.managers.track.TrackManager;
|
||||
import me.lucko.luckperms.common.managers.user.UserManager;
|
||||
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.Track;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.plugin.bootstrap.LuckPermsBootstrap;
|
||||
import me.lucko.luckperms.common.plugin.logging.PluginLogger;
|
||||
@ -77,21 +79,21 @@ public interface LuckPermsPlugin {
|
||||
*
|
||||
* @return the user manager
|
||||
*/
|
||||
UserManager<?> getUserManager();
|
||||
UserManager<? extends User> getUserManager();
|
||||
|
||||
/**
|
||||
* Gets the group manager instance for the platform
|
||||
*
|
||||
* @return the group manager
|
||||
*/
|
||||
GroupManager<?> getGroupManager();
|
||||
GroupManager<? extends Group> getGroupManager();
|
||||
|
||||
/**
|
||||
* Gets the track manager instance for the platform
|
||||
*
|
||||
* @return the track manager
|
||||
*/
|
||||
TrackManager<?> getTrackManager();
|
||||
TrackManager<? extends Track> getTrackManager();
|
||||
|
||||
/**
|
||||
* Gets the plugin's configuration
|
||||
|
Loading…
Reference in New Issue
Block a user