Merge pull request #31 from JEFF-Media-GbR/More-Hotkeys

added Shift-Right-Click as shortcut
This commit is contained in:
JEFF 2019-07-14 19:12:43 +02:00 committed by GitHub
commit 623a4f06c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 15 deletions

View File

@ -281,6 +281,14 @@ public class JeffChestSortListener implements Listener {
Player p = (Player) event.getWhoClicked();
// DEBUG START
p.sendMessage("=====================");
p.sendMessage("Click type: " + event.getClick().name());
p.sendMessage("Right click: " + event.isRightClick());
p.sendMessage("Shift click: " + event.isShiftClick());
p.sendMessage("=====================");
// DEBUG END
if(!p.hasPermission("chestsort.use")) {
return;
}
@ -310,6 +318,13 @@ public class JeffChestSortListener implements Listener {
}
}
break;
case SHIFT_RIGHT:
if(plugin.getConfig().getBoolean("hotkeys.shift-right-click")) {
if(event.getCurrentItem().getType() == Material.AIR) {
sort=true;
}
}
break;
default:
break;
}

View File

@ -139,6 +139,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
getConfig().addDefault("hotkeys.middle-click", true);
getConfig().addDefault("hotkeys.shift-click", true);
getConfig().addDefault("hotkeys.double-click", true);
getConfig().addDefault("hotkeys.shift-right-click", true);
getConfig().addDefault("verbose", true); // Prints some information in onEnable()
}
@ -250,9 +251,12 @@ public class JeffChestSortPlugin extends JavaPlugin {
getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files"));
getLogger().info("Sort time: " + getConfig().getString("sort-time"));
getLogger().info("Allow hotkeys: " + getConfig().getBoolean("allow-hotkeys"));
getLogger().info("|- Middle-Click: " + getConfig().getBoolean("hotkeys.middle-click"));
getLogger().info("|- Shift-Click: " + getConfig().getBoolean("hotkeys.shift-click"));
getLogger().info("|- Double-Click: " + getConfig().getBoolean("hotkeys.double-click"));
if(getConfig().getBoolean("allow-hotkeys")) {
getLogger().info("|- Middle-Click: " + getConfig().getBoolean("hotkeys.middle-click"));
getLogger().info("|- Shift-Click: " + getConfig().getBoolean("hotkeys.shift-click"));
getLogger().info("|- Double-Click: " + getConfig().getBoolean("hotkeys.double-click"));
getLogger().info("|- Shift-Right-Click: " + getConfig().getBoolean("hotkeys.shift-right-click"));
}
getLogger().info("Check for updates: " + getConfig().getString("check-for-updates"));
getLogger().info("Categories: " + getCategoryList());
}
@ -320,6 +324,8 @@ public class JeffChestSortPlugin extends JavaPlugin {
() -> Boolean.toString(getConfig().getBoolean("hotkeys.shift-click"))));
metrics.addCustomChart(new Metrics.SimplePie("hotkey_double_click",
() -> Boolean.toString(getConfig().getBoolean("hotkeys.double-click"))));
metrics.addCustomChart(new Metrics.SimplePie("hotkey_shift_right_click",
() -> Boolean.toString(getConfig().getBoolean("hotkeys.shift-right-click"))));
}
// Saves default category files, when enabled in the config

View File

@ -76,6 +76,8 @@ hotkeys:
shift-click: true
# Use double left-click on any EMPTY inventory slot as hotkey
double-click: true
# Use shift + right-click on any EMPTY inventory slot as hotkey
shift-right-click: true
# should we check for updates?
# when enabled, a message is printed in the console if a new
@ -166,8 +168,8 @@ message-when-using-chest: "&7Hint: Type &6/chestsort&7 to enable automatic chest
message-when-using-chest2: "&7Hint: Type &6/chestsort&7 to disable automatic chest sorting."
message-sorting-disabled: "&7Automatic chest sorting has been &cdisabled&7."
message-sorting-enabled: "&7Automatic chest sorting has been &aenabled&7."
message-error-players-only: "&cError: This command can only be run by players."
message-player-inventory-sorted: "&7Your inventory has been sorted."
message-error-players-only: "&cError: This command can only be run by players."
message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s."
##### English
@ -175,8 +177,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Hint: Type &6/chestsort&7 to disable automatic chest sorting."
#message-sorting-disabled: "&7Automatic chest sorting has been &cdisabled&7."
#message-sorting-enabled: "&7Automatic chest sorting has been &aenabled&7."
#message-error-players-only: "&cError: This command can only be run by players."
#message-player-inventory-sorted: "&7Your inventory has been sorted."
#message-error-players-only: "&cError: This command can only be run by players."
#message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s."
##### Chinese - Thanks to qsefthuopq for translating! -> https://www.spigotmc.org/members/qsefthuopq.339953/
@ -184,8 +186,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7提示: 输入 &6/chestsort&7 来关闭自动整理箱子."
#message-sorting-disabled: "&7自动整理箱子已 &c关闭&7."
#message-sorting-enabled: "&7自动整理箱子已 &a启用&7."
#message-error-players-only: "&c错误: 指令只能由玩家运行."
#message-player-inventory-sorted: "&7已成功整理你的背包."
#message-error-players-only: "&c错误: 指令只能由玩家运行."
#message-error-invalid-options: "&c错误: 位置选项 %s. 有效选项为 %s."
##### Chinese (Traditional) 繁體中文
@ -194,8 +196,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7小提醒: 輸入 &6/chestsort&7 來關閉自動整理箱子"
#message-sorting-disabled: "&7自動整理箱子已 &c關閉&7"
#message-sorting-enabled: "&7自動整理箱子已 &a開啟&7"
#message-error-players-only: "&c錯誤: 這個指令只能由玩家使用"
#message-player-inventory-sorted: "&7你的背包已成功整理."
#message-error-players-only: "&c錯誤: 這個指令只能由玩家使用"
#message-error-invalid-options: "&c錯誤: 未知選項 %s. 有效的選項為 %s."
##### Dutch - Thanks to Xeyame for translating! -> https://github.com/Xeyame
@ -203,8 +205,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Hint: Gebruik &6/chestsort&7 om automatische kist sortering uit te zetten."
#message-sorting-disabled: "&7Automatische kist sortering is &cuitgeschakeld&7."
#message-sorting-enabled: "&7Automatische kist sortering is &aingeschakeld&7."
#message-error-players-only: "&cFout: Dit commando kan alleen door spelers worden gebruikt."
#message-player-inventory-sorted: "&7Je inventaris is gesorteerd."
#message-error-players-only: "&cFout: Dit commando kan alleen door spelers worden gebruikt."
#message-error-invalid-options: "&cFout: Onbekende optie %s. Mogelijke opties zijn %s."
##### French - Thanks to automatizer for translating! -> https://www.spigotmc.org/members/automatizer.26188/
@ -213,8 +215,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Astuce: Écris &6/chestsort&7 pour désactiver le classement automatique."
#message-sorting-disabled: "&7Le classement automatique a été &cdésactivé&7."
#message-sorting-enabled: "&7Le classement automatique a été &aactivé&7."
#message-error-players-only: "&cErreur: Cette commande ne peut être utilisée que par des joueurs."
#message-player-inventory-sorted: "&7Your inventory has been sorted."
#message-error-players-only: "&cErreur: Cette commande ne peut être utilisée que par des joueurs."
#message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s."
##### German
@ -222,8 +224,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Hinweis: Benutze &6/chestsort&7 um die automatische Kistensortierung zu deaktivieren."
#message-sorting-disabled: "&7Automatische Kistensortierung &cdeaktiviert&7."
#message-sorting-enabled: "&7Automatische Kistensortierung &aaktiviert&7."
#message-error-players-only: "&cFehler: Dieser Befehl ist nur für Spieler verfügbar."
#message-player-inventory-sorted: "&7Dein Inventar wurde sortiert."
#message-error-players-only: "&cFehler: Dieser Befehl ist nur für Spieler verfügbar."
#message-error-invalid-options: "&cFehler: Unbekannte Option %s. Gültige Optionen sind %s."
##### Italian - Translated with Google. Please tell me if something is wrong :)
@ -231,8 +233,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Nota: inserire &6/chestsort&7 per disabilitare l'ordinamento automatico dei bauli."
#message-sorting-disabled: "&7L'ordinamento automatico dei bauli è stato &cdisattivato&7."
#message-sorting-enabled: "&7L'ordinamento automatico dei bauli è stato &aattivato&7."
#message-error-players-only: "&cErrore: questo comando è disponibile solo per i giocatori."
#message-player-inventory-sorted: "&7Il tuo inventario è stato ordinato."
#message-error-players-only: "&cErrore: questo comando è disponibile solo per i giocatori."
#message-error-invalid-options: "&cErrore: Parametro sconosciuto %s. I parametri validi sono %s."
##### Japanese
@ -251,8 +253,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Dica: Digite &6/chestsort&7 para desabilitar a organização automática."
#message-sorting-disabled: "&7A Organização automática de baús foi &cdesabilitada&7."
#message-sorting-enabled: "&7A Organização automática de baús foi &ahabilitada&7."
#message-error-players-only: "&cErro: Esse comando não pode ser executado por jogadores."
#message-player-inventory-sorted: "&7Seu inventário foi organizado."
#message-error-players-only: "&cErro: Esse comando não pode ser executado por jogadores."
#message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s."
##### Russian - Thanks to Gandon for translating! -> https://www.spigotmc.org/members/gandon.443887/
@ -260,8 +262,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Подсказка: введите &6/chestsort&7, чтобы отключить автоматическую сортировку вещей в сундуках."
#message-sorting-disabled: "&7Автоматическая сортировка вещей в сундуках была &cотключена&7."
#message-sorting-enabled: "&7Автоматическая сортировка вещей в сундуках была &aвключена&7."
#message-error-players-only: "&cОшибка: эта команда может быть использована только игроками."
#message-player-inventory-sorted: "&7Ваш инвентарь был отсортирован."
#message-error-players-only: "&cОшибка: эта команда может быть использована только игроками."
#message-error-invalid-options: "&cОшибка: Неизвестная опция %s. Допустимые опции: %s."
##### Spanish - Thanks to Bers_ for translating! -> https://www.spigotmc.org/members/bers_.146126/
@ -269,8 +271,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Pista: Usa &6/chestsort&7 para desactivar el orden automático de los cofres."
#message-sorting-disabled: "&7Orden automático de los cofres &cdesactivado&7."
#message-sorting-enabled: "&7Orden automático de los cofres &aactivado&7."
#message-error-players-only: "&cError: Este comando solo puede ser ejecutado por jugadores."
#message-player-inventory-sorted: "&7Tu inventario ha sido ordenado."
#message-error-players-only: "&cError: Este comando solo puede ser ejecutado por jugadores."
#message-error-invalid-options: "&cError: %s es una opción inválida. Las opciones válidas son: %s."
##### Turkish - Thanks to bertek41 for translating!-> https://www.spigotmc.org/members/bertek41.247705/
@ -278,8 +280,8 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
#message-when-using-chest2: "&7Ipucu: &6/chestsort&7 Yazarak Otomatik Sandık Organizasyon Sistemini Kapatabilirsin."
#message-sorting-disabled: "&7Otomatik Sandık Organizasyonu &cKapatıldı&7."
#message-sorting-enabled: "&7Otomatik Sandık Organizasyonu &aAçıldı&7."
#message-error-players-only: "&cHata: Bu Komut Yalnızca Oyuncular Tarafından Kullanılabilir."
#message-player-inventory-sorted: "&7Envanteriniz Düzenlendi."
#message-error-players-only: "&cHata: Bu Komut Yalnızca Oyuncular Tarafından Kullanılabilir."
#message-error-invalid-options: "&cHata: Bilinmeyen Ayar %s."
#########################