Adds tab completions for arena properties

This commit is contained in:
2023-04-26 14:41:54 +02:00
parent 4a3329459e
commit 8d1b841619
6 changed files with 232 additions and 20 deletions

View File

@ -1,5 +1,6 @@
package net.knarcraft.minigames.command.dropper;
import net.knarcraft.minigames.arena.dropper.DropperArenaEditableProperty;
import net.knarcraft.minigames.util.TabCompleteHelper;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -25,8 +26,12 @@ public class EditDropperArenaTabCompleter implements TabCompleter {
} else if (arguments.length == 2) {
return filterMatchingContains(TabCompleteHelper.getDropperArenaProperties(), arguments[1]);
} else if (arguments.length == 3) {
//TODO: Tab-complete possible values for the given property
return null;
DropperArenaEditableProperty property = DropperArenaEditableProperty.getFromArgumentString(arguments[1]);
if (property == null) {
return new ArrayList<>();
}
return filterMatchingContains(TabCompleteHelper.getTabCompleteSuggestions(property.getPropertyType()),
arguments[2]);
} else {
return new ArrayList<>();
}