use of com.massivecraft.massivecore.event.EventMassiveCoreLorePriority in project MassiveCore by MassiveCraft.
the class InventoryUtil method getSortedLore.
// -------------------------------------------- //
// SORT LORE
// -------------------------------------------- //
public static List<String> getSortedLore(ItemStack item) {
if (!item.getItemMeta().hasLore())
return Collections.emptyList();
EventMassiveCoreLorePriority event = new EventMassiveCoreLorePriority(item);
event.run();
List<Entry<String, Integer>> entries = event.getLore();
// Note: Comparator cast is necessary for Maven to compile, even if the IDE doesn't complain.
Comparator<Entry<? super String, ? super Integer>> comparator = (Comparator) ComparatorEntryValue.get(ComparatorComparable.get());
Collections.sort(entries, comparator);
List<String> ret = new MassiveList<>();
for (Entry<String, Integer> entry : entries) {
ret.add(entry.getKey());
}
return ret;
}
Aggregations