misc cleanup
This commit is contained in:
parent
7540a6eb70
commit
08869da96e
@ -105,7 +105,7 @@ public class LogDispatcher {
|
|||||||
public void dispatchFromRemote(ExtendedLogEntry entry) {
|
public void dispatchFromRemote(ExtendedLogEntry entry) {
|
||||||
boolean shouldCancel = !this.plugin.getConfiguration().get(ConfigKeys.BROADCAST_RECEIVED_LOG_ENTRIES) || !this.plugin.getConfiguration().get(ConfigKeys.LOG_NOTIFY);
|
boolean shouldCancel = !this.plugin.getConfiguration().get(ConfigKeys.BROADCAST_RECEIVED_LOG_ENTRIES) || !this.plugin.getConfiguration().get(ConfigKeys.LOG_NOTIFY);
|
||||||
if (!this.plugin.getEventFactory().handleLogBroadcast(shouldCancel, entry, LogBroadcastEvent.Origin.REMOTE)) {
|
if (!this.plugin.getEventFactory().handleLogBroadcast(shouldCancel, entry, LogBroadcastEvent.Origin.REMOTE)) {
|
||||||
broadcast(entry, LogNotifyEvent.Origin.LOCAL_API, null);
|
broadcast(entry, LogNotifyEvent.Origin.REMOTE, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,8 @@ import java.util.Optional;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class LogNotify extends SubCommand<Log> {
|
public class LogNotify extends SubCommand<Log> {
|
||||||
|
private static final String IGNORE_NODE = "luckperms.log.notify.ignoring";
|
||||||
|
|
||||||
public LogNotify(LocaleManager locale) {
|
public LogNotify(LocaleManager locale) {
|
||||||
super(CommandSpec.LOG_NOTIFY.localize(locale), "notify", CommandPermission.LOG_NOTIFY, Predicates.notInRange(0, 1));
|
super(CommandSpec.LOG_NOTIFY.localize(locale), "notify", CommandPermission.LOG_NOTIFY, Predicates.notInRange(0, 1));
|
||||||
}
|
}
|
||||||
@ -56,7 +58,7 @@ public class LogNotify extends SubCommand<Log> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Optional<? extends Node> ret = user.enduringData().immutable().get(ContextSet.empty()).stream()
|
Optional<? extends Node> ret = user.enduringData().immutable().get(ContextSet.empty()).stream()
|
||||||
.filter(n -> n.getPermission().equalsIgnoreCase("luckperms.log.notify.ignoring"))
|
.filter(n -> n.getPermission().equalsIgnoreCase(IGNORE_NODE))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
// if they don't have the perm, they're not ignoring
|
// if they don't have the perm, they're not ignoring
|
||||||
@ -72,10 +74,10 @@ public class LogNotify extends SubCommand<Log> {
|
|||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
// add the perm
|
// add the perm
|
||||||
user.setPermission(NodeFactory.make("luckperms.log.notify.ignoring"));
|
user.setPermission(NodeFactory.make(IGNORE_NODE));
|
||||||
} else {
|
} else {
|
||||||
// remove the perm
|
// remove the perm
|
||||||
user.removeIf(ContextSet.empty(), n -> n.getPermission().equalsIgnoreCase("luckperms.log.notify.ignoring"));
|
user.removeIf(ContextSet.empty(), n -> n.getPermission().equalsIgnoreCase(IGNORE_NODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getStorage().saveUser(user).join();
|
plugin.getStorage().saveUser(user).join();
|
||||||
|
@ -34,7 +34,6 @@ import me.lucko.luckperms.common.utils.TextUtils;
|
|||||||
import net.kyori.text.Component;
|
import net.kyori.text.Component;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,11 +132,6 @@ public final class AbstractSender<T> implements Sender {
|
|||||||
return this.reference.get() != null;
|
return this.reference.get() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Object> getHandle() {
|
|
||||||
return Optional.ofNullable(this.reference.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
|
@ -33,7 +33,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
|
|
||||||
import net.kyori.text.Component;
|
import net.kyori.text.Component;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,14 +155,4 @@ public interface Sender {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the handle object for this sender. (In most cases, the real
|
|
||||||
* CommandSender/CommandSource object from the platform)
|
|
||||||
*
|
|
||||||
* @return the handle
|
|
||||||
*/
|
|
||||||
default Optional<Object> getHandle() {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user