diff --git a/pom.xml b/pom.xml index bac5966..bebc4b2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.jeffclan JeffChestSort - 7.4-pre3 + 7.4 jar JeffChestSort diff --git a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java index 37fa2e8..50a0675 100644 --- a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java +++ b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java @@ -288,12 +288,13 @@ public class JeffChestSortPlugin extends JavaPlugin { // Register the events for our Listener getServer().getPluginManager().registerEvents(listener, this); - // Register the /chestsort command and associate it to a new CommandExecutor + // Create the CommandExecutor, register commands and set their TabCompleter JeffChestSortCommandExecutor commandExecutor = new JeffChestSortCommandExecutor(this); + JeffChestSortTabCompleter tabCompleter = new JeffChestSortTabCompleter(); this.getCommand("chestsort").setExecutor(commandExecutor); - - // Register the /invsort command + this.getCommand("chestsort").setTabCompleter(tabCompleter); this.getCommand("invsort").setExecutor(commandExecutor); + this.getCommand("invsort").setTabCompleter(tabCompleter); // Does anyone actually need this? if (verbose) { diff --git a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortTabCompleter.java b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortTabCompleter.java index 525af6d..e91a935 100644 --- a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortTabCompleter.java +++ b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortTabCompleter.java @@ -5,18 +5,38 @@ import java.util.List; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; -public class JeffChestSortTabCompleter { +public class JeffChestSortTabCompleter implements TabCompleter { - String[] options = { "" }; + static final String[] chestsortOptions = { "hotkeys","toggle" }; + static final String[] invsortOptions = { "all", "hotbar", "inv" }; - public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { + private List getMatchingOptions(String entered, String[] options) { List list = new ArrayList(); - if(!command.getName().equalsIgnoreCase("chestsort")) { - return list; + + for(String option : options) { + if(option.toLowerCase().startsWith(entered.toLowerCase())) { + list.add(option); + } } return list; } + + public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { + + String entered = ""; + if(args.length>0) { + entered = args[args.length-1]; + } + if(command.getName().equalsIgnoreCase("chestsort")) { + return getMatchingOptions(entered,chestsortOptions); + } + if(command.getName().equalsIgnoreCase("invsort")) { + return getMatchingOptions(entered,invsortOptions); + } + return new ArrayList(); + } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index bc781cf..2eff019 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -332,6 +332,21 @@ message-gui-shift-right-click: "Shift + Right-Click" #message-gui-double-click: "Double-Click" #message-gui-shift-right-click: "Shift + Right-Click" +##### Korean (한국어) - Thanks to kf12 for translating! +#message-when-using-chest: "&7정보: &6/chestsort&7 명령어로 자동 창고 정리를 활성화 할 수 있습니다." +#message-when-using-chest2: "&7정보: &6/chestsort&7 명령어로 자동 창고 정리를 비활성화 할 수 있습니다." +#message-sorting-disabled: "&7자동 창고 정리가 &c비활성화&7 되었습니다." +#message-sorting-enabled: "&7자동 창고 정리가 &a활성화&7 되었습니다." +#message-player-inventory-sorted: "&7인벤토리가 정리 되었습니다." +#message-error-players-only: "&cError: 이 명령은 플레이어만 실행할 수 있습니다." +#message-error-invalid-options: "&cError: 알 수 없는 옵션 %s. 올바른 옵션은 %s 입니다." +#message-gui-enabled: "&a활성화" +#message-gui-disabled: "&c비활성화" +#message-gui-middle-click: "휠 클릭" +#message-gui-shift-click: "쉬프트 + 클릭" +#message-gui-double-click: "더블 클릭" +#message-gui-shift-right-click: "쉬프트 + 우클릭" + ##### Portuguese - Thanks to wildastral for translating! ##### Note: Some messages are still untranslated. Please send me your translation at SpigotMC #message-when-using-chest: "&7Dica: Digite &6/chestsort&7 para habilitar a organização automática." diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 9273dae..f187e7d 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: de.jeffclan.JeffChestSort.JeffChestSortPlugin name: ChestSort -version: 7.4-pre3 +version: 7.4 api-version: 1.13 description: Allows automatic chest sorting author: mfnalex