Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
407ccca5e0 | ||
|
|
82de602d47 | ||
|
|
b0873112af | ||
|
|
3a0b81b7de | ||
|
|
5142b9ce92 | ||
|
|
9403a1cbcb | ||
|
|
e4ebea354d | ||
|
|
d32b31f1e5 | ||
|
|
384657f1dc | ||
|
|
7c9d226bc3 | ||
|
|
031401bb8e | ||
|
|
1a5c429b67 |
@@ -2,6 +2,7 @@ package com.willfp.eco.core.config.base;
|
|||||||
|
|
||||||
import com.willfp.eco.core.EcoPlugin;
|
import com.willfp.eco.core.EcoPlugin;
|
||||||
import com.willfp.eco.core.config.yaml.YamlBaseConfig;
|
import com.willfp.eco.core.config.yaml.YamlBaseConfig;
|
||||||
|
import com.willfp.eco.util.StringUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,6 +43,18 @@ public class LangYml extends YamlBaseConfig {
|
|||||||
* @return The message with a prefix appended.
|
* @return The message with a prefix appended.
|
||||||
*/
|
*/
|
||||||
public String getMessage(@NotNull final String message) {
|
public String getMessage(@NotNull final String message) {
|
||||||
return getPrefix() + this.getString("messages." + message);
|
return getMessage(message, StringUtils.FormatOption.WITH_PLACEHOLDERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a chat message.
|
||||||
|
*
|
||||||
|
* @param message The key of the message.
|
||||||
|
* @param option The format options.
|
||||||
|
* @return The message with a prefix appended.
|
||||||
|
*/
|
||||||
|
public String getMessage(@NotNull final String message,
|
||||||
|
@NotNull final StringUtils.FormatOption option) {
|
||||||
|
return getPrefix() + this.getString("messages." + message, option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.willfp.eco.core.integrations.customitems;
|
package com.willfp.eco.core.integrations.customitems;
|
||||||
|
|
||||||
|
import com.willfp.eco.core.integrations.Integration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class for custom item integrations.
|
* Wrapper class for custom item integrations.
|
||||||
*/
|
*/
|
||||||
public interface CustomItemsWrapper {
|
public interface CustomItemsWrapper extends Integration {
|
||||||
/**
|
/**
|
||||||
* Register all the custom items for a specific plugin into eco.
|
* Register all the custom items for a specific plugin into eco.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ public final class Items {
|
|||||||
|
|
||||||
TestableItem item = null;
|
TestableItem item = null;
|
||||||
|
|
||||||
|
int stackAmount = 1;
|
||||||
|
|
||||||
String[] split = args[0].toLowerCase().split(":");
|
String[] split = args[0].toLowerCase().split(":");
|
||||||
|
|
||||||
if (split.length == 1) {
|
if (split.length == 1) {
|
||||||
@@ -92,27 +94,50 @@ public final class Items {
|
|||||||
if (split.length == 2) {
|
if (split.length == 2) {
|
||||||
CustomItem part = REGISTRY.get(NamespacedKeyUtils.create(split[0], split[1]));
|
CustomItem part = REGISTRY.get(NamespacedKeyUtils.create(split[0], split[1]));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Legacy id:amount format
|
||||||
|
This has been superceded by id amount
|
||||||
|
*/
|
||||||
if (part == null) {
|
if (part == null) {
|
||||||
Material material = Material.getMaterial(split[0].toUpperCase());
|
Material material = Material.getMaterial(split[0].toUpperCase());
|
||||||
if (material == null || material == Material.AIR) {
|
if (material == null || material == Material.AIR) {
|
||||||
return new EmptyTestableItem();
|
return new EmptyTestableItem();
|
||||||
}
|
}
|
||||||
item = new TestableStack(new MaterialTestableItem(material), Integer.parseInt(split[1]));
|
item = new MaterialTestableItem(material);
|
||||||
|
stackAmount = Integer.parseInt(split[1]);
|
||||||
} else {
|
} else {
|
||||||
item = part;
|
item = part;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Legacy namespace:id:amount format
|
||||||
|
This has been superceded by namespace:id amount
|
||||||
|
*/
|
||||||
if (split.length == 3) {
|
if (split.length == 3) {
|
||||||
CustomItem part = REGISTRY.get(NamespacedKeyUtils.create(split[0], split[1]));
|
CustomItem part = REGISTRY.get(NamespacedKeyUtils.create(split[0], split[1]));
|
||||||
item = part == null ? new EmptyTestableItem() : new TestableStack(part, Integer.parseInt(split[2]));
|
if (part == null) {
|
||||||
|
return new EmptyTestableItem();
|
||||||
|
}
|
||||||
|
item = part;
|
||||||
|
stackAmount = Integer.parseInt(split[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null || item instanceof EmptyTestableItem) {
|
boolean usingNewStackFormat = false;
|
||||||
|
|
||||||
|
if (args.length >= 2) {
|
||||||
|
try {
|
||||||
|
stackAmount = Integer.parseInt(args[1]);
|
||||||
|
usingNewStackFormat = true;
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item == null) {
|
||||||
return new EmptyTestableItem();
|
return new EmptyTestableItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] enchantArgs = Arrays.copyOfRange(args, 1, args.length);
|
String[] enchantArgs = Arrays.copyOfRange(args, usingNewStackFormat ? 2 : 1, args.length);
|
||||||
|
|
||||||
Map<Enchantment, Integer> requiredEnchantments = new HashMap<>();
|
Map<Enchantment, Integer> requiredEnchantments = new HashMap<>();
|
||||||
|
|
||||||
@@ -125,10 +150,6 @@ public final class Items {
|
|||||||
requiredEnchantments.put(enchantment, level);
|
requiredEnchantments.put(enchantment, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requiredEnchantments.isEmpty()) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack example = item.getItem();
|
ItemStack example = item.getItem();
|
||||||
|
|
||||||
if (example.getItemMeta() instanceof EnchantmentStorageMeta storageMeta) {
|
if (example.getItemMeta() instanceof EnchantmentStorageMeta storageMeta) {
|
||||||
@@ -141,41 +162,49 @@ public final class Items {
|
|||||||
example.setItemMeta(meta);
|
example.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ModifiedTestableItem(
|
if (!requiredEnchantments.isEmpty()) {
|
||||||
item,
|
item = new ModifiedTestableItem(
|
||||||
itemStack -> {
|
item,
|
||||||
if (!itemStack.hasItemMeta()) {
|
itemStack -> {
|
||||||
return false;
|
if (!itemStack.hasItemMeta()) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ItemMeta meta = itemStack.getItemMeta();
|
ItemMeta meta = itemStack.getItemMeta();
|
||||||
|
|
||||||
assert meta != null;
|
assert meta != null;
|
||||||
|
|
||||||
if (meta instanceof EnchantmentStorageMeta storageMeta) {
|
if (meta instanceof EnchantmentStorageMeta storageMeta) {
|
||||||
for (Map.Entry<Enchantment, Integer> entry : requiredEnchantments.entrySet()) {
|
for (Map.Entry<Enchantment, Integer> entry : requiredEnchantments.entrySet()) {
|
||||||
if (!storageMeta.hasStoredEnchant(entry.getKey())) {
|
if (!storageMeta.hasStoredEnchant(entry.getKey())) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (storageMeta.getStoredEnchantLevel(entry.getKey()) < entry.getValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (storageMeta.getStoredEnchantLevel(entry.getKey()) < entry.getValue()) {
|
} else {
|
||||||
return false;
|
for (Map.Entry<Enchantment, Integer> entry : requiredEnchantments.entrySet()) {
|
||||||
|
if (!meta.hasEnchant(entry.getKey())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (meta.getEnchantLevel(entry.getKey()) < entry.getValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (Map.Entry<Enchantment, Integer> entry : requiredEnchantments.entrySet()) {
|
|
||||||
if (!meta.hasEnchant(entry.getKey())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (meta.getEnchantLevel(entry.getKey()) < entry.getValue()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
example
|
example
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stackAmount == 1) {
|
||||||
|
return item;
|
||||||
|
} else {
|
||||||
|
return new TestableStack(item, stackAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class EcoMenu(
|
|||||||
|
|
||||||
fun handleClose(event: InventoryCloseEvent) {
|
fun handleClose(event: InventoryCloseEvent) {
|
||||||
onClose.handle(event, this)
|
onClose.handle(event, this)
|
||||||
|
MenuHandler.unregisterMenu(event.inventory)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getRows(): Int {
|
override fun getRows(): Int {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.willfp.eco.proxy.v1_16_R3
|
package com.willfp.eco.proxy.v1_16_R3
|
||||||
import com.willfp.eco.core.display.Display
|
import com.willfp.eco.core.display.Display
|
||||||
|
import com.willfp.eco.proxy.VillagerTradeProxy
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMerchantRecipe
|
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMerchantRecipe
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.inventory.MerchantRecipe
|
import org.bukkit.inventory.MerchantRecipe
|
||||||
import com.willfp.eco.proxy.VillagerTradeProxy
|
|
||||||
import java.lang.reflect.Field
|
import java.lang.reflect.Field
|
||||||
|
|
||||||
class VillagerTrade : VillagerTradeProxy {
|
class VillagerTrade : VillagerTradeProxy {
|
||||||
@@ -15,7 +15,7 @@ class VillagerTrade : VillagerTradeProxy {
|
|||||||
): MerchantRecipe {
|
): MerchantRecipe {
|
||||||
val oldRecipe = recipe as CraftMerchantRecipe
|
val oldRecipe = recipe as CraftMerchantRecipe
|
||||||
val newRecipe = CraftMerchantRecipe(
|
val newRecipe = CraftMerchantRecipe(
|
||||||
Display.display(recipe.getResult().clone()),
|
Display.display(recipe.getResult().clone(), player),
|
||||||
recipe.getUses(),
|
recipe.getUses(),
|
||||||
recipe.getMaxUses(),
|
recipe.getMaxUses(),
|
||||||
recipe.hasExperienceReward(),
|
recipe.hasExperienceReward(),
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package com.willfp.eco.proxy.v1_17_R1
|
package com.willfp.eco.proxy.v1_17_R1
|
||||||
|
|
||||||
import com.willfp.eco.core.display.Display
|
import com.willfp.eco.core.display.Display
|
||||||
|
import com.willfp.eco.proxy.VillagerTradeProxy
|
||||||
import net.minecraft.world.item.trading.MerchantOffer
|
import net.minecraft.world.item.trading.MerchantOffer
|
||||||
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMerchantRecipe
|
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMerchantRecipe
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.inventory.MerchantRecipe
|
import org.bukkit.inventory.MerchantRecipe
|
||||||
import com.willfp.eco.proxy.VillagerTradeProxy
|
|
||||||
import java.lang.reflect.Field
|
import java.lang.reflect.Field
|
||||||
|
|
||||||
class VillagerTrade : VillagerTradeProxy {
|
class VillagerTrade : VillagerTradeProxy {
|
||||||
private var handle: Field
|
private val handle: Field = CraftMerchantRecipe::class.java.getDeclaredField("handle")
|
||||||
|
|
||||||
override fun displayTrade(
|
override fun displayTrade(
|
||||||
recipe: MerchantRecipe,
|
recipe: MerchantRecipe,
|
||||||
@@ -17,7 +17,7 @@ class VillagerTrade : VillagerTradeProxy {
|
|||||||
): MerchantRecipe {
|
): MerchantRecipe {
|
||||||
val oldRecipe = recipe as CraftMerchantRecipe
|
val oldRecipe = recipe as CraftMerchantRecipe
|
||||||
val newRecipe = CraftMerchantRecipe(
|
val newRecipe = CraftMerchantRecipe(
|
||||||
Display.display(recipe.getResult().clone()),
|
Display.display(recipe.getResult().clone(), player),
|
||||||
recipe.getUses(),
|
recipe.getUses(),
|
||||||
recipe.getMaxUses(),
|
recipe.getMaxUses(),
|
||||||
recipe.hasExperienceReward(),
|
recipe.hasExperienceReward(),
|
||||||
@@ -32,21 +32,10 @@ class VillagerTrade : VillagerTradeProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getHandle(recipe: CraftMerchantRecipe): MerchantOffer {
|
private fun getHandle(recipe: CraftMerchantRecipe): MerchantOffer {
|
||||||
try {
|
return handle[recipe] as MerchantOffer
|
||||||
return handle[recipe] as MerchantOffer
|
|
||||||
} catch (e: IllegalAccessException) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
throw IllegalArgumentException("Not CMR")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
try {
|
handle.isAccessible = true
|
||||||
handle = CraftMerchantRecipe::class.java.getDeclaredField("handle")
|
|
||||||
handle.isAccessible = true
|
|
||||||
} catch (e: NoSuchFieldException) {
|
|
||||||
e.printStackTrace()
|
|
||||||
throw RuntimeException("Error!")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ dependencies {
|
|||||||
compileOnly 'com.willfp:Oraxen:e1f4003d8d'
|
compileOnly 'com.willfp:Oraxen:e1f4003d8d'
|
||||||
compileOnly 'com.github.brcdev-minecraft:shopgui-api:2.2.0'
|
compileOnly 'com.github.brcdev-minecraft:shopgui-api:2.2.0'
|
||||||
|
|
||||||
compileOnly 'com.github.LoneDev6:API-ItemsAdder:2.3.8'
|
compileOnly 'com.github.LoneDev6:API-ItemsAdder:2.4.7'
|
||||||
|
|
||||||
// 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'
|
||||||
|
|||||||
@@ -98,16 +98,65 @@ public class ShapedRecipeListener extends PluginDependent<EcoPlugin> implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getPlugin().getScheduler().runLater(() -> {
|
boolean isStackedRecipe = false;
|
||||||
for (int i = 0; i < 9; i++) {
|
|
||||||
ItemStack inMatrix = event.getInventory().getMatrix()[i];
|
|
||||||
TestableItem inRecipe = matched.getParts().get(i);
|
|
||||||
|
|
||||||
if (inRecipe instanceof TestableStack testableStack) {
|
int upperBound = 64;
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
ItemStack inMatrix = event.getInventory().getMatrix()[i];
|
||||||
|
TestableItem inRecipe = matched.getParts().get(i);
|
||||||
|
|
||||||
|
if (inRecipe instanceof TestableStack testableStack) {
|
||||||
|
int max = Math.floorDiv(inMatrix.getAmount(), testableStack.getAmount());
|
||||||
|
if (max < upperBound) {
|
||||||
|
upperBound = max;
|
||||||
|
}
|
||||||
|
isStackedRecipe = true;
|
||||||
|
} else if (inMatrix != null) {
|
||||||
|
int max = inMatrix.getAmount();
|
||||||
|
if (max < upperBound) {
|
||||||
|
upperBound = max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isStackedRecipe) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int toGivePerRecipe = event.getRecipe().getResult().getAmount();
|
||||||
|
int maxStackSize = event.getRecipe().getResult().getMaxStackSize();
|
||||||
|
while (toGivePerRecipe * upperBound > maxStackSize) {
|
||||||
|
upperBound--;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
ItemStack inMatrix = event.getInventory().getMatrix()[i];
|
||||||
|
TestableItem inRecipe = matched.getParts().get(i);
|
||||||
|
|
||||||
|
if (inRecipe instanceof TestableStack testableStack) {
|
||||||
|
if (event.isShiftClick()) {
|
||||||
|
int amount = inMatrix.getAmount() + 1;
|
||||||
|
for (int j = 0; j < upperBound; j++) {
|
||||||
|
amount -= testableStack.getAmount();
|
||||||
|
}
|
||||||
|
inMatrix.setAmount(amount);
|
||||||
|
} else {
|
||||||
inMatrix.setAmount(inMatrix.getAmount() - (testableStack.getAmount() - 1));
|
inMatrix.setAmount(inMatrix.getAmount() - (testableStack.getAmount() - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1);
|
}
|
||||||
|
|
||||||
|
int finalUpperBound = upperBound;
|
||||||
|
|
||||||
|
if (event.isShiftClick()) {
|
||||||
|
ItemStack result = event.getInventory().getResult();
|
||||||
|
if (result == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.setAmount(result.getAmount() * finalUpperBound);
|
||||||
|
event.getInventory().setResult(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.willfp.eco.spigot.eventlisteners.*
|
|||||||
import com.willfp.eco.spigot.gui.GUIListener
|
import com.willfp.eco.spigot.gui.GUIListener
|
||||||
import com.willfp.eco.spigot.integrations.anticheat.*
|
import com.willfp.eco.spigot.integrations.anticheat.*
|
||||||
import com.willfp.eco.spigot.integrations.antigrief.*
|
import com.willfp.eco.spigot.integrations.antigrief.*
|
||||||
|
import com.willfp.eco.spigot.integrations.customitems.CustomItemsItemsAdder
|
||||||
import com.willfp.eco.spigot.integrations.customitems.CustomItemsOraxen
|
import com.willfp.eco.spigot.integrations.customitems.CustomItemsOraxen
|
||||||
import com.willfp.eco.spigot.integrations.mcmmo.McmmoIntegrationImpl
|
import com.willfp.eco.spigot.integrations.mcmmo.McmmoIntegrationImpl
|
||||||
import com.willfp.eco.spigot.integrations.shop.ShopShopGuiPlus
|
import com.willfp.eco.spigot.integrations.shop.ShopShopGuiPlus
|
||||||
@@ -111,6 +112,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
|||||||
|
|
||||||
// Custom Items
|
// Custom Items
|
||||||
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen()) },
|
IntegrationLoader("Oraxen") { CustomItemsManager.register(CustomItemsOraxen()) },
|
||||||
|
IntegrationLoader("ItemsAdder") { CustomItemsManager.register(CustomItemsItemsAdder()) },
|
||||||
|
|
||||||
// Shop
|
// Shop
|
||||||
IntegrationLoader("ShopGuiPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
IntegrationLoader("ShopGuiPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
||||||
@@ -121,19 +123,14 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun loadPacketAdapters(): List<AbstractPacketAdapter> {
|
override fun loadPacketAdapters(): List<AbstractPacketAdapter> {
|
||||||
val adapters = mutableListOf(
|
return listOf(
|
||||||
PacketAutoRecipe(this),
|
PacketAutoRecipe(this),
|
||||||
PacketChat(this),
|
PacketChat(this),
|
||||||
PacketSetCreativeSlot(this),
|
PacketSetCreativeSlot(this),
|
||||||
PacketSetSlot(this),
|
PacketSetSlot(this),
|
||||||
PacketWindowItems(this)
|
PacketWindowItems(this),
|
||||||
|
PacketOpenWindowMerchant(this)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!configYml.getBool("disable-display-on-villagers")) {
|
|
||||||
adapters.add(PacketOpenWindowMerchant(this))
|
|
||||||
}
|
|
||||||
|
|
||||||
return adapters
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loadListeners(): List<Listener> {
|
override fun loadListeners(): List<Listener> {
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.willfp.eco.spigot.integrations.customitems
|
||||||
|
|
||||||
|
import com.willfp.eco.core.integrations.customitems.CustomItemsWrapper
|
||||||
|
import com.willfp.eco.core.items.CustomItem
|
||||||
|
import com.willfp.eco.util.NamespacedKeyUtils
|
||||||
|
import dev.lone.itemsadder.api.CustomStack
|
||||||
|
import dev.lone.itemsadder.api.ItemsAdder
|
||||||
|
import org.bukkit.inventory.ItemStack
|
||||||
|
import java.util.function.Predicate
|
||||||
|
|
||||||
|
class CustomItemsItemsAdder : CustomItemsWrapper {
|
||||||
|
override fun registerAllItems() {
|
||||||
|
for (item in ItemsAdder.getAllItems()) {
|
||||||
|
val stack = item.itemStack
|
||||||
|
val id = item.id
|
||||||
|
val key = NamespacedKeyUtils.create("itemsadder", id.lowercase())
|
||||||
|
CustomItem(
|
||||||
|
key,
|
||||||
|
Predicate { test: ItemStack ->
|
||||||
|
val customStack = CustomStack.byItemStack(test) ?: return@Predicate false
|
||||||
|
customStack.id.equals(id, ignoreCase = true)
|
||||||
|
},
|
||||||
|
stack
|
||||||
|
).register()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getPluginName(): String {
|
||||||
|
return "ItemsAdder"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,4 +23,8 @@ class CustomItemsOraxen : CustomItemsWrapper {
|
|||||||
).register()
|
).register()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getPluginName(): String {
|
||||||
|
return "Oraxen"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
|
|
||||||
# Options to fix villager bugs left behind from old (buggy) versions.
|
# Options to fix villager bugs left behind from old (buggy) versions.
|
||||||
disable-display-on-villagers: false
|
|
||||||
villager-display-fix: false
|
villager-display-fix: false
|
||||||
|
|
||||||
# DropQueue by default uses a faster collated queue system where all drops
|
# DropQueue by default uses a faster collated queue system where all drops
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ softdepend:
|
|||||||
- mcMMO
|
- mcMMO
|
||||||
- CombatLogX
|
- CombatLogX
|
||||||
- ShopGuiPlus
|
- ShopGuiPlus
|
||||||
|
- ItemsAdder
|
||||||
|
- Oraxen
|
||||||
libraries:
|
libraries:
|
||||||
- org.reflections:reflections:0.9.12
|
- org.reflections:reflections:0.9.12
|
||||||
- org.apache.maven:maven-artifact:3.0.3
|
- org.apache.maven:maven-artifact:3.0.3
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
version = 6.6.0
|
version = 6.6.3
|
||||||
plugin-name = eco
|
plugin-name = eco
|
||||||
Reference in New Issue
Block a user