mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Small cleanup
This commit is contained in:
parent
3e846d9527
commit
4f6e229943
@ -322,7 +322,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
@Override
|
||||
public List<Sender> getNotifyListeners() {
|
||||
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)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ import me.lucko.luckperms.api.Logger;
|
||||
import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.SubCommand;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@ -82,7 +82,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
public MigrationBPermissions() {
|
||||
super("bpermissions", "Migration from bPermissions", MIGRATION, Predicate.alwaysFalse(), null);
|
||||
super("bpermissions", "Migration from bPermissions", MIGRATION, Predicates.alwaysFalse(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,11 +24,15 @@ package me.lucko.luckperms.bukkit.migration;
|
||||
|
||||
import me.lucko.luckperms.api.Logger;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
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.ObjectLacksException;
|
||||
import org.anjocaido.groupmanager.GlobalGroups;
|
||||
@ -43,7 +47,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class MigrationGroupManager extends SubCommand<Object> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -26,12 +26,16 @@ import me.lucko.luckperms.api.Logger;
|
||||
import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.api.PlatformType;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import ru.tehkode.permissions.NativeInterface;
|
||||
import ru.tehkode.permissions.PermissionGroup;
|
||||
@ -46,7 +50,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -30,11 +30,15 @@ import me.lucko.luckperms.api.Logger;
|
||||
import me.lucko.luckperms.api.data.Callback;
|
||||
import me.lucko.luckperms.bukkit.migration.utils.LPResultRunnable;
|
||||
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.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -116,7 +120,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
|
||||
|
||||
public MigrationPowerfulPerms() {
|
||||
super("powerfulperms", "Migration from PowerfulPerms", MIGRATION, Predicate.not(5),
|
||||
super("powerfulperms", "Migration from PowerfulPerms", MIGRATION, Predicates.not(5),
|
||||
Arg.list(
|
||||
Arg.create("address", true, "the address of the PP database"),
|
||||
Arg.create("database", true, "the name of the PP database"),
|
||||
|
@ -25,13 +25,17 @@ package me.lucko.luckperms.bukkit.migration;
|
||||
import me.lucko.luckperms.api.Logger;
|
||||
import me.lucko.luckperms.api.MetaUtils;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import org.tyrannyofheaven.bukkit.zPermissions.ZPermissionsService;
|
||||
|
||||
@ -42,7 +46,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class MigrationZPermissions extends SubCommand<Object> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -58,7 +58,10 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
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.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@ -229,7 +232,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
@Override
|
||||
public List<Sender> getNotifyListeners() {
|
||||
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)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ import me.lucko.luckperms.api.Logger;
|
||||
import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.SubCommand;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import net.alpenblock.bungeeperms.*;
|
||||
|
||||
@ -43,7 +43,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class MigrationBungeePerms extends SubCommand<Object> {
|
||||
public MigrationBungeePerms() {
|
||||
super("bungeeperms", "Migration from BungeePerms", Permission.MIGRATION, Predicate.alwaysFalse(), null);
|
||||
super("bungeeperms", "Migration from BungeePerms", Permission.MIGRATION, Predicates.alwaysFalse(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,6 +31,7 @@ import me.lucko.luckperms.api.context.IContextCalculator;
|
||||
import me.lucko.luckperms.api.event.LPEvent;
|
||||
import me.lucko.luckperms.api.event.LPListener;
|
||||
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.users.UserIdentifier;
|
||||
|
||||
@ -95,17 +96,17 @@ public class ApiProvider implements LuckPermsApi {
|
||||
|
||||
@Override
|
||||
public LPConfiguration getConfiguration() {
|
||||
return new me.lucko.luckperms.common.api.internal.LPConfigurationLink(plugin.getConfiguration());
|
||||
return new LPConfigurationLink(plugin.getConfiguration());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Datastore getDatastore() {
|
||||
return new me.lucko.luckperms.common.api.internal.DatastoreLink(plugin, plugin.getDatastore());
|
||||
return new DatastoreLink(plugin, plugin.getDatastore());
|
||||
}
|
||||
|
||||
@Override
|
||||
public UuidCache getUuidCache() {
|
||||
return new me.lucko.luckperms.common.api.internal.UuidCacheLink(plugin.getUuidCache());
|
||||
return new UuidCacheLink(plugin.getUuidCache());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,11 +117,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
@Override
|
||||
public User getUser(@NonNull UUID uuid) {
|
||||
final me.lucko.luckperms.common.users.User user = plugin.getUserManager().get(uuid);
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new me.lucko.luckperms.common.api.internal.UserLink(user);
|
||||
return user == null ? null : new UserLink(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -131,11 +128,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
@Override
|
||||
public User getUser(@NonNull String name) {
|
||||
final me.lucko.luckperms.common.users.User user = plugin.getUserManager().get(name);
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new me.lucko.luckperms.common.api.internal.UserLink(user);
|
||||
return user == null ? null : new UserLink(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -145,7 +138,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -156,17 +149,13 @@ public class ApiProvider implements LuckPermsApi {
|
||||
@Override
|
||||
public void cleanupUser(@NonNull User 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
|
||||
public Group getGroup(@NonNull String name) {
|
||||
final me.lucko.luckperms.common.groups.Group group = plugin.getGroupManager().get(name);
|
||||
if (group == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new me.lucko.luckperms.common.api.internal.GroupLink(group);
|
||||
return group == null ? null : new GroupLink(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -176,7 +165,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -187,11 +176,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
@Override
|
||||
public Track getTrack(@NonNull String name) {
|
||||
final me.lucko.luckperms.common.tracks.Track track = plugin.getTrackManager().get(name);
|
||||
if (track == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new me.lucko.luckperms.common.api.internal.TrackLink(track);
|
||||
return track == null ? null : new TrackLink(track);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -201,7 +186,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
|
||||
@Override
|
||||
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
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
package me.lucko.luckperms.common.api.internal;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.Track;
|
||||
@ -32,57 +33,51 @@ import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
public class Utils {
|
||||
|
||||
public static void checkUser(User user) {
|
||||
if (!(user instanceof UserLink)) {
|
||||
throw new IllegalStateException("User instance cannot be handled by this implementation.");
|
||||
}
|
||||
Preconditions.checkState(user instanceof UserLink, "User instance cannot be handled by this implementation.");
|
||||
}
|
||||
|
||||
public static void checkGroup(Group group) {
|
||||
if (!(group instanceof GroupLink)) {
|
||||
throw new IllegalStateException("Group instance cannot be handled by this implementation.");
|
||||
}
|
||||
Preconditions.checkState(group instanceof GroupLink, "Group instance cannot be handled by this implementation.");
|
||||
}
|
||||
|
||||
public static void checkTrack(Track track) {
|
||||
if (!(track instanceof TrackLink)) {
|
||||
throw new IllegalStateException("Track instance cannot be handled by this implementation.");
|
||||
}
|
||||
Preconditions.checkState(track instanceof TrackLink, "Track instance cannot be handled by this implementation.");
|
||||
}
|
||||
|
||||
public static String checkUsername(String s) {
|
||||
if (ArgumentChecker.checkUsername(s)) {
|
||||
throw new IllegalArgumentException("Invalid username entry '" + s + "'. Usernames must be less than 16 chars" +
|
||||
" and only contain 'a-z A-Z 1-9 _'.");
|
||||
}
|
||||
Preconditions.checkArgument(
|
||||
!ArgumentChecker.checkUsername(s),
|
||||
"Invalid username entry '" + s + "'. Usernames must be less than 16 chars and only contain 'a-z A-Z 1-9 _'."
|
||||
);
|
||||
return s;
|
||||
}
|
||||
|
||||
public static String checkName(String s) {
|
||||
if (ArgumentChecker.checkName(s)) {
|
||||
throw new IllegalArgumentException("Invalid name entry '" + s + "'. Names must be less than 37 chars" +
|
||||
" and only contain 'a-z A-Z 1-9'.");
|
||||
}
|
||||
Preconditions.checkArgument(
|
||||
!ArgumentChecker.checkName(s),
|
||||
"Invalid name entry '" + s + "'. Names must be less than 37 chars and only contain 'a-z A-Z 1-9'."
|
||||
);
|
||||
return s.toLowerCase();
|
||||
}
|
||||
|
||||
public static String checkServer(String s) {
|
||||
if (ArgumentChecker.checkServer(s)) {
|
||||
throw new IllegalArgumentException("Invalid server entry '" + s + "'. Server names can only contain alphanumeric characters.");
|
||||
}
|
||||
Preconditions.checkArgument(
|
||||
!ArgumentChecker.checkServer(s),
|
||||
"Invalid server entry '" + s + "'. Server names can only contain alphanumeric characters."
|
||||
);
|
||||
return s;
|
||||
}
|
||||
|
||||
public static String checkNode(String s) {
|
||||
if (ArgumentChecker.checkNode(s)) {
|
||||
throw new IllegalArgumentException("Invalid node entry '" + s + "'. Nodes cannot contain '/' or '$' characters.");
|
||||
}
|
||||
Preconditions.checkArgument(
|
||||
!ArgumentChecker.checkNode(s),
|
||||
"Invalid node entry '" + s + "'. Nodes cannot contain '/' or '$' characters."
|
||||
);
|
||||
return s;
|
||||
}
|
||||
|
||||
public static long checkTime(long l) {
|
||||
if (ArgumentChecker.checkTime(l)) {
|
||||
throw new IllegalArgumentException("Unix time '" + l + "' is invalid, as it has already passed.");
|
||||
}
|
||||
Preconditions.checkArgument(!ArgumentChecker.checkTime(l), "Unix time '" + l + "' is invalid, as it has already passed.");
|
||||
return l;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.common.api.internal;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import me.lucko.luckperms.api.UuidCache;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -35,12 +36,12 @@ public class UuidCacheLink implements UuidCache {
|
||||
private final me.lucko.luckperms.common.core.UuidCache master;
|
||||
|
||||
@Override
|
||||
public UUID getUUID(UUID external) {
|
||||
public UUID getUUID(@NonNull UUID external) {
|
||||
return master.getUUID(external);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getExternalUUID(UUID internal) {
|
||||
public UUID getExternalUUID(@NonNull UUID internal) {
|
||||
return master.getExternalUUID(internal);
|
||||
}
|
||||
}
|
||||
|
@ -43,11 +43,7 @@ public class Arg {
|
||||
private final String description;
|
||||
|
||||
public String asPrettyString() {
|
||||
if (required) {
|
||||
return "&8<&7" + name + "&8>";
|
||||
} else {
|
||||
return "&8[&7" + name + "&8]";
|
||||
}
|
||||
return required ? "&8<&7" + name + "&8>" : "&8[&7" + name + "&8]";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,13 +34,13 @@ public enum CommandResult {
|
||||
INVALID_ARGS(false),
|
||||
NO_PERMISSION(false);
|
||||
|
||||
private boolean booleanValue;
|
||||
private boolean value;
|
||||
|
||||
public boolean booleanValue() {
|
||||
return booleanValue;
|
||||
public boolean asBoolean() {
|
||||
return value;
|
||||
}
|
||||
|
||||
static CommandResult of(boolean b) {
|
||||
public static CommandResult of(boolean b) {
|
||||
return b ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.utils.ImmutableCollectors;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.*;
|
||||
@ -50,11 +49,7 @@ public abstract class SenderFactory<T> implements Runnable {
|
||||
protected abstract boolean hasPermission(T t, String node);
|
||||
|
||||
public final Sender wrap(T t) {
|
||||
return new SenderImp(plugin, t, null);
|
||||
}
|
||||
|
||||
public final Sender wrap(T t, Set<Permission> toCheck) {
|
||||
return new SenderImp(plugin, t, toCheck);
|
||||
return new SenderImp(plugin, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -77,9 +72,6 @@ public abstract class SenderFactory<T> implements Runnable {
|
||||
private class SenderImp implements Sender {
|
||||
private final WeakReference<T> tRef;
|
||||
|
||||
// Cache these permissions, so they can be accessed async
|
||||
private Map<Permission, Boolean> perms;
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
@ -91,24 +83,12 @@ public abstract class SenderFactory<T> implements Runnable {
|
||||
@Getter
|
||||
private final LuckPermsPlugin platform;
|
||||
|
||||
private SenderImp(LuckPermsPlugin platform, T t, Set<Permission> toCheck) {
|
||||
private SenderImp(LuckPermsPlugin platform, T t) {
|
||||
this.platform = platform;
|
||||
this.tRef = new WeakReference<>(t);
|
||||
this.name = factory.getName(t);
|
||||
this.uuid = factory.getUuid(t);
|
||||
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
|
||||
@ -128,7 +108,17 @@ public abstract class SenderFactory<T> implements Runnable {
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,13 @@
|
||||
package me.lucko.luckperms.common.commands.generic;
|
||||
|
||||
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.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -38,7 +42,7 @@ public class SecondaryMainCommand<T extends PermissionHolder> extends SubCommand
|
||||
private final 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.user = user;
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MetaAddPrefix extends SecondarySubCommand {
|
||||
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.create("priority", true, "the priority to add the prefix at"),
|
||||
Arg.create("prefix", true, "the prefix string"),
|
||||
|
@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MetaAddSuffix extends SecondarySubCommand {
|
||||
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.create("priority", true, "the priority to add the suffix at"),
|
||||
Arg.create("suffix", true, "the suffix string"),
|
||||
|
@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MetaAddTempPrefix extends SecondarySubCommand {
|
||||
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.create("priority", true, "the priority to add the prefix at"),
|
||||
Arg.create("prefix", true, "the prefix string"),
|
||||
|
@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MetaAddTempSuffix extends SecondarySubCommand {
|
||||
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.create("priority", true, "the priority to add the suffix at"),
|
||||
Arg.create("suffix", true, "the suffix string"),
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.meta;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MetaClear extends SecondarySubCommand {
|
||||
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.create("server", false, "the server name to filter by"),
|
||||
Arg.create("world", false, "the world name to filter by")
|
||||
|
@ -26,19 +26,19 @@ import me.lucko.luckperms.api.Contexts;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.Util;
|
||||
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class MetaInfo extends SecondarySubCommand {
|
||||
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
|
||||
|
@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -42,7 +42,7 @@ import java.util.List;
|
||||
|
||||
public class MetaRemovePrefix extends SecondarySubCommand {
|
||||
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.create("priority", true, "the priority to add the prefix at"),
|
||||
Arg.create("prefix", true, "the prefix string"),
|
||||
|
@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -42,7 +42,7 @@ import java.util.List;
|
||||
|
||||
public class MetaRemoveSuffix extends SecondarySubCommand {
|
||||
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.create("priority", true, "the priority to add the suffix at"),
|
||||
Arg.create("suffix", true, "the suffix string"),
|
||||
|
@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -42,7 +42,7 @@ import java.util.List;
|
||||
|
||||
public class MetaRemoveTempPrefix extends SecondarySubCommand {
|
||||
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.create("priority", true, "the priority to add the prefix at"),
|
||||
Arg.create("prefix", true, "the prefix string"),
|
||||
|
@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -42,7 +42,7 @@ import java.util.List;
|
||||
|
||||
public class MetaRemoveTempSuffix extends SecondarySubCommand {
|
||||
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.create("priority", true, "the priority to add the suffix at"),
|
||||
Arg.create("suffix", true, "the suffix string"),
|
||||
|
@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MetaSet extends SecondarySubCommand {
|
||||
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.create("key", true, "the key to set"),
|
||||
Arg.create("value", true, "the value to set"),
|
||||
|
@ -27,7 +27,6 @@ import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MetaSetTemp extends SecondarySubCommand {
|
||||
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.create("key", true, "the key to set"),
|
||||
Arg.create("value", true, "the value to set"),
|
||||
|
@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MetaUnset extends SecondarySubCommand {
|
||||
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.create("key", true, "the key to unset"),
|
||||
Arg.create("server", false, "the server to remove the meta pair on"),
|
||||
|
@ -26,7 +26,6 @@ import me.lucko.luckperms.api.MetaUtils;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MetaUnsetTemp extends SecondarySubCommand {
|
||||
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.create("key", true, "the key to unset"),
|
||||
Arg.create("server", false, "the server to remove the meta pair on"),
|
||||
|
@ -24,10 +24,14 @@ package me.lucko.luckperms.common.commands.generic.other;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -36,7 +40,7 @@ import java.util.stream.Collectors;
|
||||
public class HolderShowTracks<T extends PermissionHolder> extends SubCommand<T> {
|
||||
public HolderShowTracks(boolean user) {
|
||||
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
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.groups.Group;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
@ -43,7 +43,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
|
||||
public class ParentAdd extends SecondarySubCommand {
|
||||
public ParentAdd() {
|
||||
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.create("group", true, "the group to inherit from"),
|
||||
Arg.create("server", false, "the server to inherit the group on"),
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
@ -44,7 +44,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
|
||||
public class ParentAddTemp extends SecondarySubCommand {
|
||||
public ParentAddTemp() {
|
||||
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.create("group", true, "the group to inherit from"),
|
||||
Arg.create("duration", true, "the duration of the group membership"),
|
||||
|
@ -24,20 +24,20 @@ package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.Util;
|
||||
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ParentInfo extends SecondarySubCommand {
|
||||
public ParentInfo() {
|
||||
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
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.users.User;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
@ -43,7 +43,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
|
||||
public class ParentRemove extends SecondarySubCommand {
|
||||
public ParentRemove() {
|
||||
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.create("group", true, "the group to remove"),
|
||||
Arg.create("server", false, "the server to remove the group on"),
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
@ -42,7 +42,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
|
||||
public class ParentRemoveTemp extends SecondarySubCommand {
|
||||
public ParentRemoveTemp() {
|
||||
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.create("group", true, "the group to remove"),
|
||||
Arg.create("server", false, "the server to remove the group on"),
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.parent;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.users.User;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
@ -44,7 +44,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getGroupTabComplete;
|
||||
public class ParentSet extends SecondarySubCommand {
|
||||
public ParentSet() {
|
||||
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.create("group", true, "the group to set to"),
|
||||
Arg.create("server", false, "the server to set the group on"),
|
||||
|
@ -23,20 +23,24 @@
|
||||
package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
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.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeBuilder;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PermissionCheck extends SecondarySubCommand {
|
||||
public PermissionCheck() {
|
||||
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.create("node", true, "the permission node to check for"),
|
||||
Arg.create("server", false, "the server to check on"),
|
||||
|
@ -23,7 +23,10 @@
|
||||
package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
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.constants.Message;
|
||||
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.PermissionHolder;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PermissionCheckInherits extends SecondarySubCommand {
|
||||
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,
|
||||
Predicate.notInRange(1, 3),
|
||||
Predicates.notInRange(1, 3),
|
||||
Arg.list(
|
||||
Arg.create("node", true, "the permission node to check for"),
|
||||
Arg.create("server", false, "the server to check on"),
|
||||
|
@ -24,19 +24,19 @@ package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.Util;
|
||||
import me.lucko.luckperms.common.commands.generic.SecondarySubCommand;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PermissionInfo extends SecondarySubCommand {
|
||||
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
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
@ -41,7 +41,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getBoolTabComplete;
|
||||
|
||||
public class PermissionSet extends SecondarySubCommand {
|
||||
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.create("node", true, "the permission node to set"),
|
||||
Arg.create("true|false", true, "the value of the node"),
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
@ -43,7 +43,7 @@ import static me.lucko.luckperms.common.commands.SubCommand.getBoolTabComplete;
|
||||
public class PermissionSetTemp extends SecondarySubCommand {
|
||||
public PermissionSetTemp() {
|
||||
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.create("node", true, "the permission node to set"),
|
||||
Arg.create("true|false", true, "the value of the node"),
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PermissionUnset extends SecondarySubCommand {
|
||||
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.create("node", true, "the permission node to unset"),
|
||||
Arg.create("server", false, "the server to remove the permission node on"),
|
||||
|
@ -25,7 +25,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
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.generic.SecondarySubCommand;
|
||||
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.data.LogEntry;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
@ -40,7 +40,7 @@ import java.util.List;
|
||||
public class PermissionUnsetTemp extends SecondarySubCommand {
|
||||
public PermissionUnsetTemp() {
|
||||
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.create("node", true, "the permission node to unset"),
|
||||
Arg.create("server", false, "the server to remove the permission node on"),
|
||||
|
@ -24,11 +24,15 @@ package me.lucko.luckperms.common.commands.group.subcommands;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
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.ObjectLacksException;
|
||||
|
||||
@ -39,7 +43,7 @@ import java.util.Set;
|
||||
|
||||
public class GroupBulkChange extends SubCommand<Group> {
|
||||
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.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"),
|
||||
|
@ -23,19 +23,23 @@
|
||||
package me.lucko.luckperms.common.commands.group.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GroupClear extends SubCommand<Group> {
|
||||
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.create("server", false, "the server name to filter by"),
|
||||
Arg.create("world", false, "the world name to filter by")
|
||||
|
@ -23,18 +23,22 @@
|
||||
package me.lucko.luckperms.common.commands.group.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GroupClone extends SubCommand<Group> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -24,18 +24,18 @@ package me.lucko.luckperms.common.commands.group.subcommands;
|
||||
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.SubCommand;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GroupInfo extends SubCommand<Group> {
|
||||
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
|
||||
|
@ -23,18 +23,22 @@
|
||||
package me.lucko.luckperms.common.commands.group.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GroupRename extends SubCommand<Group> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -24,10 +24,14 @@ package me.lucko.luckperms.common.commands.log.subcommands;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -38,7 +42,7 @@ import java.util.List;
|
||||
|
||||
public class LogExport extends SubCommand<Log> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -24,12 +24,16 @@ package me.lucko.luckperms.common.commands.log.subcommands;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -37,7 +41,7 @@ import java.util.SortedMap;
|
||||
|
||||
public class LogGroupHistory extends SubCommand<Log> {
|
||||
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.create("group", true, "the name of the group"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
|
@ -23,10 +23,14 @@
|
||||
package me.lucko.luckperms.common.commands.log.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -34,7 +38,7 @@ import java.util.UUID;
|
||||
|
||||
public class LogNotify extends SubCommand<Log> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import me.lucko.luckperms.common.constants.Patterns;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -38,7 +39,7 @@ import java.util.UUID;
|
||||
|
||||
public class LogRecent extends SubCommand<Log> {
|
||||
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.create("user", false, "the name/uuid of the user to filter by"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
|
@ -24,11 +24,15 @@ package me.lucko.luckperms.common.commands.log.subcommands;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -37,7 +41,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class LogSearch extends SubCommand<Log> {
|
||||
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.create("query", true, "the query to search by"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
|
@ -24,12 +24,16 @@ package me.lucko.luckperms.common.commands.log.subcommands;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -37,7 +41,7 @@ import java.util.SortedMap;
|
||||
|
||||
public class LogTrackHistory extends SubCommand<Log> {
|
||||
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.create("track", true, "the name of the track"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
|
@ -30,6 +30,7 @@ import me.lucko.luckperms.common.constants.Patterns;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.utils.DateUtil;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -38,7 +39,7 @@ import java.util.UUID;
|
||||
|
||||
public class LogUserHistory extends SubCommand<Log> {
|
||||
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.create("user", true, "the name/uuid of the user"),
|
||||
Arg.create("page", false, "the page number to view")
|
||||
|
@ -30,13 +30,14 @@ import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackAppend extends SubCommand<Track> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -24,19 +24,19 @@ package me.lucko.luckperms.common.commands.track.subcommands;
|
||||
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.SubCommand;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackClear extends SubCommand<Track> {
|
||||
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
|
||||
|
@ -23,18 +23,22 @@
|
||||
package me.lucko.luckperms.common.commands.track.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackClone extends SubCommand<Track> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -23,16 +23,20 @@
|
||||
package me.lucko.luckperms.common.commands.track.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackInfo extends SubCommand<Track> {
|
||||
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
|
||||
|
@ -30,13 +30,14 @@ import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackInsert extends SubCommand<Track> {
|
||||
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.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)")
|
||||
|
@ -29,13 +29,14 @@ import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackRemove extends SubCommand<Track> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -23,18 +23,22 @@
|
||||
package me.lucko.luckperms.common.commands.track.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrackRename extends SubCommand<Track> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -24,11 +24,15 @@ package me.lucko.luckperms.common.commands.user.subcommands;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
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.ObjectLacksException;
|
||||
|
||||
@ -39,7 +43,7 @@ import java.util.Set;
|
||||
|
||||
public class UserBulkChange extends SubCommand<User> {
|
||||
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.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"),
|
||||
|
@ -23,19 +23,23 @@
|
||||
package me.lucko.luckperms.common.commands.user.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
import me.lucko.luckperms.common.utils.ArgumentChecker;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class UserClear extends SubCommand<User> {
|
||||
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.create("server", false, "the server name to filter by"),
|
||||
Arg.create("world", false, "the world name to filter by")
|
||||
|
@ -37,6 +37,7 @@ import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
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.ObjectLacksException;
|
||||
|
||||
@ -48,7 +49,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class UserDemote extends SubCommand<User> {
|
||||
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.create("track", true, "the track to demote the user down"),
|
||||
Arg.create("server", false, "the server to promote on"),
|
||||
|
@ -24,18 +24,18 @@ package me.lucko.luckperms.common.commands.user.subcommands;
|
||||
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.SubCommand;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserGetUUID extends SubCommand<User> {
|
||||
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
|
||||
|
@ -24,18 +24,18 @@ package me.lucko.luckperms.common.commands.user.subcommands;
|
||||
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
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.SubCommand;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserInfo extends SubCommand<User> {
|
||||
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
|
||||
|
@ -37,6 +37,7 @@ import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.tracks.Track;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
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.ObjectLacksException;
|
||||
|
||||
@ -48,7 +49,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class UserPromote extends SubCommand<User> {
|
||||
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.create("track", true, "the track to promote the user up"),
|
||||
Arg.create("server", false, "the server to promote on"),
|
||||
|
@ -23,19 +23,23 @@
|
||||
package me.lucko.luckperms.common.commands.user.subcommands;
|
||||
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.data.LogEntry;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserSetPrimaryGroup extends SubCommand<User> {
|
||||
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"))
|
||||
);
|
||||
}
|
||||
|
@ -24,12 +24,16 @@ package me.lucko.luckperms.common.commands.usersbulkedit.subcommands;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.storage.Datastore;
|
||||
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.ObjectLacksException;
|
||||
|
||||
@ -37,7 +41,7 @@ import java.util.*;
|
||||
|
||||
public class BulkEditGroup extends SubCommand<Datastore> {
|
||||
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.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'"),
|
||||
|
@ -24,12 +24,16 @@ package me.lucko.luckperms.common.commands.usersbulkedit.subcommands;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
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.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.storage.Datastore;
|
||||
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.ObjectLacksException;
|
||||
|
||||
@ -37,7 +41,7 @@ import java.util.*;
|
||||
|
||||
public class BulkEditPermission extends SubCommand<Datastore> {
|
||||
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.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'"),
|
||||
|
@ -27,6 +27,7 @@ import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@ -57,7 +58,7 @@ public class Patterns {
|
||||
public static Pattern compile(String regex) {
|
||||
try {
|
||||
return CACHE.get(regex);
|
||||
} catch (ExecutionException e) {
|
||||
} catch (UncheckedExecutionException | ExecutionException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class Importer {
|
||||
|
||||
int errors = 0;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
@ -129,7 +129,7 @@ public class Importer {
|
||||
|
||||
int errIndex = 1;
|
||||
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());
|
||||
for (String s : e.getValue().getOutput()) {
|
||||
Message.IMPORT_END_ERROR_CONTENT.send(executor, s);
|
||||
@ -147,7 +147,7 @@ public class Importer {
|
||||
int errors = 0;
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ package me.lucko.luckperms.common.storage;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.Delegate;
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
@ -44,13 +45,13 @@ import java.util.function.Supplier;
|
||||
*/
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class AbstractDatastore implements Datastore {
|
||||
|
||||
public static Datastore wrap(LuckPermsPlugin plugin, AbstractBacking backing) {
|
||||
BufferedOutputDatastore bufferedDs = BufferedOutputDatastore.wrap(TolerantDatastore.wrap(new AbstractDatastore(backing)), 1000L);
|
||||
plugin.doAsyncRepeating(bufferedDs, 10L);
|
||||
return bufferedDs;
|
||||
}
|
||||
|
||||
@Delegate(types = Delegated.class)
|
||||
private final AbstractBacking backing;
|
||||
|
||||
private <T> LPFuture<T> makeFuture(Supplier<T> supplier) {
|
||||
@ -62,46 +63,11 @@ public class AbstractDatastore implements Datastore {
|
||||
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
|
||||
public Datastore force() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
backing.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
backing.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LPFuture<Boolean> logAction(LogEntry entry) {
|
||||
return makeFuture(() -> backing.logAction(entry));
|
||||
@ -196,4 +162,14 @@ public class AbstractDatastore implements Datastore {
|
||||
public LPFuture<String> getName(UUID 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();
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ public class BufferedOutputDatastore implements Datastore, Runnable {
|
||||
userOutputBuffer.flush(flushTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Datastore force() {
|
||||
return backing;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ package me.lucko.luckperms.common.storage;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.Delegate;
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.common.data.Log;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
@ -46,44 +47,16 @@ public class TolerantDatastore implements Datastore {
|
||||
return new TolerantDatastore(datastore);
|
||||
}
|
||||
|
||||
@Delegate(types = Delegated.class)
|
||||
private final Datastore backing;
|
||||
|
||||
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
|
||||
public Datastore force() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
backing.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Wait for other threads to finish.
|
||||
@ -285,4 +258,13 @@ public class TolerantDatastore implements Datastore {
|
||||
phaser.arriveAndDeregister();
|
||||
}
|
||||
}
|
||||
|
||||
private interface Delegated {
|
||||
String getName();
|
||||
boolean isAcceptingLogins();
|
||||
void setAcceptingLogins(boolean b);
|
||||
void doAsync(Runnable r);
|
||||
void doSync(Runnable r);
|
||||
void init();
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
package me.lucko.luckperms.common.tracks;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -66,7 +67,7 @@ public class Track implements Identifiable<String> {
|
||||
* @return am ordered {@link List} of the groups on this track
|
||||
*/
|
||||
public List<String> getGroups() {
|
||||
return Collections.unmodifiableList(groups);
|
||||
return ImmutableList.copyOf(groups);
|
||||
}
|
||||
|
||||
public void setGroups(List<String> groups) {
|
||||
|
@ -99,7 +99,7 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
|
||||
* Sets up the UserData cache
|
||||
* Blocking call.
|
||||
*/
|
||||
public void setupData(boolean op) {
|
||||
public synchronized void setupData(boolean op) {
|
||||
if (userData != null) {
|
||||
return;
|
||||
}
|
||||
@ -120,11 +120,11 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
|
||||
* Blocking call.
|
||||
*/
|
||||
private synchronized void refreshPermissions() {
|
||||
if (userData == null) {
|
||||
UserData ud = userData;
|
||||
if (ud == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
UserData ud = userData;
|
||||
ud.recalculatePermissions();
|
||||
ud.recalculateMeta();
|
||||
getPlugin().getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));
|
||||
|
@ -22,16 +22,14 @@
|
||||
|
||||
package me.lucko.luckperms.common.users;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.*;
|
||||
import me.lucko.luckperms.common.utils.Identifiable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode(of = "uuid")
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class UserIdentifier implements Identifiable<UUID> {
|
||||
public static UserIdentifier of(UUID uuid, String username) {
|
||||
@ -45,17 +43,4 @@ public class UserIdentifier implements Identifiable<UUID> {
|
||||
public UUID getId() {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ public class UserManager extends AbstractManager<UserIdentifier, User> {
|
||||
* @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
|
||||
*/
|
||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
||||
public User get(String name) {
|
||||
for (User user : getAll().values()) {
|
||||
if (user.getName().equalsIgnoreCase(name)) {
|
||||
|
@ -22,10 +22,7 @@
|
||||
|
||||
package me.lucko.luckperms.common.utils;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -96,29 +93,15 @@ public abstract class Buffer<T, R> implements Runnable {
|
||||
flush(DEFAULT_FLUSH_TIME);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@EqualsAndHashCode(of = "object")
|
||||
@AllArgsConstructor
|
||||
private static class BufferedObject<T, R> {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private long bufferTime;
|
||||
|
||||
@Getter
|
||||
private final T object;
|
||||
|
||||
@Getter
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,38 +20,39 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.commands;
|
||||
package me.lucko.luckperms.common.utils;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@SuppressWarnings({"WeakerAccess", "unused"})
|
||||
@UtilityClass
|
||||
public class Predicate {
|
||||
public static <T> java.util.function.Predicate<T> alwaysFalse() {
|
||||
public class Predicates {
|
||||
public static <T> Predicate<T> alwaysFalse() {
|
||||
return t -> false;
|
||||
}
|
||||
|
||||
public static <T> java.util.function.Predicate<T> alwaysTrue() {
|
||||
public static <T> Predicate<T> alwaysTrue() {
|
||||
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));
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public static <T> java.util.function.Predicate<T> isOneOf(Set<T> ta) {
|
||||
public static <T> Predicate<T> isOneOf(Set<T> ta) {
|
||||
return t -> {
|
||||
for (T i : ta) {
|
||||
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));
|
||||
}
|
||||
|
||||
public static <T> java.util.function.Predicate<T> is(T t) {
|
||||
public static <T> Predicate<T> is(T t) {
|
||||
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);
|
||||
}
|
||||
}
|
@ -307,7 +307,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
||||
@Override
|
||||
public List<Sender> getNotifyListeners() {
|
||||
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)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
@ -26,12 +26,16 @@ import me.lucko.luckperms.api.Logger;
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
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.core.NodeBuilder;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
import me.lucko.luckperms.common.users.User;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import org.spongepowered.api.Sponge;
|
||||
@ -44,7 +48,7 @@ import java.util.*;
|
||||
|
||||
public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
public MigrationPermissionsEx() {
|
||||
super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicate.alwaysFalse(), null);
|
||||
super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicates.alwaysFalse(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user