enum names should be singular
This commit is contained in:
parent
f803082b15
commit
f35cb95001
@ -12,7 +12,7 @@ import me.lucko.luckperms.commands.misc.InfoCommand;
|
||||
import me.lucko.luckperms.commands.misc.SyncCommand;
|
||||
import me.lucko.luckperms.commands.user.UserMainCommand;
|
||||
import me.lucko.luckperms.commands.user.subcommands.*;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -106,7 +106,7 @@ public class CommandManager {
|
||||
}
|
||||
|
||||
private void sendCommandUsage(Sender sender) {
|
||||
Messages.INFO_BRIEF.send(sender, plugin.getVersion());
|
||||
Message.INFO_BRIEF.send(sender, plugin.getVersion());
|
||||
|
||||
mainCommands.stream()
|
||||
.filter(c -> c.canUse(sender))
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -34,7 +34,7 @@ public abstract class MainCommand {
|
||||
}
|
||||
|
||||
} else {
|
||||
Messages.COMMAND_NO_PERMISSION.send(sender);
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.MainCommand;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -25,13 +25,13 @@ public class CreateGroupCommand extends MainCommand {
|
||||
String groupName = args.get(0).toLowerCase();
|
||||
plugin.getDatastore().loadGroup(groupName, success -> {
|
||||
if (success) {
|
||||
Messages.GROUP_ALREADY_EXISTS.send(sender);
|
||||
Message.GROUP_ALREADY_EXISTS.send(sender);
|
||||
} else {
|
||||
plugin.getDatastore().createAndLoadGroup(groupName, success1 -> {
|
||||
if (!success1) {
|
||||
Messages.CREATE_GROUP_ERROR.send(sender);
|
||||
Message.CREATE_GROUP_ERROR.send(sender);
|
||||
} else {
|
||||
Messages.CREATE_GROUP_SUCCESS.send(sender, groupName);
|
||||
Message.CREATE_GROUP_SUCCESS.send(sender, groupName);
|
||||
plugin.runUpdateTask();
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.MainCommand;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
|
||||
@ -26,24 +26,24 @@ public class DeleteGroupCommand extends MainCommand {
|
||||
String groupName = args.get(0).toLowerCase();
|
||||
|
||||
if (groupName.equalsIgnoreCase(plugin.getConfiguration().getDefaultGroupName())) {
|
||||
Messages.DELETE_GROUP_ERROR_DEFAULT.send(sender);
|
||||
Message.DELETE_GROUP_ERROR_DEFAULT.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getDatastore().loadGroup(groupName, success -> {
|
||||
if (!success) {
|
||||
Messages.GROUP_DOES_NOT_EXIST.send(sender);
|
||||
Message.GROUP_DOES_NOT_EXIST.send(sender);
|
||||
} else {
|
||||
|
||||
Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
Messages.GROUP_LOAD_ERROR.send(sender);
|
||||
Message.GROUP_LOAD_ERROR.send(sender);
|
||||
} else {
|
||||
plugin.getDatastore().deleteGroup(group, success1 -> {
|
||||
if (!success1) {
|
||||
Messages.DELETE_GROUP_ERROR.send(sender);
|
||||
Message.DELETE_GROUP_ERROR.send(sender);
|
||||
} else {
|
||||
Messages.DELETE_GROUP_SUCCESS.send(sender, groupName);
|
||||
Message.DELETE_GROUP_SUCCESS.send(sender, groupName);
|
||||
plugin.runUpdateTask();
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.MainCommand;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -29,13 +29,13 @@ public class GroupMainCommand extends MainCommand {
|
||||
Optional<GroupSubCommand> o = subCommands.stream().filter(s -> s.getName().equalsIgnoreCase(args.get(1))).limit(1).findAny();
|
||||
|
||||
if (!o.isPresent()) {
|
||||
Messages.COMMAND_NOT_RECOGNISED.send(sender);
|
||||
Message.COMMAND_NOT_RECOGNISED.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
final GroupSubCommand sub = o.get();
|
||||
if (!sub.isAuthorized(sender)) {
|
||||
Messages.COMMAND_NO_PERMISSION.send(sender);
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -47,13 +47,13 @@ public class GroupMainCommand extends MainCommand {
|
||||
final String groupName = args.get(0).toLowerCase();
|
||||
plugin.getDatastore().loadGroup(groupName, success -> {
|
||||
if (!success) {
|
||||
Messages.GROUP_NOT_FOUND.send(sender);
|
||||
Message.GROUP_NOT_FOUND.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
Messages.GROUP_NOT_FOUND.send(sender);
|
||||
Message.GROUP_NOT_FOUND.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.group;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
|
||||
@ -19,9 +19,9 @@ public abstract class GroupSubCommand extends SubCommand {
|
||||
protected void saveGroup(Group group, Sender sender, LuckPermsPlugin plugin) {
|
||||
plugin.getDatastore().saveGroup(group, success -> {
|
||||
if (success) {
|
||||
Messages.GROUP_SAVE_SUCCESS.send(sender);
|
||||
Message.GROUP_SAVE_SUCCESS.send(sender);
|
||||
} else {
|
||||
Messages.GROUP_SAVE_ERROR.send(sender);
|
||||
Message.GROUP_SAVE_ERROR.send(sender);
|
||||
}
|
||||
|
||||
plugin.runUpdateTask();
|
||||
|
@ -5,7 +5,7 @@ import me.lucko.luckperms.commands.MainCommand;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -20,9 +20,9 @@ public class ListGroupsCommand extends MainCommand {
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
plugin.getDatastore().loadAllGroups(success -> {
|
||||
if (!success) {
|
||||
Messages.GROUPS_LOAD_ERROR.send(sender);
|
||||
Message.GROUPS_LOAD_ERROR.send(sender);
|
||||
} else {
|
||||
Messages.GROUPS_LIST.send(sender, Util.listToCommaSep(new ArrayList<>(plugin.getGroupManager().getGroups().keySet())));
|
||||
Message.GROUPS_LIST.send(sender, Util.listToCommaSep(new ArrayList<>(plugin.getGroupManager().getGroups().keySet())));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.group.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.group.GroupSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
|
||||
@ -17,7 +17,7 @@ public class GroupClearCommand extends GroupSubCommand {
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) {
|
||||
group.clearNodes();
|
||||
Messages.CLEAR_SUCCESS.send(sender, group.getName());
|
||||
Message.CLEAR_SUCCESS.send(sender, group.getName());
|
||||
|
||||
saveGroup(group, sender, plugin);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.group.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.group.GroupSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
|
||||
@ -16,7 +16,7 @@ public class GroupInfoCommand extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) {
|
||||
Messages.GROUP_INFO.send(sender, group.getName(), group.getNodes().keySet().size(), group.getName());
|
||||
Message.GROUP_INFO.send(sender, group.getName(), group.getNodes().keySet().size(), group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.commands.group.GroupSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
|
||||
@ -18,7 +18,7 @@ public class GroupListNodesCommand extends GroupSubCommand {
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args) {
|
||||
Messages.LISTNODES.send(sender, group.getName(), Util.nodesToString(group.getNodes()));
|
||||
Message.LISTNODES.send(sender, group.getName(), Util.nodesToString(group.getNodes()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.group.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.group.GroupSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
@ -22,21 +22,21 @@ public class GroupSetInheritCommand extends GroupSubCommand {
|
||||
|
||||
plugin.getDatastore().loadGroup(groupName, success -> {
|
||||
if (!success) {
|
||||
Messages.GROUP_LOAD_ERROR.send(sender);
|
||||
Message.GROUP_LOAD_ERROR.send(sender);
|
||||
} else {
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
group.setPermission("group." + groupName, true, server);
|
||||
Messages.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
Message.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
} else {
|
||||
group.setPermission("group." + groupName, true);
|
||||
Messages.GROUP_SETINHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
Message.GROUP_SETINHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
}
|
||||
|
||||
saveGroup(group, sender, plugin);
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Messages.GROUP_ALREADY_INHERITS.send(sender, group.getName(), groupName);
|
||||
Message.GROUP_ALREADY_INHERITS.send(sender, group.getName(), groupName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.group.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.group.GroupSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
@ -27,7 +27,7 @@ public class GroupSetPermissionCommand extends GroupSubCommand {
|
||||
}
|
||||
|
||||
if (node.matches("group\\..*")) {
|
||||
Messages.GROUP_USE_INHERIT.send(sender);
|
||||
Message.GROUP_USE_INHERIT.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -42,15 +42,15 @@ public class GroupSetPermissionCommand extends GroupSubCommand {
|
||||
if (args.size() == 3) {
|
||||
final String server = args.get(2).toLowerCase();
|
||||
group.setPermission(node, b, server);
|
||||
Messages.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server);
|
||||
Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server);
|
||||
} else {
|
||||
group.setPermission(node, b);
|
||||
Messages.SETPERMISSION_SUCCESS.send(sender, node, bool, group.getName());
|
||||
Message.SETPERMISSION_SUCCESS.send(sender, node, bool, group.getName());
|
||||
}
|
||||
|
||||
saveGroup(group, sender, plugin);
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Messages.ALREADY_HASPERMISSION.send(sender, group.getName());
|
||||
Message.ALREADY_HASPERMISSION.send(sender, group.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.group.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.group.GroupSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksPermissionException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
@ -26,7 +26,7 @@ public class GroupUnSetPermissionCommand extends GroupSubCommand {
|
||||
}
|
||||
|
||||
if (node.matches("group\\..*")) {
|
||||
Messages.GROUP_USE_UNINHERIT.send(sender);
|
||||
Message.GROUP_USE_UNINHERIT.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -34,15 +34,15 @@ public class GroupUnSetPermissionCommand extends GroupSubCommand {
|
||||
if (args.size() == 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
group.unsetPermission(node, server);
|
||||
Messages.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server);
|
||||
Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server);
|
||||
} else {
|
||||
group.unsetPermission(node);
|
||||
Messages.UNSETPERMISSION_SUCCESS.send(sender, node, group.getName());
|
||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, group.getName());
|
||||
}
|
||||
|
||||
saveGroup(group, sender, plugin);
|
||||
} catch (ObjectLacksPermissionException e) {
|
||||
Messages.DOES_NOT_HAVEPERMISSION.send(sender, group.getName());
|
||||
Message.DOES_NOT_HAVEPERMISSION.send(sender, group.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.group.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.group.GroupSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksPermissionException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
@ -24,15 +24,15 @@ public class GroupUnsetInheritCommand extends GroupSubCommand {
|
||||
if (args.size() == 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
group.unsetPermission("group." + groupName, server);
|
||||
Messages.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
Message.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server);
|
||||
} else {
|
||||
group.unsetPermission("group." + groupName);
|
||||
Messages.GROUP_UNSETINHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
Message.GROUP_UNSETINHERIT_SUCCESS.send(sender, group.getName(), groupName);
|
||||
}
|
||||
|
||||
saveGroup(group, sender, plugin);
|
||||
} catch (ObjectLacksPermissionException e) {
|
||||
Messages.GROUP_DOES_NOT_INHERIT.send(sender, group.getName(), groupName);
|
||||
Message.GROUP_DOES_NOT_INHERIT.send(sender, group.getName(), groupName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.MainCommand;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -17,7 +17,7 @@ public class DebugCommand extends MainCommand {
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
Messages.DEBUG.send(sender, plugin.getPlayerCount(), plugin.getUserManager().getUsers().size(),
|
||||
Message.DEBUG.send(sender, plugin.getPlayerCount(), plugin.getUserManager().getUsers().size(),
|
||||
plugin.getGroupManager().getGroups().size()
|
||||
);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.MainCommand;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -17,7 +17,7 @@ public class InfoCommand extends MainCommand {
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
Messages.INFO.send(sender, plugin.getVersion(), plugin.getDatastore().getName());
|
||||
Message.INFO.send(sender, plugin.getVersion(), plugin.getDatastore().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.MainCommand;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -17,7 +17,7 @@ public class SyncCommand extends MainCommand {
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, List<String> args) {
|
||||
Messages.UPDATE_TASK_RUN.send(sender);
|
||||
Message.UPDATE_TASK_RUN.send(sender);
|
||||
plugin.runUpdateTask();
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import me.lucko.luckperms.commands.MainCommand;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.users.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -31,13 +31,13 @@ public class UserMainCommand extends MainCommand{
|
||||
Optional<UserSubCommand> o = subCommands.stream().filter(s -> s.getName().equalsIgnoreCase(args.get(1))).limit(1).findAny();
|
||||
|
||||
if (!o.isPresent()) {
|
||||
Messages.COMMAND_NOT_RECOGNISED.send(sender);
|
||||
Message.COMMAND_NOT_RECOGNISED.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
final UserSubCommand sub = o.get();
|
||||
if (!sub.isAuthorized(sender)) {
|
||||
Messages.COMMAND_NO_PERMISSION.send(sender);
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -55,11 +55,11 @@ public class UserMainCommand extends MainCommand{
|
||||
}
|
||||
|
||||
if (user.length() <= 16) {
|
||||
Messages.USER_ATTEMPTING_LOOKUP.send(sender);
|
||||
Message.USER_ATTEMPTING_LOOKUP.send(sender);
|
||||
|
||||
plugin.getDatastore().getUUID(user, uuid -> {
|
||||
if (uuid == null) {
|
||||
Messages.USER_NOT_FOUND.send(sender);
|
||||
Message.USER_NOT_FOUND.send(sender);
|
||||
return;
|
||||
}
|
||||
runSub(plugin, sender, uuid, sub, strippedArgs);
|
||||
@ -67,19 +67,19 @@ public class UserMainCommand extends MainCommand{
|
||||
return;
|
||||
}
|
||||
|
||||
Messages.USER_INVALID_ENTRY.send(sender, user);
|
||||
Message.USER_INVALID_ENTRY.send(sender, user);
|
||||
}
|
||||
|
||||
private void runSub(LuckPermsPlugin plugin, Sender sender, UUID uuid, UserSubCommand command, List<String> strippedArgs) {
|
||||
plugin.getDatastore().loadUser(uuid, success -> {
|
||||
if (!success) {
|
||||
Messages.USER_NOT_FOUND.send(sender);
|
||||
Message.USER_NOT_FOUND.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
User user = plugin.getUserManager().getUser(uuid);
|
||||
if (user == null) {
|
||||
Messages.USER_NOT_FOUND.send(sender);
|
||||
Message.USER_NOT_FOUND.send(sender);
|
||||
}
|
||||
|
||||
if (command.isArgLengthInvalid(strippedArgs.size())) {
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.user;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.SubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.users.User;
|
||||
|
||||
@ -21,9 +21,9 @@ public abstract class UserSubCommand extends SubCommand {
|
||||
|
||||
plugin.getDatastore().saveUser(user, success -> {
|
||||
if (success) {
|
||||
Messages.USER_SAVE_SUCCESS.send(sender);
|
||||
Message.USER_SAVE_SUCCESS.send(sender);
|
||||
} else {
|
||||
Messages.USER_SAVE_ERROR.send(sender);
|
||||
Message.USER_SAVE_ERROR.send(sender);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.user.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
@ -22,11 +22,11 @@ public class UserAddGroupCommand extends UserSubCommand {
|
||||
|
||||
plugin.getDatastore().loadGroup(groupName, success -> {
|
||||
if (!success) {
|
||||
Messages.GROUP_DOES_NOT_EXIST.send(sender);
|
||||
Message.GROUP_DOES_NOT_EXIST.send(sender);
|
||||
} else {
|
||||
Group group = plugin.getGroupManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
Messages.GROUP_DOES_NOT_EXIST.send(sender);
|
||||
Message.GROUP_DOES_NOT_EXIST.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -34,15 +34,15 @@ public class UserAddGroupCommand extends UserSubCommand {
|
||||
if (args.size() == 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
user.addGroup(group, server);
|
||||
Messages.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
Message.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
} else {
|
||||
user.addGroup(group);
|
||||
Messages.USER_ADDGROUP_SUCCESS.send(sender, user.getName(), groupName);
|
||||
Message.USER_ADDGROUP_SUCCESS.send(sender, user.getName(), groupName);
|
||||
}
|
||||
|
||||
saveUser(user, sender, plugin);
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Messages.USER_ALREADY_MEMBER_OF.send(sender, user.getName(), group.getName());
|
||||
Message.USER_ALREADY_MEMBER_OF.send(sender, user.getName(), group.getName());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.user.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.users.User;
|
||||
|
||||
@ -18,7 +18,7 @@ public class UserClearCommand extends UserSubCommand {
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) {
|
||||
user.clearNodes();
|
||||
plugin.getUserManager().giveDefaults(user);
|
||||
Messages.CLEAR_SUCCESS.send(sender, user.getName());
|
||||
Message.CLEAR_SUCCESS.send(sender, user.getName());
|
||||
|
||||
saveUser(user, sender, plugin);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.user.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.users.User;
|
||||
|
||||
@ -16,7 +16,7 @@ public class UserGetUUIDCommand extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) {
|
||||
Messages.USER_GETUUID.send(sender, user.getName(), user.getUuid().toString());
|
||||
Message.USER_GETUUID.send(sender, user.getName(), user.getUuid().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.users.User;
|
||||
|
||||
@ -17,7 +17,7 @@ public class UserInfoCommand extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) {
|
||||
Messages.USER_INFO.send(sender, user.getName(), user.getUuid(), plugin.getPlayerStatus(user.getUuid()),
|
||||
Message.USER_INFO.send(sender, user.getName(), user.getUuid(), plugin.getPlayerStatus(user.getUuid()),
|
||||
Util.listToCommaSep(user.getGroupNames()), user.getPrimaryGroup(),
|
||||
(user.getNodes().keySet().size() - user.getGroupNames().size()), user.getName()
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.users.User;
|
||||
|
||||
@ -17,7 +17,7 @@ public class UserListNodesCommand extends UserSubCommand {
|
||||
|
||||
@Override
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) {
|
||||
Messages.LISTNODES.send(sender, user.getName(), Util.nodesToString(user.getNodes()));
|
||||
Message.LISTNODES.send(sender, user.getName(), Util.nodesToString(user.getNodes()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.user.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksPermissionException;
|
||||
import me.lucko.luckperms.users.User;
|
||||
@ -21,7 +21,7 @@ public class UserRemoveGroupCommand extends UserSubCommand {
|
||||
|
||||
if ((args.size() == 1 || (args.size() == 2 && args.get(1).equalsIgnoreCase("global")))
|
||||
&& user.getPrimaryGroup().equalsIgnoreCase(groupName)) {
|
||||
Messages.USER_REMOVEGROUP_ERROR_PRIMARY.send(sender);
|
||||
Message.USER_REMOVEGROUP_ERROR_PRIMARY.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -29,15 +29,15 @@ public class UserRemoveGroupCommand extends UserSubCommand {
|
||||
if (args.size() == 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
user.unsetPermission("group." + groupName, server);
|
||||
Messages.USER_REMOVEGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
Message.USER_REMOVEGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server);
|
||||
} else {
|
||||
user.unsetPermission("group." + groupName);
|
||||
Messages.USER_REMOVEGROUP_SUCCESS.send(sender, user.getName(), groupName);
|
||||
Message.USER_REMOVEGROUP_SUCCESS.send(sender, user.getName(), groupName);
|
||||
}
|
||||
|
||||
saveUser(user, sender, plugin);
|
||||
} catch (ObjectLacksPermissionException e) {
|
||||
Messages.USER_NOT_MEMBER_OF.send(sender, user.getName(), groupName);
|
||||
Message.USER_NOT_MEMBER_OF.send(sender, user.getName(), groupName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.user.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.users.User;
|
||||
@ -27,7 +27,7 @@ public class UserSetPermissionCommand extends UserSubCommand {
|
||||
}
|
||||
|
||||
if (node.matches("group\\..*")) {
|
||||
Messages.USER_USE_ADDGROUP.send(sender);
|
||||
Message.USER_USE_ADDGROUP.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -42,15 +42,15 @@ public class UserSetPermissionCommand extends UserSubCommand {
|
||||
if (args.size() == 3) {
|
||||
final String server = args.get(2).toLowerCase();
|
||||
user.setPermission(node, b, server);
|
||||
Messages.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, user.getName(), server);
|
||||
Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, user.getName(), server);
|
||||
} else {
|
||||
user.setPermission(node, b);
|
||||
Messages.SETPERMISSION_SUCCESS.send(sender, node, bool, user.getName());
|
||||
Message.SETPERMISSION_SUCCESS.send(sender, node, bool, user.getName());
|
||||
}
|
||||
|
||||
saveUser(user, sender, plugin);
|
||||
} catch (ObjectAlreadyHasException e) {
|
||||
Messages.ALREADY_HASPERMISSION.send(sender, user.getName());
|
||||
Message.ALREADY_HASPERMISSION.send(sender, user.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.user.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.users.User;
|
||||
@ -20,22 +20,22 @@ public class UserSetPrimaryGroupCommand extends UserSubCommand {
|
||||
protected void execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args) {
|
||||
Group group = plugin.getGroupManager().getGroup(args.get(0).toLowerCase());
|
||||
if (group == null) {
|
||||
Messages.GROUP_DOES_NOT_EXIST.send(sender);
|
||||
Message.GROUP_DOES_NOT_EXIST.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.getPrimaryGroup().equalsIgnoreCase(group.getName())) {
|
||||
Messages.USER_PRIMARYGROUP_ERROR_ALREADYHAS.send(sender);
|
||||
Message.USER_PRIMARYGROUP_ERROR_ALREADYHAS.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user.isInGroup(group)) {
|
||||
Messages.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender);
|
||||
Message.USER_PRIMARYGROUP_ERROR_NOTMEMBER.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
user.setPrimaryGroup(group.getName());
|
||||
Messages.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getName(), group.getName());
|
||||
Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getName(), group.getName());
|
||||
|
||||
saveUser(user, sender, plugin);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package me.lucko.luckperms.commands.user.subcommands;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.commands.user.UserSubCommand;
|
||||
import me.lucko.luckperms.constants.Messages;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksPermissionException;
|
||||
import me.lucko.luckperms.users.User;
|
||||
@ -26,7 +26,7 @@ public class UserUnSetPermissionCommand extends UserSubCommand {
|
||||
}
|
||||
|
||||
if (node.matches("group\\..*")) {
|
||||
Messages.USER_USE_REMOVEGROUP.send(sender);
|
||||
Message.USER_USE_REMOVEGROUP.send(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -34,15 +34,15 @@ public class UserUnSetPermissionCommand extends UserSubCommand {
|
||||
if (args.size() == 2) {
|
||||
final String server = args.get(1).toLowerCase();
|
||||
user.unsetPermission(node, server);
|
||||
Messages.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, user.getName(), server);
|
||||
Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, user.getName(), server);
|
||||
} else {
|
||||
user.unsetPermission(node);
|
||||
Messages.UNSETPERMISSION_SUCCESS.send(sender, node, user.getName());
|
||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, user.getName());
|
||||
}
|
||||
|
||||
saveUser(user, sender, plugin);
|
||||
} catch (ObjectLacksPermissionException e) {
|
||||
Messages.DOES_NOT_HAVEPERMISSION.send(sender, user.getName());
|
||||
Message.DOES_NOT_HAVEPERMISSION.send(sender, user.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import me.lucko.luckperms.commands.Util;
|
||||
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
@AllArgsConstructor
|
||||
public enum Messages {
|
||||
public enum Message {
|
||||
|
||||
PREFIX("&7&l[&b&lL&a&lP&7&l] &c", false),
|
||||
|
Loading…
Reference in New Issue
Block a user