aboutsummaryrefslogtreecommitdiff
path: root/spark-bukkit/src/main
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2019-08-03 15:48:34 +0100
committerLuck <git@lucko.me>2019-08-03 15:48:34 +0100
commit4308eda6fd4ce3d637ad29b50f53d870ec1facbc (patch)
tree893f48b04d89ada7ed3f7e436a28ad538c49fe41 /spark-bukkit/src/main
parent9d5aad9413ec8a219549f626db6e33ccca2f5acf (diff)
downloadspark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.tar.gz
spark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.tar.bz2
spark-4308eda6fd4ce3d637ad29b50f53d870ec1facbc.zip
more cleanup work, fix build
Diffstat (limited to 'spark-bukkit/src/main')
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java
index 15882ce..ebcc3e8 100644
--- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java
+++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java
@@ -31,10 +31,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
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 SparkBukkitPlugin extends JavaPlugin implements SparkPlugin {
@@ -102,11 +100,11 @@ public class SparkBukkitPlugin extends JavaPlugin implements SparkPlugin {
}
@Override
- public Set<BukkitCommandSender> getSendersWithPermission(String permission) {
- List<CommandSender> senders = new LinkedList<>(getServer().getOnlinePlayers());
- senders.removeIf(sender -> !sender.hasPermission(permission));
- senders.add(getServer().getConsoleSender());
- return senders.stream().map(BukkitCommandSender::new).collect(Collectors.toSet());
+ public Stream<BukkitCommandSender> getSendersWithPermission(String permission) {
+ return Stream.concat(
+ getServer().getOnlinePlayers().stream().filter(player -> player.hasPermission(permission)),
+ Stream.of(getServer().getConsoleSender())
+ ).map(BukkitCommandSender::new);
}
@Override