mirror of
https://github.com/Auxilor/EcoArmor.git
synced 2026-01-04 15:31:51 +00:00
Reworked backend
This commit is contained in:
@@ -8,6 +8,10 @@ import com.willfp.ecoarmor.commands.CommandEagive;
|
||||
import com.willfp.ecoarmor.commands.CommandEareload;
|
||||
import com.willfp.ecoarmor.commands.TabcompleterEagive;
|
||||
import com.willfp.ecoarmor.config.EcoArmorConfigs;
|
||||
import com.willfp.ecoarmor.display.packets.PacketChat;
|
||||
import com.willfp.ecoarmor.display.packets.PacketSetCreativeSlot;
|
||||
import com.willfp.ecoarmor.display.packets.PacketSetSlot;
|
||||
import com.willfp.ecoarmor.display.packets.PacketWindowItems;
|
||||
import com.willfp.ecoarmor.effects.Effects;
|
||||
import com.willfp.ecoarmor.sets.ArmorSets;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -96,7 +100,12 @@ public class EcoArmorPlugin extends AbstractEcoPlugin {
|
||||
*/
|
||||
@Override
|
||||
public List<AbstractPacketAdapter> getPacketAdapters() {
|
||||
return new ArrayList<>();
|
||||
return Arrays.asList(
|
||||
new PacketChat(this),
|
||||
new PacketSetSlot(this),
|
||||
new PacketSetCreativeSlot(this),
|
||||
new PacketWindowItems(this)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.willfp.eco.util.config.Configs;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.ecoarmor.sets.ArmorSet;
|
||||
import com.willfp.ecoarmor.sets.ArmorSets;
|
||||
import com.willfp.ecoarmor.sets.meta.ArmorSlot;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -60,9 +61,8 @@ public class CommandEagive extends AbstractCommand {
|
||||
String message = Configs.LANG.getMessage("give-success");
|
||||
message = message.replace("%set%", set.getName()).replace("%recipient%", reciever.getName());
|
||||
sender.sendMessage(message);
|
||||
reciever.getInventory().addItem(set.getHelmet());
|
||||
reciever.getInventory().addItem(set.getChestplate());
|
||||
reciever.getInventory().addItem(set.getLeggings());
|
||||
reciever.getInventory().addItem(set.getBoots());
|
||||
for (ArmorSlot slot : ArmorSlot.values()) {
|
||||
reciever.getInventory().addItem(set.getItemStack(slot));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.willfp.ecoarmor.display;
|
||||
|
||||
import com.willfp.ecoarmor.sets.ArmorSet;
|
||||
import com.willfp.ecoarmor.sets.meta.ArmorSlot;
|
||||
import com.willfp.ecoarmor.sets.util.ArmorUtils;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@UtilityClass
|
||||
public class ArmorDisplay {
|
||||
/**
|
||||
* The prefix for all EcoArmor lines to have in lore.
|
||||
*/
|
||||
public static final String PREFIX = "§v";
|
||||
|
||||
/**
|
||||
* Revert display.
|
||||
*
|
||||
* @param item The item to revert.
|
||||
* @return The item, updated.
|
||||
*/
|
||||
public static ItemStack revertDisplay(@Nullable final ItemStack item) {
|
||||
if (item == null || item.getItemMeta() == null) {
|
||||
return item;
|
||||
}
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> itemLore;
|
||||
|
||||
if (meta.hasLore()) {
|
||||
itemLore = meta.getLore();
|
||||
} else {
|
||||
itemLore = new ArrayList<>();
|
||||
}
|
||||
|
||||
if (itemLore == null) {
|
||||
itemLore = new ArrayList<>();
|
||||
}
|
||||
|
||||
itemLore.removeIf(s -> s.startsWith(PREFIX));
|
||||
|
||||
meta.setLore(itemLore);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show itemStack lore, set display name, color, texture, etc.
|
||||
*
|
||||
* @param itemStack The itemStack to update.
|
||||
* @return The itemStack, updated.
|
||||
*/
|
||||
public static ItemStack display(@Nullable final ItemStack itemStack) {
|
||||
if (itemStack == null || itemStack.getItemMeta() == null || itemStack.getType() != Material.PLAYER_HEAD) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
ArmorSlot slot = ArmorSlot.getSlot(itemStack);
|
||||
|
||||
if (slot == null) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
revertDisplay(itemStack);
|
||||
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
if (meta == null) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
ArmorSet set = ArmorUtils.getSetOnItem(itemStack);
|
||||
|
||||
if (set == null) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
ItemStack slotStack = set.getItemStack(slot);
|
||||
ItemMeta slotMeta = slotStack.getItemMeta();
|
||||
assert slotMeta != null;
|
||||
|
||||
meta.setLore(slotMeta.getLore());
|
||||
meta.setDisplayName(slotMeta.getDisplayName());
|
||||
|
||||
if (meta instanceof SkullMeta && slotMeta instanceof SkullMeta) {
|
||||
((SkullMeta) meta).setOwningPlayer(((SkullMeta) slotMeta).getOwningPlayer());
|
||||
}
|
||||
|
||||
if (meta instanceof LeatherArmorMeta && slotMeta instanceof LeatherArmorMeta) {
|
||||
((LeatherArmorMeta) meta).setColor(((LeatherArmorMeta) slotMeta).getColor());
|
||||
}
|
||||
|
||||
itemStack.setItemMeta(meta);
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.willfp.ecoarmor.display.packets;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||
import com.willfp.ecoarmor.proxy.proxies.ChatComponentProxy;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PacketChat extends AbstractPacketAdapter {
|
||||
/**
|
||||
* Instantiate a new listener for {@link PacketType.Play.Server#CHAT}.
|
||||
*
|
||||
* @param plugin The plugin to listen through.
|
||||
*/
|
||||
public PacketChat(@NotNull final AbstractEcoPlugin plugin) {
|
||||
super(plugin, PacketType.Play.Server.CHAT, ListenerPriority.NORMAL, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSend(@NotNull final PacketContainer packet,
|
||||
@NotNull final Player player) {
|
||||
for (int i = 0; i < packet.getChatComponents().size(); i++) {
|
||||
WrappedChatComponent component = packet.getChatComponents().read(i);
|
||||
if (component == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (component.getHandle() == null) {
|
||||
return;
|
||||
}
|
||||
WrappedChatComponent newComponent = WrappedChatComponent.fromHandle(ProxyUtils.getProxy(ChatComponentProxy.class).modifyComponent(component.getHandle()));
|
||||
packet.getChatComponents().write(i, newComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.willfp.ecoarmor.display.packets;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||
import com.willfp.ecoarmor.display.ArmorDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PacketSetCreativeSlot extends AbstractPacketAdapter {
|
||||
/**
|
||||
* Instantiate a new listener for {@link PacketType.Play.Client#SET_CREATIVE_SLOT}.
|
||||
*
|
||||
* @param plugin The plugin to listen through.
|
||||
*/
|
||||
public PacketSetCreativeSlot(@NotNull final AbstractEcoPlugin plugin) {
|
||||
super(plugin, PacketType.Play.Client.ITEM_NAME, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(@NotNull final PacketContainer packet,
|
||||
@NotNull final Player player) {
|
||||
packet.getItemModifier().modify(0, ArmorDisplay::revertDisplay);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.willfp.ecoarmor.display.packets;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||
import com.willfp.ecoarmor.display.ArmorDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PacketSetSlot extends AbstractPacketAdapter {
|
||||
/**
|
||||
* Instantiate a new listener for {@link PacketType.Play.Server#SET_SLOT}.
|
||||
*
|
||||
* @param plugin The plugin to listen through.
|
||||
*/
|
||||
public PacketSetSlot(@NotNull final AbstractEcoPlugin plugin) {
|
||||
super(plugin, PacketType.Play.Server.SET_SLOT, ListenerPriority.NORMAL, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSend(@NotNull final PacketContainer packet,
|
||||
@NotNull final Player player) {
|
||||
packet.getItemModifier().modify(0, ArmorDisplay::display);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.willfp.ecoarmor.display.packets;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.eco.util.protocollib.AbstractPacketAdapter;
|
||||
import com.willfp.ecoarmor.display.ArmorDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PacketWindowItems extends AbstractPacketAdapter {
|
||||
/**
|
||||
* Instantiate a new listener for {@link PacketType.Play.Server#WINDOW_ITEMS}.
|
||||
*
|
||||
* @param plugin The plugin to listen through.
|
||||
*/
|
||||
public PacketWindowItems(@NotNull final AbstractEcoPlugin plugin) {
|
||||
super(plugin, PacketType.Play.Server.WINDOW_ITEMS, ListenerPriority.NORMAL, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSend(@NotNull final PacketContainer packet,
|
||||
@NotNull final Player player) {
|
||||
packet.getItemListModifier().modify(0, itemStacks -> {
|
||||
if (itemStacks == null) {
|
||||
return null;
|
||||
}
|
||||
itemStacks.forEach(ArmorDisplay::display);
|
||||
return itemStacks;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@UtilityClass
|
||||
@SuppressWarnings("unused")
|
||||
public class Effects {
|
||||
/**
|
||||
* All registered effects.
|
||||
|
||||
@@ -6,9 +6,12 @@ import com.willfp.eco.util.StringUtils;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.eco.util.recipe.EcoShapedRecipe;
|
||||
import com.willfp.ecoarmor.config.EcoArmorConfigs;
|
||||
import com.willfp.ecoarmor.display.ArmorDisplay;
|
||||
import com.willfp.ecoarmor.effects.Effect;
|
||||
import com.willfp.ecoarmor.effects.Effects;
|
||||
import com.willfp.ecoarmor.proxy.proxies.SkullProxy;
|
||||
import com.willfp.ecoarmor.sets.meta.ArmorSlot;
|
||||
import com.willfp.ecoarmor.sets.meta.ArmorTier;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
@@ -55,28 +58,9 @@ public class ArmorSet {
|
||||
private final Map<PotionEffectType, Integer> potionEffects = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Helmet ItemStack.
|
||||
* Items in set.
|
||||
*/
|
||||
@Getter
|
||||
private final ItemStack helmet;
|
||||
|
||||
/**
|
||||
* Chestplate ItemStack.
|
||||
*/
|
||||
@Getter
|
||||
private final ItemStack chestplate;
|
||||
|
||||
/**
|
||||
* Leggings ItemStack.
|
||||
*/
|
||||
@Getter
|
||||
private final ItemStack leggings;
|
||||
|
||||
/**
|
||||
* Boots ItemStack.
|
||||
*/
|
||||
@Getter
|
||||
private final ItemStack boots;
|
||||
private final Map<ArmorSlot, ItemStack> items = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Create a new Armor Set.
|
||||
@@ -92,10 +76,10 @@ public class ArmorSet {
|
||||
effects.put(effect, value);
|
||||
}
|
||||
|
||||
helmet = construct("helmet");
|
||||
chestplate = construct("chestplate");
|
||||
leggings = construct("leggings");
|
||||
boots = construct("boots");
|
||||
for (ArmorSlot slot : ArmorSlot.values()) {
|
||||
ItemStack item = construct(slot.name().toLowerCase());
|
||||
items.put(slot, item);
|
||||
}
|
||||
|
||||
ArmorSets.addNewSet(this);
|
||||
}
|
||||
@@ -104,44 +88,48 @@ public class ArmorSet {
|
||||
String pieceName = slot.toLowerCase();
|
||||
|
||||
Material material = Material.getMaterial(EcoArmorConfigs.SETS.getString(name + "." + pieceName + ".material").toUpperCase());
|
||||
String displayName = EcoArmorConfigs.SETS.getString(name + "." + pieceName + ".name");
|
||||
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
|
||||
for (String enchantKey : EcoArmorConfigs.SETS.getConfig().getConfigurationSection(name + "." + pieceName + ".enchants").getKeys(false)) {
|
||||
int level = EcoArmorConfigs.SETS.getInt(name + "." + pieceName + ".enchants." + enchantKey);
|
||||
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(enchantKey));
|
||||
enchants.put(enchantment, level);
|
||||
}
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
for (String loreLine : EcoArmorConfigs.SETS.getStrings(name + "." + pieceName + ".lore")) {
|
||||
lore.add(StringUtils.translate(loreLine));
|
||||
}
|
||||
|
||||
ItemStack itemStack = new ItemStack(material);
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
|
||||
assert meta != null;
|
||||
|
||||
if (material == Material.PLAYER_HEAD) {
|
||||
String base64 = EcoArmorConfigs.SETS.getString(name + "." + pieceName + ".skull-texture");
|
||||
String displayName = EcoArmorConfigs.SETS.getString(name + "." + pieceName + ".name");
|
||||
|
||||
ProxyUtils.getProxy(SkullProxy.class).setTalismanTexture((SkullMeta) meta, base64);
|
||||
List<String> lore = new ArrayList<>();
|
||||
for (String loreLine : EcoArmorConfigs.SETS.getStrings(name + "." + pieceName + ".lore")) {
|
||||
lore.add(ArmorDisplay.PREFIX + StringUtils.translate(loreLine));
|
||||
}
|
||||
|
||||
if (material.toString().toLowerCase().contains("leather")) {
|
||||
if (meta instanceof SkullMeta) {
|
||||
String base64 = EcoArmorConfigs.SETS.getString(name + "." + pieceName + ".skull-texture");
|
||||
ProxyUtils.getProxy(SkullProxy.class).setTexture((SkullMeta) meta, base64);
|
||||
}
|
||||
|
||||
if (meta instanceof LeatherArmorMeta) {
|
||||
String colorString = EcoArmorConfigs.SETS.getString(name + "." + pieceName + ".leather-color");
|
||||
|
||||
java.awt.Color awtColor = java.awt.Color.decode(colorString);
|
||||
Color color = Color.fromRGB(awtColor.getRed(), awtColor.getGreen(), awtColor.getBlue());
|
||||
((LeatherArmorMeta) meta).setColor(color);
|
||||
|
||||
((LeatherArmorMeta) meta).setColor(Color.fromRGB(awtColor.getRed(), awtColor.getGreen(), awtColor.getBlue()));
|
||||
meta.addItemFlags(ItemFlag.HIDE_DYE);
|
||||
}
|
||||
|
||||
meta.setDisplayName(displayName);
|
||||
enchants.forEach((enchantment, integer) -> meta.addEnchant(enchantment, integer, true));
|
||||
|
||||
meta.setLore(lore);
|
||||
|
||||
enchants.forEach((enchantment, integer) -> meta.addEnchant(enchantment, integer, true));
|
||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||
container.set(PLUGIN.getNamespacedKeyFactory().create("set"), PersistentDataType.STRING, name);
|
||||
container.set(PLUGIN.getNamespacedKeyFactory().create("tier"), PersistentDataType.STRING, ArmorTier.DEFAULT);
|
||||
itemStack.setItemMeta(meta);
|
||||
|
||||
constructRecipe(slot, itemStack);
|
||||
@@ -163,6 +151,16 @@ public class ArmorSet {
|
||||
recipe.register();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item stack from slot.
|
||||
*
|
||||
* @param slot The slot.
|
||||
* @return The item.
|
||||
*/
|
||||
public ItemStack getItemStack(@NotNull final ArmorSlot slot) {
|
||||
return items.get(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) {
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.willfp.ecoarmor.sets.meta;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public enum ArmorSlot {
|
||||
/**
|
||||
* Helmet.
|
||||
*/
|
||||
HELMET,
|
||||
|
||||
/**
|
||||
* Chestplate.
|
||||
*/
|
||||
CHESTPLATE,
|
||||
|
||||
/**
|
||||
* Elytra.
|
||||
*/
|
||||
ELYTRA,
|
||||
|
||||
/**
|
||||
* Leggings.
|
||||
*/
|
||||
LEGGINGS,
|
||||
|
||||
/**
|
||||
* Boots.
|
||||
*/
|
||||
BOOTS;
|
||||
|
||||
/**
|
||||
* Get ArmorSlot from item.
|
||||
*
|
||||
* @param itemStack The item.
|
||||
* @return The slot, or null.
|
||||
*/
|
||||
@Nullable
|
||||
public static ArmorSlot getSlot(@NotNull final ItemStack itemStack) {
|
||||
Material material = itemStack.getType();
|
||||
String name = material.name().toLowerCase();
|
||||
|
||||
if (name.endsWith("helmet") || name.endsWith("head")) {
|
||||
return HELMET;
|
||||
}
|
||||
|
||||
if (name.endsWith("chestplate")) {
|
||||
return CHESTPLATE;
|
||||
}
|
||||
|
||||
if (name.endsWith("elytra")) {
|
||||
return ELYTRA;
|
||||
}
|
||||
|
||||
if (name.endsWith("leggings")) {
|
||||
return LEGGINGS;
|
||||
}
|
||||
|
||||
if (name.endsWith("boots")) {
|
||||
return BOOTS;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.willfp.ecoarmor.sets.meta;
|
||||
|
||||
public class ArmorTier {
|
||||
/**
|
||||
* Default tier.
|
||||
*/
|
||||
public static final String DEFAULT = "default";
|
||||
|
||||
/**
|
||||
* Iron tier.
|
||||
*/
|
||||
public static final String IRON = "iron";
|
||||
|
||||
/**
|
||||
* Diamond tier.
|
||||
*/
|
||||
public static final String DIAMOND = "diamond";
|
||||
|
||||
/**
|
||||
* Netherite tier.
|
||||
*/
|
||||
public static final String NETHERITE = "netherite";
|
||||
}
|
||||
@@ -23,6 +23,30 @@ public class ArmorUtils {
|
||||
*/
|
||||
private static final AbstractEcoPlugin PLUGIN = AbstractEcoPlugin.getInstance();
|
||||
|
||||
/**
|
||||
* Get armor set on an item.
|
||||
*
|
||||
* @param itemStack The itemStack to check.
|
||||
* @return The set, or null if no set is found.
|
||||
*/
|
||||
@Nullable
|
||||
public ArmorSet getSetOnItem(@NotNull final ItemStack itemStack) {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
|
||||
if (meta == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||
String setName = container.get(PLUGIN.getNamespacedKeyFactory().create("set"), PersistentDataType.STRING);
|
||||
|
||||
if (setName == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ArmorSets.getByName(setName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get armor set that player is wearing.
|
||||
*
|
||||
@@ -38,20 +62,12 @@ public class ArmorUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
ArmorSet set = getSetOnItem(itemStack);
|
||||
|
||||
if (meta == null) {
|
||||
if (set == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||
String setName = container.get(PLUGIN.getNamespacedKeyFactory().create("set"), PersistentDataType.STRING);
|
||||
|
||||
if (setName == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ArmorSet set = ArmorSets.getByName(setName);
|
||||
found.add(set);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
name: EcoArmor
|
||||
version: ${projectVersion}
|
||||
main: com.willfp.ecoarmor.EcoArmorPlugin
|
||||
api-version: 1.15
|
||||
api-version: 1.16
|
||||
authors: [ Auxilor ]
|
||||
website: willfp.com
|
||||
load: STARTUP
|
||||
depend: []
|
||||
depend:
|
||||
- ProtocolLib
|
||||
softdepend:
|
||||
- WorldGuard
|
||||
- GriefPrevention
|
||||
|
||||
@@ -14,6 +14,9 @@ Reaper:
|
||||
- "&c&lREAPER SET BONUS"
|
||||
- "&8» &cDeal 25% more damage"
|
||||
- "&8&oRequires full set to be worn"
|
||||
- ""
|
||||
- "&fTier: %tier%"
|
||||
- "&8&oUpgrade with a Tier Upgrader"
|
||||
recipe:
|
||||
- air
|
||||
- nether_star
|
||||
@@ -39,6 +42,9 @@ Reaper:
|
||||
- "&c&lREAPER SET BONUS"
|
||||
- "&8» &cDeal 25% more damage"
|
||||
- "&8&oRequires full set to be worn"
|
||||
- ""
|
||||
- "&fTier: %tier%"
|
||||
- "&8&oUpgrade with a Tier Upgrader"
|
||||
recipe:
|
||||
- air
|
||||
- nether_star
|
||||
@@ -48,6 +54,33 @@ Reaper:
|
||||
- diamond_chestplate
|
||||
- nether_star
|
||||
|
||||
- air
|
||||
- nether_star
|
||||
- air
|
||||
elytra:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: elytra
|
||||
name: "&cReaper Elytra"
|
||||
lore:
|
||||
- "&cThe soul of the grim reaper"
|
||||
- ""
|
||||
- "&c&lREAPER SET BONUS"
|
||||
- "&8» &cDeal 25% more damage"
|
||||
- "&8&oRequires full set to be worn"
|
||||
- ""
|
||||
- "&fTier: %tier%"
|
||||
- "&8&oUpgrade with a Tier Upgrader"
|
||||
recipe:
|
||||
- air
|
||||
- nether_star
|
||||
- air
|
||||
|
||||
- nether_star
|
||||
- elytra
|
||||
- nether_star
|
||||
|
||||
- air
|
||||
- nether_star
|
||||
- air
|
||||
@@ -64,6 +97,9 @@ Reaper:
|
||||
- "&c&lREAPER SET BONUS"
|
||||
- "&8» &cDeal 25% more damage"
|
||||
- "&8&oRequires full set to be worn"
|
||||
- ""
|
||||
- "&fTier: %tier%"
|
||||
- "&8&oUpgrade with a Tier Upgrader"
|
||||
recipe:
|
||||
- air
|
||||
- nether_star
|
||||
@@ -89,6 +125,9 @@ Reaper:
|
||||
- "&c&lREAPER SET BONUS"
|
||||
- "&8» &cDeal 25% more damage"
|
||||
- "&8&oRequires full set to be worn"
|
||||
- ""
|
||||
- "&fTier: %tier%"
|
||||
- "&8&oUpgrade with a Tier Upgrader"
|
||||
recipe:
|
||||
- air
|
||||
- nether_star
|
||||
@@ -100,215 +139,4 @@ Reaper:
|
||||
|
||||
- air
|
||||
- nether_star
|
||||
- air
|
||||
Emerald:
|
||||
set-bonus:
|
||||
experience-multiplier: 2.5
|
||||
helmet:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: leather_helmet
|
||||
leather-color: "#00ff33"
|
||||
name: "&aEmerald Helmet"
|
||||
lore:
|
||||
- "&aThe essence of wisdom"
|
||||
- ""
|
||||
- "&a&lEMERALD SET BONUS"
|
||||
- "&8» &aGain 2.5x more experience"
|
||||
- "&8&oRequires full set to be worn"
|
||||
recipe:
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
|
||||
- air
|
||||
- air
|
||||
- air
|
||||
chestplate:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: leather_chestplate
|
||||
leather-color: "#00ff33"
|
||||
name: "&aEmerald Chestplate"
|
||||
lore:
|
||||
- "&aThe essence of wisdom"
|
||||
- ""
|
||||
- "&a&lEMERALD SET BONUS"
|
||||
- "&8» &aGain 2.5x more experience"
|
||||
- "&8&oRequires full set to be worn"
|
||||
recipe:
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
leggings:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: leather_leggings
|
||||
leather-color: "#00ff33"
|
||||
name: "&aEmerald Leggings"
|
||||
lore:
|
||||
- "&aThe essence of wisdom"
|
||||
- ""
|
||||
- "&a&lEMERALD SET BONUS"
|
||||
- "&8» &aGain 2.5x more experience"
|
||||
- "&8&oRequires full set to be worn"
|
||||
recipe:
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
boots:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: leather_boots
|
||||
leather-color: "#00ff33"
|
||||
name: "&aEmerald Boots"
|
||||
lore:
|
||||
- "&aThe essence of wisdom"
|
||||
- ""
|
||||
- "&a&lEMERALD SET BONUS"
|
||||
- "&8» &aGain 2.5x more experience"
|
||||
- "&8&oRequires full set to be worn"
|
||||
recipe:
|
||||
- air
|
||||
- air
|
||||
- air
|
||||
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
Golem:
|
||||
set-bonus:
|
||||
damage-taken-multiplier: 0.6
|
||||
speed-multiplier: 0.75
|
||||
helmet:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: leather_helmet
|
||||
leather-color: "#c0c0c0"
|
||||
name: "&fGolem Helmet"
|
||||
lore:
|
||||
- "&fBuilt like a tank"
|
||||
- ""
|
||||
- "&f&lGOLEM SET BONUS"
|
||||
- "&8» &fTake 40% less damage"
|
||||
- "&8» &fMove 25% slower"
|
||||
- "&8&oRequires full set to be worn"
|
||||
recipe:
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
|
||||
- air
|
||||
- air
|
||||
- air
|
||||
chestplate:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: leather_chestplate
|
||||
leather-color: "#c0c0c0"
|
||||
name: "&fGolem Chestplate"
|
||||
lore:
|
||||
- "&fBuilt like a tank"
|
||||
- ""
|
||||
- "&f&lGOLEM SET BONUS"
|
||||
- "&8» &fTake 40% less damage"
|
||||
- "&8» &fMove 25% slower"
|
||||
- "&8&oRequires full set to be worn"
|
||||
recipe:
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
leggings:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: leather_leggings
|
||||
leather-color: "#c0c0c0"
|
||||
name: "&fGolem Leggings"
|
||||
lore:
|
||||
- "&fBuilt like a tank"
|
||||
- ""
|
||||
- "&f&lGOLEM SET BONUS"
|
||||
- "&8» &fTake 40% less damage"
|
||||
- "&8» &fMove 25% slower"
|
||||
- "&8&oRequires full set to be worn"
|
||||
recipe:
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
boots:
|
||||
enchants:
|
||||
protection: 4
|
||||
unbreaking: 3
|
||||
material: leather_boots
|
||||
leather-color: "#c0c0c0"
|
||||
name: "&fGolem Boots"
|
||||
lore:
|
||||
- "&fBuilt like a tank"
|
||||
- ""
|
||||
- "&f&lGOLEM SET BONUS"
|
||||
- "&8» &fTake 40% less damage"
|
||||
- "&8» &fMove 25% slower"
|
||||
- "&8&oRequires full set to be worn"
|
||||
recipe:
|
||||
- air
|
||||
- air
|
||||
- air
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
|
||||
- emerald_block
|
||||
- air
|
||||
- emerald_block
|
||||
- air
|
||||
Reference in New Issue
Block a user