Cleanup some remaining TODOs
This commit is contained in:
@@ -93,7 +93,10 @@ public interface LuckPermsPlugin {
|
||||
* @param uuid The player's uuid
|
||||
* @return a formatted status string
|
||||
*/
|
||||
Message getPlayerStatus(UUID uuid);
|
||||
default Message getPlayerStatus(UUID uuid) {
|
||||
UUID external = getUuidCache().getExternalUUID(uuid);
|
||||
return isOnline(external) ? Message.PLAYER_ONLINE : Message.PLAYER_OFFLINE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of users online on the platform
|
||||
@@ -107,6 +110,19 @@ public interface LuckPermsPlugin {
|
||||
*/
|
||||
List<String> getPlayerList();
|
||||
|
||||
/**
|
||||
* Gets the UUIDs of the users online on the platform
|
||||
* @return a {@link Set} of UUIDs
|
||||
*/
|
||||
Set<UUID> getOnlinePlayers();
|
||||
|
||||
/**
|
||||
* Checks if a user is online
|
||||
* @param external the users external uuid
|
||||
* @return true if the user is online
|
||||
*/
|
||||
boolean isOnline(UUID external);
|
||||
|
||||
/**
|
||||
* @return a {@link List} of senders online on the platform
|
||||
*/
|
||||
@@ -117,7 +133,11 @@ public interface LuckPermsPlugin {
|
||||
*/
|
||||
Sender getConsoleSender();
|
||||
|
||||
// TODO javadoc
|
||||
/**
|
||||
* Gets a set of Contexts that should be pre-processed in advance
|
||||
* @param op if the user being processed is op
|
||||
* @return a set of contexts
|
||||
*/
|
||||
Set<Contexts> getPreProcessContexts(boolean op);
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,9 +27,11 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import me.lucko.luckperms.api.event.events.GroupAddEvent;
|
||||
import me.lucko.luckperms.api.event.events.UserPermissionRefreshEvent;
|
||||
import me.lucko.luckperms.common.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.api.internal.GroupLink;
|
||||
import me.lucko.luckperms.common.api.internal.PermissionHolderLink;
|
||||
import me.lucko.luckperms.common.api.internal.UserLink;
|
||||
import me.lucko.luckperms.common.caching.UserData;
|
||||
import me.lucko.luckperms.common.core.PermissionHolder;
|
||||
import me.lucko.luckperms.common.groups.Group;
|
||||
@@ -109,7 +111,6 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
|
||||
userData.invalidateCache();
|
||||
userData = null;
|
||||
}
|
||||
// TODO
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,7 +125,7 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
|
||||
UserData ud = userData;
|
||||
ud.recalculatePermissions();
|
||||
ud.recalculateMeta();
|
||||
// TODO api call?
|
||||
getPlugin().getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,7 @@ import me.lucko.luckperms.common.utils.AbstractManager;
|
||||
import me.lucko.luckperms.common.utils.Identifiable;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@@ -120,14 +121,23 @@ public class UserManager extends AbstractManager<UserIdentifier, User> {
|
||||
* @param user The user to be cleaned up
|
||||
*/
|
||||
public void cleanup(User user) {
|
||||
// TODO
|
||||
if (!plugin.isOnline(plugin.getUuidCache().getExternalUUID(user.getUuid()))) {
|
||||
unload(user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the data of all online users
|
||||
*/
|
||||
public void updateAllUsers() {
|
||||
// TODO
|
||||
plugin.doSync(() -> {
|
||||
Set<UUID> players = plugin.getOnlinePlayers();
|
||||
plugin.doAsync(() -> {
|
||||
for (UUID uuid : players) {
|
||||
plugin.getDatastore().loadUser(plugin.getUuidCache().getUUID(uuid), "null");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user