From 81c5ed05f57ed78f8f7442a8481e7e308499de4b Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 13 May 2017 17:28:10 +0200 Subject: [PATCH] Added tab completion for Towny's and AreaShop's config values --- .../epiceric/shopchest/ShopTabCompleter.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/main/java/de/epiceric/shopchest/ShopTabCompleter.java b/src/main/java/de/epiceric/shopchest/ShopTabCompleter.java index cb66712..b2594ff 100644 --- a/src/main/java/de/epiceric/shopchest/ShopTabCompleter.java +++ b/src/main/java/de/epiceric/shopchest/ShopTabCompleter.java @@ -25,6 +25,8 @@ class ShopTabCompleter implements TabCompleter { List subCommands = Arrays.asList("config", "create", "info", "limits", "open", "reload", "remove", "update"); List createSubCommands = Arrays.asList("admin", "normal"); List configSubCommands = Arrays.asList("add", "remove", "set"); + List areaShopRemoveEvents = Arrays.asList("DELETE", "RESELL", "SELL", "UNRENT"); + List townyShopPlots = Arrays.asList("ARENA", "COMMERCIAL", "EMBASSY", "FARM", "INN", "JAIL", "RESIDENTIAL", "SPLEEF", "WILDS"); Set configValues = plugin.getConfig().getKeys(true); @@ -70,6 +72,34 @@ class ShopTabCompleter implements TabCompleter { return new ArrayList<>(configValues); } } + } else if (args.length == 4) { + if (args[0].equals("config")) { + if (args[2].equals("towny-shop-plots")) { + if (!args[3].equals("")) { + for (String s : townyShopPlots) { + if (s.startsWith(args[3])) { + returnCompletions.add(s); + } + } + + return returnCompletions; + } else { + return townyShopPlots; + } + } else if (args[2].equals("areashop-remove-shops")) { + if (!args[3].equals("")) { + for (String s : areaShopRemoveEvents) { + if (s.startsWith(args[3])) { + returnCompletions.add(s); + } + } + + return returnCompletions; + } else { + return areaShopRemoveEvents; + } + } + } } else if (args.length == 5) { if (args[0].equals("create")) { if (!args[4].equals("")) {