From 663ae0438164a957a6722f67e299bba1d3547220 Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Mon, 27 Nov 2023 16:09:16 -0500 Subject: [PATCH] fix tab complete order --- .../paper/commands/AuctionTab.java | 21 +++++++++---------- paper/src/main/resources/paper-plugin.yml | 8 ------- 2 files changed, 10 insertions(+), 19 deletions(-) delete mode 100644 paper/src/main/resources/paper-plugin.yml diff --git a/paper/src/main/java/com/badbones69/crazyauctions/paper/commands/AuctionTab.java b/paper/src/main/java/com/badbones69/crazyauctions/paper/commands/AuctionTab.java index 3582b84..7c82881 100644 --- a/paper/src/main/java/com/badbones69/crazyauctions/paper/commands/AuctionTab.java +++ b/paper/src/main/java/com/badbones69/crazyauctions/paper/commands/AuctionTab.java @@ -1,8 +1,11 @@ package com.badbones69.crazyauctions.paper.commands; +import com.badbones69.crazyauctions.paper.CrazyAuctions; +import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; +import org.bukkit.entity.Player; import org.bukkit.util.StringUtil; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -10,6 +13,8 @@ import java.util.Arrays; import java.util.List; public class AuctionTab implements TabCompleter { + + private final CrazyAuctions plugin = CrazyAuctions.get(); @Override public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String commandLabel, String[] args) { @@ -28,23 +33,17 @@ public class AuctionTab implements TabCompleter { if (hasPermission(sender, "bid")) completions.add("bid"); return StringUtil.copyPartialMatches(args[0], completions, new ArrayList<>()); } else if (args.length == 2) { // /crazyauctions arg0 + switch (args[0].toLowerCase()) { + case "bid", "sell" -> completions.addAll(Arrays.asList("50", "100", "250", "500", "1000", "2500", "5000", "10000")); + case "view" -> completions.addAll(this.plugin.getServer().getOnlinePlayers().stream().map(Player::getName).toList()); + } return StringUtil.copyPartialMatches(args[1], completions, new ArrayList<>()); } else if (args.length == 3) { // /crazyauctions arg0 arg1 switch (args[0].toLowerCase()) { - case "bid", "sell" -> { - if (hasPermission(sender, "bid") || hasPermission(sender, "sell")) completions.addAll(Arrays.asList("50", "100", "250", "500", "1000", "2500", "5000", "10000")); - } + case "bid", "sell" -> completions.addAll(Arrays.asList("1", "2", "4", "8", "10", "20", "40", "64")); } return StringUtil.copyPartialMatches(args[2], completions, new ArrayList<>()); - } else if (args.length == 4) { // /crazyauctions arg0 arg1 arg2 - switch (args[0].toLowerCase()) { - case "bid", "sell" -> { - if (hasPermission(sender, "bid") || hasPermission(sender, "sell")) completions.addAll(Arrays.asList("50", "100", "250", "500", "1000", "2500", "5000", "10000")); - } - } - - return StringUtil.copyPartialMatches(args[3], completions, new ArrayList<>()); } return new ArrayList<>(); diff --git a/paper/src/main/resources/paper-plugin.yml b/paper/src/main/resources/paper-plugin.yml deleted file mode 100644 index 7552ffe..0000000 --- a/paper/src/main/resources/paper-plugin.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: '${name}' -main: '${group}.CrazyAuctions' - -version: '${version}' -api-version: '${apiVersion}' -description: '${description}' - -bootstrapper: '${group}.CrazyStarter' \ No newline at end of file