Sponge fixes
This commit is contained in:
@@ -103,7 +103,7 @@ public interface LuckPermsPlugin {
|
||||
/**
|
||||
* @return a {@link List} of senders online on the platform
|
||||
*/
|
||||
List<Sender> getSenders();
|
||||
List<Sender> getNotifyListeners();
|
||||
|
||||
/**
|
||||
* @return the console sender of the instance
|
||||
|
||||
@@ -47,7 +47,11 @@ public abstract class SenderFactory<T> implements Runnable {
|
||||
protected abstract boolean hasPermission(T t, String node);
|
||||
|
||||
public final Sender wrap(T t) {
|
||||
return new SenderImp(t);
|
||||
return new SenderImp(t, null);
|
||||
}
|
||||
|
||||
public final Sender wrap(T t, Set<Permission> toCheck) {
|
||||
return new SenderImp(t, toCheck);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,15 +85,19 @@ public abstract class SenderFactory<T> implements Runnable {
|
||||
|
||||
private final boolean console;
|
||||
|
||||
private SenderImp(T t) {
|
||||
private SenderImp(T t, Set<Permission> toCheck) {
|
||||
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 = ImmutableMap.copyOf(Arrays.stream(Permission.values())
|
||||
.collect(Collectors.toMap(p -> p, p -> factory.hasPermission(t, p.getNode()))));
|
||||
if (toCheck == null || toCheck.isEmpty()) {
|
||||
this.perms = ImmutableMap.copyOf(Arrays.stream(Permission.values())
|
||||
.collect(Collectors.toMap(p -> p, p -> factory.hasPermission(t, p.getNode()))));
|
||||
} else {
|
||||
this.perms = ImmutableMap.copyOf(toCheck.stream().collect(Collectors.toMap(p -> p, p -> factory.hasPermission(t, p.getNode()))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,14 +26,12 @@ import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.event.events.LogNotifyEvent;
|
||||
import me.lucko.luckperms.commands.Sender;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
import me.lucko.luckperms.core.PermissionHolder;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.tracks.Track;
|
||||
import me.lucko.luckperms.users.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LogEntry extends me.lucko.luckperms.api.LogEntry {
|
||||
public static LogEntryBuilder build() {
|
||||
@@ -58,9 +56,7 @@ public class LogEntry extends me.lucko.luckperms.api.LogEntry {
|
||||
|
||||
final String msg = super.getFormatted();
|
||||
|
||||
List<Sender> senders = plugin.getSenders().stream()
|
||||
.filter(Permission.LOG_NOTIFY::isAuthorized)
|
||||
.collect(Collectors.toList());
|
||||
List<Sender> senders = plugin.getNotifyListeners();
|
||||
senders.add(plugin.getConsoleSender());
|
||||
|
||||
if (sender == null) {
|
||||
|
||||
Reference in New Issue
Block a user