7.4 update (TabComplete, Bugfix, Translation)

This commit is contained in:
mfnalex 2020-05-16 20:44:53 +02:00
parent 84516eafbc
commit 811ada97b6
5 changed files with 46 additions and 10 deletions

View File

@ -6,7 +6,7 @@
<groupId>de.jeffclan</groupId>
<artifactId>JeffChestSort</artifactId>
<version>7.4-pre3</version>
<version>7.4</version>
<packaging>jar</packaging>
<name>JeffChestSort</name>

View File

@ -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) {

View File

@ -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<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
private List<String> getMatchingOptions(String entered, String[] options) {
List<String> list = new ArrayList<String>();
if(!command.getName().equalsIgnoreCase("chestsort")) {
return list;
for(String option : options) {
if(option.toLowerCase().startsWith(entered.toLowerCase())) {
list.add(option);
}
}
return list;
}
public List<String> 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<String>();
}
}

View File

@ -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."

View File

@ -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