mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-11-26 20:48:12 +01:00
added new shortcuts/hotkeys
This commit is contained in:
parent
ff330bae45
commit
c49ac6c9bb
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.jeffclan</groupId>
|
||||
<artifactId>JeffChestSort</artifactId>
|
||||
<version>6.0</version>
|
||||
<version>6.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>JeffChestSort</name>
|
||||
|
@ -4,6 +4,7 @@ import java.util.UUID;
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.block.EnderChest;
|
||||
@ -289,32 +290,52 @@ public class JeffChestSortListener implements Listener {
|
||||
|
||||
InventoryHolder holder = event.getInventory().getHolder();
|
||||
|
||||
if(event.getClick() != ClickType.MIDDLE) {
|
||||
return;
|
||||
boolean sort = false;
|
||||
|
||||
switch(event.getClick()) {
|
||||
case MIDDLE:
|
||||
if(plugin.getConfig().getBoolean("shortcuts.middle-click")) {
|
||||
sort=true;
|
||||
}
|
||||
break;
|
||||
case DOUBLE_CLICK:
|
||||
if(plugin.getConfig().getBoolean("shortcuts.double-click")) {
|
||||
// We need getCursor() instead of getCurrentItem(), because after picking up the item, it is gone into the cursor
|
||||
if(event.getCursor().getType() == Material.AIR) {
|
||||
sort=true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHIFT_LEFT:
|
||||
if(plugin.getConfig().getBoolean("shortcuts.shift-click")) {
|
||||
if(event.getCurrentItem().getType() == Material.AIR) {
|
||||
sort=true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(!sort) return;
|
||||
|
||||
if(belongsToChestLikeBlock(event.getInventory())) {
|
||||
//p.sendMessage("Sorting chest");
|
||||
plugin.organizer.sortInventory(event.getInventory());
|
||||
updateInventoryView(event);
|
||||
return;
|
||||
} else if(holder instanceof Player) {
|
||||
//p.sendMessage("Sorting player inv");
|
||||
if(event.getSlotType() == SlotType.QUICKBAR) {
|
||||
//p.sendMessage("Sorting Hotbar");
|
||||
plugin.organizer.sortInventory(p.getInventory(),0,8);
|
||||
updateInventoryView(event);
|
||||
return;
|
||||
}
|
||||
else if(event.getSlotType() == SlotType.CONTAINER) {
|
||||
//p.sendMessage("Sorting container");
|
||||
plugin.organizer.sortInventory(p.getInventory(),9,35);
|
||||
updateInventoryView(event);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void updateInventoryView(InventoryClickEvent event) {
|
||||
|
@ -61,7 +61,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
JeffChestSortListener listener;
|
||||
String sortingMethod;
|
||||
ArrayList<String> disabledWorlds;
|
||||
int currentConfigVersion = 12;
|
||||
int currentConfigVersion = 14;
|
||||
boolean usingMatchingConfig = true;
|
||||
boolean debug = false;
|
||||
boolean verbose = true;
|
||||
@ -135,6 +135,9 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
getConfig().addDefault("auto-generate-category-files", true);
|
||||
getConfig().addDefault("sort-time", "close");
|
||||
getConfig().addDefault("allow-shortcut", true);
|
||||
getConfig().addDefault("shortcuts.middle-click", true);
|
||||
getConfig().addDefault("shortcuts.shift-click", true);
|
||||
getConfig().addDefault("shortcuts.double-click", true);
|
||||
getConfig().addDefault("verbose", true); // Prints some information in onEnable()
|
||||
}
|
||||
|
||||
@ -252,7 +255,12 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
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("Sort time: " + getConfig().getString("sort-time"));
|
||||
getLogger().info("Allow shortcut: " + getConfig().getString("allow-shortcut"));
|
||||
getLogger().info("Allow shortcut: " + getConfig().getBoolean("allow-shortcut"));
|
||||
if(getConfig().getBoolean("allow-shortcut")) {
|
||||
getLogger().info("|- Middle-Click: " + getConfig().getBoolean("shortcuts.middle-click"));
|
||||
getLogger().info("|- Shift-Click: " + getConfig().getBoolean("shortcuts.shift-click"));
|
||||
getLogger().info("|- Double-Click: " + getConfig().getBoolean("shortcuts.double-click"));
|
||||
}
|
||||
getLogger().info("Check for updates: " + getConfig().getString("check-for-updates"));
|
||||
getLogger().info("Categories: " + getCategoryList());
|
||||
}
|
||||
|
@ -63,11 +63,20 @@ auto-generate-category-files: true
|
||||
# Available options: open, close, both
|
||||
sort-time: close
|
||||
|
||||
# Instead of automatic sorting, you can also use middle-click
|
||||
# Instead of automatic sorting, you can also use hotkeys (see below)
|
||||
# when using an inventory to have it sorted immediately.
|
||||
# You can disable this by setting this to false.
|
||||
allow-shortcut: true
|
||||
|
||||
# You can disable/enable certain hotkeys when you have allow-shortcut enabled
|
||||
shortcuts:
|
||||
# Use middle click (mousewheel) on ANY inventory slot as hotkey
|
||||
middle-click: true
|
||||
# Use shift + left-click on any EMPTY inventory slot as hotkey
|
||||
shift-click: true
|
||||
# Use double left-click on any EMPTY inventory slot as hotkey
|
||||
double-click: true
|
||||
|
||||
# should we check for updates?
|
||||
# when enabled, a message is printed in the console if a new
|
||||
# version has been found, and OPs will be notified when they join the server
|
||||
@ -279,4 +288,4 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
|
||||
#########################
|
||||
|
||||
# please do not change the following line manually!
|
||||
config-version: 12
|
||||
config-version: 14
|
||||
|
@ -1,6 +1,6 @@
|
||||
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 6.0
|
||||
version: 6.1
|
||||
api-version: 1.13
|
||||
description: Allows automatic chest sorting
|
||||
author: mfnalex
|
||||
|
Loading…
Reference in New Issue
Block a user