mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Release 1.6
This commit is contained in:
parent
6aea3b53f3
commit
57f5a7c4cd
@ -133,7 +133,7 @@ public interface Datastore {
|
||||
boolean cleanupUsers();
|
||||
|
||||
/**
|
||||
* Gets a set user's UUIDs who are "unique", aren't just a member of the "default" group.
|
||||
* Gets a set all user's UUIDs who are "unique", and aren't just a member of the "default" group.
|
||||
* @return a set of uuids, or null if the operation failed.
|
||||
* @since 1.6
|
||||
*/
|
||||
|
@ -53,12 +53,14 @@ public interface LuckPermsApi {
|
||||
/**
|
||||
* Registers a listener to be sent LuckPerms events
|
||||
* @param listener the listener instance
|
||||
* @throws NullPointerException if the listener is null
|
||||
*/
|
||||
void registerListener(LPListener listener);
|
||||
|
||||
/**
|
||||
* Unregisters a previously registered listener from the EventBus
|
||||
* @param listener the listener instance to unregister
|
||||
* @throws NullPointerException if the listener is null
|
||||
*/
|
||||
void unregisterListener(LPListener listener);
|
||||
|
||||
@ -90,6 +92,7 @@ public interface LuckPermsApi {
|
||||
* Gets a wrapped user object from the user storage
|
||||
* @param uuid the uuid of the user to get
|
||||
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
User getUser(UUID uuid);
|
||||
|
||||
@ -97,6 +100,7 @@ public interface LuckPermsApi {
|
||||
* Gets a wrapped user object from the user storage. This method does not return null, unlike {@link #getUser(UUID)}
|
||||
* @param uuid the uuid of the user to get
|
||||
* @return an optional {@link User} object
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
Optional<User> getUserSafe(UUID uuid);
|
||||
|
||||
@ -104,6 +108,7 @@ public interface LuckPermsApi {
|
||||
* Gets a wrapped user object from the user storage
|
||||
* @param name the username of the user to get
|
||||
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
User getUser(String name);
|
||||
|
||||
@ -111,6 +116,7 @@ public interface LuckPermsApi {
|
||||
* Gets a wrapped user object from the user storage. This method does not return null, unlike {@link #getUser(String)}
|
||||
* @param name the username of the user to get
|
||||
* @return an optional {@link User} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<User> getUserSafe(String name);
|
||||
|
||||
@ -124,13 +130,23 @@ public interface LuckPermsApi {
|
||||
* Check if a user is loaded in memory
|
||||
* @param uuid the uuid to check for
|
||||
* @return true if the user is loaded
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
boolean isUserLoaded(UUID uuid);
|
||||
|
||||
/**
|
||||
* Unload a user from the internal storage, if they're not currently online.
|
||||
* @param user the user to unload
|
||||
* @throws NullPointerException if the user is null
|
||||
* @since 1.6
|
||||
*/
|
||||
void cleanupUser(User user);
|
||||
|
||||
/**
|
||||
* Gets a wrapped group object from the group storage
|
||||
* @param name the name of the group to get
|
||||
* @return a {@link Group} object, if one matching the name exists, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Group getGroup(String name);
|
||||
|
||||
@ -138,6 +154,7 @@ public interface LuckPermsApi {
|
||||
* Gets a wrapped group object from the group storage. This method does not return null, unlike {@link #getGroup}
|
||||
* @param name the name of the group to get
|
||||
* @return an optional {@link Group} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<Group> getGroupSafe(String name);
|
||||
|
||||
@ -151,6 +168,7 @@ public interface LuckPermsApi {
|
||||
* Check if a group is loaded in memory
|
||||
* @param name the name to check for
|
||||
* @return true if the group is loaded
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
boolean isGroupLoaded(String name);
|
||||
|
||||
@ -158,6 +176,7 @@ public interface LuckPermsApi {
|
||||
* Gets a wrapped track object from the track storage
|
||||
* @param name the name of the track to get
|
||||
* @return a {@link Track} object, if one matching the name exists, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Track getTrack(String name);
|
||||
|
||||
@ -165,6 +184,7 @@ public interface LuckPermsApi {
|
||||
* Gets a wrapped tracj object from the track storage. This method does not return null, unlike {@link #getTrack}
|
||||
* @param name the name of the track to get
|
||||
* @return an optional {@link Track} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<Track> getTrackSafe(String name);
|
||||
|
||||
@ -178,6 +198,7 @@ public interface LuckPermsApi {
|
||||
* Check if a track is loaded in memory
|
||||
* @param name the name to check for
|
||||
* @return true if the track is loaded
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
boolean isTrackLoaded(String name);
|
||||
|
||||
@ -186,6 +207,7 @@ public interface LuckPermsApi {
|
||||
* @param permission the main permission node to build
|
||||
* @return a {@link Node.Builder} instance
|
||||
* @throws IllegalArgumentException if the permission is invalid
|
||||
* @throws NullPointerException if the permission is null
|
||||
* @since 1.6
|
||||
*/
|
||||
Node.Builder buildNode(String permission) throws IllegalArgumentException;
|
||||
|
@ -27,7 +27,6 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.*;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.LPEvent;
|
||||
import me.lucko.luckperms.api.event.LPListener;
|
||||
import me.lucko.luckperms.api.implementation.internal.*;
|
||||
@ -77,12 +76,12 @@ public class ApiProvider implements LuckPermsApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerListener(LPListener listener) {
|
||||
public void registerListener(@NonNull LPListener listener) {
|
||||
eventBus.register(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterListener(LPListener listener) {
|
||||
public void unregisterListener(@NonNull LPListener listener) {
|
||||
eventBus.unregister(listener);
|
||||
}
|
||||
|
||||
@ -117,7 +116,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<User> getUserSafe(UUID uuid) {
|
||||
public Optional<User> getUserSafe(@NonNull UUID uuid) {
|
||||
return Optional.ofNullable(getUser(uuid));
|
||||
}
|
||||
|
||||
@ -132,7 +131,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<User> getUserSafe(String name) {
|
||||
public Optional<User> getUserSafe(@NonNull String name) {
|
||||
return Optional.ofNullable(getUser(name));
|
||||
}
|
||||
|
||||
@ -146,6 +145,12 @@ public class ApiProvider implements LuckPermsApi {
|
||||
return plugin.getUserManager().isLoaded(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupUser(@NonNull User user) {
|
||||
Utils.checkUser(user);
|
||||
plugin.getUserManager().cleanup(((UserLink) user).getMaster());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Group getGroup(@NonNull String name) {
|
||||
final me.lucko.luckperms.groups.Group group = plugin.getGroupManager().get(name);
|
||||
@ -157,7 +162,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Group> getGroupSafe(String name) {
|
||||
public Optional<Group> getGroupSafe(@NonNull String name) {
|
||||
return Optional.ofNullable(getGroup(name));
|
||||
}
|
||||
|
||||
@ -182,7 +187,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Track> getTrackSafe(String name) {
|
||||
public Optional<Track> getTrackSafe(@NonNull String name) {
|
||||
return Optional.ofNullable(getTrack(name));
|
||||
}
|
||||
|
||||
@ -197,7 +202,7 @@ public class ApiProvider implements LuckPermsApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node.Builder buildNode(String permission) throws IllegalArgumentException {
|
||||
public Node.Builder buildNode(@NonNull String permission) throws IllegalArgumentException {
|
||||
return new me.lucko.luckperms.utils.Node.Builder(checkNode(permission));
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ import me.lucko.luckperms.api.data.Callback;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
package me.lucko.luckperms.api.implementation.internal;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
@ -43,7 +42,7 @@ import static me.lucko.luckperms.api.implementation.internal.Utils.*;
|
||||
@SuppressWarnings("unused")
|
||||
public class UserLink extends PermissionHolderLink implements User {
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Getter
|
||||
private final me.lucko.luckperms.users.User master;
|
||||
|
||||
@Getter
|
||||
|
@ -30,7 +30,7 @@ import me.lucko.luckperms.users.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static me.lucko.luckperms.core.PermissionHolder.*;
|
||||
import static me.lucko.luckperms.core.PermissionHolder.exportToLegacy;
|
||||
|
||||
public class UserListNodes extends SubCommand<User> {
|
||||
public UserListNodes() {
|
||||
|
@ -42,7 +42,7 @@ import java.util.logging.*;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static me.lucko.luckperms.core.PermissionHolder.*;
|
||||
import static me.lucko.luckperms.core.PermissionHolder.exportToLegacy;
|
||||
|
||||
@SuppressWarnings({"ResultOfMethodCallIgnored", "UnnecessaryLocalVariable"})
|
||||
public class FlatfileDatastore extends Datastore {
|
||||
|
@ -37,7 +37,6 @@ import org.spongepowered.api.util.Tristate;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LuckPermsService implements PermissionService {
|
||||
public static final String SERVER_CONTEXT = "server";
|
||||
|
@ -261,17 +261,16 @@ public class LuckPermsSubject implements Subject {
|
||||
|
||||
@Override
|
||||
public boolean clearPermissions() {
|
||||
// TODO re-give default nodes?
|
||||
|
||||
holder.getNodes().clear();
|
||||
if (holder instanceof User) {
|
||||
service.getPlugin().getUserManager().giveDefaultIfNeeded(((User) holder), false);
|
||||
}
|
||||
superClass.objectSave(holder);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearPermissions(Set<Context> set) {
|
||||
// TODO re-give default nodes?
|
||||
|
||||
Map<String, String> context = new HashMap<>();
|
||||
for (Context c : set) {
|
||||
context.put(c.getKey(), c.getValue());
|
||||
@ -288,6 +287,10 @@ public class LuckPermsSubject implements Subject {
|
||||
}
|
||||
}
|
||||
|
||||
if (holder instanceof User) {
|
||||
service.getPlugin().getUserManager().giveDefaultIfNeeded(((User) holder), false);
|
||||
}
|
||||
|
||||
superClass.objectSave(holder);
|
||||
return work;
|
||||
}
|
||||
@ -372,8 +375,6 @@ public class LuckPermsSubject implements Subject {
|
||||
|
||||
@Override
|
||||
public boolean clearParents() {
|
||||
// TODO re-give default nodes?
|
||||
|
||||
boolean work = false;
|
||||
Iterator<Node> iterator = holder.getNodes().iterator();
|
||||
|
||||
@ -386,14 +387,16 @@ public class LuckPermsSubject implements Subject {
|
||||
}
|
||||
}
|
||||
|
||||
if (holder instanceof User) {
|
||||
service.getPlugin().getUserManager().giveDefaultIfNeeded(((User) holder), false);
|
||||
}
|
||||
|
||||
superClass.objectSave(holder);
|
||||
return work;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearParents(Set<Context> set) {
|
||||
// TODO re-give default nodes?
|
||||
|
||||
Map<String, String> context = new HashMap<>();
|
||||
for (Context c : set) {
|
||||
context.put(c.getKey(), c.getValue());
|
||||
@ -415,6 +418,10 @@ public class LuckPermsSubject implements Subject {
|
||||
}
|
||||
}
|
||||
|
||||
if (holder instanceof User) {
|
||||
service.getPlugin().getUserManager().giveDefaultIfNeeded(((User) holder), false);
|
||||
}
|
||||
|
||||
superClass.objectSave(holder);
|
||||
return work;
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ package me.lucko.luckperms.api.sponge.collections;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import me.lucko.luckperms.groups.GroupManager;
|
||||
import me.lucko.luckperms.api.sponge.LuckPermsService;
|
||||
import me.lucko.luckperms.api.sponge.simple.SimpleSubject;
|
||||
import me.lucko.luckperms.api.sponge.LuckPermsSubject;
|
||||
import me.lucko.luckperms.api.sponge.simple.SimpleSubject;
|
||||
import me.lucko.luckperms.groups.GroupManager;
|
||||
import org.spongepowered.api.service.context.Context;
|
||||
import org.spongepowered.api.service.permission.PermissionService;
|
||||
import org.spongepowered.api.service.permission.Subject;
|
||||
|
@ -25,8 +25,8 @@ package me.lucko.luckperms.api.sponge.collections;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import me.lucko.luckperms.api.sponge.LuckPermsService;
|
||||
import me.lucko.luckperms.api.sponge.simple.SimpleSubject;
|
||||
import me.lucko.luckperms.api.sponge.LuckPermsSubject;
|
||||
import me.lucko.luckperms.api.sponge.simple.SimpleSubject;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import me.lucko.luckperms.users.UserManager;
|
||||
import org.spongepowered.api.service.context.Context;
|
||||
|
Loading…
Reference in New Issue
Block a user