Compare commits

..

11 Commits

Author SHA1 Message Date
Auxilor
17ee1ac2ff Updated to 6.29.2 2022-03-20 15:44:06 +00:00
Auxilor
a6fa446d95 Fixed Head Database integration 2022-03-20 15:43:55 +00:00
Auxilor
2f98c0ace5 Updated to 6.29.1 2022-03-18 09:40:35 +00:00
Auxilor
60d7abcda8 Fixed oraxen integration 2022-03-18 09:40:26 +00:00
Auxilor
69a5fa81b4 Updated MythicMobs 2022-03-16 20:48:42 +00:00
Auxilor
0316e627e1 Updated to 6.29.0 2022-03-16 13:22:17 +00:00
Auxilor
5bc5b47bf8 Added Menu#refresh 2022-03-16 13:22:05 +00:00
Auxilor
a9c906843d Updated to 6.28.3 2022-03-13 16:59:14 +00:00
Auxilor
85861971d3 Added wildcard material testable items 2022-03-13 16:59:02 +00:00
Auxilor
bdb24e5a14 Updated to 6.28.2 2022-03-12 21:03:59 +00:00
Auxilor
cb481d4532 Fixed 1.17.1 and 1.18.1 errors 2022-03-12 21:03:45 +00:00
12 changed files with 100 additions and 45 deletions

View File

@@ -96,6 +96,13 @@ public interface Menu {
*/
Set<NamespacedKey> getKeys(@NotNull Player player);
/**
* Re-render the menu for a player.
*
* @param player The player.
*/
void refresh(@NotNull Player player);
/**
* Create a builder with a given amount of rows.
*

View File

@@ -8,6 +8,7 @@ import com.willfp.eco.core.recipe.parts.EmptyTestableItem;
import com.willfp.eco.core.recipe.parts.MaterialTestableItem;
import com.willfp.eco.core.recipe.parts.ModifiedTestableItem;
import com.willfp.eco.core.recipe.parts.TestableStack;
import com.willfp.eco.core.recipe.parts.UnrestrictedMaterialTestableItem;
import com.willfp.eco.util.NamespacedKeyUtils;
import com.willfp.eco.util.NumberUtils;
import org.bukkit.Material;
@@ -155,11 +156,16 @@ public final class Items {
String[] split = args[0].toLowerCase().split(":");
if (split.length == 1) {
Material material = Material.getMaterial(args[0].toUpperCase());
String itemType = args[0];
boolean isWildcard = itemType.startsWith("*");
if (isWildcard) {
itemType = itemType.substring(1);
}
Material material = Material.getMaterial(itemType.toUpperCase());
if (material == null || material == Material.AIR) {
return new EmptyTestableItem();
}
item = new MaterialTestableItem(material);
item = isWildcard ? new UnrestrictedMaterialTestableItem(material) : new MaterialTestableItem(material);
}
if (split.length == 2) {
@@ -183,11 +189,16 @@ public final class Items {
This has been superseded by id amount
*/
if (part == null) {
Material material = Material.getMaterial(split[0].toUpperCase());
String itemType = split[0];
boolean isWildcard = itemType.startsWith("*");
if (isWildcard) {
itemType = itemType.substring(1);
}
Material material = Material.getMaterial(itemType.toUpperCase());
if (material == null || material == Material.AIR) {
return new EmptyTestableItem();
}
item = new MaterialTestableItem(material);
item = isWildcard ? new UnrestrictedMaterialTestableItem(material) : new MaterialTestableItem(material);
stackAmount = Integer.parseInt(split[1]);
} else {
item = part;

View File

@@ -0,0 +1,32 @@
package com.willfp.eco.core.recipe.parts;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Same as material testable items, but doesn't filter out custom items.
*/
public class UnrestrictedMaterialTestableItem extends MaterialTestableItem {
/**
* Create a new simple recipe part.
*
* @param material The material.
*/
public UnrestrictedMaterialTestableItem(@NotNull final Material material) {
super(material);
}
/**
* If the item matches the material.
*
* @param itemStack The item to test.
* @return If the item is of the specified material.
*/
@Override
public boolean matches(@Nullable final ItemStack itemStack) {
return itemStack != null && itemStack.getType() == this.getMaterial();
}
}

View File

@@ -19,7 +19,7 @@ class EcoMenu(
val slots: List<MutableList<EcoSlot>>,
private val title: String,
private val onClose: CloseHandler
): Menu {
) : Menu {
override fun getSlot(row: Int, column: Int): Slot {
if (row < 1 || row > this.rows) {
return slots[0][0]
@@ -46,7 +46,7 @@ class EcoMenu(
if (meta != null) {
val lore = meta.lore
if (lore != null) {
lore.replaceAll{ s -> StringUtils.format(s, player) }
lore.replaceAll { s -> StringUtils.format(s, player) }
meta.lore = lore
}
slotItem.itemMeta = meta
@@ -103,4 +103,9 @@ class EcoMenu(
inventory ?: return HashSet()
return inventory.data.keys
}
override fun refresh(player: Player) {
val inventory = MenuHandler.getExtendedInventory(player.openInventory.topInventory) ?: return
inventory.refresh(player)
}
}

View File

@@ -62,7 +62,8 @@ class ChatComponent : ChatComponentProxy {
}
val newShowItem = showItem.nbt(
BinaryTagHolder.binaryTagHolder(
@Suppress("UnstableApiUsage", "DEPRECATION")
BinaryTagHolder.of(
CraftItemStack.asNMSCopy(
Display.display(
CraftItemStack.asBukkitCopy(

View File

@@ -62,7 +62,8 @@ class ChatComponent : ChatComponentProxy {
}
val newShowItem = showItem.nbt(
BinaryTagHolder.binaryTagHolder(
@Suppress("UnstableApiUsage", "DEPRECATION")
BinaryTagHolder.of(
CraftItemStack.asNMSCopy(
Display.display(
CraftItemStack.asBukkitCopy(

View File

@@ -40,7 +40,8 @@ dependencies {
compileOnly 'com.github.WhipDevelopment:CrashClaim:f9cd7d92eb'
compileOnly 'com.wolfyscript.wolfyutilities:wolfyutilities:3.16.0.0'
compileOnly 'com.github.decentsoftware-eu:decentholograms:2.1.2'
compileOnly 'io.lumine.xikage:MythicMobs:4.9.1'
compileOnly 'io.lumine:Mythic:5.0.1'
compileOnly 'io.lumine:LumineUtils:1.16.1-SNAPSHOT'
// CombatLogX V10 + NewbieHelper Expansion
compileOnly 'com.SirBlobman.combatlogx:CombatLogX-API:10.0.0.0-SNAPSHOT'

View File

@@ -2,13 +2,13 @@ package com.willfp.eco.internal.spigot.integrations.customentities
import com.willfp.eco.core.entities.CustomEntity
import com.willfp.eco.core.integrations.customentities.CustomEntitiesWrapper
import io.lumine.xikage.mythicmobs.MythicMobs
import io.lumine.mythic.bukkit.MythicBukkit
import org.bukkit.NamespacedKey
class CustomEntitiesMythicMobs : CustomEntitiesWrapper {
override fun registerAllEntities() {
val mobManager = MythicMobs.inst().mobManager
val api = MythicMobs.inst().apiHelper
val mobManager = MythicBukkit.inst().mobManager
val api = MythicBukkit.inst().apiHelper
for (id in mobManager.mobNames) {
val key = NamespacedKey.fromString("mythicmobs:${id.lowercase()}")

View File

@@ -35,7 +35,7 @@ class CustomItemsHeadDatabase(
private lateinit var api: HeadDatabaseAPI
override fun provideForKey(key: String): TestableItem? {
if (this::api.isInitialized) {
if (!this::api.isInitialized) {
return null
}

View File

@@ -4,14 +4,14 @@ import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.integrations.customitems.CustomItemsWrapper
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.recipe.parts.EmptyTestableItem
import io.lumine.xikage.mythicmobs.adapters.bukkit.BukkitItemStack
import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicDropLoadEvent
import io.lumine.xikage.mythicmobs.drops.Drop
import io.lumine.xikage.mythicmobs.drops.DropMetadata
import io.lumine.xikage.mythicmobs.drops.IMultiDrop
import io.lumine.xikage.mythicmobs.drops.LootBag
import io.lumine.xikage.mythicmobs.drops.droppables.ItemDrop
import io.lumine.xikage.mythicmobs.io.MythicLineConfig
import io.lumine.mythic.api.config.MythicLineConfig
import io.lumine.mythic.api.drops.DropMetadata
import io.lumine.mythic.api.drops.IMultiDrop
import io.lumine.mythic.bukkit.adapters.BukkitItemStack
import io.lumine.mythic.bukkit.events.MythicDropLoadEvent
import io.lumine.mythic.core.drops.Drop
import io.lumine.mythic.core.drops.LootBag
import io.lumine.mythic.core.drops.droppables.ItemDrop
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
@@ -42,9 +42,9 @@ class CustomItemsMythicMobs(
private class MythicMobsDrop(
private val plugin: EcoPlugin,
private val config: MythicLineConfig
) : Drop(config.line, config), IMultiDrop {
private val id = config.getString(arrayOf("type", "t", "item", "i"), this.dropVar)
itemConfig: MythicLineConfig
) : Drop(itemConfig.line, itemConfig), IMultiDrop {
private val id = itemConfig.getString(arrayOf("type", "t", "item", "i"), this.dropVar)
override fun get(data: DropMetadata): LootBag {
val bag = LootBag(data)

View File

@@ -2,33 +2,30 @@ package com.willfp.eco.internal.spigot.integrations.customitems
import com.willfp.eco.core.integrations.customitems.CustomItemsWrapper
import com.willfp.eco.core.items.CustomItem
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.TestableItem
import com.willfp.eco.core.items.provider.ItemProvider
import com.willfp.eco.util.NamespacedKeyUtils
import io.th0rgal.oraxen.items.OraxenItems
import org.bukkit.NamespacedKey
import org.bukkit.inventory.ItemStack
import java.util.Objects
import java.util.function.Predicate
class CustomItemsOraxen : CustomItemsWrapper {
override fun registerAllItems() {
for (item in OraxenItems.getItems()) {
val stack = item.build()
val id: String = Objects.requireNonNullElse(OraxenItems.getIdByItem(item), "")
if (id.isEmpty()) {
continue
}
val key: NamespacedKey = NamespacedKeyUtils.create("oraxen", id.lowercase())
CustomItem(
key, Predicate { test: ItemStack ->
val oraxenId: String = OraxenItems.getIdByItem(test) ?: return@Predicate false
oraxenId.equals(id, ignoreCase = true)
},
stack
).register()
}
Items.registerItemProvider(OraxenProvider())
}
override fun getPluginName(): String {
return "Oraxen"
}
}
private class OraxenProvider : ItemProvider("oraxen") {
override fun provideForKey(id: String): TestableItem? {
val item = OraxenItems.getItemById(id) ?: return null
val key = NamespacedKeyUtils.create("oraxen", id)
return CustomItem(
key,
{ id.equals(OraxenItems.getIdByItem(it), ignoreCase = true) },
item.build()
)
}
}
}

View File

@@ -1,3 +1,3 @@
version = 6.28.1
version = 6.29.2
plugin-name = eco
kotlin.code.style = official