9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-26 18:39:08 +00:00

Fix peaceful command suggest

This commit is contained in:
violetc
2023-08-13 16:01:10 +08:00
parent 43850f0496
commit 5f6865c2ee

View File

@@ -122,7 +122,7 @@ index 550dcb7d595221b221e4710890d8a3cad789fc07..7b576936c5a29f3714b2fc16c24e8cde
if (!this.persistentDataContainer.isEmpty()) {
c.put("BukkitValues", this.persistentDataContainer.toTagCompound());
diff --git a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java
index 78d3df6a15057d42466c266226f308a070f560ac..06f5859cd04fe2147e37d61ab18e8fc0ff30769b 100644
index 8027a27b253db02570c2f28ebb200001b76a1fc3..da1f7ce2db23c509c70f673c8bb1c46af2ed7279 100644
--- a/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java
+++ b/src/main/java/top/leavesmc/leaves/command/LeavesCommand.java
@@ -12,6 +12,7 @@ import org.bukkit.permissions.PermissionDefault;
@@ -143,10 +143,10 @@ index 78d3df6a15057d42466c266226f308a070f560ac..06f5859cd04fe2147e37d61ab18e8fc0
.flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue())))
diff --git a/src/main/java/top/leavesmc/leaves/command/subcommands/PeacefulModeSwitchCommand.java b/src/main/java/top/leavesmc/leaves/command/subcommands/PeacefulModeSwitchCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..50c883ba689a51c1383e26ead3eb183c79b9a543
index 0000000000000000000000000000000000000000..417689ab712ce21ee05fa05ffec35b9ff163e324
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/command/subcommands/PeacefulModeSwitchCommand.java
@@ -0,0 +1,89 @@
@@ -0,0 +1,87 @@
+package top.leavesmc.leaves.command.subcommands;
+
+import io.papermc.paper.command.CommandUtil;
@@ -228,9 +228,7 @@ index 0000000000000000000000000000000000000000..50c883ba689a51c1383e26ead3eb183c
+
+ private List<String> suggestPeacefulModeSwitch(final String[] args) {
+ if (args.length == 1) {
+ final List<String> worlds = new ArrayList<>(Bukkit.getWorlds().stream().map(World::getName).toList());
+ worlds.add("*");
+ return worlds;
+ return new ArrayList<>(Bukkit.getWorlds().stream().map(World::getName).toList());
+ }
+
+ return Collections.emptyList();