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-bungeecord/src/main/java | |
parent | 9d5aad9413ec8a219549f626db6e33ccca2f5acf (diff) | |
download | spark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.tar.gz spark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.tar.bz2 spark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.zip |
more cleanup work, fix build
Diffstat (limited to 'spark-bungeecord/src/main/java')
-rw-r--r-- | spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java b/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java index 9becaf1..630035b 100644 --- a/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java +++ b/spark-bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java @@ -30,10 +30,7 @@ import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.TabExecutor; 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; public class SparkBungeeCordPlugin extends Plugin implements SparkPlugin { @@ -67,11 +64,11 @@ public class SparkBungeeCordPlugin extends Plugin implements SparkPlugin { } @Override - public Set<BungeeCordCommandSender> getSendersWithPermission(String permission) { - List<CommandSender> senders = new LinkedList<>(getProxy().getPlayers()); - senders.removeIf(sender -> !sender.hasPermission(permission)); - senders.add(getProxy().getConsole()); - return senders.stream().map(BungeeCordCommandSender::new).collect(Collectors.toSet()); + public Stream<BungeeCordCommandSender> getSendersWithPermission(String permission) { + return Stream.concat( + getProxy().getPlayers().stream().filter(player -> player.hasPermission(permission)), + Stream.of(getProxy().getConsole()) + ).map(BungeeCordCommandSender::new); } @Override |