diff options
author | Luck <git@lucko.me> | 2019-08-03 15:48:34 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2019-08-03 15:48:34 +0100 |
commit | 4308eda6fd4ce3d637ad29b50f53d870ec1facbc (patch) | |
tree | 893f48b04d89ada7ed3f7e436a28ad538c49fe41 /spark-velocity/src/main/java/me/lucko | |
parent | 9d5aad9413ec8a219549f626db6e33ccca2f5acf (diff) | |
download | spark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.tar.gz spark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.tar.bz2 spark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.zip |
more cleanup work, fix build
Diffstat (limited to 'spark-velocity/src/main/java/me/lucko')
-rw-r--r-- | spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java b/spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java index 7cf345a..69217a9 100644 --- a/spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java +++ b/spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java @@ -30,7 +30,6 @@ import com.velocitypowered.api.event.proxy.ProxyShutdownEvent; import com.velocitypowered.api.plugin.Plugin; import com.velocitypowered.api.plugin.annotation.DataDirectory; import com.velocitypowered.api.proxy.ProxyServer; -import me.lucko.spark.common.CommandSender; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.SparkPlugin; import me.lucko.spark.common.sampler.ThreadDumper; @@ -39,10 +38,8 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.optional.qual.MaybePresent; import java.nio.file.Path; -import java.util.LinkedList; import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; +import java.util.stream.Stream; @Plugin( id = "spark", @@ -102,11 +99,11 @@ public class SparkVelocityPlugin implements SparkPlugin, Command { } @Override - public Set<CommandSender> getSendersWithPermission(String permission) { - List<CommandSource> senders = new LinkedList<>(this.proxy.getAllPlayers()); - senders.removeIf(sender -> !sender.hasPermission(permission)); - senders.add(this.proxy.getConsoleCommandSource()); - return senders.stream().map(VelocityCommandSender::new).collect(Collectors.toSet()); + public Stream<VelocityCommandSender> getSendersWithPermission(String permission) { + return Stream.concat( + this.proxy.getAllPlayers().stream().filter(player -> player.hasPermission(permission)), + Stream.of(this.proxy.getConsoleCommandSource()) + ).map(VelocityCommandSender::new); } @Override |