mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-11-13 06:05:36 +01:00
11.4.0
This commit is contained in:
parent
3f3684a22f
commit
9ea1feb3f6
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## 11.4.0
|
||||
- Added {tier} sorting modifier to sort by tool/block material (netherite, diamond, gold, iron, stone, wood, then the rest)
|
||||
- Fixed exception
|
||||
|
||||
## 11.3.0
|
||||
- Added support for BetterBackpacks
|
||||
|
||||
## 11.2.3
|
||||
- Cancel inventory click when using hotkeys (TODO: Better explanation)
|
||||
|
||||
## 11.2.2
|
||||
- Fixed warning regarding PlaceholderAPI on server startup
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -9,7 +9,7 @@
|
||||
<name>ChestSort</name>
|
||||
<url>https://www.chestsort.de</url>
|
||||
<description>Allows automatic chest sorting!</description>
|
||||
<version>11.2.2</version>
|
||||
<version>11.4.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -442,6 +442,8 @@ public class ChestSortOrganizer {
|
||||
// Put enchanted items before unenchanted ones
|
||||
typeName = typeName + EnchantmentUtils.getEnchantmentString(item); //String.format("%05d", 10000 - getNumberOfEnchantments(item));
|
||||
|
||||
String tier = getTier(item);
|
||||
|
||||
// Generate the map of string replacements used to generate a sortableString.
|
||||
// This map can be edited by ChestSortEvent handlers. See ChestSortEvent.getSortableMaps()
|
||||
Map<String, String> sortableMap = new HashMap<>();
|
||||
@ -453,10 +455,21 @@ public class ChestSortOrganizer {
|
||||
sortableMap.put("{keepCategoryOrder}", lineNumber);
|
||||
sortableMap.put("{customName}", customName);
|
||||
sortableMap.put("{lore}", lore);
|
||||
|
||||
sortableMap.put("{tier}", tier);
|
||||
return sortableMap;
|
||||
}
|
||||
|
||||
private String getTier(ItemStack item) {
|
||||
String type = item.getType().name();
|
||||
if(type.contains("NETHERITE")) return "10netherite";
|
||||
if(type.contains("DIAMOND")) return "20diamond";
|
||||
if(type.contains("GOLD")) return "30gold";
|
||||
if(type.contains("IRON")) return "40iron";
|
||||
if(type.contains("STONE")) return "50stone";
|
||||
if(type.contains("WOOD")) return "60wood";
|
||||
return "99none";
|
||||
}
|
||||
|
||||
// This puts together the sortable item name, the category, the color, and
|
||||
// whether the item is a block or a "regular item"
|
||||
String getSortableString(ItemStack item, Map<String, String> sortableMap) {
|
||||
|
@ -470,7 +470,7 @@ public class Listener implements org.bukkit.event.Listener {
|
||||
if (event.getWhoClicked().getGameMode() != GameMode.CREATIVE) {
|
||||
sort = true;
|
||||
} else {
|
||||
if (event.getCurrentItem() != null || event.getCurrentItem().getType() != Material.AIR) {
|
||||
if (event.getCurrentItem() != null || (event.getCurrentItem()==null && event.getCurrentItem().getType() != Material.AIR)) {
|
||||
sort = false;
|
||||
}
|
||||
}
|
||||
@ -512,7 +512,7 @@ public class Listener implements org.bukkit.event.Listener {
|
||||
if (!sort) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if(plugin.isInHotkeyCooldown(p.getUniqueId())) {
|
||||
plugin.debug("Skipping: hotkey cooldown");
|
||||
@ -640,6 +640,11 @@ public class Listener implements org.bukkit.event.Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
// BetterBackpacks
|
||||
if (e.getInventory() != null && e.getInventory().getHolder() != null && e.getInventory().getHolder().getClass().getName().equals("com.alonsoaliaga.betterbackpacks.others.BackpackHolder")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!p.hasPermission("chestsort.use")) return;
|
||||
|
||||
plugin.registerPlayerIfNeeded(p);
|
||||
|
@ -316,6 +316,7 @@ prevent-sorting-null-inventories: false
|
||||
# {keepCategoryOrder} orders stuff in the same category according to their line numbers in the category file
|
||||
# {itemsFirst} put items before blocks
|
||||
# {blocksFirst} put blocks before items
|
||||
# {tier} orders by material type from best to worst (netherite, diamond, gold, iron, stone, wood, then all remaining items)
|
||||
# {name} returns the name (e.g. DIRT, GRASS_BLOCK, BIRCH_LOG, DIAMOND_SWORD, ...)
|
||||
# {color} returns the color, e.g. light_blue for wool. Empty if block/item is not dyeable
|
||||
# {customName} returns the display name if set (e.g. with an anvil)
|
||||
|
Loading…
Reference in New Issue
Block a user