misc cleanup

This commit is contained in:
Luck 2018-07-13 17:51:30 -07:00
parent 7540a6eb70
commit 08869da96e
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
4 changed files with 6 additions and 21 deletions

View File

@ -105,7 +105,7 @@ public class LogDispatcher {
public void dispatchFromRemote(ExtendedLogEntry entry) {
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)) {
broadcast(entry, LogNotifyEvent.Origin.LOCAL_API, null);
broadcast(entry, LogNotifyEvent.Origin.REMOTE, null);
}
}
}

View File

@ -45,6 +45,8 @@ import java.util.Optional;
import java.util.UUID;
public class LogNotify extends SubCommand<Log> {
private static final String IGNORE_NODE = "luckperms.log.notify.ignoring";
public LogNotify(LocaleManager locale) {
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()
.filter(n -> n.getPermission().equalsIgnoreCase("luckperms.log.notify.ignoring"))
.filter(n -> n.getPermission().equalsIgnoreCase(IGNORE_NODE))
.findFirst();
// if they don't have the perm, they're not ignoring
@ -72,10 +74,10 @@ public class LogNotify extends SubCommand<Log> {
if (state) {
// add the perm
user.setPermission(NodeFactory.make("luckperms.log.notify.ignoring"));
user.setPermission(NodeFactory.make(IGNORE_NODE));
} else {
// 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();

View File

@ -34,7 +34,6 @@ import me.lucko.luckperms.common.utils.TextUtils;
import net.kyori.text.Component;
import java.lang.ref.WeakReference;
import java.util.Optional;
import java.util.UUID;
/**
@ -133,11 +132,6 @@ public final class AbstractSender<T> implements Sender {
return this.reference.get() != null;
}
@Override
public Optional<Object> getHandle() {
return Optional.ofNullable(this.reference.get());
}
@Override
public boolean equals(Object o) {
if (o == this) return true;

View File

@ -33,7 +33,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
import net.kyori.text.Component;
import java.util.Optional;
import java.util.UUID;
/**
@ -156,14 +155,4 @@ public interface Sender {
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();
}
}