Small cleanup

This commit is contained in:
Luck 2016-11-05 23:23:08 +00:00
parent 3e846d9527
commit 4f6e229943
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
84 changed files with 345 additions and 335 deletions

View File

@ -322,7 +322,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
@Override @Override
public List<Sender> getNotifyListeners() { public List<Sender> getNotifyListeners() {
return getServer().getOnlinePlayers().stream() return getServer().getOnlinePlayers().stream()
.map(p -> BukkitSenderFactory.get(this).wrap(p, Collections.singleton(Permission.LOG_NOTIFY))) .map(p -> BukkitSenderFactory.get(this).wrap(p))
.filter(Permission.LOG_NOTIFY::isAuthorized) .filter(Permission.LOG_NOTIFY::isAuthorized)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View File

@ -27,12 +27,12 @@ import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand; import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -82,7 +82,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
} }
public MigrationBPermissions() { public MigrationBPermissions() {
super("bpermissions", "Migration from bPermissions", MIGRATION, Predicate.alwaysFalse(), null); super("bpermissions", "Migration from bPermissions", MIGRATION, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -24,11 +24,15 @@ package me.lucko.luckperms.bukkit.migration;
import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.NodeFactory;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import org.anjocaido.groupmanager.GlobalGroups; import org.anjocaido.groupmanager.GlobalGroups;
@ -43,7 +47,7 @@ import java.util.stream.Collectors;
public class MigrationGroupManager extends SubCommand<Object> { public class MigrationGroupManager extends SubCommand<Object> {
public MigrationGroupManager() { public MigrationGroupManager() {
super("groupmanager", "Migration from GroupManager", Permission.MIGRATION, Predicate.is(0), super("groupmanager", "Migration from GroupManager", Permission.MIGRATION, Predicates.is(0),
Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from")) Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from"))
); );
} }

View File

@ -26,12 +26,16 @@ import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.api.PlatformType; import me.lucko.luckperms.api.PlatformType;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import ru.tehkode.permissions.NativeInterface; import ru.tehkode.permissions.NativeInterface;
import ru.tehkode.permissions.PermissionGroup; import ru.tehkode.permissions.PermissionGroup;
@ -46,7 +50,7 @@ import java.util.stream.Collectors;
public class MigrationPermissionsEx extends SubCommand<Object> { public class MigrationPermissionsEx extends SubCommand<Object> {
public MigrationPermissionsEx() { public MigrationPermissionsEx() {
super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicate.alwaysFalse(), super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicates.alwaysFalse(),
Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from")) Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from"))
); );
} }

View File

@ -30,11 +30,15 @@ import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.data.Callback; import me.lucko.luckperms.api.data.Callback;
import me.lucko.luckperms.bukkit.migration.utils.LPResultRunnable; import me.lucko.luckperms.bukkit.migration.utils.LPResultRunnable;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -116,7 +120,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
public MigrationPowerfulPerms() { public MigrationPowerfulPerms() {
super("powerfulperms", "Migration from PowerfulPerms", MIGRATION, Predicate.not(5), super("powerfulperms", "Migration from PowerfulPerms", MIGRATION, Predicates.not(5),
Arg.list( Arg.list(
Arg.create("address", true, "the address of the PP database"), Arg.create("address", true, "the address of the PP database"),
Arg.create("database", true, "the name of the PP database"), Arg.create("database", true, "the name of the PP database"),

View File

@ -25,13 +25,17 @@ package me.lucko.luckperms.bukkit.migration;
import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import org.tyrannyofheaven.bukkit.zPermissions.ZPermissionsService; import org.tyrannyofheaven.bukkit.zPermissions.ZPermissionsService;
@ -42,7 +46,7 @@ import java.util.stream.Collectors;
public class MigrationZPermissions extends SubCommand<Object> { public class MigrationZPermissions extends SubCommand<Object> {
public MigrationZPermissions() { public MigrationZPermissions() {
super("zpermissions", "Migration from zPermissions", Permission.MIGRATION, Predicate.alwaysFalse(), super("zpermissions", "Migration from zPermissions", Permission.MIGRATION, Predicates.alwaysFalse(),
Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from")) Arg.list(Arg.create("world names...", false, "a list of worlds to migrate permissions from"))
); );
} }

View File

@ -58,7 +58,10 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
import java.io.File; import java.io.File;
import java.util.*; import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -229,7 +232,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
@Override @Override
public List<Sender> getNotifyListeners() { public List<Sender> getNotifyListeners() {
return getProxy().getPlayers().stream() return getProxy().getPlayers().stream()
.map(p -> BungeeSenderFactory.get(this).wrap(p, Collections.singleton(Permission.LOG_NOTIFY))) .map(p -> BungeeSenderFactory.get(this).wrap(p))
.filter(Permission.LOG_NOTIFY::isAuthorized) .filter(Permission.LOG_NOTIFY::isAuthorized)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View File

@ -26,12 +26,12 @@ import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.MetaUtils; import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand; import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import net.alpenblock.bungeeperms.*; import net.alpenblock.bungeeperms.*;
@ -43,7 +43,7 @@ import java.util.Map;
*/ */
public class MigrationBungeePerms extends SubCommand<Object> { public class MigrationBungeePerms extends SubCommand<Object> {
public MigrationBungeePerms() { public MigrationBungeePerms() {
super("bungeeperms", "Migration from BungeePerms", Permission.MIGRATION, Predicate.alwaysFalse(), null); super("bungeeperms", "Migration from BungeePerms", Permission.MIGRATION, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -31,6 +31,7 @@ import me.lucko.luckperms.api.context.IContextCalculator;
import me.lucko.luckperms.api.event.LPEvent; import me.lucko.luckperms.api.event.LPEvent;
import me.lucko.luckperms.api.event.LPListener; import me.lucko.luckperms.api.event.LPListener;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.api.internal.*;
import me.lucko.luckperms.common.core.NodeBuilder; import me.lucko.luckperms.common.core.NodeBuilder;
import me.lucko.luckperms.common.users.UserIdentifier; import me.lucko.luckperms.common.users.UserIdentifier;
@ -95,17 +96,17 @@ public class ApiProvider implements LuckPermsApi {
@Override @Override
public LPConfiguration getConfiguration() { public LPConfiguration getConfiguration() {
return new me.lucko.luckperms.common.api.internal.LPConfigurationLink(plugin.getConfiguration()); return new LPConfigurationLink(plugin.getConfiguration());
} }
@Override @Override
public Datastore getDatastore() { public Datastore getDatastore() {
return new me.lucko.luckperms.common.api.internal.DatastoreLink(plugin, plugin.getDatastore()); return new DatastoreLink(plugin, plugin.getDatastore());
} }
@Override @Override
public UuidCache getUuidCache() { public UuidCache getUuidCache() {
return new me.lucko.luckperms.common.api.internal.UuidCacheLink(plugin.getUuidCache()); return new UuidCacheLink(plugin.getUuidCache());
} }
@Override @Override
@ -116,11 +117,7 @@ public class ApiProvider implements LuckPermsApi {
@Override @Override
public User getUser(@NonNull UUID uuid) { public User getUser(@NonNull UUID uuid) {
final me.lucko.luckperms.common.users.User user = plugin.getUserManager().get(uuid); final me.lucko.luckperms.common.users.User user = plugin.getUserManager().get(uuid);
if (user == null) { return user == null ? null : new UserLink(user);
return null;
}
return new me.lucko.luckperms.common.api.internal.UserLink(user);
} }
@Override @Override
@ -131,11 +128,7 @@ public class ApiProvider implements LuckPermsApi {
@Override @Override
public User getUser(@NonNull String name) { public User getUser(@NonNull String name) {
final me.lucko.luckperms.common.users.User user = plugin.getUserManager().get(name); final me.lucko.luckperms.common.users.User user = plugin.getUserManager().get(name);
if (user == null) { return user == null ? null : new UserLink(user);
return null;
}
return new me.lucko.luckperms.common.api.internal.UserLink(user);
} }
@Override @Override
@ -145,7 +138,7 @@ public class ApiProvider implements LuckPermsApi {
@Override @Override
public Set<User> getUsers() { public Set<User> getUsers() {
return plugin.getUserManager().getAll().values().stream().map(me.lucko.luckperms.common.api.internal.UserLink::new).collect(Collectors.toSet()); return plugin.getUserManager().getAll().values().stream().map(UserLink::new).collect(Collectors.toSet());
} }
@Override @Override
@ -156,17 +149,13 @@ public class ApiProvider implements LuckPermsApi {
@Override @Override
public void cleanupUser(@NonNull User user) { public void cleanupUser(@NonNull User user) {
me.lucko.luckperms.common.api.internal.Utils.checkUser(user); me.lucko.luckperms.common.api.internal.Utils.checkUser(user);
plugin.getUserManager().cleanup(((me.lucko.luckperms.common.api.internal.UserLink) user).getMaster()); plugin.getUserManager().cleanup(((UserLink) user).getMaster());
} }
@Override @Override
public Group getGroup(@NonNull String name) { public Group getGroup(@NonNull String name) {
final me.lucko.luckperms.common.groups.Group group = plugin.getGroupManager().get(name); final me.lucko.luckperms.common.groups.Group group = plugin.getGroupManager().get(name);
if (group == null) { return group == null ? null : new GroupLink(group);
return null;
}
return new me.lucko.luckperms.common.api.internal.GroupLink(group);
} }
@Override @Override
@ -176,7 +165,7 @@ public class ApiProvider implements LuckPermsApi {
@Override @Override
public Set<Group> getGroups() { public Set<Group> getGroups() {
return plugin.getGroupManager().getAll().values().stream().map(me.lucko.luckperms.common.api.internal.GroupLink::new).collect(Collectors.toSet()); return plugin.getGroupManager().getAll().values().stream().map(GroupLink::new).collect(Collectors.toSet());
} }
@Override @Override
@ -187,11 +176,7 @@ public class ApiProvider implements LuckPermsApi {
@Override @Override
public Track getTrack(@NonNull String name) { public Track getTrack(@NonNull String name) {
final me.lucko.luckperms.common.tracks.Track track = plugin.getTrackManager().get(name); final me.lucko.luckperms.common.tracks.Track track = plugin.getTrackManager().get(name);
if (track == null) { return track == null ? null : new TrackLink(track);
return null;
}
return new me.lucko.luckperms.common.api.internal.TrackLink(track);
} }
@Override @Override
@ -201,7 +186,7 @@ public class ApiProvider implements LuckPermsApi {
@Override @Override
public Set<Track> getTracks() { public Set<Track> getTracks() {
return plugin.getTrackManager().getAll().values().stream().map(me.lucko.luckperms.common.api.internal.TrackLink::new).collect(Collectors.toSet()); return plugin.getTrackManager().getAll().values().stream().map(TrackLink::new).collect(Collectors.toSet());
} }
@Override @Override

View File

@ -22,6 +22,7 @@
package me.lucko.luckperms.common.api.internal; package me.lucko.luckperms.common.api.internal;
import com.google.common.base.Preconditions;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import me.lucko.luckperms.api.Group; import me.lucko.luckperms.api.Group;
import me.lucko.luckperms.api.Track; import me.lucko.luckperms.api.Track;
@ -32,57 +33,51 @@ import me.lucko.luckperms.common.utils.ArgumentChecker;
public class Utils { public class Utils {
public static void checkUser(User user) { public static void checkUser(User user) {
if (!(user instanceof UserLink)) { Preconditions.checkState(user instanceof UserLink, "User instance cannot be handled by this implementation.");
throw new IllegalStateException("User instance cannot be handled by this implementation.");
}
} }
public static void checkGroup(Group group) { public static void checkGroup(Group group) {
if (!(group instanceof GroupLink)) { Preconditions.checkState(group instanceof GroupLink, "Group instance cannot be handled by this implementation.");
throw new IllegalStateException("Group instance cannot be handled by this implementation.");
}
} }
public static void checkTrack(Track track) { public static void checkTrack(Track track) {
if (!(track instanceof TrackLink)) { Preconditions.checkState(track instanceof TrackLink, "Track instance cannot be handled by this implementation.");
throw new IllegalStateException("Track instance cannot be handled by this implementation.");
}
} }
public static String checkUsername(String s) { public static String checkUsername(String s) {
if (ArgumentChecker.checkUsername(s)) { Preconditions.checkArgument(
throw new IllegalArgumentException("Invalid username entry '" + s + "'. Usernames must be less than 16 chars" + !ArgumentChecker.checkUsername(s),
" and only contain 'a-z A-Z 1-9 _'."); "Invalid username entry '" + s + "'. Usernames must be less than 16 chars and only contain 'a-z A-Z 1-9 _'."
} );
return s; return s;
} }
public static String checkName(String s) { public static String checkName(String s) {
if (ArgumentChecker.checkName(s)) { Preconditions.checkArgument(
throw new IllegalArgumentException("Invalid name entry '" + s + "'. Names must be less than 37 chars" + !ArgumentChecker.checkName(s),
" and only contain 'a-z A-Z 1-9'."); "Invalid name entry '" + s + "'. Names must be less than 37 chars and only contain 'a-z A-Z 1-9'."
} );
return s.toLowerCase(); return s.toLowerCase();
} }
public static String checkServer(String s) { public static String checkServer(String s) {
if (ArgumentChecker.checkServer(s)) { Preconditions.checkArgument(
throw new IllegalArgumentException("Invalid server entry '" + s + "'. Server names can only contain alphanumeric characters."); !ArgumentChecker.checkServer(s),
} "Invalid server entry '" + s + "'. Server names can only contain alphanumeric characters."
);
return s; return s;
} }
public static String checkNode(String s) { public static String checkNode(String s) {
if (ArgumentChecker.checkNode(s)) { Preconditions.checkArgument(
throw new IllegalArgumentException("Invalid node entry '" + s + "'. Nodes cannot contain '/' or '$' characters."); !ArgumentChecker.checkNode(s),
} "Invalid node entry '" + s + "'. Nodes cannot contain '/' or '$' characters."
);
return s; return s;
} }
public static long checkTime(long l) { public static long checkTime(long l) {
if (ArgumentChecker.checkTime(l)) { Preconditions.checkArgument(!ArgumentChecker.checkTime(l), "Unix time '" + l + "' is invalid, as it has already passed.");
throw new IllegalArgumentException("Unix time '" + l + "' is invalid, as it has already passed.");
}
return l; return l;
} }

View File

@ -23,6 +23,7 @@
package me.lucko.luckperms.common.api.internal; package me.lucko.luckperms.common.api.internal;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.NonNull;
import me.lucko.luckperms.api.UuidCache; import me.lucko.luckperms.api.UuidCache;
import java.util.UUID; import java.util.UUID;
@ -35,12 +36,12 @@ public class UuidCacheLink implements UuidCache {
private final me.lucko.luckperms.common.core.UuidCache master; private final me.lucko.luckperms.common.core.UuidCache master;
@Override @Override
public UUID getUUID(UUID external) { public UUID getUUID(@NonNull UUID external) {
return master.getUUID(external); return master.getUUID(external);
} }
@Override @Override
public UUID getExternalUUID(UUID internal) { public UUID getExternalUUID(@NonNull UUID internal) {
return master.getExternalUUID(internal); return master.getExternalUUID(internal);
} }
} }

View File

@ -43,11 +43,7 @@ public class Arg {
private final String description; private final String description;
public String asPrettyString() { public String asPrettyString() {
if (required) { return required ? "&8<&7" + name + "&8>" : "&8[&7" + name + "&8]";
return "&8<&7" + name + "&8>";
} else {
return "&8[&7" + name + "&8]";
}
} }
} }

View File

@ -34,13 +34,13 @@ public enum CommandResult {
INVALID_ARGS(false), INVALID_ARGS(false),
NO_PERMISSION(false); NO_PERMISSION(false);
private boolean booleanValue; private boolean value;
public boolean booleanValue() { public boolean asBoolean() {
return booleanValue; return value;
} }
static CommandResult of(boolean b) { public static CommandResult of(boolean b) {
return b ? SUCCESS : FAILURE; return b ? SUCCESS : FAILURE;
} }

View File

@ -27,7 +27,6 @@ import lombok.RequiredArgsConstructor;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Constants;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.utils.ImmutableCollectors;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.*; import java.util.*;
@ -50,11 +49,7 @@ public abstract class SenderFactory<T> implements Runnable {
protected abstract boolean hasPermission(T t, String node); protected abstract boolean hasPermission(T t, String node);
public final Sender wrap(T t) { public final Sender wrap(T t) {
return new SenderImp(plugin, t, null); return new SenderImp(plugin, t);
}
public final Sender wrap(T t, Set<Permission> toCheck) {
return new SenderImp(plugin, t, toCheck);
} }
@Override @Override
@ -77,9 +72,6 @@ public abstract class SenderFactory<T> implements Runnable {
private class SenderImp implements Sender { private class SenderImp implements Sender {
private final WeakReference<T> tRef; private final WeakReference<T> tRef;
// Cache these permissions, so they can be accessed async
private Map<Permission, Boolean> perms;
@Getter @Getter
private final String name; private final String name;
@ -91,24 +83,12 @@ public abstract class SenderFactory<T> implements Runnable {
@Getter @Getter
private final LuckPermsPlugin platform; private final LuckPermsPlugin platform;
private SenderImp(LuckPermsPlugin platform, T t, Set<Permission> toCheck) { private SenderImp(LuckPermsPlugin platform, T t) {
this.platform = platform; this.platform = platform;
this.tRef = new WeakReference<>(t); this.tRef = new WeakReference<>(t);
this.name = factory.getName(t); this.name = factory.getName(t);
this.uuid = factory.getUuid(t); this.uuid = factory.getUuid(t);
this.console = this.uuid.equals(Constants.getConsoleUUID()) || this.uuid.equals(Constants.getImporterUUID()); this.console = this.uuid.equals(Constants.getConsoleUUID()) || this.uuid.equals(Constants.getImporterUUID());
if (!this.console) {
this.perms = ((toCheck == null || toCheck.isEmpty()) ? Arrays.stream(Permission.values()) : toCheck.stream())
.collect(ImmutableCollectors.toImmutableMap(p -> p, p -> {
for (String s : p.getNodes()) {
if (factory.hasPermission(t, s)) {
return true;
}
}
return false;
}));
}
} }
@Override @Override
@ -128,7 +108,17 @@ public abstract class SenderFactory<T> implements Runnable {
@Override @Override
public boolean hasPermission(Permission permission) { public boolean hasPermission(Permission permission) {
return console || perms.get(permission); if (console) return true;
T t = tRef.get();
if (t == null) return false;
for (String s : permission.getNodes()) {
if (factory.hasPermission(t, s)) {
return true;
}
}
return false;
} }
} }
} }

View File

@ -23,9 +23,13 @@
package me.lucko.luckperms.common.commands.generic; package me.lucko.luckperms.common.commands.generic;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -38,7 +42,7 @@ public class SecondaryMainCommand<T extends PermissionHolder> extends SubCommand
private final List<SecondarySubCommand> secondaryCommands; private final List<SecondarySubCommand> secondaryCommands;
public SecondaryMainCommand(String name, String description, boolean user, List<SecondarySubCommand> secondaryCommands) { public SecondaryMainCommand(String name, String description, boolean user, List<SecondarySubCommand> secondaryCommands) {
super(name, description, null, Predicate.alwaysFalse(), null); super(name, description, null, Predicates.alwaysFalse(), null);
this.secondaryCommands = secondaryCommands; this.secondaryCommands = secondaryCommands;
this.user = user; this.user = user;
} }

View File

@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -34,13 +33,14 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class MetaAddPrefix extends SecondarySubCommand { public class MetaAddPrefix extends SecondarySubCommand {
public MetaAddPrefix() { public MetaAddPrefix() {
super("addprefix", "Adds a prefix", Permission.USER_META_ADDPREFIX, Permission.GROUP_META_ADDPREFIX, Predicate.notInRange(2, 4), super("addprefix", "Adds a prefix", Permission.USER_META_ADDPREFIX, Permission.GROUP_META_ADDPREFIX, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("priority", true, "the priority to add the prefix at"), Arg.create("priority", true, "the priority to add the prefix at"),
Arg.create("prefix", true, "the prefix string"), Arg.create("prefix", true, "the prefix string"),

View File

@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -34,13 +33,14 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class MetaAddSuffix extends SecondarySubCommand { public class MetaAddSuffix extends SecondarySubCommand {
public MetaAddSuffix() { public MetaAddSuffix() {
super("addsuffix", "Adds a suffix", Permission.USER_META_ADDSUFFIX, Permission.GROUP_META_ADDSUFFIX, Predicate.notInRange(2, 4), super("addsuffix", "Adds a suffix", Permission.USER_META_ADDSUFFIX, Permission.GROUP_META_ADDSUFFIX, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("priority", true, "the priority to add the suffix at"), Arg.create("priority", true, "the priority to add the suffix at"),
Arg.create("suffix", true, "the suffix string"), Arg.create("suffix", true, "the suffix string"),

View File

@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -35,13 +34,14 @@ import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class MetaAddTempPrefix extends SecondarySubCommand { public class MetaAddTempPrefix extends SecondarySubCommand {
public MetaAddTempPrefix() { public MetaAddTempPrefix() {
super("addtempprefix", "Adds a prefix temporarily", Permission.USER_META_ADDTEMP_PREFIX, Permission.GROUP_META_ADDTEMP_PREFIX, Predicate.notInRange(3, 5), super("addtempprefix", "Adds a prefix temporarily", Permission.USER_META_ADDTEMP_PREFIX, Permission.GROUP_META_ADDTEMP_PREFIX, Predicates.notInRange(3, 5),
Arg.list( Arg.list(
Arg.create("priority", true, "the priority to add the prefix at"), Arg.create("priority", true, "the priority to add the prefix at"),
Arg.create("prefix", true, "the prefix string"), Arg.create("prefix", true, "the prefix string"),

View File

@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -35,13 +34,14 @@ import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class MetaAddTempSuffix extends SecondarySubCommand { public class MetaAddTempSuffix extends SecondarySubCommand {
public MetaAddTempSuffix() { public MetaAddTempSuffix() {
super("addtempsuffix", "Adds a suffix temporarily", Permission.USER_META_ADDTEMP_SUFFIX, Permission.GROUP_META_ADDTEMP_SUFFIX, Predicate.notInRange(3, 5), super("addtempsuffix", "Adds a suffix temporarily", Permission.USER_META_ADDTEMP_SUFFIX, Permission.GROUP_META_ADDTEMP_SUFFIX, Predicates.notInRange(3, 5),
Arg.list( Arg.list(
Arg.create("priority", true, "the priority to add the suffix at"), Arg.create("priority", true, "the priority to add the suffix at"),
Arg.create("suffix", true, "the suffix string"), Arg.create("suffix", true, "the suffix string"),

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.meta;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -33,13 +32,14 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class MetaClear extends SecondarySubCommand { public class MetaClear extends SecondarySubCommand {
public MetaClear() { public MetaClear() {
super("clear", "Clears all chat meta", Permission.USER_META_CLEAR, Permission.GROUP_META_CLEAR, Predicate.notInRange(0, 2), super("clear", "Clears all chat meta", Permission.USER_META_CLEAR, Permission.GROUP_META_CLEAR, Predicates.notInRange(0, 2),
Arg.list( Arg.list(
Arg.create("server", false, "the server name to filter by"), Arg.create("server", false, "the server name to filter by"),
Arg.create("world", false, "the world name to filter by") Arg.create("world", false, "the world name to filter by")

View File

@ -26,19 +26,19 @@ import me.lucko.luckperms.api.Contexts;
import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.Util; import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.*; import java.util.*;
public class MetaInfo extends SecondarySubCommand { public class MetaInfo extends SecondarySubCommand {
public MetaInfo() { public MetaInfo() {
super("info", "Shows all chat meta", Permission.USER_META_INFO, Permission.GROUP_META_INFO, Predicate.alwaysFalse(), null); super("info", "Shows all chat meta", Permission.USER_META_INFO, Permission.GROUP_META_INFO, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,7 +42,7 @@ import java.util.List;
public class MetaRemovePrefix extends SecondarySubCommand { public class MetaRemovePrefix extends SecondarySubCommand {
public MetaRemovePrefix() { public MetaRemovePrefix() {
super("removeprefix", "Removes a prefix", Permission.USER_META_REMOVEPREFIX, Permission.GROUP_META_REMOVEPREFIX, Predicate.notInRange(2, 4), super("removeprefix", "Removes a prefix", Permission.USER_META_REMOVEPREFIX, Permission.GROUP_META_REMOVEPREFIX, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("priority", true, "the priority to add the prefix at"), Arg.create("priority", true, "the priority to add the prefix at"),
Arg.create("prefix", true, "the prefix string"), Arg.create("prefix", true, "the prefix string"),

View File

@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,7 +42,7 @@ import java.util.List;
public class MetaRemoveSuffix extends SecondarySubCommand { public class MetaRemoveSuffix extends SecondarySubCommand {
public MetaRemoveSuffix() { public MetaRemoveSuffix() {
super("removesuffix", "Removes a suffix", Permission.USER_META_REMOVESUFFIX, Permission.GROUP_META_REMOVESUFFIX, Predicate.notInRange(2, 4), super("removesuffix", "Removes a suffix", Permission.USER_META_REMOVESUFFIX, Permission.GROUP_META_REMOVESUFFIX, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("priority", true, "the priority to add the suffix at"), Arg.create("priority", true, "the priority to add the suffix at"),
Arg.create("suffix", true, "the suffix string"), Arg.create("suffix", true, "the suffix string"),

View File

@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,7 +42,7 @@ import java.util.List;
public class MetaRemoveTempPrefix extends SecondarySubCommand { public class MetaRemoveTempPrefix extends SecondarySubCommand {
public MetaRemoveTempPrefix() { public MetaRemoveTempPrefix() {
super("removetempprefix", "Removes a temporary prefix", Permission.USER_META_REMOVETEMP_PREFIX, Permission.GROUP_META_REMOVETEMP_PREFIX, Predicate.notInRange(2, 4), super("removetempprefix", "Removes a temporary prefix", Permission.USER_META_REMOVETEMP_PREFIX, Permission.GROUP_META_REMOVETEMP_PREFIX, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("priority", true, "the priority to add the prefix at"), Arg.create("priority", true, "the priority to add the prefix at"),
Arg.create("prefix", true, "the prefix string"), Arg.create("prefix", true, "the prefix string"),

View File

@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -35,6 +34,7 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,7 +42,7 @@ import java.util.List;
public class MetaRemoveTempSuffix extends SecondarySubCommand { public class MetaRemoveTempSuffix extends SecondarySubCommand {
public MetaRemoveTempSuffix() { public MetaRemoveTempSuffix() {
super("removetempsuffix", "Removes a temporary suffix", Permission.USER_META_REMOVETEMP_SUFFIX, Permission.GROUP_META_REMOVETEMP_SUFFIX, Predicate.notInRange(2, 4), super("removetempsuffix", "Removes a temporary suffix", Permission.USER_META_REMOVETEMP_SUFFIX, Permission.GROUP_META_REMOVETEMP_SUFFIX, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("priority", true, "the priority to add the suffix at"), Arg.create("priority", true, "the priority to add the suffix at"),
Arg.create("suffix", true, "the suffix string"), Arg.create("suffix", true, "the suffix string"),

View File

@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -36,13 +35,14 @@ import me.lucko.luckperms.common.core.NodeBuilder;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class MetaSet extends SecondarySubCommand { public class MetaSet extends SecondarySubCommand {
public MetaSet() { public MetaSet() {
super("set", "Sets a meta value", Permission.USER_META_SET, Permission.GROUP_META_SET, Predicate.notInRange(2, 4), super("set", "Sets a meta value", Permission.USER_META_SET, Permission.GROUP_META_SET, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("key", true, "the key to set"), Arg.create("key", true, "the key to set"),
Arg.create("value", true, "the value to set"), Arg.create("value", true, "the value to set"),

View File

@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -37,13 +36,14 @@ import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class MetaSetTemp extends SecondarySubCommand { public class MetaSetTemp extends SecondarySubCommand {
public MetaSetTemp() { public MetaSetTemp() {
super("settemp", "Sets a meta value temporarily", Permission.USER_META_SETTEMP, Permission.GROUP_META_SETTEMP, Predicate.notInRange(3, 5), super("settemp", "Sets a meta value temporarily", Permission.USER_META_SETTEMP, Permission.GROUP_META_SETTEMP, Predicates.notInRange(3, 5),
Arg.list( Arg.list(
Arg.create("key", true, "the key to set"), Arg.create("key", true, "the key to set"),
Arg.create("value", true, "the value to set"), Arg.create("value", true, "the value to set"),

View File

@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -34,13 +33,14 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class MetaUnset extends SecondarySubCommand { public class MetaUnset extends SecondarySubCommand {
public MetaUnset() { public MetaUnset() {
super("unset", "Unsets a meta value", Permission.USER_META_UNSET, Permission.GROUP_META_UNSET, Predicate.notInRange(1, 3), super("unset", "Unsets a meta value", Permission.USER_META_UNSET, Permission.GROUP_META_UNSET, Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("key", true, "the key to unset"), Arg.create("key", true, "the key to unset"),
Arg.create("server", false, "the server to remove the meta pair on"), Arg.create("server", false, "the server to remove the meta pair on"),

View File

@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -34,13 +33,14 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class MetaUnsetTemp extends SecondarySubCommand { public class MetaUnsetTemp extends SecondarySubCommand {
public MetaUnsetTemp() { public MetaUnsetTemp() {
super("unsettemp", "Unsets a temporary meta value", Permission.USER_META_UNSETTEMP, Permission.GROUP_META_UNSETTEMP, Predicate.notInRange(1, 3), super("unsettemp", "Unsets a temporary meta value", Permission.USER_META_UNSETTEMP, Permission.GROUP_META_UNSETTEMP, Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("key", true, "the key to unset"), Arg.create("key", true, "the key to unset"),
Arg.create("server", false, "the server to remove the meta pair on"), Arg.create("server", false, "the server to remove the meta pair on"),

View File

@ -24,10 +24,14 @@ package me.lucko.luckperms.common.commands.generic.other;
import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -36,7 +40,7 @@ import java.util.stream.Collectors;
public class HolderShowTracks<T extends PermissionHolder> extends SubCommand<T> { public class HolderShowTracks<T extends PermissionHolder> extends SubCommand<T> {
public HolderShowTracks(boolean user) { public HolderShowTracks(boolean user) {
super("showtracks", "Lists the tracks that the object is on", super("showtracks", "Lists the tracks that the object is on",
user ? Permission.USER_SHOWTRACKS : Permission.GROUP_SHOWTRACKS, Predicate.alwaysFalse(), null); user ? Permission.USER_SHOWTRACKS : Permission.GROUP_SHOWTRACKS, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -34,6 +33,7 @@ import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
@ -43,7 +43,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
public class ParentAdd extends SecondarySubCommand { public class ParentAdd extends SecondarySubCommand {
public ParentAdd() { public ParentAdd() {
super("add", "Sets another group for the object to inherit permissions from", super("add", "Sets another group for the object to inherit permissions from",
Permission.USER_PARENT_ADD, Permission.GROUP_PARENT_ADD, Predicate.notInRange(1, 3), Permission.USER_PARENT_ADD, Permission.GROUP_PARENT_ADD, Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("group", true, "the group to inherit from"), Arg.create("group", true, "the group to inherit from"),
Arg.create("server", false, "the server to inherit the group on"), Arg.create("server", false, "the server to inherit the group on"),

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -35,6 +34,7 @@ import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
@ -44,7 +44,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
public class ParentAddTemp extends SecondarySubCommand { public class ParentAddTemp extends SecondarySubCommand {
public ParentAddTemp() { public ParentAddTemp() {
super("addtemp", "Sets another group for the object to inherit permissions from temporarily", super("addtemp", "Sets another group for the object to inherit permissions from temporarily",
Permission.USER_PARENT_ADDTEMP, Permission.GROUP_PARENT_ADDTEMP, Predicate.notInRange(2, 4), Permission.USER_PARENT_ADDTEMP, Permission.GROUP_PARENT_ADDTEMP, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("group", true, "the group to inherit from"), Arg.create("group", true, "the group to inherit from"),
Arg.create("duration", true, "the duration of the group membership"), Arg.create("duration", true, "the duration of the group membership"),

View File

@ -24,20 +24,20 @@ package me.lucko.luckperms.common.commands.generic.parent;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.Util; import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class ParentInfo extends SecondarySubCommand { public class ParentInfo extends SecondarySubCommand {
public ParentInfo() { public ParentInfo() {
super("info", "Lists the groups that this object inherits from", super("info", "Lists the groups that this object inherits from",
Permission.USER_PARENT_INFO, Permission.GROUP_PARENT_INFO, Predicate.alwaysFalse(), null); Permission.USER_PARENT_INFO, Permission.GROUP_PARENT_INFO, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -34,6 +33,7 @@ import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List; import java.util.List;
@ -43,7 +43,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
public class ParentRemove extends SecondarySubCommand { public class ParentRemove extends SecondarySubCommand {
public ParentRemove() { public ParentRemove() {
super("remove", "Removes a previously set inheritance rule", Permission.USER_PARENT_REMOVE, Permission.GROUP_PARENT_REMOVE, super("remove", "Removes a previously set inheritance rule", Permission.USER_PARENT_REMOVE, Permission.GROUP_PARENT_REMOVE,
Predicate.notInRange(1, 3), Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("group", true, "the group to remove"), Arg.create("group", true, "the group to remove"),
Arg.create("server", false, "the server to remove the group on"), Arg.create("server", false, "the server to remove the group on"),

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List; import java.util.List;
@ -42,7 +42,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
public class ParentRemoveTemp extends SecondarySubCommand { public class ParentRemoveTemp extends SecondarySubCommand {
public ParentRemoveTemp() { public ParentRemoveTemp() {
super("removetemp", "Removes a previously set temporary inheritance rule", super("removetemp", "Removes a previously set temporary inheritance rule",
Permission.USER_PARENT_REMOVETEMP, Permission.GROUP_PARENT_REMOVETEMP, Predicate.notInRange(1, 3), Permission.USER_PARENT_REMOVETEMP, Permission.GROUP_PARENT_REMOVETEMP, Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("group", true, "the group to remove"), Arg.create("group", true, "the group to remove"),
Arg.create("server", false, "the server to remove the group on"), Arg.create("server", false, "the server to remove the group on"),

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -35,6 +34,7 @@ import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
@ -44,7 +44,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
public class ParentSet extends SecondarySubCommand { public class ParentSet extends SecondarySubCommand {
public ParentSet() { public ParentSet() {
super("set", "Removes all other groups the object inherits already and adds them to the one given", super("set", "Removes all other groups the object inherits already and adds them to the one given",
Permission.USER_PARENT_SET, Permission.GROUP_PARENT_SET, Predicate.notInRange(1, 3), Permission.USER_PARENT_SET, Permission.GROUP_PARENT_SET, Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("group", true, "the group to set to"), Arg.create("group", true, "the group to set to"),
Arg.create("server", false, "the server to set the group on"), Arg.create("server", false, "the server to set the group on"),

View File

@ -23,20 +23,24 @@
package me.lucko.luckperms.common.commands.generic.permission; package me.lucko.luckperms.common.commands.generic.permission;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.NodeBuilder; import me.lucko.luckperms.common.core.NodeBuilder;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class PermissionCheck extends SecondarySubCommand { public class PermissionCheck extends SecondarySubCommand {
public PermissionCheck() { public PermissionCheck() {
super("check", "Checks to see if the object has a certain permission node", Permission.USER_PERM_CHECK, Permission.GROUP_PERM_CHECK, super("check", "Checks to see if the object has a certain permission node", Permission.USER_PERM_CHECK, Permission.GROUP_PERM_CHECK,
Predicate.notInRange(1, 3), Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("node", true, "the permission node to check for"), Arg.create("node", true, "the permission node to check for"),
Arg.create("server", false, "the server to check on"), Arg.create("server", false, "the server to check on"),

View File

@ -23,7 +23,10 @@
package me.lucko.luckperms.common.commands.generic.permission; package me.lucko.luckperms.common.commands.generic.permission;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
@ -31,13 +34,14 @@ import me.lucko.luckperms.common.core.InheritanceInfo;
import me.lucko.luckperms.common.core.NodeBuilder; import me.lucko.luckperms.common.core.NodeBuilder;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class PermissionCheckInherits extends SecondarySubCommand { public class PermissionCheckInherits extends SecondarySubCommand {
public PermissionCheckInherits() { public PermissionCheckInherits() {
super("checkinherits", "Checks to see if the object inherits a certain permission node", Permission.USER_PERM_CHECK_INHERITS, Permission.GROUP_PERM_CHECK_INHERITS, super("checkinherits", "Checks to see if the object inherits a certain permission node", Permission.USER_PERM_CHECK_INHERITS, Permission.GROUP_PERM_CHECK_INHERITS,
Predicate.notInRange(1, 3), Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("node", true, "the permission node to check for"), Arg.create("node", true, "the permission node to check for"),
Arg.create("server", false, "the server to check on"), Arg.create("server", false, "the server to check on"),

View File

@ -24,19 +24,19 @@ package me.lucko.luckperms.common.commands.generic.permission;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.Util; import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class PermissionInfo extends SecondarySubCommand { public class PermissionInfo extends SecondarySubCommand {
public PermissionInfo() { public PermissionInfo() {
super("info", "Lists the permission nodes the object has", Permission.USER_PERM_INFO, Permission.GROUP_PERM_INFO, Predicate.alwaysFalse(), null); super("info", "Lists the permission nodes the object has", Permission.USER_PERM_INFO, Permission.GROUP_PERM_INFO, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
@ -41,7 +41,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getBoolTabComplete;
public class PermissionSet extends SecondarySubCommand { public class PermissionSet extends SecondarySubCommand {
public PermissionSet() { public PermissionSet() {
super("set", "Sets a permission for the object", Permission.USER_PERM_SET, Permission.GROUP_PERM_SET, Predicate.notInRange(2, 4), super("set", "Sets a permission for the object", Permission.USER_PERM_SET, Permission.GROUP_PERM_SET, Predicates.notInRange(2, 4),
Arg.list( Arg.list(
Arg.create("node", true, "the permission node to set"), Arg.create("node", true, "the permission node to set"),
Arg.create("true|false", true, "the value of the node"), Arg.create("true|false", true, "the value of the node"),

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -34,6 +33,7 @@ import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
@ -43,7 +43,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getBoolTabComplete;
public class PermissionSetTemp extends SecondarySubCommand { public class PermissionSetTemp extends SecondarySubCommand {
public PermissionSetTemp() { public PermissionSetTemp() {
super("settemp", "Sets a permission for the object temporarily", Permission.USER_PERM_SETTEMP, Permission.GROUP_PERM_SETTEMP, super("settemp", "Sets a permission for the object temporarily", Permission.USER_PERM_SETTEMP, Permission.GROUP_PERM_SETTEMP,
Predicate.notInRange(3, 5), Predicates.notInRange(3, 5),
Arg.list( Arg.list(
Arg.create("node", true, "the permission node to set"), Arg.create("node", true, "the permission node to set"),
Arg.create("true|false", true, "the value of the node"), Arg.create("true|false", true, "the value of the node"),

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -33,13 +32,14 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List; import java.util.List;
public class PermissionUnset extends SecondarySubCommand { public class PermissionUnset extends SecondarySubCommand {
public PermissionUnset() { public PermissionUnset() {
super("unset", "Unsets a permission for the object", Permission.USER_PERM_UNSET, Permission.GROUP_PERM_UNSET, Predicate.notInRange(1, 3), super("unset", "Unsets a permission for the object", Permission.USER_PERM_UNSET, Permission.GROUP_PERM_UNSET, Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("node", true, "the permission node to unset"), Arg.create("node", true, "the permission node to unset"),
Arg.create("server", false, "the server to remove the permission node on"), Arg.create("server", false, "the server to remove the permission node on"),

View File

@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand; import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
@ -33,6 +32,7 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List; import java.util.List;
@ -40,7 +40,7 @@ import java.util.List;
public class PermissionUnsetTemp extends SecondarySubCommand { public class PermissionUnsetTemp extends SecondarySubCommand {
public PermissionUnsetTemp() { public PermissionUnsetTemp() {
super("unsettemp", "Unsets a temporary permission for the object", Permission.USER_PERM_UNSETTEMP, Permission.GROUP_PERM_UNSETTEMP, super("unsettemp", "Unsets a temporary permission for the object", Permission.USER_PERM_UNSETTEMP, Permission.GROUP_PERM_UNSETTEMP,
Predicate.notInRange(1, 3), Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("node", true, "the permission node to unset"), Arg.create("node", true, "the permission node to unset"),
Arg.create("server", false, "the server to remove the permission node on"), Arg.create("server", false, "the server to remove the permission node on"),

View File

@ -24,11 +24,15 @@ package me.lucko.luckperms.common.commands.group.subcommands;
import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.NodeFactory;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
@ -39,7 +43,7 @@ import java.util.Set;
public class GroupBulkChange extends SubCommand<Group> { public class GroupBulkChange extends SubCommand<Group> {
public GroupBulkChange() { public GroupBulkChange() {
super("bulkchange", "Applies a bulk permission change to the group's permissions", Permission.GROUP_BULKCHANGE, Predicate.not(3), super("bulkchange", "Applies a bulk permission change to the group's permissions", Permission.GROUP_BULKCHANGE, Predicates.not(3),
Arg.list( Arg.list(
Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"), Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"),
Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"), Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"),

View File

@ -23,19 +23,23 @@
package me.lucko.luckperms.common.commands.group.subcommands; package me.lucko.luckperms.common.commands.group.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class GroupClear extends SubCommand<Group> { public class GroupClear extends SubCommand<Group> {
public GroupClear() { public GroupClear() {
super("clear", "Clears the group's permissions and parent groups", Permission.GROUP_CLEAR, Predicate.notInRange(0, 2), super("clear", "Clears the group's permissions and parent groups", Permission.GROUP_CLEAR, Predicates.notInRange(0, 2),
Arg.list( Arg.list(
Arg.create("server", false, "the server name to filter by"), Arg.create("server", false, "the server name to filter by"),
Arg.create("world", false, "the world name to filter by") Arg.create("world", false, "the world name to filter by")

View File

@ -23,18 +23,22 @@
package me.lucko.luckperms.common.commands.group.subcommands; package me.lucko.luckperms.common.commands.group.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class GroupClone extends SubCommand<Group> { public class GroupClone extends SubCommand<Group> {
public GroupClone() { public GroupClone() {
super("clone", "Clone the group", Permission.GROUP_CLONE, Predicate.not(1), super("clone", "Clone the group", Permission.GROUP_CLONE, Predicates.not(1),
Arg.list(Arg.create("name", true, "the name of the clone")) Arg.list(Arg.create("name", true, "the name of the clone"))
); );
} }

View File

@ -24,18 +24,18 @@ package me.lucko.luckperms.common.commands.group.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand; import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class GroupInfo extends SubCommand<Group> { public class GroupInfo extends SubCommand<Group> {
public GroupInfo() { public GroupInfo() {
super("info", "Gives info about the group", Permission.GROUP_INFO, Predicate.alwaysFalse(), null); super("info", "Gives info about the group", Permission.GROUP_INFO, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -23,18 +23,22 @@
package me.lucko.luckperms.common.commands.group.subcommands; package me.lucko.luckperms.common.commands.group.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class GroupRename extends SubCommand<Group> { public class GroupRename extends SubCommand<Group> {
public GroupRename() { public GroupRename() {
super("rename", "Rename the group", Permission.GROUP_RENAME, Predicate.not(1), super("rename", "Rename the group", Permission.GROUP_RENAME, Predicates.not(1),
Arg.list(Arg.create("name", true, "the new name")) Arg.list(Arg.create("name", true, "the new name"))
); );
} }

View File

@ -24,10 +24,14 @@ package me.lucko.luckperms.common.commands.log.subcommands;
import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
import me.lucko.luckperms.common.utils.Predicates;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -38,7 +42,7 @@ import java.util.List;
public class LogExport extends SubCommand<Log> { public class LogExport extends SubCommand<Log> {
public LogExport() { public LogExport() {
super("export", "Export the log to a file", Permission.LOG_EXPORT, Predicate.not(1), super("export", "Export the log to a file", Permission.LOG_EXPORT, Predicates.not(1),
Arg.list(Arg.create("file", true, "the name of the file")) Arg.list(Arg.create("file", true, "the name of the file"))
); );
} }

View File

@ -24,12 +24,16 @@ package me.lucko.luckperms.common.commands.log.subcommands;
import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,7 +41,7 @@ import java.util.SortedMap;
public class LogGroupHistory extends SubCommand<Log> { public class LogGroupHistory extends SubCommand<Log> {
public LogGroupHistory() { public LogGroupHistory() {
super("grouphistory", "View an group's history", Permission.LOG_GROUP_HISTORY, Predicate.notInRange(1, 2), super("grouphistory", "View an group's history", Permission.LOG_GROUP_HISTORY, Predicates.notInRange(1, 2),
Arg.list( Arg.list(
Arg.create("group", true, "the name of the group"), Arg.create("group", true, "the name of the group"),
Arg.create("page", false, "the page number to view") Arg.create("page", false, "the page number to view")

View File

@ -23,10 +23,14 @@
package me.lucko.luckperms.common.commands.log.subcommands; package me.lucko.luckperms.common.commands.log.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -34,7 +38,7 @@ import java.util.UUID;
public class LogNotify extends SubCommand<Log> { public class LogNotify extends SubCommand<Log> {
public LogNotify() { public LogNotify() {
super("notify", "Toggle notifications", Permission.LOG_NOTIFY, Predicate.notInRange(0, 1), super("notify", "Toggle notifications", Permission.LOG_NOTIFY, Predicates.notInRange(0, 1),
Arg.list(Arg.create("on|off", false, "whether to toggle on or off")) Arg.list(Arg.create("on|off", false, "whether to toggle on or off"))
); );
} }

View File

@ -30,6 +30,7 @@ import me.lucko.luckperms.common.constants.Patterns;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -38,7 +39,7 @@ import java.util.UUID;
public class LogRecent extends SubCommand<Log> { public class LogRecent extends SubCommand<Log> {
public LogRecent() { public LogRecent() {
super("recent", "View recent actions", Permission.LOG_RECENT, Predicate.notInRange(0, 2), super("recent", "View recent actions", Permission.LOG_RECENT, Predicates.notInRange(0, 2),
Arg.list( Arg.list(
Arg.create("user", false, "the name/uuid of the user to filter by"), Arg.create("user", false, "the name/uuid of the user to filter by"),
Arg.create("page", false, "the page number to view") Arg.create("page", false, "the page number to view")

View File

@ -24,11 +24,15 @@ package me.lucko.luckperms.common.commands.log.subcommands;
import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,7 +41,7 @@ import java.util.stream.Collectors;
public class LogSearch extends SubCommand<Log> { public class LogSearch extends SubCommand<Log> {
public LogSearch() { public LogSearch() {
super("search", "Search the log for an entry", Permission.LOG_SEARCH, Predicate.is(0), super("search", "Search the log for an entry", Permission.LOG_SEARCH, Predicates.is(0),
Arg.list( Arg.list(
Arg.create("query", true, "the query to search by"), Arg.create("query", true, "the query to search by"),
Arg.create("page", false, "the page number to view") Arg.create("page", false, "the page number to view")

View File

@ -24,12 +24,16 @@ package me.lucko.luckperms.common.commands.log.subcommands;
import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,7 +41,7 @@ import java.util.SortedMap;
public class LogTrackHistory extends SubCommand<Log> { public class LogTrackHistory extends SubCommand<Log> {
public LogTrackHistory() { public LogTrackHistory() {
super("trackhistory", "View a track's history", Permission.LOG_TRACK_HISTORY, Predicate.notInRange(1, 2), super("trackhistory", "View a track's history", Permission.LOG_TRACK_HISTORY, Predicates.notInRange(1, 2),
Arg.list( Arg.list(
Arg.create("track", true, "the name of the track"), Arg.create("track", true, "the name of the track"),
Arg.create("page", false, "the page number to view") Arg.create("page", false, "the page number to view")

View File

@ -30,6 +30,7 @@ import me.lucko.luckperms.common.constants.Patterns;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
import me.lucko.luckperms.common.utils.DateUtil; import me.lucko.luckperms.common.utils.DateUtil;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -38,7 +39,7 @@ import java.util.UUID;
public class LogUserHistory extends SubCommand<Log> { public class LogUserHistory extends SubCommand<Log> {
public LogUserHistory() { public LogUserHistory() {
super("userhistory", "View a user's history", Permission.LOG_USER_HISTORY, Predicate.notInRange(1, 2), super("userhistory", "View a user's history", Permission.LOG_USER_HISTORY, Predicates.notInRange(1, 2),
Arg.list( Arg.list(
Arg.create("user", true, "the name/uuid of the user"), Arg.create("user", true, "the name/uuid of the user"),
Arg.create("page", false, "the page number to view") Arg.create("page", false, "the page number to view")

View File

@ -30,13 +30,14 @@ import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class TrackAppend extends SubCommand<Track> { public class TrackAppend extends SubCommand<Track> {
public TrackAppend() { public TrackAppend() {
super("append", "Appends a group onto the end of the track", Permission.TRACK_APPEND, Predicate.not(1), super("append", "Appends a group onto the end of the track", Permission.TRACK_APPEND, Predicates.not(1),
Arg.list(Arg.create("group", true, "the group to append")) Arg.list(Arg.create("group", true, "the group to append"))
); );
} }

View File

@ -24,19 +24,19 @@ package me.lucko.luckperms.common.commands.track.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand; import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class TrackClear extends SubCommand<Track> { public class TrackClear extends SubCommand<Track> {
public TrackClear() { public TrackClear() {
super("clear", "Clears the groups on the track", Permission.TRACK_CLEAR, Predicate.alwaysFalse(), null); super("clear", "Clears the groups on the track", Permission.TRACK_CLEAR, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -23,18 +23,22 @@
package me.lucko.luckperms.common.commands.track.subcommands; package me.lucko.luckperms.common.commands.track.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class TrackClone extends SubCommand<Track> { public class TrackClone extends SubCommand<Track> {
public TrackClone() { public TrackClone() {
super("clone", "Clone the track", Permission.TRACK_CLONE, Predicate.not(1), super("clone", "Clone the track", Permission.TRACK_CLONE, Predicates.not(1),
Arg.list(Arg.create("name", true, "the name of the clone")) Arg.list(Arg.create("name", true, "the name of the clone"))
); );
} }

View File

@ -23,16 +23,20 @@
package me.lucko.luckperms.common.commands.track.subcommands; package me.lucko.luckperms.common.commands.track.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class TrackInfo extends SubCommand<Track> { public class TrackInfo extends SubCommand<Track> {
public TrackInfo() { public TrackInfo() {
super("info", "Gives info about the track", Permission.TRACK_INFO, Predicate.alwaysFalse(), null); super("info", "Gives info about the track", Permission.TRACK_INFO, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -30,13 +30,14 @@ import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class TrackInsert extends SubCommand<Track> { public class TrackInsert extends SubCommand<Track> {
public TrackInsert() { public TrackInsert() {
super("insert", "Inserts a group at a given position along the track", Permission.TRACK_INSERT, Predicate.not(2), super("insert", "Inserts a group at a given position along the track", Permission.TRACK_INSERT, Predicates.not(2),
Arg.list( Arg.list(
Arg.create("group", true, "the group to insert"), Arg.create("group", true, "the group to insert"),
Arg.create("position", true, "the position to insert the group at (the first position on the track is 1)") Arg.create("position", true, "the position to insert the group at (the first position on the track is 1)")

View File

@ -29,13 +29,14 @@ import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List; import java.util.List;
public class TrackRemove extends SubCommand<Track> { public class TrackRemove extends SubCommand<Track> {
public TrackRemove() { public TrackRemove() {
super("remove", "Removes a group from the track", Permission.TRACK_REMOVE, Predicate.not(1), super("remove", "Removes a group from the track", Permission.TRACK_REMOVE, Predicates.not(1),
Arg.list(Arg.create("group", true, "the group to remove")) Arg.list(Arg.create("group", true, "the group to remove"))
); );
} }

View File

@ -23,18 +23,22 @@
package me.lucko.luckperms.common.commands.track.subcommands; package me.lucko.luckperms.common.commands.track.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class TrackRename extends SubCommand<Track> { public class TrackRename extends SubCommand<Track> {
public TrackRename() { public TrackRename() {
super("rename", "Rename the track", Permission.TRACK_RENAME, Predicate.not(1), super("rename", "Rename the track", Permission.TRACK_RENAME, Predicates.not(1),
Arg.list(Arg.create("name", true, "the new name")) Arg.list(Arg.create("name", true, "the new name"))
); );
} }

View File

@ -24,11 +24,15 @@ package me.lucko.luckperms.common.commands.user.subcommands;
import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.NodeFactory;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
@ -39,7 +43,7 @@ import java.util.Set;
public class UserBulkChange extends SubCommand<User> { public class UserBulkChange extends SubCommand<User> {
public UserBulkChange() { public UserBulkChange() {
super("bulkchange", "Applies a bulk permission change to the user's permissions", Permission.USER_BULKCHANGE, Predicate.not(3), super("bulkchange", "Applies a bulk permission change to the user's permissions", Permission.USER_BULKCHANGE, Predicates.not(3),
Arg.list( Arg.list(
Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"), Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"),
Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"), Arg.create("from", true, "the server/world to be changed from. can be 'global' or 'null' respectively"),

View File

@ -23,19 +23,23 @@
package me.lucko.luckperms.common.commands.user.subcommands; package me.lucko.luckperms.common.commands.user.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class UserClear extends SubCommand<User> { public class UserClear extends SubCommand<User> {
public UserClear() { public UserClear() {
super("clear", "Clears the user's permissions and groups", Permission.USER_CLEAR, Predicate.notInRange(0, 2), super("clear", "Clears the user's permissions and groups", Permission.USER_CLEAR, Predicates.notInRange(0, 2),
Arg.list( Arg.list(
Arg.create("server", false, "the server name to filter by"), Arg.create("server", false, "the server name to filter by"),
Arg.create("world", false, "the world name to filter by") Arg.create("world", false, "the world name to filter by")

View File

@ -37,6 +37,7 @@ import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
@ -48,7 +49,7 @@ import java.util.stream.Collectors;
public class UserDemote extends SubCommand<User> { public class UserDemote extends SubCommand<User> {
public UserDemote() { public UserDemote() {
super("demote", "Demotes the user down a track", Permission.USER_DEMOTE, Predicate.notInRange(1, 3), super("demote", "Demotes the user down a track", Permission.USER_DEMOTE, Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("track", true, "the track to demote the user down"), Arg.create("track", true, "the track to demote the user down"),
Arg.create("server", false, "the server to promote on"), Arg.create("server", false, "the server to promote on"),

View File

@ -24,18 +24,18 @@ package me.lucko.luckperms.common.commands.user.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand; import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class UserGetUUID extends SubCommand<User> { public class UserGetUUID extends SubCommand<User> {
public UserGetUUID() { public UserGetUUID() {
super("getuuid", "Displays the user's internal LuckPerms unique id", Permission.USER_GETUUID, Predicate.alwaysFalse(), null); super("getuuid", "Displays the user's internal LuckPerms unique id", Permission.USER_GETUUID, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -24,18 +24,18 @@ package me.lucko.luckperms.common.commands.user.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Predicate;
import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand; import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import java.util.List; import java.util.List;
public class UserInfo extends SubCommand<User> { public class UserInfo extends SubCommand<User> {
public UserInfo() { public UserInfo() {
super("info", "Shows info about the user", Permission.USER_INFO, Predicate.alwaysFalse(), null); super("info", "Shows info about the user", Permission.USER_INFO, Predicates.alwaysFalse(), null);
} }
@Override @Override

View File

@ -37,6 +37,7 @@ import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.tracks.Track; import me.lucko.luckperms.common.tracks.Track;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.ArgumentChecker; import me.lucko.luckperms.common.utils.ArgumentChecker;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
@ -48,7 +49,7 @@ import java.util.stream.Collectors;
public class UserPromote extends SubCommand<User> { public class UserPromote extends SubCommand<User> {
public UserPromote() { public UserPromote() {
super("promote", "Promotes the user up a track", Permission.USER_PROMOTE, Predicate.notInRange(1, 3), super("promote", "Promotes the user up a track", Permission.USER_PROMOTE, Predicates.notInRange(1, 3),
Arg.list( Arg.list(
Arg.create("track", true, "the track to promote the user up"), Arg.create("track", true, "the track to promote the user up"),
Arg.create("server", false, "the server to promote on"), Arg.create("server", false, "the server to promote on"),

View File

@ -23,19 +23,23 @@
package me.lucko.luckperms.common.commands.user.subcommands; package me.lucko.luckperms.common.commands.user.subcommands;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.data.LogEntry; import me.lucko.luckperms.common.data.LogEntry;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import java.util.List; import java.util.List;
public class UserSetPrimaryGroup extends SubCommand<User> { public class UserSetPrimaryGroup extends SubCommand<User> {
public UserSetPrimaryGroup() { public UserSetPrimaryGroup() {
super("setprimarygroup", "Sets the user's primary group", Permission.USER_SETPRIMARYGROUP, Predicate.not(1), super("setprimarygroup", "Sets the user's primary group", Permission.USER_SETPRIMARYGROUP, Predicates.not(1),
Arg.list(Arg.create("group", true, "the group to set as the primary group")) Arg.list(Arg.create("group", true, "the group to set as the primary group"))
); );
} }

View File

@ -24,12 +24,16 @@ package me.lucko.luckperms.common.commands.usersbulkedit.subcommands;
import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.NodeFactory;
import me.lucko.luckperms.common.storage.Datastore; import me.lucko.luckperms.common.storage.Datastore;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
@ -37,7 +41,7 @@ import java.util.*;
public class BulkEditGroup extends SubCommand<Datastore> { public class BulkEditGroup extends SubCommand<Datastore> {
public BulkEditGroup() { public BulkEditGroup() {
super("group", "Bulk edit group memberships", Permission.USER_BULKCHANGE, Predicate.not(4), super("group", "Bulk edit group memberships", Permission.USER_BULKCHANGE, Predicates.not(4),
Arg.list( Arg.list(
Arg.create("group|null", true, "the group to edit ('null' to select and edit all groups)"), Arg.create("group|null", true, "the group to edit ('null' to select and edit all groups)"),
Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"), Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"),

View File

@ -24,12 +24,16 @@ package me.lucko.luckperms.common.commands.usersbulkedit.subcommands;
import me.lucko.luckperms.api.Node; import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.Arg;
import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.NodeFactory; import me.lucko.luckperms.common.core.NodeFactory;
import me.lucko.luckperms.common.storage.Datastore; import me.lucko.luckperms.common.storage.Datastore;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException; import me.lucko.luckperms.exceptions.ObjectLacksException;
@ -37,7 +41,7 @@ import java.util.*;
public class BulkEditPermission extends SubCommand<Datastore> { public class BulkEditPermission extends SubCommand<Datastore> {
public BulkEditPermission() { public BulkEditPermission() {
super("permission", "Bulk edit permissions", Permission.USER_BULKCHANGE, Predicate.not(4), super("permission", "Bulk edit permissions", Permission.USER_BULKCHANGE, Predicates.not(4),
Arg.list( Arg.list(
Arg.create("node|null", true, "the node to edit ('null' to select and edit all nodes)"), Arg.create("node|null", true, "the node to edit ('null' to select and edit all nodes)"),
Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"), Arg.create("server|world", true, "if the bulk change is modifying a 'server' or a 'world'"),

View File

@ -27,6 +27,7 @@ import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.UncheckedExecutionException;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -57,7 +58,7 @@ public class Patterns {
public static Pattern compile(String regex) { public static Pattern compile(String regex) {
try { try {
return CACHE.get(regex); return CACHE.get(regex);
} catch (ExecutionException e) { } catch (UncheckedExecutionException | ExecutionException e) {
return null; return null;
} }
} }

View File

@ -114,7 +114,7 @@ public class Importer {
int errors = 0; int errors = 0;
for (Map.Entry<Integer, Result> e : cmdResult.entrySet()) { for (Map.Entry<Integer, Result> e : cmdResult.entrySet()) {
if (e.getValue().getResult() != null && !e.getValue().getResult().booleanValue()) { if (e.getValue().getResult() != null && !e.getValue().getResult().asBoolean()) {
errors++; errors++;
} }
} }
@ -129,7 +129,7 @@ public class Importer {
int errIndex = 1; int errIndex = 1;
for (Map.Entry<Integer, Result> e : cmdResult.entrySet()) { for (Map.Entry<Integer, Result> e : cmdResult.entrySet()) {
if (e.getValue().getResult() != null && !e.getValue().getResult().booleanValue()) { if (e.getValue().getResult() != null && !e.getValue().getResult().asBoolean()) {
Message.IMPORT_END_ERROR_HEADER.send(executor, errIndex, e.getKey(), e.getValue().getCommand(), e.getValue().getResult().toString()); Message.IMPORT_END_ERROR_HEADER.send(executor, errIndex, e.getKey(), e.getValue().getCommand(), e.getValue().getResult().toString());
for (String s : e.getValue().getOutput()) { for (String s : e.getValue().getOutput()) {
Message.IMPORT_END_ERROR_CONTENT.send(executor, s); Message.IMPORT_END_ERROR_CONTENT.send(executor, s);
@ -147,7 +147,7 @@ public class Importer {
int errors = 0; int errors = 0;
for (Map.Entry<Integer, Result> e : cmdResult.entrySet()) { for (Map.Entry<Integer, Result> e : cmdResult.entrySet()) {
if (e.getValue().getResult() != null && !e.getValue().getResult().booleanValue()) { if (e.getValue().getResult() != null && !e.getValue().getResult().asBoolean()) {
errors++; errors++;
} }
} }

View File

@ -24,6 +24,7 @@ package me.lucko.luckperms.common.storage;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.experimental.Delegate;
import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
@ -44,13 +45,13 @@ import java.util.function.Supplier;
*/ */
@RequiredArgsConstructor(access = AccessLevel.PRIVATE) @RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class AbstractDatastore implements Datastore { public class AbstractDatastore implements Datastore {
public static Datastore wrap(LuckPermsPlugin plugin, AbstractBacking backing) { public static Datastore wrap(LuckPermsPlugin plugin, AbstractBacking backing) {
BufferedOutputDatastore bufferedDs = BufferedOutputDatastore.wrap(TolerantDatastore.wrap(new AbstractDatastore(backing)), 1000L); BufferedOutputDatastore bufferedDs = BufferedOutputDatastore.wrap(TolerantDatastore.wrap(new AbstractDatastore(backing)), 1000L);
plugin.doAsyncRepeating(bufferedDs, 10L); plugin.doAsyncRepeating(bufferedDs, 10L);
return bufferedDs; return bufferedDs;
} }
@Delegate(types = Delegated.class)
private final AbstractBacking backing; private final AbstractBacking backing;
private <T> LPFuture<T> makeFuture(Supplier<T> supplier) { private <T> LPFuture<T> makeFuture(Supplier<T> supplier) {
@ -62,46 +63,11 @@ public class AbstractDatastore implements Datastore {
return future; return future;
} }
@Override
public String getName() {
return backing.getName();
}
@Override
public boolean isAcceptingLogins() {
return backing.isAcceptingLogins();
}
@Override
public void setAcceptingLogins(boolean acceptingLogins) {
backing.setAcceptingLogins(acceptingLogins);
}
@Override
public void doAsync(Runnable r) {
backing.doAsync(r);
}
@Override
public void doSync(Runnable r) {
backing.doSync(r);
}
@Override @Override
public Datastore force() { public Datastore force() {
return this; return this;
} }
@Override
public void init() {
backing.init();
}
@Override
public void shutdown() {
backing.shutdown();
}
@Override @Override
public LPFuture<Boolean> logAction(LogEntry entry) { public LPFuture<Boolean> logAction(LogEntry entry) {
return makeFuture(() -> backing.logAction(entry)); return makeFuture(() -> backing.logAction(entry));
@ -196,4 +162,14 @@ public class AbstractDatastore implements Datastore {
public LPFuture<String> getName(UUID uuid) { public LPFuture<String> getName(UUID uuid) {
return makeFuture(() -> backing.getName(uuid)); return makeFuture(() -> backing.getName(uuid));
} }
private interface Delegated {
String getName();
boolean isAcceptingLogins();
void setAcceptingLogins(boolean b);
void doAsync(Runnable r);
void doSync(Runnable r);
void init();
void shutdown();
}
} }

View File

@ -91,6 +91,7 @@ public class BufferedOutputDatastore implements Datastore, Runnable {
userOutputBuffer.flush(flushTime); userOutputBuffer.flush(flushTime);
} }
@Override
public Datastore force() { public Datastore force() {
return backing; return backing;
} }

View File

@ -24,6 +24,7 @@ package me.lucko.luckperms.common.storage;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.experimental.Delegate;
import me.lucko.luckperms.api.LogEntry; import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.common.data.Log; import me.lucko.luckperms.common.data.Log;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
@ -46,44 +47,16 @@ public class TolerantDatastore implements Datastore {
return new TolerantDatastore(datastore); return new TolerantDatastore(datastore);
} }
@Delegate(types = Delegated.class)
private final Datastore backing; private final Datastore backing;
private final Phaser phaser = new Phaser(); private final Phaser phaser = new Phaser();
@Override
public String getName() {
return backing.getName();
}
@Override
public boolean isAcceptingLogins() {
return backing.isAcceptingLogins();
}
@Override
public void setAcceptingLogins(boolean acceptingLogins) {
backing.setAcceptingLogins(acceptingLogins);
}
@Override
public void doAsync(Runnable r) {
backing.doAsync(r);
}
@Override
public void doSync(Runnable r) {
backing.doSync(r);
}
@Override @Override
public Datastore force() { public Datastore force() {
return this; return this;
} }
@Override
public void init() {
backing.init();
}
@Override @Override
public void shutdown() { public void shutdown() {
// Wait for other threads to finish. // Wait for other threads to finish.
@ -285,4 +258,13 @@ public class TolerantDatastore implements Datastore {
phaser.arriveAndDeregister(); phaser.arriveAndDeregister();
} }
} }
private interface Delegated {
String getName();
boolean isAcceptingLogins();
void setAcceptingLogins(boolean b);
void doAsync(Runnable r);
void doSync(Runnable r);
void init();
}
} }

View File

@ -22,6 +22,7 @@
package me.lucko.luckperms.common.tracks; package me.lucko.luckperms.common.tracks;
import com.google.common.collect.ImmutableList;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -66,7 +67,7 @@ public class Track implements Identifiable<String> {
* @return am ordered {@link List} of the groups on this track * @return am ordered {@link List} of the groups on this track
*/ */
public List<String> getGroups() { public List<String> getGroups() {
return Collections.unmodifiableList(groups); return ImmutableList.copyOf(groups);
} }
public void setGroups(List<String> groups) { public void setGroups(List<String> groups) {

View File

@ -99,7 +99,7 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
* Sets up the UserData cache * Sets up the UserData cache
* Blocking call. * Blocking call.
*/ */
public void setupData(boolean op) { public synchronized void setupData(boolean op) {
if (userData != null) { if (userData != null) {
return; return;
} }
@ -120,11 +120,11 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
* Blocking call. * Blocking call.
*/ */
private synchronized void refreshPermissions() { private synchronized void refreshPermissions() {
if (userData == null) { UserData ud = userData;
if (ud == null) {
return; return;
} }
UserData ud = userData;
ud.recalculatePermissions(); ud.recalculatePermissions();
ud.recalculateMeta(); ud.recalculateMeta();
getPlugin().getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this))); getPlugin().getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));

View File

@ -22,16 +22,14 @@
package me.lucko.luckperms.common.users; package me.lucko.luckperms.common.users;
import lombok.AccessLevel; import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import me.lucko.luckperms.common.utils.Identifiable; import me.lucko.luckperms.common.utils.Identifiable;
import java.util.UUID; import java.util.UUID;
@Getter @Getter
@ToString @ToString
@EqualsAndHashCode(of = "uuid")
@AllArgsConstructor(access = AccessLevel.PRIVATE) @AllArgsConstructor(access = AccessLevel.PRIVATE)
public class UserIdentifier implements Identifiable<UUID> { public class UserIdentifier implements Identifiable<UUID> {
public static UserIdentifier of(UUID uuid, String username) { public static UserIdentifier of(UUID uuid, String username) {
@ -45,17 +43,4 @@ public class UserIdentifier implements Identifiable<UUID> {
public UUID getId() { public UUID getId() {
return getUuid(); return getUuid();
} }
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof UserIdentifier)) return false;
final UserIdentifier other = (UserIdentifier) o;
final Object thisUuid = this.getUuid();
final Object otherUuid = other.getUuid();
return thisUuid == null ? otherUuid == null : thisUuid.equals(otherUuid);
}
public int hashCode() {
return 59 + (this.getUuid() == null ? 43 : this.getUuid().hashCode());
}
} }

View File

@ -42,7 +42,6 @@ public class UserManager extends AbstractManager<UserIdentifier, User> {
* @param name The name to search by * @param name The name to search by
* @return a {@link User} object if the user is loaded, returns null if the user is not loaded * @return a {@link User} object if the user is loaded, returns null if the user is not loaded
*/ */
@SuppressWarnings("OptionalGetWithoutIsPresent")
public User get(String name) { public User get(String name) {
for (User user : getAll().values()) { for (User user : getAll().values()) {
if (user.getName().equalsIgnoreCase(name)) { if (user.getName().equalsIgnoreCase(name)) {

View File

@ -22,10 +22,7 @@
package me.lucko.luckperms.common.utils; package me.lucko.luckperms.common.utils;
import lombok.AllArgsConstructor; import lombok.*;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -96,29 +93,15 @@ public abstract class Buffer<T, R> implements Runnable {
flush(DEFAULT_FLUSH_TIME); flush(DEFAULT_FLUSH_TIME);
} }
@Getter
@EqualsAndHashCode(of = "object")
@AllArgsConstructor @AllArgsConstructor
private static class BufferedObject<T, R> { private static class BufferedObject<T, R> {
@Getter
@Setter @Setter
private long bufferTime; private long bufferTime;
@Getter
private final T object; private final T object;
@Getter
private final AbstractFuture<R> future; private final AbstractFuture<R> future;
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof Buffer.BufferedObject)) return false;
final BufferedObject other = (BufferedObject) o;
return this.getObject() == null ? other.getObject() == null : this.getObject().equals(other.getObject());
}
public int hashCode() {
return 59 + (this.getObject() == null ? 43 : this.getObject().hashCode());
}
} }
} }

View File

@ -20,38 +20,39 @@
* SOFTWARE. * SOFTWARE.
*/ */
package me.lucko.luckperms.common.commands; package me.lucko.luckperms.common.utils;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
@SuppressWarnings({"WeakerAccess", "unused"}) @SuppressWarnings({"WeakerAccess", "unused"})
@UtilityClass @UtilityClass
public class Predicate { public class Predicates {
public static <T> java.util.function.Predicate<T> alwaysFalse() { public static <T> Predicate<T> alwaysFalse() {
return t -> false; return t -> false;
} }
public static <T> java.util.function.Predicate<T> alwaysTrue() { public static <T> Predicate<T> alwaysTrue() {
return t -> true; return t -> true;
} }
public static java.util.function.Predicate<Integer> notInRange(Integer start, Integer end) { public static Predicate<Integer> notInRange(Integer start, Integer end) {
return inverse(inRange(start, end)); return inverse(inRange(start, end));
} }
public static java.util.function.Predicate<Integer> inRange(Integer start, Integer end) { public static Predicate<Integer> inRange(Integer start, Integer end) {
return isOneOf(IntStream.rangeClosed(start, end).boxed().collect(Collectors.toSet())); return isOneOf(IntStream.rangeClosed(start, end).boxed().collect(Collectors.toSet()));
} }
public static <T> java.util.function.Predicate<T> notOneOf(Set<T> ts) { public static <T> Predicate<T> notOneOf(Set<T> ts) {
return inverse(isOneOf(ts)); return inverse(isOneOf(ts));
} }
public static <T> java.util.function.Predicate<T> isOneOf(Set<T> ta) { public static <T> Predicate<T> isOneOf(Set<T> ta) {
return t -> { return t -> {
for (T i : ta) { for (T i : ta) {
if (i == t) { if (i == t) {
@ -62,15 +63,15 @@ public class Predicate {
}; };
} }
public static <T> java.util.function.Predicate<T> not(T t) { public static <T> Predicate<T> not(T t) {
return inverse(is(t)); return inverse(is(t));
} }
public static <T> java.util.function.Predicate<T> is(T t) { public static <T> Predicate<T> is(T t) {
return t2 -> t == t2; return t2 -> t == t2;
} }
public static <T> java.util.function.Predicate<T> inverse(java.util.function.Predicate<T> t) { public static <T> Predicate<T> inverse(Predicate<T> t) {
return t2 -> !t.test(t2); return t2 -> !t.test(t2);
} }
} }

View File

@ -307,7 +307,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
@Override @Override
public List<Sender> getNotifyListeners() { public List<Sender> getNotifyListeners() {
return game.getServer().getOnlinePlayers().stream() return game.getServer().getOnlinePlayers().stream()
.map(s -> SpongeSenderFactory.get(this).wrap(s, Collections.singleton(Permission.LOG_NOTIFY))) .map(s -> SpongeSenderFactory.get(this).wrap(s))
.filter(Permission.LOG_NOTIFY::isAuthorized) .filter(Permission.LOG_NOTIFY::isAuthorized)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View File

@ -26,12 +26,16 @@ import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.context.ContextSet; import me.lucko.luckperms.api.context.ContextSet;
import me.lucko.luckperms.api.context.MutableContextSet; import me.lucko.luckperms.api.context.MutableContextSet;
import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.LuckPermsPlugin;
import me.lucko.luckperms.common.commands.*; import me.lucko.luckperms.common.commands.CommandResult;
import me.lucko.luckperms.common.commands.Sender;
import me.lucko.luckperms.common.commands.SubCommand;
import me.lucko.luckperms.common.commands.Util;
import me.lucko.luckperms.common.constants.Permission; import me.lucko.luckperms.common.constants.Permission;
import me.lucko.luckperms.common.core.NodeBuilder; import me.lucko.luckperms.common.core.NodeBuilder;
import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.core.PermissionHolder;
import me.lucko.luckperms.common.groups.Group; import me.lucko.luckperms.common.groups.Group;
import me.lucko.luckperms.common.users.User; import me.lucko.luckperms.common.users.User;
import me.lucko.luckperms.common.utils.Predicates;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException; import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.sponge.service.LuckPermsService; import me.lucko.luckperms.sponge.service.LuckPermsService;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
@ -44,7 +48,7 @@ import java.util.*;
public class MigrationPermissionsEx extends SubCommand<Object> { public class MigrationPermissionsEx extends SubCommand<Object> {
public MigrationPermissionsEx() { public MigrationPermissionsEx() {
super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicate.alwaysFalse(), null); super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicates.alwaysFalse(), null);
} }
@Override @Override