Compare commits

..

7 Commits

Author SHA1 Message Date
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
10 changed files with 82 additions and 24 deletions

View File

@@ -96,6 +96,13 @@ public interface Menu {
*/ */
Set<NamespacedKey> getKeys(@NotNull Player player); 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. * 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.MaterialTestableItem;
import com.willfp.eco.core.recipe.parts.ModifiedTestableItem; import com.willfp.eco.core.recipe.parts.ModifiedTestableItem;
import com.willfp.eco.core.recipe.parts.TestableStack; 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.NamespacedKeyUtils;
import com.willfp.eco.util.NumberUtils; import com.willfp.eco.util.NumberUtils;
import org.bukkit.Material; import org.bukkit.Material;
@@ -155,11 +156,16 @@ public final class Items {
String[] split = args[0].toLowerCase().split(":"); String[] split = args[0].toLowerCase().split(":");
if (split.length == 1) { 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) { if (material == null || material == Material.AIR) {
return new EmptyTestableItem(); return new EmptyTestableItem();
} }
item = new MaterialTestableItem(material); item = isWildcard ? new UnrestrictedMaterialTestableItem(material) : new MaterialTestableItem(material);
} }
if (split.length == 2) { if (split.length == 2) {
@@ -183,11 +189,16 @@ public final class Items {
This has been superseded by id amount This has been superseded by id amount
*/ */
if (part == null) { 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) { if (material == null || material == Material.AIR) {
return new EmptyTestableItem(); return new EmptyTestableItem();
} }
item = new MaterialTestableItem(material); item = isWildcard ? new UnrestrictedMaterialTestableItem(material) : new MaterialTestableItem(material);
stackAmount = Integer.parseInt(split[1]); stackAmount = Integer.parseInt(split[1]);
} else { } else {
item = part; 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>>, val slots: List<MutableList<EcoSlot>>,
private val title: String, private val title: String,
private val onClose: CloseHandler private val onClose: CloseHandler
): Menu { ) : Menu {
override fun getSlot(row: Int, column: Int): Slot { override fun getSlot(row: Int, column: Int): Slot {
if (row < 1 || row > this.rows) { if (row < 1 || row > this.rows) {
return slots[0][0] return slots[0][0]
@@ -46,7 +46,7 @@ class EcoMenu(
if (meta != null) { if (meta != null) {
val lore = meta.lore val lore = meta.lore
if (lore != null) { if (lore != null) {
lore.replaceAll{ s -> StringUtils.format(s, player) } lore.replaceAll { s -> StringUtils.format(s, player) }
meta.lore = lore meta.lore = lore
} }
slotItem.itemMeta = meta slotItem.itemMeta = meta
@@ -103,4 +103,9 @@ class EcoMenu(
inventory ?: return HashSet() inventory ?: return HashSet()
return inventory.data.keys 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( val newShowItem = showItem.nbt(
BinaryTagHolder.binaryTagHolder( @Suppress("UnstableApiUsage", "DEPRECATION")
BinaryTagHolder.of(
CraftItemStack.asNMSCopy( CraftItemStack.asNMSCopy(
Display.display( Display.display(
CraftItemStack.asBukkitCopy( CraftItemStack.asBukkitCopy(

View File

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

View File

@@ -40,7 +40,8 @@ dependencies {
compileOnly 'com.github.WhipDevelopment:CrashClaim:f9cd7d92eb' compileOnly 'com.github.WhipDevelopment:CrashClaim:f9cd7d92eb'
compileOnly 'com.wolfyscript.wolfyutilities:wolfyutilities:3.16.0.0' compileOnly 'com.wolfyscript.wolfyutilities:wolfyutilities:3.16.0.0'
compileOnly 'com.github.decentsoftware-eu:decentholograms:2.1.2' 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 // CombatLogX V10 + NewbieHelper Expansion
compileOnly 'com.SirBlobman.combatlogx:CombatLogX-API:10.0.0.0-SNAPSHOT' 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.entities.CustomEntity
import com.willfp.eco.core.integrations.customentities.CustomEntitiesWrapper import com.willfp.eco.core.integrations.customentities.CustomEntitiesWrapper
import io.lumine.xikage.mythicmobs.MythicMobs import io.lumine.mythic.bukkit.MythicBukkit
import org.bukkit.NamespacedKey import org.bukkit.NamespacedKey
class CustomEntitiesMythicMobs : CustomEntitiesWrapper { class CustomEntitiesMythicMobs : CustomEntitiesWrapper {
override fun registerAllEntities() { override fun registerAllEntities() {
val mobManager = MythicMobs.inst().mobManager val mobManager = MythicBukkit.inst().mobManager
val api = MythicMobs.inst().apiHelper val api = MythicBukkit.inst().apiHelper
for (id in mobManager.mobNames) { for (id in mobManager.mobNames) {
val key = NamespacedKey.fromString("mythicmobs:${id.lowercase()}") val key = NamespacedKey.fromString("mythicmobs:${id.lowercase()}")

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

View File

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