From a867c2d23af5a4865d3bde5a0bedf57a05d448a7 Mon Sep 17 00:00:00 2001 From: Aust1n46 Date: Sun, 21 Mar 2021 13:58:29 -0500 Subject: [PATCH] Added common mute times to tab completion. --- src/mineverse/Aust1n46/chat/command/mute/Mute.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mineverse/Aust1n46/chat/command/mute/Mute.java b/src/mineverse/Aust1n46/chat/command/mute/Mute.java index 2b7e362..d41df9d 100644 --- a/src/mineverse/Aust1n46/chat/command/mute/Mute.java +++ b/src/mineverse/Aust1n46/chat/command/mute/Mute.java @@ -3,6 +3,7 @@ package mineverse.Aust1n46.chat.command.mute; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -22,6 +23,8 @@ import mineverse.Aust1n46.chat.utilities.Format; public class Mute extends MineverseCommand { private MineverseChat plugin = MineverseChat.getInstance(); + + private static final List COMMON_MUTE_TIMES = Collections.unmodifiableList(Arrays.asList(new String[]{"12h", "15m", "1d", "1h", "1m", "30s"})); public Mute(String name) { super(name); @@ -130,6 +133,12 @@ public class Mute extends MineverseCommand { StringUtil.copyPartialMatches(args[1], ChatChannel.getChatChannels().stream().map(ChatChannel::getName).collect(Collectors.toList()), completions); Collections.sort(completions); return completions; + } + if(args.length == 3) { + StringUtil.copyPartialMatches(args[2], COMMON_MUTE_TIMES, completions); + Collections.sort(completions); + return completions; + } return Collections.emptyList(); }