mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2025-03-26 05:29:18 +01:00
7.1
This commit is contained in:
parent
91fcc77ac9
commit
2c3a794c41
@ -1,3 +1,5 @@
|
||||
# Changelog
|
||||
## 6.2
|
||||
Automatic config update now correctly updates EVERY config setting, including disabled-worlds and the individual hotkey settings.
|
||||
## 7.1
|
||||
- Removed weapons from armor-and-arrows category.
|
||||
- Logs will now get sorted before their stripped variants
|
||||
- Enchanted items will be put before their unenchanted equivalents
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.jeffclan</groupId>
|
||||
<artifactId>JeffChestSort</artifactId>
|
||||
<version>7.0</version>
|
||||
<version>7.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>JeffChestSort</name>
|
||||
|
@ -7,11 +7,14 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
|
||||
import de.jeffclan.hooks.CrackShotHook;
|
||||
import de.jeffclan.hooks.InventoryPagesHook;
|
||||
@ -188,6 +191,7 @@ public class JeffChestSortOrganizer {
|
||||
}
|
||||
// Same for wood, but the wood name can also be in the middle of the item name,
|
||||
// e.g. "stripped_oak_log"
|
||||
|
||||
for (String woodName : woodNames) {
|
||||
if (typeName.equals(woodName + "_wood")) {
|
||||
typeName = "log_wood";
|
||||
@ -204,6 +208,10 @@ public class JeffChestSortOrganizer {
|
||||
myColor = woodName;
|
||||
}
|
||||
}
|
||||
// when typeName is exactly "log", change to "log_a" so it gets sorted before the stripped variants
|
||||
if(typeName.equals("log")) {
|
||||
typeName = "log_a";
|
||||
}
|
||||
|
||||
// "egg" has to be put in front to group spawn eggs
|
||||
// e.g. cow_spawn_egg -> egg_cow_spawn
|
||||
@ -315,6 +323,8 @@ public class JeffChestSortOrganizer {
|
||||
lore = String.join(",", loreArray);
|
||||
}
|
||||
|
||||
// Put enchanted items before unenchanted ones
|
||||
typeName = typeName + String.format("%05d", 10000-getNumberOfEnchantments(item));
|
||||
|
||||
// Generate the strings that finally are used for sorting.
|
||||
// They are generated according to the config.yml's sorting-method option
|
||||
@ -445,6 +455,29 @@ public class JeffChestSortOrganizer {
|
||||
}
|
||||
currentSlot++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static int getNumberOfEnchantments(ItemStack is) {
|
||||
|
||||
int totalEnchants = 0;
|
||||
|
||||
//if(!is.getItemMeta().hasEnchants()) return 0;
|
||||
if(is.getItemMeta() instanceof EnchantmentStorageMeta) {
|
||||
EnchantmentStorageMeta storageMeta = (EnchantmentStorageMeta) is.getItemMeta();
|
||||
Map<Enchantment,Integer> storedEnchants = storageMeta.getStoredEnchants();
|
||||
for(int level : storedEnchants.values()) {
|
||||
totalEnchants += level;
|
||||
}
|
||||
}
|
||||
|
||||
Map<Enchantment,Integer> enchants= is.getItemMeta().getEnchants();
|
||||
|
||||
for(int level : enchants.values()) {
|
||||
totalEnchants += level;
|
||||
}
|
||||
return totalEnchants;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,14 +14,11 @@
|
||||
sticky=false
|
||||
|
||||
turtle_helmet
|
||||
bow
|
||||
arrow
|
||||
*_sword
|
||||
*_helmet
|
||||
*_chestplate
|
||||
*_leggings
|
||||
*_boots
|
||||
spectral_arrow
|
||||
tipped_arrow
|
||||
totem_of_undying
|
||||
trident
|
||||
totem_of_undying
|
@ -1,6 +1,6 @@
|
||||
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 7.0
|
||||
version: 7.1
|
||||
api-version: 1.13
|
||||
description: Allows automatic chest sorting
|
||||
author: mfnalex
|
||||
|
Loading…
Reference in New Issue
Block a user