mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-02 15:43:22 +01:00
renamed shortcuts to hotkeys
This commit is contained in:
parent
c49ac6c9bb
commit
2cfec8c523
@ -1,21 +1,18 @@
|
|||||||
package de.jeffclan.JeffChestSort;
|
package de.jeffclan.JeffChestSort;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
import org.bukkit.block.DoubleChest;
|
import org.bukkit.block.DoubleChest;
|
||||||
import org.bukkit.block.EnderChest;
|
|
||||||
import org.bukkit.block.ShulkerBox;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
import org.bukkit.event.inventory.InventoryEvent;
|
import org.bukkit.event.inventory.InventoryEvent;
|
||||||
@ -274,7 +271,7 @@ public class JeffChestSortListener implements Listener {
|
|||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||||
|
|
||||||
if(!plugin.getConfig().getBoolean("allow-shortcut")) {
|
if(!plugin.getConfig().getBoolean("allow-hotkeys")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,12 +291,12 @@ public class JeffChestSortListener implements Listener {
|
|||||||
|
|
||||||
switch(event.getClick()) {
|
switch(event.getClick()) {
|
||||||
case MIDDLE:
|
case MIDDLE:
|
||||||
if(plugin.getConfig().getBoolean("shortcuts.middle-click")) {
|
if(plugin.getConfig().getBoolean("hotkeys.middle-click")) {
|
||||||
sort=true;
|
sort=true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DOUBLE_CLICK:
|
case DOUBLE_CLICK:
|
||||||
if(plugin.getConfig().getBoolean("shortcuts.double-click")) {
|
if(plugin.getConfig().getBoolean("hotkeys.double-click")) {
|
||||||
// We need getCursor() instead of getCurrentItem(), because after picking up the item, it is gone into the cursor
|
// We need getCursor() instead of getCurrentItem(), because after picking up the item, it is gone into the cursor
|
||||||
if(event.getCursor().getType() == Material.AIR) {
|
if(event.getCursor().getType() == Material.AIR) {
|
||||||
sort=true;
|
sort=true;
|
||||||
@ -307,7 +304,7 @@ public class JeffChestSortListener implements Listener {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SHIFT_LEFT:
|
case SHIFT_LEFT:
|
||||||
if(plugin.getConfig().getBoolean("shortcuts.shift-click")) {
|
if(plugin.getConfig().getBoolean("hotkeys.shift-click")) {
|
||||||
if(event.getCurrentItem().getType() == Material.AIR) {
|
if(event.getCurrentItem().getType() == Material.AIR) {
|
||||||
sort=true;
|
sort=true;
|
||||||
}
|
}
|
||||||
|
@ -134,10 +134,10 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
getConfig().addDefault("check-for-updates", "true");
|
getConfig().addDefault("check-for-updates", "true");
|
||||||
getConfig().addDefault("auto-generate-category-files", true);
|
getConfig().addDefault("auto-generate-category-files", true);
|
||||||
getConfig().addDefault("sort-time", "close");
|
getConfig().addDefault("sort-time", "close");
|
||||||
getConfig().addDefault("allow-shortcut", true);
|
getConfig().addDefault("allow-hotkeys", true);
|
||||||
getConfig().addDefault("shortcuts.middle-click", true);
|
getConfig().addDefault("hotkeys.middle-click", true);
|
||||||
getConfig().addDefault("shortcuts.shift-click", true);
|
getConfig().addDefault("hotkeys.shift-click", true);
|
||||||
getConfig().addDefault("shortcuts.double-click", true);
|
getConfig().addDefault("hotkeys.double-click", true);
|
||||||
getConfig().addDefault("verbose", true); // Prints some information in onEnable()
|
getConfig().addDefault("verbose", true); // Prints some information in onEnable()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,11 +255,11 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
getLogger().info("Sorting enabled by default: " + getConfig().getBoolean("sorting-enabled-by-default"));
|
getLogger().info("Sorting enabled by default: " + getConfig().getBoolean("sorting-enabled-by-default"));
|
||||||
getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files"));
|
getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files"));
|
||||||
getLogger().info("Sort time: " + getConfig().getString("sort-time"));
|
getLogger().info("Sort time: " + getConfig().getString("sort-time"));
|
||||||
getLogger().info("Allow shortcut: " + getConfig().getBoolean("allow-shortcut"));
|
getLogger().info("Allow hotkeys " + getConfig().getBoolean("allow-hotkeys"));
|
||||||
if(getConfig().getBoolean("allow-shortcut")) {
|
if (getConfig().getBoolean("allow-hotkeys")) {
|
||||||
getLogger().info("|- Middle-Click: " + getConfig().getBoolean("shortcuts.middle-click"));
|
getLogger().info("|- Middle-Click: " + getConfig().getBoolean("hotkeys.middle-click"));
|
||||||
getLogger().info("|- Shift-Click: " + getConfig().getBoolean("shortcuts.shift-click"));
|
getLogger().info("|- Shift-Click: " + getConfig().getBoolean("hotkeys.shift-click"));
|
||||||
getLogger().info("|- Double-Click: " + getConfig().getBoolean("shortcuts.double-click"));
|
getLogger().info("|- Double-Click: " + getConfig().getBoolean("hotkeys.double-click"));
|
||||||
}
|
}
|
||||||
getLogger().info("Check for updates: " + getConfig().getString("check-for-updates"));
|
getLogger().info("Check for updates: " + getConfig().getString("check-for-updates"));
|
||||||
getLogger().info("Categories: " + getCategoryList());
|
getLogger().info("Categories: " + getCategoryList());
|
||||||
@ -288,7 +288,8 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
private String getCategoryList() {
|
private String getCategoryList() {
|
||||||
String list = "";
|
String list = "";
|
||||||
JeffChestSortCategory[] categories = organizer.categories.toArray(new JeffChestSortCategory[organizer.categories.size()]);
|
JeffChestSortCategory[] categories = organizer.categories
|
||||||
|
.toArray(new JeffChestSortCategory[organizer.categories.size()]);
|
||||||
Arrays.sort(categories);
|
Arrays.sort(categories);
|
||||||
for (JeffChestSortCategory category : categories) {
|
for (JeffChestSortCategory category : categories) {
|
||||||
list = list + category.name + " (";
|
list = list + category.name + " (";
|
||||||
@ -320,6 +321,14 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
metrics.addCustomChart(new Metrics.SimplePie("sort_time", () -> getConfig().getString("sort-time")));
|
metrics.addCustomChart(new Metrics.SimplePie("sort_time", () -> getConfig().getString("sort-time")));
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("auto_generate_category_files",
|
metrics.addCustomChart(new Metrics.SimplePie("auto_generate_category_files",
|
||||||
() -> Boolean.toString(getConfig().getBoolean("auto-generate-category-files"))));
|
() -> Boolean.toString(getConfig().getBoolean("auto-generate-category-files"))));
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("allow_hotkeys",
|
||||||
|
() -> Boolean.toString(getConfig().getBoolean("allow-hotkeys"))));
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("hotkey_middle_click",
|
||||||
|
() -> Boolean.toString(getConfig().getBoolean("hotkeys.middle-click"))));
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("hotkey_shift_click",
|
||||||
|
() -> Boolean.toString(getConfig().getBoolean("hotkeys.shift-click"))));
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("hotkey_double_click",
|
||||||
|
() -> Boolean.toString(getConfig().getBoolean("hotkeys.double-click"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saves default category files, when enabled in the config
|
// Saves default category files, when enabled in the config
|
||||||
@ -331,8 +340,9 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Isn't there a smarter way to find all the 9** files in the .jar?
|
// Isn't there a smarter way to find all the 9** files in the .jar?
|
||||||
String[] defaultCategories = { "900-weapons", "905-common-tools", "907-other-tools", "909-food", "910-valuables", "920-armor-and-arrows", "930-brewing",
|
String[] defaultCategories = { "900-weapons", "905-common-tools", "907-other-tools", "909-food",
|
||||||
"950-redstone", "960-wood", "970-stone", "980-plants", "981-corals","_ReadMe - Category files" };
|
"910-valuables", "920-armor-and-arrows", "930-brewing", "950-redstone", "960-wood", "970-stone",
|
||||||
|
"980-plants", "981-corals", "_ReadMe - Category files" };
|
||||||
|
|
||||||
// Delete all files starting with 9..
|
// Delete all files starting with 9..
|
||||||
for (File file : new File(getDataFolder().getAbsolutePath() + File.separator + "categories" + File.separator)
|
for (File file : new File(getDataFolder().getAbsolutePath() + File.separator + "categories" + File.separator)
|
||||||
|
@ -66,10 +66,10 @@ sort-time: close
|
|||||||
# Instead of automatic sorting, you can also use hotkeys (see below)
|
# Instead of automatic sorting, you can also use hotkeys (see below)
|
||||||
# when using an inventory to have it sorted immediately.
|
# when using an inventory to have it sorted immediately.
|
||||||
# You can disable this by setting this to false.
|
# You can disable this by setting this to false.
|
||||||
allow-shortcut: true
|
allow-hotkeys: true
|
||||||
|
|
||||||
# You can disable/enable certain hotkeys when you have allow-shortcut enabled
|
# You can disable/enable certain hotkeys when you have allow-hotkeys enabled
|
||||||
shortcuts:
|
hotkeys:
|
||||||
# Use middle click (mousewheel) on ANY inventory slot as hotkey
|
# Use middle click (mousewheel) on ANY inventory slot as hotkey
|
||||||
middle-click: true
|
middle-click: true
|
||||||
# Use shift + left-click on any EMPTY inventory slot as hotkey
|
# Use shift + left-click on any EMPTY inventory slot as hotkey
|
||||||
|
Loading…
Reference in New Issue
Block a user