Skip to content

Commit

Permalink
Fix peaceful command suggest
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Aug 13, 2023
1 parent 43850f0 commit 5f6865c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions patches/server/0116-Force-peaceful-mode-switch.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 5f6865c

Please sign in to comment.