mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-03 06:37:47 +01:00
!merged
This commit is contained in:
commit
8442fff585
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems</artifactId>
|
||||
<version>5.3</version>
|
||||
<version>5.3</version>
|
||||
<name>MMOItems</name>
|
||||
<description>A great item solution for your RPG server.</description>
|
||||
|
||||
|
@ -43,11 +43,11 @@ import net.Indyuce.mmoitems.comp.rpg.RPGHandler;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
import net.Indyuce.mmoitems.gui.listener.GuiListener;
|
||||
import net.Indyuce.mmoitems.listener.CustomBlockListener;
|
||||
import net.Indyuce.mmoitems.listener.CustomDurability;
|
||||
import net.Indyuce.mmoitems.listener.CustomSoundListener;
|
||||
import net.Indyuce.mmoitems.listener.DisableInteractions;
|
||||
import net.Indyuce.mmoitems.listener.ElementListener;
|
||||
import net.Indyuce.mmoitems.listener.ItemUse;
|
||||
import net.Indyuce.mmoitems.listener.NewDurabilityListener;
|
||||
import net.Indyuce.mmoitems.listener.PlayerListener;
|
||||
import net.Indyuce.mmoitems.listener.version.Listener_v1_13;
|
||||
import net.Indyuce.mmoitems.manager.AbilityManager;
|
||||
@ -145,7 +145,7 @@ public class MMOItems extends JavaPlugin {
|
||||
Bukkit.getPluginManager().registerEvents(new ItemUse(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new CustomSoundListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new CustomDurability(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new NewDurabilityListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new DisableInteractions(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new GuiListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ElementListener(), this);
|
||||
|
@ -52,7 +52,7 @@ public class MMOUtils {
|
||||
public static Vector normalize(Vector vector) {
|
||||
return vector.getX() == 0 && vector.getY() == 0 ? vector : vector.normalize();
|
||||
}
|
||||
|
||||
|
||||
public static String getProgressBar(double ratio, int n, String barChar) {
|
||||
String bar = "";
|
||||
for (int k = 0; k < n; k++)
|
||||
|
@ -1,40 +0,0 @@
|
||||
package net.Indyuce.mmoitems.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ItemBreakEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private NBTItem item;
|
||||
private boolean itemBreak;
|
||||
|
||||
public ItemBreakEvent(Player player, NBTItem item) {
|
||||
super(player);
|
||||
this.item = item;
|
||||
this.itemBreak = item.getBoolean("MMOITEMS_WILL_BREAK");
|
||||
}
|
||||
|
||||
public NBTItem getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns if the item really broke or if it just became unusable till a
|
||||
* player repairs it
|
||||
*/
|
||||
public boolean doesItemBreak() {
|
||||
return itemBreak;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package net.Indyuce.mmoitems.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemDurabilityStateChangeEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancelled = false;
|
||||
private ItemStack item;
|
||||
private String oldState, newState;
|
||||
|
||||
public ItemDurabilityStateChangeEvent(Player player, ItemStack item, String oldState, String newState) {
|
||||
super(player);
|
||||
this.item = item;
|
||||
this.oldState = oldState;
|
||||
this.newState = newState;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean bool) {
|
||||
cancelled = bool;
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public String getOldState() {
|
||||
return oldState;
|
||||
}
|
||||
|
||||
public String getNewState() {
|
||||
return newState;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package net.Indyuce.mmoitems.api.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ItemLoseDurabilityEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancelled = false;
|
||||
private NBTItem item;
|
||||
private int oldDurability, newDurability, durabilityLoss, maxDurability = 0;
|
||||
|
||||
public ItemLoseDurabilityEvent(Player player, NBTItem item, int old, int loss) {
|
||||
super(player);
|
||||
this.item = item;
|
||||
this.oldDurability = old;
|
||||
this.durabilityLoss = loss;
|
||||
this.newDurability = old - loss;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean bool) {
|
||||
cancelled = bool;
|
||||
}
|
||||
|
||||
public NBTItem getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public int getNewDurability() {
|
||||
return newDurability;
|
||||
}
|
||||
|
||||
public int getOldDurability() {
|
||||
return oldDurability;
|
||||
}
|
||||
|
||||
public int getDurabilityLoss() {
|
||||
return durabilityLoss;
|
||||
}
|
||||
|
||||
public int getMaxDurability() {
|
||||
return maxDurability == 0 ? maxDurability = item.getInteger("MMOITEMS_MAX_DURABILITY") : maxDurability;
|
||||
}
|
||||
|
||||
public boolean isItemBroken() {
|
||||
return newDurability < 0;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,23 +1,16 @@
|
||||
package net.Indyuce.mmoitems.api.interaction.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.event.ItemBreakEvent;
|
||||
import net.Indyuce.mmoitems.api.event.ItemLoseDurabilityEvent;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
@ -25,9 +18,12 @@ import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
public class DurabilityItem {
|
||||
private final NBTItem nbtItem;
|
||||
private final Player player;
|
||||
|
||||
private int unbreakingLevel = -1, durability, maxDurability = -1;
|
||||
private boolean broken;
|
||||
private final int maxDurability, unbreakingLevel;
|
||||
|
||||
/*
|
||||
* broken if below than 0
|
||||
*/
|
||||
private int durability;
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
@ -35,19 +31,21 @@ public class DurabilityItem {
|
||||
this(player, MMOLib.plugin.getNMS().getNBTItem(item));
|
||||
}
|
||||
|
||||
/*
|
||||
* durability loss is not perfect and thus should only be used with weapons
|
||||
* and not with tools which could lose durability more than often e.g when
|
||||
* breaking a block with shears
|
||||
*/
|
||||
public DurabilityItem(Player player, NBTItem item) {
|
||||
this.player = player;
|
||||
this.nbtItem = item;
|
||||
this.durability = nbtItem.getInteger("MMOITEMS_DURABILITY");
|
||||
|
||||
durability = nbtItem.getInteger("MMOITEMS_DURABILITY");
|
||||
maxDurability = nbtItem.getInteger("MMOITEMS_MAX_DURABILITY");
|
||||
unbreakingLevel = nbtItem.getItem().getItemMeta().getEnchantLevel(Enchantment.DURABILITY);
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public int getMaxDurability() {
|
||||
return maxDurability < 0 ? maxDurability = nbtItem.getInteger("MMOITEMS_MAX_DURABILITY") : maxDurability;
|
||||
return maxDurability;
|
||||
}
|
||||
|
||||
public int getDurability() {
|
||||
@ -55,13 +53,21 @@ public class DurabilityItem {
|
||||
}
|
||||
|
||||
public int getUnbreakingLevel() {
|
||||
return unbreakingLevel < 0 ? nbtItem.getItem().getItemMeta().getEnchantLevel(Enchantment.DURABILITY) : unbreakingLevel;
|
||||
return unbreakingLevel;
|
||||
}
|
||||
|
||||
public NBTItem getNBTItem() {
|
||||
return nbtItem;
|
||||
}
|
||||
|
||||
public boolean isBroken() {
|
||||
return durability <= 0;
|
||||
}
|
||||
|
||||
public boolean isLostWhenBroken() {
|
||||
return nbtItem.getBoolean("MMOITEMS_WILL_BREAK");
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return player.getGameMode() != GameMode.CREATIVE && nbtItem.hasTag("MMOITEMS_DURABILITY");
|
||||
}
|
||||
@ -71,11 +77,6 @@ public class DurabilityItem {
|
||||
return this;
|
||||
}
|
||||
|
||||
public DurabilityItem doBreak() {
|
||||
broken = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DurabilityItem decreaseDurability(int loss) {
|
||||
|
||||
/*
|
||||
@ -87,48 +88,12 @@ public class DurabilityItem {
|
||||
if (getUnbreakingLevel() > 0 && random.nextInt(getUnbreakingLevel()) > 0)
|
||||
return this;
|
||||
|
||||
ItemLoseDurabilityEvent event = new ItemLoseDurabilityEvent(player, nbtItem, durability, loss);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
return this;
|
||||
|
||||
addDurability(-loss);
|
||||
|
||||
// when the item breaks
|
||||
if (durability < 1) {
|
||||
if (durability <= 0) {
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
|
||||
ItemBreakEvent breakEvent = new ItemBreakEvent(player, nbtItem);
|
||||
Bukkit.getPluginManager().callEvent(breakEvent);
|
||||
|
||||
/*
|
||||
* does NOT work with armors. armors need to be entirely updated
|
||||
* when they break. no problem since they do not have any dupe issue
|
||||
*/
|
||||
player.getInventory().removeItem(nbtItem.getItem());
|
||||
|
||||
/*
|
||||
* when the item breaks and gets really removed from the player
|
||||
* inventory since the corresponding item option is toggled on
|
||||
*/
|
||||
if (breakEvent.doesItemBreak()) {
|
||||
Message.ITEM_BROKE.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(nbtItem.getItem())).send(player, "item-break");
|
||||
doBreak();
|
||||
return this;
|
||||
}
|
||||
|
||||
/*
|
||||
* when the item is unusable, it gets removed from the player
|
||||
* inventory but gets added again in a different slot to make sure
|
||||
* the player unequips it and won't be able to equip it again
|
||||
* without repairing it first
|
||||
*/
|
||||
for (ItemStack drop : player.getInventory().addItem(toItem()).values())
|
||||
player.getWorld().dropItem(player.getLocation(), drop);
|
||||
doBreak();
|
||||
|
||||
Message.ZERO_DURABILITY.format(ChatColor.RED).send(player, "item-break");
|
||||
PlayerData.get(player).updateInventory();
|
||||
return this;
|
||||
PlayerData.get(player).scheduleDelayedInventoryUpdate();
|
||||
}
|
||||
|
||||
return this;
|
||||
@ -136,13 +101,6 @@ public class DurabilityItem {
|
||||
|
||||
public ItemStack toItem() {
|
||||
|
||||
/*
|
||||
* is the item is broken, return a null. this is used by armors to set
|
||||
* the armor piece to null since it's not removed from the inventory
|
||||
*/
|
||||
if (broken)
|
||||
return null;
|
||||
|
||||
/*
|
||||
* calculate the new durability state and update it in the item lore. if
|
||||
* the durability state is null, it either means the durability state is
|
||||
@ -150,46 +108,24 @@ public class DurabilityItem {
|
||||
* cases it shall no be updated
|
||||
*/
|
||||
nbtItem.addTag(new ItemTag("MMOITEMS_DURABILITY", durability));
|
||||
DurabilityState state = getDurabilityState();
|
||||
if (state == null)
|
||||
return nbtItem.toItem();
|
||||
ItemStack item = nbtItem.toItem();
|
||||
|
||||
/*
|
||||
* if the item does not have the correct durability state, update it
|
||||
* update vanilla durability
|
||||
*/
|
||||
DurabilityState expected = getExpectedDurabilityState();
|
||||
if (!state.equals(expected)) {
|
||||
List<String> lore = nbtItem.getItem().getItemMeta().getLore();
|
||||
for (int j = 0; j < lore.size(); j++)
|
||||
if (lore.get(j).equals(state.getDisplay())) {
|
||||
nbtItem.addTag(new ItemTag("MMOITEMS_DURABILITY_STATE", expected.getID())).toItem();
|
||||
double ratio = (double) durability / maxDurability;
|
||||
int damage = (int) ((1. - ratio) * item.getType().getMaxDurability());
|
||||
|
||||
ItemStack result = nbtItem.toItem();
|
||||
ItemMeta meta = result.getItemMeta();
|
||||
lore.set(j, expected.getDisplay());
|
||||
meta.setLore(lore);
|
||||
result.setItemMeta(meta);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* make sure the vanilla bar displays at least 1 damage so the item can
|
||||
* always be mended
|
||||
*/
|
||||
damage = Math.max(ratio < 1 ? 1 : 0, damage);
|
||||
|
||||
return nbtItem.toItem();
|
||||
}
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
((Damageable) meta).setDamage(damage);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
private DurabilityState getDurabilityState() {
|
||||
String tag = nbtItem.getString("MMOITEMS_DURABILITY_STATE");
|
||||
return MMOItems.plugin.getLanguage().hasDurabilityState(tag) ? MMOItems.plugin.getLanguage().getDurabilityState(tag) : null;
|
||||
}
|
||||
|
||||
private DurabilityState getExpectedDurabilityState() {
|
||||
return getExpectedDurabilityState(durability, getMaxDurability());
|
||||
}
|
||||
|
||||
// used during item generation to determine the item first state
|
||||
public static DurabilityState getExpectedDurabilityState(int durability, int max) {
|
||||
for (DurabilityState state : MMOItems.plugin.getLanguage().getDurabilityStates())
|
||||
if (state.isInState(durability, max))
|
||||
return state;
|
||||
return null;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
package net.Indyuce.mmoitems.api.interaction.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class DurabilityState {
|
||||
private String id;
|
||||
|
||||
// how it is displayed in the lore. it is already color-formatted
|
||||
private String display;
|
||||
|
||||
// use ratio = <uses-left> / <max-durability>
|
||||
private double minRatio, maxRatio;
|
||||
|
||||
public DurabilityState(ConfigurationSection config) {
|
||||
this.minRatio = config.getDouble("use-ratio.min") / 100;
|
||||
this.maxRatio = config.getDouble("use-ratio.max") / 100;
|
||||
this.display = ChatColor.translateAlternateColorCodes('&', config.getString("lore-tag"));
|
||||
this.id = config.getName().toUpperCase().replace("-", "_");
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isInState(double current, double max) {
|
||||
double ratio = current / max;
|
||||
return maxRatio >= ratio && ratio >= minRatio;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof DurabilityState && ((DurabilityState) obj).id.equals(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package net.Indyuce.mmoitems.api.interaction.util;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class UntargetedDurabilityItem extends DurabilityItem {
|
||||
private final EquipmentSlot slot;
|
||||
|
||||
/*
|
||||
* allows to delete items when they are right clicked while using the same
|
||||
* durability system as vanilla items
|
||||
*/
|
||||
public UntargetedDurabilityItem(Player player, NBTItem item, EquipmentSlot slot) {
|
||||
super(player, item);
|
||||
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UntargetedDurabilityItem decreaseDurability(int loss) {
|
||||
return (UntargetedDurabilityItem) super.decreaseDurability(loss);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
||||
if (isBroken() && isLostWhenBroken()) {
|
||||
if (slot == EquipmentSlot.OFF_HAND)
|
||||
getPlayer().getInventory().setItemInOffHand(null);
|
||||
else
|
||||
getPlayer().getInventory().setItemInMainHand(null);
|
||||
return;
|
||||
}
|
||||
|
||||
getNBTItem().getItem().setItemMeta(toItem().getItemMeta());
|
||||
}
|
||||
}
|
@ -11,8 +11,6 @@ import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.UseItem;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.InteractItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
@ -72,11 +70,6 @@ public class Weapon extends UseItem {
|
||||
|
||||
public ItemAttackResult targetedAttack(CachedStats stats, LivingEntity target, EquipmentSlot slot, ItemAttackResult result) {
|
||||
|
||||
// custom durability
|
||||
DurabilityItem durItem = new DurabilityItem(getPlayer(), getNBTItem());
|
||||
if (durItem.isValid())
|
||||
new InteractItem(getPlayer(), slot).setItem(durItem.decreaseDurability(1).toItem());
|
||||
|
||||
// cooldown
|
||||
double attackSpeed = getNBTItem().getStat(ItemStat.ATTACK_SPEED);
|
||||
attackSpeed = attackSpeed == 0 ? 1.493 : 1 / attackSpeed;
|
||||
|
@ -5,10 +5,12 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.UntargetedDurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
@ -20,7 +22,7 @@ public class Crossbow extends UntargetedWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void untargetedAttackEffects() {
|
||||
public void untargetedAttack(EquipmentSlot slot) {
|
||||
|
||||
// check for arrow
|
||||
if (getPlayer().getGameMode() != GameMode.CREATIVE && !getPlayer().getInventory().containsAtLeast(new ItemStack(Material.ARROW), 1))
|
||||
@ -30,6 +32,10 @@ public class Crossbow extends UntargetedWeapon {
|
||||
if (!hasEnoughResources(1 / getValue(stats.getStat(ItemStat.ATTACK_SPEED), MMOItems.plugin.getConfig().getDouble("default.attack-speed")), CooldownType.ATTACK, false))
|
||||
return;
|
||||
|
||||
UntargetedDurabilityItem durItem = new UntargetedDurabilityItem(getPlayer(), getNBTItem(), slot);
|
||||
if (durItem.isValid())
|
||||
durItem.decreaseDurability(1).update();
|
||||
|
||||
// consume arrow
|
||||
// has to be after the CD check
|
||||
if (getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -15,6 +16,7 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.UntargetedDurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
@ -30,13 +32,17 @@ public class Lute extends UntargetedWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void untargetedAttackEffects() {
|
||||
CachedStats stats = getPlayerData().getStats().newTemporary();
|
||||
public void untargetedAttack(EquipmentSlot slot) {
|
||||
|
||||
CachedStats stats = getPlayerData().getStats().newTemporary();
|
||||
double attackSpeed = 1 / getValue(stats.getStat(ItemStat.ATTACK_SPEED), MMOItems.plugin.getConfig().getDouble("default.attack-speed"));
|
||||
if (!hasEnoughResources(attackSpeed, CooldownType.ATTACK, false))
|
||||
return;
|
||||
|
||||
UntargetedDurabilityItem durItem = new UntargetedDurabilityItem(getPlayer(), getNBTItem(), slot);
|
||||
if (durItem.isValid())
|
||||
durItem.decreaseDurability(1).update();
|
||||
|
||||
double attackDamage = getValue(stats.getStat(ItemStat.ATTACK_DAMAGE), 1);
|
||||
double range = getValue(getNBTItem().getStat(ItemStat.RANGE), MMOItems.plugin.getConfig().getDouble("default.range"));
|
||||
Vector weight = new Vector(0, -.003 * getNBTItem().getStat(ItemStat.NOTE_WEIGHT), 0);
|
||||
|
@ -4,12 +4,14 @@ import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.UntargetedDurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
@ -24,11 +26,15 @@ public class Musket extends UntargetedWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void untargetedAttackEffects() {
|
||||
public void untargetedAttack(EquipmentSlot slot) {
|
||||
CachedStats stats = getPlayerData().getStats().newTemporary();
|
||||
|
||||
if (!hasEnoughResources(1 / getValue(stats.getStat(ItemStat.ATTACK_SPEED), MMOItems.plugin.getConfig().getDouble("default.attack-speed")), CooldownType.ATTACK, false))
|
||||
return;
|
||||
|
||||
UntargetedDurabilityItem durItem = new UntargetedDurabilityItem(getPlayer(), getNBTItem(), slot);
|
||||
if (durItem.isValid())
|
||||
durItem.decreaseDurability(1).update();
|
||||
|
||||
double attackDamage = stats.getStat(ItemStat.ATTACK_DAMAGE);
|
||||
double range = getValue(getNBTItem().getStat(ItemStat.RANGE), MMOItems.plugin.getConfig().getDouble("default.range"));
|
||||
|
@ -6,12 +6,14 @@ import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.UntargetedDurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.Staff_Spirit.StaffSpirit;
|
||||
@ -28,12 +30,16 @@ public class Staff extends UntargetedWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void untargetedAttackEffects() {
|
||||
CachedStats stats = getPlayerData().getStats().newTemporary();
|
||||
public void untargetedAttack(EquipmentSlot slot) {
|
||||
|
||||
CachedStats stats = getPlayerData().getStats().newTemporary();
|
||||
if (!hasEnoughResources(1 / getValue(stats.getStat(ItemStat.ATTACK_SPEED), MMOItems.plugin.getConfig().getDouble("default.attack-speed")), CooldownType.ATTACK, false))
|
||||
return;
|
||||
|
||||
UntargetedDurabilityItem durItem = new UntargetedDurabilityItem(getPlayer(), getNBTItem(), slot);
|
||||
if (durItem.isValid())
|
||||
durItem.decreaseDurability(1).update();
|
||||
|
||||
double attackDamage = getValue(stats.getStat(ItemStat.ATTACK_DAMAGE), 1);
|
||||
double range = getValue(getNBTItem().getStat(ItemStat.RANGE), MMOItems.plugin.getConfig().getDouble("default.range"));
|
||||
|
||||
|
@ -5,8 +5,6 @@ import org.bukkit.event.block.Action;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.InteractItem;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
@ -24,20 +22,12 @@ public abstract class UntargetedWeapon extends Weapon {
|
||||
* called first when the player clicks his item and allows to apply
|
||||
* durability onto a weapon that is not targeted
|
||||
*/
|
||||
public final void untargetedAttack(EquipmentSlot slot) {
|
||||
DurabilityItem durItem = new DurabilityItem(getPlayer(), getNBTItem());
|
||||
if (durItem.isValid())
|
||||
new InteractItem(getPlayer(), slot).setItem(durItem.decreaseDurability(1).toItem());
|
||||
|
||||
untargetedAttackEffects();
|
||||
}
|
||||
public abstract void untargetedAttack(EquipmentSlot slot);
|
||||
|
||||
public WeaponType getWeaponType() {
|
||||
return weaponType;
|
||||
}
|
||||
|
||||
public abstract void untargetedAttackEffects();
|
||||
|
||||
public enum WeaponType {
|
||||
RIGHT_CLICK,
|
||||
LEFT_CLICK;
|
||||
|
@ -3,12 +3,14 @@ package net.Indyuce.mmoitems.api.interaction.weapon.untargeted;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.UntargetedDurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
@ -24,12 +26,16 @@ public class Whip extends UntargetedWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void untargetedAttackEffects() {
|
||||
public void untargetedAttack(EquipmentSlot slot) {
|
||||
|
||||
CachedStats stats = getPlayerData().getStats().newTemporary();
|
||||
if (!hasEnoughResources(1 / getValue(stats.getStat(ItemStat.ATTACK_SPEED), MMOItems.plugin.getConfig().getDouble("default.attack-speed")), CooldownType.ATTACK, false))
|
||||
return;
|
||||
|
||||
UntargetedDurabilityItem durItem = new UntargetedDurabilityItem(getPlayer(), getNBTItem(), slot);
|
||||
if (durItem.isValid())
|
||||
durItem.decreaseDurability(1).update();
|
||||
|
||||
double attackDamage = getValue(stats.getStat(ItemStat.ATTACK_DAMAGE), 1);
|
||||
double range = getValue(getNBTItem().getStat(ItemStat.RANGE), MMOItems.plugin.getConfig().getDouble("default.range"));
|
||||
|
||||
|
@ -62,7 +62,7 @@ public abstract class RPGPlayer {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for (Conditional condition : MMOItems.plugin.getStats().getConditionals())
|
||||
if (!condition.canUse(this, item, message))
|
||||
return false;
|
||||
|
@ -30,7 +30,7 @@ public enum Message {
|
||||
UNIDENTIFIED_ITEM("You can't use an unidentified item!"),
|
||||
|
||||
// custom durability
|
||||
ITEM_BROKE("Your #item#&c broke."),
|
||||
// ITEM_BROKE("Your #item#&c broke."),
|
||||
ZERO_DURABILITY("This item is broken, you first need to repair it."),
|
||||
|
||||
// consumables & gem stones
|
||||
|
@ -30,7 +30,7 @@ public class GetMMOItemObjective extends Objective {
|
||||
type = MMOItems.plugin.getTypes().get(format);
|
||||
|
||||
id = config.getString("id");
|
||||
required = config.contains("amount") ? Math.min(config.getInt("amount"), 1) : 1;
|
||||
required = config.contains("amount") ? Math.max(config.getInt("amount"), 1) : 1;
|
||||
npcId = config.getInt("npc");
|
||||
}
|
||||
|
||||
|
@ -1,316 +0,0 @@
|
||||
package net.Indyuce.mmoitems.listener;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityToggleGlideEvent;
|
||||
import org.bukkit.event.player.PlayerExpChangeEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent.State;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemMendEvent;
|
||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.InteractItem;
|
||||
|
||||
|
||||
public class CustomDurability implements Listener {
|
||||
private final List<DamageCause> applyDamageCauses = Arrays.asList(DamageCause.ENTITY_ATTACK, DamageCause.ENTITY_EXPLOSION, DamageCause.BLOCK_EXPLOSION, DamageCause.THORNS, DamageCause.CONTACT, DamageCause.FIRE, DamageCause.HOT_FLOOR, DamageCause.LAVA, DamageCause.PROJECTILE);
|
||||
private final List<String> hoeableBlocks = Arrays.asList("GRASS_PATH", "GRASS", "DIRT");
|
||||
private final List<PlayerFishEvent.State> applyFishStates = Arrays.asList(State.IN_GROUND, State.CAUGHT_ENTITY, State.CAUGHT_FISH);
|
||||
|
||||
/*
|
||||
* if the player switches his glide more than once a second, the old
|
||||
* runnable needs to be cancelled so it doesn't consume twice as much
|
||||
* durability
|
||||
*/
|
||||
private Map<UUID, BukkitRunnable> elytraDurabilityLoss = new HashMap<>();
|
||||
|
||||
/*
|
||||
* when breaking a block, ANY item will lose one durability point even if
|
||||
* the block can be broken instantly.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void a(BlockBreakEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
DurabilityItem durItem = new DurabilityItem(player, item);
|
||||
if (durItem.isValid()) {
|
||||
ItemStack result = durItem.decreaseDurability(1).toItem();
|
||||
if (result != null && result.getType() != Material.AIR)
|
||||
item.setItemMeta(result.getItemMeta());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* when getting hit, any armor piece will lose 1 durability point
|
||||
* (explosions deal 2 points of damage)
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void c(EntityDamageEvent event) {
|
||||
if (event.isCancelled() || !(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!applyDamageCauses.contains(event.getCause()))
|
||||
return;
|
||||
|
||||
int dura = 1;
|
||||
if (event.getCause() == DamageCause.BLOCK_EXPLOSION || event.getCause() == DamageCause.ENTITY_EXPLOSION)
|
||||
dura = 2;
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
DurabilityItem durabilityItem;
|
||||
|
||||
ItemStack helmet = player.getInventory().getHelmet();
|
||||
if (helmet != null)
|
||||
if ((durabilityItem = new DurabilityItem(player, helmet)).isValid())
|
||||
player.getInventory().setHelmet(durabilityItem.decreaseDurability(dura).toItem());
|
||||
|
||||
ItemStack chestplate = player.getInventory().getChestplate();
|
||||
if (chestplate != null)
|
||||
if ((durabilityItem = new DurabilityItem(player, chestplate)).isValid())
|
||||
player.getInventory().setChestplate(durabilityItem.decreaseDurability(dura).toItem());
|
||||
|
||||
ItemStack leggings = player.getInventory().getLeggings();
|
||||
if (leggings != null)
|
||||
if ((durabilityItem = new DurabilityItem(player, leggings)).isValid())
|
||||
player.getInventory().setLeggings(durabilityItem.decreaseDurability(dura).toItem());
|
||||
|
||||
ItemStack boots = player.getInventory().getBoots();
|
||||
if (boots != null)
|
||||
if ((durabilityItem = new DurabilityItem(player, boots)).isValid())
|
||||
player.getInventory().setBoots(durabilityItem.decreaseDurability(dura).toItem());
|
||||
|
||||
InteractItem intItem = new InteractItem(player, Material.SHIELD);
|
||||
if (intItem.hasItem() && player.isBlocking())
|
||||
if ((durabilityItem = new DurabilityItem(player, intItem.getItem())).isValid())
|
||||
intItem.setItem(durabilityItem.decreaseDurability(dura).toItem());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void d(EntityShootBowEvent event) {
|
||||
if (event.isCancelled() || !(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
DurabilityItem durItem = new DurabilityItem(player, event.getBow());
|
||||
if (durItem.isValid())
|
||||
event.getBow().setItemMeta(durItem.decreaseDurability(1).toItem().getItemMeta());
|
||||
}
|
||||
|
||||
/*
|
||||
* make shears lose durability when used on a sheep
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void e(PlayerShearEntityEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
InteractItem intItem = new InteractItem(player, Material.SHEARS);
|
||||
if (!intItem.hasItem())
|
||||
return;
|
||||
|
||||
DurabilityItem durItem = new DurabilityItem(player, intItem.getItem());
|
||||
if (durItem.isValid())
|
||||
intItem.setItem(durItem.decreaseDurability(1).toItem());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void f(PlayerInteractEvent event) {
|
||||
if (!event.hasItem() || event.getAction() != Action.RIGHT_CLICK_BLOCK || !event.hasBlock())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
InteractItem intItem;
|
||||
Material material = event.getClickedBlock().getType();
|
||||
|
||||
/*
|
||||
* making hoe lose durability when hoeing grass/dirt/coarse
|
||||
*/
|
||||
if (hoeableBlocks.contains(material.name()) && (intItem = new InteractItem(player, "_HOE")).hasItem()) {
|
||||
DurabilityItem durItem = new DurabilityItem(player, intItem.getItem());
|
||||
if (durItem.isValid())
|
||||
intItem.setItem(durItem.decreaseDurability(1).toItem());
|
||||
}
|
||||
|
||||
/*
|
||||
* grass path creation
|
||||
*/
|
||||
else if (material == Material.GRASS && (intItem = new InteractItem(player, "_SPADE")).hasItem()) {
|
||||
DurabilityItem durItem = new DurabilityItem(player, intItem.getItem());
|
||||
if (durItem.isValid())
|
||||
intItem.setItem(durItem.decreaseDurability(1).toItem());
|
||||
}
|
||||
|
||||
/*
|
||||
* stripped logs
|
||||
*/
|
||||
else if (material.name().endsWith("_LOG") && !material.name().startsWith("STRIPPED_") && (intItem = new InteractItem(player, "_AXE")).hasItem()) {
|
||||
DurabilityItem durItem = new DurabilityItem(player, intItem.getItem());
|
||||
if (durItem.isValid())
|
||||
intItem.setItem(durItem.decreaseDurability(1).toItem());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* flint and steel consuming
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void g(BlockIgniteEvent event) {
|
||||
if (event.isCancelled() || !(event.getIgnitingEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getIgnitingEntity();
|
||||
InteractItem intItem = new InteractItem(player, Material.FLINT_AND_STEEL);
|
||||
if (!intItem.hasItem())
|
||||
return;
|
||||
|
||||
DurabilityItem durItem = new DurabilityItem(player, intItem.getItem());
|
||||
if (durItem.isValid())
|
||||
intItem.setItem(durItem.decreaseDurability(1).toItem());
|
||||
}
|
||||
|
||||
/*
|
||||
* fishing rod durability loss - loses 1 if it catches a fish successfully.
|
||||
* if it catches an item, uses 3 durability, 5 if it is any other entity,
|
||||
* and 0 durability loss if it does not catch anything ; a delay is needed
|
||||
* otherwise it does not update the item held by the player
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void h(PlayerFishEvent event) {
|
||||
if (event.isCancelled() || !applyFishStates.contains(event.getState()))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
InteractItem intItem = new InteractItem(player, Material.FISHING_ROD);
|
||||
if (!intItem.hasItem())
|
||||
return;
|
||||
|
||||
DurabilityItem durItem = new DurabilityItem(player, intItem.getItem());
|
||||
if (!durItem.isValid())
|
||||
return;
|
||||
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
int loss = event.getState() == State.CAUGHT_FISH ? 1 : (event.getState() == State.CAUGHT_ENTITY ? (event.getCaught() instanceof Item ? 3 : 5) : 2);
|
||||
intItem.setItem(durItem.decreaseDurability(loss).toItem());
|
||||
}
|
||||
}.runTaskLater(MMOItems.plugin, 0);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void i(EntityToggleGlideEvent event) {
|
||||
if (event.isCancelled() || !(event.getEntity() instanceof Player) || !(event.isGliding()))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
if (elytraDurabilityLoss.containsKey(player.getUniqueId()))
|
||||
elytraDurabilityLoss.get(player.getUniqueId()).cancel();
|
||||
|
||||
BukkitRunnable runnable = new BukkitRunnable() {
|
||||
public void run() {
|
||||
if (player == null || !player.isOnline() || !player.isGliding()) {
|
||||
cancel();
|
||||
elytraDurabilityLoss.remove(player.getUniqueId());
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack elytra = player.getInventory().getChestplate();
|
||||
if (elytra != null && elytra.getType() == Material.ELYTRA) {
|
||||
DurabilityItem durabilityItem = new DurabilityItem(player, elytra);
|
||||
if (durabilityItem.isValid())
|
||||
player.getInventory().setChestplate(durabilityItem.decreaseDurability(1).toItem());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
elytraDurabilityLoss.put(player.getUniqueId(), runnable);
|
||||
runnable.runTaskTimer(MMOItems.plugin, 10, 20);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void j(PlayerItemMendEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
DurabilityItem durItem = new DurabilityItem(event.getPlayer(), event.getItem());
|
||||
if (durItem.isValid())
|
||||
event.getItem().setItemMeta(durItem.addDurability(event.getRepairAmount()).toItem().getItemMeta());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void k(PlayerExpChangeEvent event) {
|
||||
|
||||
int expAmount = event.getAmount();
|
||||
|
||||
if (expAmount <= 0)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
DurabilityItem durabilityItem;
|
||||
int durabilityGain = expAmount * 2;
|
||||
|
||||
ItemStack mainHandItem = player.getInventory().getItemInMainHand();
|
||||
if (mainHandItem != null && mainHandItem.getType() != Material.AIR)
|
||||
if ((durabilityItem = new DurabilityItem(player, mainHandItem)).isValid() && isMending(mainHandItem))
|
||||
player.getInventory().setItemInMainHand(durabilityItem.addDurability(durabilityGain).toItem());
|
||||
|
||||
ItemStack offHandItem = player.getInventory().getItemInOffHand();
|
||||
if (offHandItem != null && offHandItem.getType() != Material.AIR)
|
||||
if ((durabilityItem = new DurabilityItem(player, offHandItem)).isValid() && isMending(offHandItem))
|
||||
player.getInventory().setItemInOffHand(durabilityItem.addDurability(durabilityGain).toItem());
|
||||
|
||||
ItemStack helmet = player.getInventory().getHelmet();
|
||||
if (helmet != null && helmet.getType() != Material.AIR)
|
||||
if ((durabilityItem = new DurabilityItem(player, helmet)).isValid() && isMending(helmet))
|
||||
player.getInventory().setHelmet(durabilityItem.addDurability(durabilityGain).toItem());
|
||||
|
||||
ItemStack chestplate = player.getInventory().getChestplate();
|
||||
if (chestplate != null && chestplate.getType() != Material.AIR)
|
||||
if ((durabilityItem = new DurabilityItem(player, chestplate)).isValid() && isMending(chestplate))
|
||||
player.getInventory().setChestplate(durabilityItem.addDurability(durabilityGain).toItem());
|
||||
|
||||
ItemStack leggings = player.getInventory().getLeggings();
|
||||
if (leggings != null && leggings.getType() != Material.AIR)
|
||||
if ((durabilityItem = new DurabilityItem(player, leggings)).isValid() && isMending(leggings))
|
||||
player.getInventory().setLeggings(durabilityItem.addDurability(durabilityGain).toItem());
|
||||
|
||||
ItemStack boots = player.getInventory().getBoots();
|
||||
if (boots != null && boots.getType() != Material.AIR)
|
||||
if ((durabilityItem = new DurabilityItem(player, boots)).isValid() && isMending(boots))
|
||||
player.getInventory().setBoots(durabilityItem.addDurability(durabilityGain).toItem());
|
||||
}
|
||||
|
||||
private boolean isMending(ItemStack itemStack) {
|
||||
Map<Enchantment, Integer> enchantments = itemStack.getEnchantments();
|
||||
|
||||
if(enchantments.getOrDefault(Enchantment.MENDING, -1) == -1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -21,25 +21,24 @@ import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.api.event.ItemBreakEvent;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class CustomSoundListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(EntityDamageByEntityEvent event) {
|
||||
if(!(event.getDamager() instanceof Player) || !(event.getEntity() instanceof LivingEntity))
|
||||
if (!(event.getDamager() instanceof Player) || !(event.getEntity() instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
|
||||
Player player = (Player) event.getDamager();
|
||||
playSound(player.getInventory().getItemInMainHand(), "ON_ATTACK", player);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void b(EntityPickupItemEvent event) {
|
||||
if(event.getEntityType().equals(EntityType.PLAYER))
|
||||
playSound(event.getItem().getItemStack(), "ON_PICKUP", (Player) event.getEntity());
|
||||
}
|
||||
|
||||
public void b(EntityPickupItemEvent event) {
|
||||
if (event.getEntityType().equals(EntityType.PLAYER))
|
||||
playSound(event.getItem().getItemStack(), "ON_PICKUP", (Player) event.getEntity());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void c(BlockBreakEvent event) {
|
||||
playSound(event.getPlayer().getInventory().getItemInMainHand(), "ON_BLOCK_BREAK", event.getPlayer());
|
||||
@ -47,72 +46,66 @@ public class CustomSoundListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void d(PlayerInteractEvent event) {
|
||||
if(event.getHand() == null || event.getHand() == EquipmentSlot.OFF_HAND || !event.hasItem()) return;
|
||||
|
||||
if(event.hasBlock())
|
||||
{
|
||||
if(event.getAction().name().contains("RIGHT_CLICK"))
|
||||
if (event.getHand() == null || event.getHand() == EquipmentSlot.OFF_HAND || !event.hasItem())
|
||||
return;
|
||||
|
||||
if (event.hasBlock()) {
|
||||
if (event.getAction().name().contains("RIGHT_CLICK"))
|
||||
playSound(event.getItem(), "ON_RIGHT_CLICK", event.getPlayer());
|
||||
|
||||
if(event.getAction().name().contains("LEFT_CLICK"))
|
||||
if (event.getAction().name().contains("LEFT_CLICK"))
|
||||
playSound(event.getItem(), "ON_LEFT_CLICK", event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void e(CraftItemEvent event) {
|
||||
playSound(event.getInventory().getResult(), "ON_CRAFT",
|
||||
event.getWhoClicked().getWorld(), event.getWhoClicked().getLocation());
|
||||
}
|
||||
public void e(CraftItemEvent event) {
|
||||
playSound(event.getInventory().getResult(), "ON_CRAFT", event.getWhoClicked().getWorld(), event.getWhoClicked().getLocation());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void f(FurnaceSmeltEvent event) {
|
||||
public void f(FurnaceSmeltEvent event) {
|
||||
playSound(event.getResult(), "ON_CRAFT", event.getBlock());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void g(PlayerItemConsumeEvent event) {
|
||||
playSound(event.getItem(), "ON_CONSUME", event.getPlayer());
|
||||
}
|
||||
public void g(PlayerItemConsumeEvent event) {
|
||||
playSound(event.getItem(), "ON_CONSUME", event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void h1(PlayerItemBreakEvent event) {
|
||||
playSound(event.getBrokenItem(), "ON_ITEM_BREAK", event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void h2(ItemBreakEvent event) {
|
||||
playSound(event.getItem().getItem(), "ON_ITEM_BREAK", event.getPlayer());
|
||||
}
|
||||
public void h1(PlayerItemBreakEvent event) {
|
||||
playSound(event.getBrokenItem(), "ON_ITEM_BREAK", event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void i(BlockPlaceEvent event) {
|
||||
playSound(event.getItemInHand(), "ON_PLACED", event.getPlayer());
|
||||
}
|
||||
|
||||
public void i(BlockPlaceEvent event) {
|
||||
playSound(event.getItemInHand(), "ON_PLACED", event.getPlayer());
|
||||
}
|
||||
|
||||
public static void stationCrafting(ItemStack item, Player player) {
|
||||
if(item == null) return;
|
||||
if (item == null)
|
||||
return;
|
||||
NBTItem nbt = NBTItem.get(item);
|
||||
if(nbt.hasTag("MMOITEMS_SOUND_ON_CRAFT")) {
|
||||
player.getWorld().playSound(player.getLocation(),
|
||||
nbt.getString("MMOITEMS_SOUND_ON_CRAFT"),
|
||||
(float) nbt.getDouble("MMOITEMS_SOUND_ON_CRAFT_VOL"),
|
||||
(float) nbt.getDouble("MMOITEMS_SOUND_ON_CRAFT_PIT"));
|
||||
if (nbt.hasTag("MMOITEMS_SOUND_ON_CRAFT")) {
|
||||
player.getWorld().playSound(player.getLocation(), nbt.getString("MMOITEMS_SOUND_ON_CRAFT"), (float) nbt.getDouble("MMOITEMS_SOUND_ON_CRAFT_VOL"), (float) nbt.getDouble("MMOITEMS_SOUND_ON_CRAFT_PIT"));
|
||||
}
|
||||
}
|
||||
|
||||
void playSound(ItemStack item, String sound, Player player)
|
||||
{ playSound(item, sound, player.getWorld(), player.getLocation()); }
|
||||
void playSound(ItemStack item, String sound, Block block)
|
||||
{ playSound(item, sound, block.getWorld(), block.getLocation()); }
|
||||
void playSound(ItemStack item, String sound, Player player) {
|
||||
playSound(item, sound, player.getWorld(), player.getLocation());
|
||||
}
|
||||
|
||||
void playSound(ItemStack item, String sound, Block block) {
|
||||
playSound(item, sound, block.getWorld(), block.getLocation());
|
||||
}
|
||||
|
||||
void playSound(ItemStack item, String sound, World world, Location loc) {
|
||||
if(item == null) return;
|
||||
if (item == null)
|
||||
return;
|
||||
NBTItem nbt = NBTItem.get(item);
|
||||
if(nbt.hasTag("MMOITEMS_SOUND_" + sound)) {
|
||||
world.playSound(loc, nbt.getString("MMOITEMS_SOUND_" + sound),
|
||||
(float) nbt.getDouble("MMOITEMS_SOUND_" + sound + "_VOL"),
|
||||
(float) nbt.getDouble("MMOITEMS_SOUND_" + sound + "_PIT"));
|
||||
if (nbt.hasTag("MMOITEMS_SOUND_" + sound)) {
|
||||
world.playSound(loc, nbt.getString("MMOITEMS_SOUND_" + sound), (float) nbt.getDouble("MMOITEMS_SOUND_" + sound + "_VOL"), (float) nbt.getDouble("MMOITEMS_SOUND_" + sound + "_PIT"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
public class ItemUse implements Listener {
|
||||
private static final DecimalFormat digit = new DecimalFormat("0.#");
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void a(PlayerInteractEvent event) {
|
||||
if (!event.hasItem() || event.getHand() != EquipmentSlot.HAND)
|
||||
return;
|
||||
|
@ -0,0 +1,43 @@
|
||||
package net.Indyuce.mmoitems.listener;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerItemDamageEvent;
|
||||
import org.bukkit.event.player.PlayerItemMendEvent;
|
||||
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
|
||||
|
||||
public class NewDurabilityListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void a(PlayerItemDamageEvent event) {
|
||||
DurabilityItem item = new DurabilityItem(event.getPlayer(), event.getItem());
|
||||
if (item.isValid()) {
|
||||
|
||||
/*
|
||||
* calculate item durability loss
|
||||
*/
|
||||
item.decreaseDurability(event.getDamage());
|
||||
|
||||
/*
|
||||
* if the item is broken and if it is meant to be lost when broken,
|
||||
* do NOT cancel the event and make sure the item is destroyed
|
||||
*/
|
||||
if (item.isBroken() && item.isLostWhenBroken()) {
|
||||
event.setDamage(999);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getItem().setItemMeta(item.toItem().getItemMeta());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void b(PlayerItemMendEvent event) {
|
||||
DurabilityItem durItem = new DurabilityItem(event.getPlayer(), event.getItem());
|
||||
if (durItem.isValid())
|
||||
event.getItem().setItemMeta(durItem.addDurability(event.getRepairAmount()).toItem().getItemMeta());
|
||||
}
|
||||
}
|
@ -5,11 +5,8 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
@ -23,7 +20,6 @@ import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability;
|
||||
import net.Indyuce.mmoitems.api.ability.Ability.CastingMode;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityState;
|
||||
import net.Indyuce.mmoitems.api.item.plugin.ConfigItem;
|
||||
import net.Indyuce.mmoitems.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
@ -33,13 +29,13 @@ import net.Indyuce.mmoitems.stat.Staff_Spirit.StaffSpirit;
|
||||
public class ConfigManager {
|
||||
|
||||
// must be updated each time a new language file is needed
|
||||
private String[] fileNames = { "abilities", "lore-format", "messages", "potion-effects", "stats", "items", "attack-effects" };
|
||||
private String[] fileNames = { "abilities", "messages", "potion-effects", "stats", "items", "attack-effects" };
|
||||
|
||||
// must be updated each time a new language is added
|
||||
private String[] languages = { "french", "chinese", "spanish", "russian", "polish" };
|
||||
|
||||
// cached config files
|
||||
private ConfigFile abilities, items, loreFormat, messages, potionEffects, stats, attackEffects, namePlaceholders, durabilityStatesConfig;
|
||||
private ConfigFile abilities, items, loreFormat, messages, potionEffects, stats, attackEffects, namePlaceholders;
|
||||
|
||||
// cached config options
|
||||
public boolean abilityPlayerDamage, dodgeKnockbackEnabled, replaceMushroomDrops, worldGenEnabled;
|
||||
@ -48,8 +44,6 @@ public class ConfigManager {
|
||||
|
||||
public double dodgeKnockbackForce, soulboundBaseDamage, soulboundPerLvlDamage;
|
||||
|
||||
private Map<String, DurabilityState> durabilityStates = new HashMap<>();
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
// try to setup non existing languages
|
||||
@ -88,8 +82,7 @@ public class ConfigManager {
|
||||
for (String fileName : fileNames)
|
||||
if (!new File(MMOItems.plugin.getDataFolder() + "/language/" + language, fileName + ".yml").exists()) {
|
||||
try {
|
||||
Files.copy(MMOItems.plugin.getResource("language/" + language + "/" + fileName + ".yml"),
|
||||
new File(MMOItems.plugin.getDataFolder() + "/language/" + language, fileName + ".yml").getAbsoluteFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
Files.copy(MMOItems.plugin.getResource("language/" + language + "/" + fileName + ".yml"), new File(MMOItems.plugin.getDataFolder() + "/language/" + language, fileName + ".yml").getAbsoluteFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -183,7 +176,6 @@ public class ConfigManager {
|
||||
stats = new ConfigFile("/language", "stats");
|
||||
attackEffects = new ConfigFile("/language", "attack-effects");
|
||||
namePlaceholders = new ConfigFile("name-placeholders");
|
||||
durabilityStatesConfig = new ConfigFile("use-states");
|
||||
|
||||
/*
|
||||
* reload cached config options for quicker access - these options are
|
||||
@ -202,11 +194,6 @@ public class ConfigManager {
|
||||
soulboundBaseDamage = MMOItems.plugin.getConfig().getDouble("soulbound.damage.base");
|
||||
soulboundPerLvlDamage = MMOItems.plugin.getConfig().getDouble("soulbound.damage.per-lvl");
|
||||
|
||||
// reload durability states, cache them into a list
|
||||
durabilityStates.clear();
|
||||
for (String id : durabilityStatesConfig.getConfig().getKeys(false))
|
||||
durabilityStates.put(id, new DurabilityState(durabilityStatesConfig.getConfig().getConfigurationSection(id)));
|
||||
|
||||
for (ConfigItem item : ConfigItem.values)
|
||||
item.update(items.getConfig().getConfigurationSection(item.getId()));
|
||||
}
|
||||
@ -256,18 +243,6 @@ public class ConfigManager {
|
||||
return ChatColor.translateAlternateColorCodes('&', attackEffects.getConfig().getString("staff-spirit." + spirit.name().toLowerCase().replace("_", "-")));
|
||||
}
|
||||
|
||||
public DurabilityState getDurabilityState(String id) {
|
||||
return durabilityStates.get(id);
|
||||
}
|
||||
|
||||
public boolean hasDurabilityState(String id) {
|
||||
return durabilityStates.containsKey(id);
|
||||
}
|
||||
|
||||
public Collection<DurabilityState> getDurabilityStates() {
|
||||
return durabilityStates.values();
|
||||
}
|
||||
|
||||
/*
|
||||
* all config files that have a default configuration are stored here, they
|
||||
* get copied into the plugin folder when the plugin enables
|
||||
@ -280,7 +255,6 @@ public class ConfigManager {
|
||||
CUSTOM_BLOCKS("custom-blocks.yml", "", "custom-blocks.yml"),
|
||||
GEN_TEMPLATES("gen-templates.yml", "", "gen-templates.yml"),
|
||||
DROPS("drops.yml", "", "drops.yml"),
|
||||
USE_STATES("use-states.yml", "", "use-states.yml"),
|
||||
ITEM_SETS("item-sets.yml", "", "item-sets.yml"),
|
||||
NAME_PLACEHOLDERS("name-placeholders.yml", "", "name-placeholders.yml"),
|
||||
UPGRADE_TEMPLATES("upgrade-templates.yml", "", "upgrade-templates.yml"),
|
||||
|
@ -8,9 +8,9 @@ import net.Indyuce.mmoitems.stat.data.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.BooleanStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
|
||||
public class Will_Break extends BooleanStat {
|
||||
public Will_Break() {
|
||||
super(new ItemStack(Material.SHEARS), "Will Break?", new String[] { "If set to true, the item will break", "once it reaches 0 durability.", "&c&oOnly works with custom durability." }, "will-break", new String[] { "all" });
|
||||
public class Lost_when_Broken extends BooleanStat {
|
||||
public Lost_when_Broken() {
|
||||
super(new ItemStack(Material.SHEARS), "Lost when Broken?", new String[] { "If set to true, the item will be lost", "once it reaches 0 durability." }, "will-break", new String[] { "all" });
|
||||
}
|
||||
|
||||
@Override
|
@ -1,14 +1,10 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityState;
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
@ -18,9 +14,9 @@ import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class Max_Custom_Durability extends DoubleStat implements Conditional {
|
||||
public Max_Custom_Durability() {
|
||||
super(new ItemStack(Material.SHEARS), "Max Custom Durability", new String[] { "The amount of uses before your", "item becomes unusable/breaks." }, "max-durability", new String[] { "all" });
|
||||
public class Maximum_Durability extends DoubleStat implements Conditional {
|
||||
public Maximum_Durability() {
|
||||
super(new ItemStack(Material.SHEARS), "Maximum Durability", new String[] { "The amount of uses before your", "item becomes unusable/breaks." }, "max-durability", new String[] { "all" });
|
||||
}
|
||||
|
||||
/*
|
||||
@ -28,21 +24,14 @@ public class Max_Custom_Durability extends DoubleStat implements Conditional {
|
||||
*/
|
||||
@Override
|
||||
public boolean whenApplied(MMOItemBuilder item, StatData data) {
|
||||
try {
|
||||
double value = ((DoubleData) data).generateNewValue();
|
||||
DurabilityState state = DurabilityItem.getExpectedDurabilityState((int) value, (int) value);
|
||||
item.addItemTag(new ItemTag("MMOITEMS_MAX_DURABILITY", value), new ItemTag("MMOITEMS_DURABILITY", value), new ItemTag("MMOITEMS_DURABILITY_STATE", state.getID()));
|
||||
item.getLore().insert("durability-state", state.getDisplay());
|
||||
} catch (Exception e) {
|
||||
item.getMMOItem().log(Level.WARNING, "Could not determine the initial durability state. Make sure you have a durability state that has its max use ratio at 100%.");
|
||||
return true;
|
||||
}
|
||||
double value = ((DoubleData) data).generateNewValue();
|
||||
item.addItemTag(new ItemTag("MMOITEMS_MAX_DURABILITY", value), new ItemTag("MMOITEMS_DURABILITY", value));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse(RPGPlayer player, NBTItem item, boolean message) {
|
||||
if (item.hasTag("MMOITEMS_DURABILITY") && item.getDouble("MMOITEMS_DURABILITY") < 1) {
|
||||
if (item.hasTag("MMOITEMS_DURABILITY") && item.getDouble("MMOITEMS_DURABILITY") <= 0) {
|
||||
if (message) {
|
||||
Message.ZERO_DURABILITY.format(ChatColor.RED).send(player.getPlayer(), "cant-use-item");
|
||||
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
|
@ -4,5 +4,11 @@ import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public interface Conditional {
|
||||
|
||||
/*
|
||||
* conditional stats are used to let extra plugins implement extra item
|
||||
* restrictions to MMOItems easily. if the method returns false, the item
|
||||
* cannot be used by the player.
|
||||
*/
|
||||
public boolean canUse(RPGPlayer player, NBTItem item, boolean message);
|
||||
}
|
||||
|
@ -44,11 +44,12 @@ import net.Indyuce.mmoitems.stat.Item_Tier;
|
||||
import net.Indyuce.mmoitems.stat.Item_Type_Restriction;
|
||||
import net.Indyuce.mmoitems.stat.Knockback_Resistance;
|
||||
import net.Indyuce.mmoitems.stat.Lore;
|
||||
import net.Indyuce.mmoitems.stat.Lost_when_Broken;
|
||||
import net.Indyuce.mmoitems.stat.Lute_Attack_Effect;
|
||||
import net.Indyuce.mmoitems.stat.Lute_Attack_Sound;
|
||||
import net.Indyuce.mmoitems.stat.MaterialStat;
|
||||
import net.Indyuce.mmoitems.stat.Max_Custom_Durability;
|
||||
import net.Indyuce.mmoitems.stat.Max_Health;
|
||||
import net.Indyuce.mmoitems.stat.Maximum_Durability;
|
||||
import net.Indyuce.mmoitems.stat.Movement_Speed;
|
||||
import net.Indyuce.mmoitems.stat.NBT_Tags;
|
||||
import net.Indyuce.mmoitems.stat.Perm_Effects;
|
||||
@ -67,7 +68,6 @@ import net.Indyuce.mmoitems.stat.Staff_Spirit;
|
||||
import net.Indyuce.mmoitems.stat.Unbreakable;
|
||||
import net.Indyuce.mmoitems.stat.Upgrade_Stat;
|
||||
import net.Indyuce.mmoitems.stat.Vanilla_Eating_Animation;
|
||||
import net.Indyuce.mmoitems.stat.Will_Break;
|
||||
import net.Indyuce.mmoitems.stat.data.StatData;
|
||||
import net.Indyuce.mmoitems.version.durability.stat.DefaultDurability;
|
||||
import net.Indyuce.mmoitems.version.durability.stat.LegacyDurability;
|
||||
@ -76,8 +76,9 @@ import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public abstract class ItemStat {
|
||||
public static final ItemStat MATERIAL = new MaterialStat(), DURABILITY = MMOLib.plugin.getVersion().isBelowOrEqual(1, 12) ? new LegacyDurability() : new DefaultDurability(), CUSTOM_MODEL_DATA = new Custom_Model_Data(), MAX_CUSTOM_DURABILITY = new Max_Custom_Durability(), WILL_BREAK = new Will_Break();
|
||||
public static final ItemStat MATERIAL = new MaterialStat(), DURABILITY = MMOLib.plugin.getVersion().isBelowOrEqual(1, 12) ? new LegacyDurability() : new DefaultDurability(), CUSTOM_MODEL_DATA = new Custom_Model_Data(), MAX_CUSTOM_DURABILITY = new Maximum_Durability(), WILL_BREAK = new Lost_when_Broken();
|
||||
public static final ItemStat NAME = new Display_Name(), LORE = new Lore(), NBT_TAGS = new NBT_Tags();
|
||||
|
||||
public static final ItemStat DISPLAYED_TYPE = new StringStat(new ItemStack(VersionMaterial.OAK_SIGN.toMaterial()), "Displayed Type", new String[] { "This option will only affect the", "type displayed on the item lore." }, "displayed-type", new String[] { "all" });
|
||||
public static final ItemStat ENCHANTS = new Enchants(), HIDE_ENCHANTS = new Hide_Enchants(), PERMISSION = new Permission(), ITEM_PARTICLES = new Item_Particles(), ARROW_PARTICLES = new Arrow_Particles();
|
||||
public static final ItemStat DISABLE_INTERACTION = new DisableStat(VersionMaterial.GRASS_BLOCK.toMaterial(), "interaction", "Disable Interaction", "Disable any unwanted interaction:", "block placement, item use...");
|
||||
|
@ -13,7 +13,7 @@ import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class DefaultDurability extends DoubleStat {
|
||||
public DefaultDurability() {
|
||||
super(new ItemStack(Material.FISHING_ROD), "Default Durability/ID", new String[] { "The durability of your item." }, "durability", new String[] { "all" });
|
||||
super(new ItemStack(Material.FISHING_ROD), "Item Damage", new String[] { "Default item damage. This does &cNOT", "impact the item's max durability." }, "durability", new String[] { "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,7 @@ import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class LegacyDurability extends DoubleStat {
|
||||
public LegacyDurability() {
|
||||
super(new ItemStack(Material.FISHING_ROD), "Default Durability/ID", new String[] { "The durability of your item." }, "durability", new String[] { "all" });
|
||||
super(new ItemStack(Material.FISHING_ROD), "Item Damage/ID", new String[] { "The durability/ID of your item. This", "does &cNOT&7 impact the item max durability." }, "durability", new String[] { "all" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,6 @@ lore-format:
|
||||
- '#required-dexterity#'
|
||||
- '#required-strength#'
|
||||
- '#required-intelligence#'
|
||||
- '#durability-state#'
|
||||
- '#success-rate#'
|
||||
- '{bar}'
|
||||
- '#soulbound#'
|
||||
|
@ -1,4 +0,0 @@
|
||||
ingredients:
|
||||
mmoitem:
|
||||
positive:
|
||||
negative:
|
@ -1,54 +0,0 @@
|
||||
# For every durability state, please specify the minimum durability in
|
||||
# percents the item needs to have in order to be on that state, and
|
||||
# the tag that will be displayed on the item when it is in that state.
|
||||
|
||||
10:
|
||||
use-ratio:
|
||||
max: 100
|
||||
min: 90
|
||||
lore-tag: '&7Durability: &a■■■■■■■■■■'
|
||||
9:
|
||||
use-ratio:
|
||||
max: 90
|
||||
min: 80
|
||||
lore-tag: '&7Durability: &a■■■■■■■■■&f■'
|
||||
8:
|
||||
use-ratio:
|
||||
max: 80
|
||||
min: 70
|
||||
lore-tag: '&7Durability: &a■■■■■■■■&f■■'
|
||||
7:
|
||||
use-ratio:
|
||||
max: 70
|
||||
min: 60
|
||||
lore-tag: '&7Durability: &a■■■■■■■&f■■■'
|
||||
6:
|
||||
use-ratio:
|
||||
max: 60
|
||||
min: 50
|
||||
lore-tag: '&7Durability: &a■■■■■■&f■■■■'
|
||||
5:
|
||||
use-ratio:
|
||||
max: 50
|
||||
min: 40
|
||||
lore-tag: '&7Durability: &e■■■■■&f■■■■■'
|
||||
4:
|
||||
use-ratio:
|
||||
max: 40
|
||||
min: 30
|
||||
lore-tag: '&7Durability: &e■■■&f■■■■■■■'
|
||||
3:
|
||||
use-ratio:
|
||||
max: 30
|
||||
min: 20
|
||||
lore-tag: '&7Durability: &c■■&f■■■■■■■■'
|
||||
2:
|
||||
use-ratio:
|
||||
max: 20
|
||||
min: 10
|
||||
lore-tag: '&7Durability: &c■&f■■■■■■■■■'
|
||||
1:
|
||||
use-ratio:
|
||||
max: 10
|
||||
min: 0
|
||||
lore-tag: '&7Durability: &f■■■■■■■■■■'
|
@ -1,126 +0,0 @@
|
||||
# This is the way stats are organized in the item lore.
|
||||
# You can remove or change line positions as much as you like to.
|
||||
# Make sure each line ONLY has the placeholder as text.
|
||||
#
|
||||
# The lines starting with {bar} are strips that will be
|
||||
# removed from the lore if there is nothing under it.
|
||||
# The lines starting with {sbar} will stay whatever is below them.
|
||||
|
||||
lore-format:
|
||||
# - '{bar}&8&m--------&f&l &nGeneral&8 &m--------------'
|
||||
- '#item-type#'
|
||||
- '{bar}'
|
||||
- '#required-class#'
|
||||
- '#required-level#'
|
||||
- '#required-dexterity#'
|
||||
- '#required-strength#'
|
||||
- '#required-intelligence#'
|
||||
- '#durability-state#'
|
||||
- '#success-rate#'
|
||||
- '{bar}'
|
||||
- '#soulbound#'
|
||||
# - '{bar}&8&m--------&f&l &nStatistics&8 &m-------------'
|
||||
- '{bar}'
|
||||
- '#can-identify#'
|
||||
- '#can-deconstruct#'
|
||||
- '#attack-damage#'
|
||||
- '#knockback#'
|
||||
- '#recoil#'
|
||||
- '#note-weight#'
|
||||
- '#attack-speed#'
|
||||
- '#arrow-velocity#'
|
||||
- '#critical-strike-chance#'
|
||||
- '#critical-strike-power#'
|
||||
- '#range#'
|
||||
- '#pvp-damage#'
|
||||
- '#pve-damage#'
|
||||
- '#blunt-power#'
|
||||
- '#blunt-rating#'
|
||||
- '#weapon-damage#'
|
||||
- '#magic-damage#'
|
||||
- '#skill-damage#'
|
||||
- '#physical-damage#'
|
||||
- '#projectile-damage#'
|
||||
- '#damage-reduction#'
|
||||
- '#fall-damage-reduction#'
|
||||
- '#fire-damage-reduction#'
|
||||
- '#magic-damage-reduction#'
|
||||
- '#projectile-damage-reduction#'
|
||||
- '#physical-damage-reduction#'
|
||||
- '#undead-damage#'
|
||||
- '#regeneration#'
|
||||
- '#block-power#'
|
||||
- '#block-rating#'
|
||||
- '#dodge-rating#'
|
||||
- '#parry-rating#'
|
||||
- '#block-cooldown-reduction#'
|
||||
- '#dodge-cooldown-reduction#'
|
||||
- '#parry-cooldown-reduction#'
|
||||
- '#armor#'
|
||||
- '#armor-toughness#'
|
||||
- '#knockback-resistance#'
|
||||
- '#max-health#'
|
||||
- '#max-mana#'
|
||||
- '#mana-regeneration#'
|
||||
- '#max-stamina#'
|
||||
- '#stamina-regeneration#'
|
||||
- '#movement-speed#'
|
||||
- '#staff-spirit#'
|
||||
- '#lute-attack-effect#'
|
||||
- '#two-handed#'
|
||||
- '#autosmelt#'
|
||||
- '#bouncing-crack#'
|
||||
- '#pickaxe-power#'
|
||||
- '#restore-health#'
|
||||
- '#restore-food#'
|
||||
- '#restore-saturation#'
|
||||
- '#restore-mana#'
|
||||
- '#restore-stamina#'
|
||||
- '#soulbinding-chance#'
|
||||
- '#soulbound-break-chance#'
|
||||
- '#soulbound-level#'
|
||||
- '#repair#'
|
||||
- '#item-cooldown#'
|
||||
- '#additional-experience#'
|
||||
- '#skill-cooldown-reduction#'
|
||||
- '#mana-cost#'
|
||||
- '#stamina-cost#'
|
||||
# - '{bar}&8&m--------&2&l &nElements&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#fire-damage#'
|
||||
- '#fire-defense#'
|
||||
- '#ice-damage#'
|
||||
- '#ice-defense#'
|
||||
- '#wind-damage#'
|
||||
- '#wind-defense#'
|
||||
- '#earth-damage#'
|
||||
- '#earth-defense#'
|
||||
- '#thunder-damage#'
|
||||
- '#thunder-defense#'
|
||||
- '#water-damage#'
|
||||
- '#water-defense#'
|
||||
- '#light-damage#'
|
||||
- '#light-defense#'
|
||||
- '#darkness-damage#'
|
||||
- '#darkness-defense#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
- '{bar}'
|
||||
- '#effects#'
|
||||
# - '{bar}&8&m--------&b&l &nAbilities&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#abilities#'
|
||||
- '{bar}'
|
||||
- '#commands#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
# - '#perm-effects#'
|
||||
# - '{bar}&8&m--------&e&l &nGem Stones&8 &m-----------'
|
||||
- '{bar}'
|
||||
- '#gem-stones#'
|
||||
# - '{sbar}&8&m--------------------------------'
|
||||
- '{bar}'
|
||||
- '#lore#'
|
||||
- '#gem-stone-lore#'
|
||||
- '{bar}'
|
||||
- '#set#'
|
||||
- '{bar}'
|
||||
- '#tier#'
|
@ -1,126 +0,0 @@
|
||||
# This is the way stats are organized in the item lore.
|
||||
# You can remove or change line positions as much as you like to.
|
||||
# Make sure each line ONLY has the placeholder as text.
|
||||
#
|
||||
# The lines starting with {bar} are strips that will be
|
||||
# removed from the lore if there is nothing under it.
|
||||
# The lines starting with {sbar} will stay whatever is below them.
|
||||
|
||||
lore-format:
|
||||
# - '{bar}&8&m--------&f&l &nGeneral&8 &m--------------'
|
||||
- '#item-type#'
|
||||
- '{bar}'
|
||||
- '#required-class#'
|
||||
- '#required-level#'
|
||||
- '#required-dexterity#'
|
||||
- '#required-strength#'
|
||||
- '#required-intelligence#'
|
||||
- '#durability-state#'
|
||||
- '#success-rate#'
|
||||
- '{bar}'
|
||||
- '#soulbound#'
|
||||
# - '{bar}&8&m--------&f&l &nStatistics&8 &m-------------'
|
||||
- '{bar}'
|
||||
- '#can-identify#'
|
||||
- '#can-deconstruct#'
|
||||
- '#attack-damage#'
|
||||
- '#knockback#'
|
||||
- '#recoil#'
|
||||
- '#note-weight#'
|
||||
- '#attack-speed#'
|
||||
- '#arrow-velocity#'
|
||||
- '#critical-strike-chance#'
|
||||
- '#critical-strike-power#'
|
||||
- '#range#'
|
||||
- '#pvp-damage#'
|
||||
- '#pve-damage#'
|
||||
- '#blunt-power#'
|
||||
- '#blunt-rating#'
|
||||
- '#weapon-damage#'
|
||||
- '#magic-damage#'
|
||||
- '#skill-damage#'
|
||||
- '#physical-damage#'
|
||||
- '#projectile-damage#'
|
||||
- '#damage-reduction#'
|
||||
- '#fall-damage-reduction#'
|
||||
- '#fire-damage-reduction#'
|
||||
- '#magic-damage-reduction#'
|
||||
- '#projectile-damage-reduction#'
|
||||
- '#physical-damage-reduction#'
|
||||
- '#undead-damage#'
|
||||
- '#regeneration#'
|
||||
- '#block-power#'
|
||||
- '#block-rating#'
|
||||
- '#dodge-rating#'
|
||||
- '#parry-rating#'
|
||||
- '#block-cooldown-reduction#'
|
||||
- '#dodge-cooldown-reduction#'
|
||||
- '#parry-cooldown-reduction#'
|
||||
- '#armor#'
|
||||
- '#armor-toughness#'
|
||||
- '#knockback-resistance#'
|
||||
- '#max-health#'
|
||||
- '#max-mana#'
|
||||
- '#mana-regeneration#'
|
||||
- '#max-stamina#'
|
||||
- '#stamina-regeneration#'
|
||||
- '#movement-speed#'
|
||||
- '#staff-spirit#'
|
||||
- '#lute-attack-effect#'
|
||||
- '#two-handed#'
|
||||
- '#autosmelt#'
|
||||
- '#bouncing-crack#'
|
||||
- '#pickaxe-power#'
|
||||
- '#restore-health#'
|
||||
- '#restore-food#'
|
||||
- '#restore-saturation#'
|
||||
- '#restore-mana#'
|
||||
- '#restore-stamina#'
|
||||
- '#soulbinding-chance#'
|
||||
- '#soulbound-break-chance#'
|
||||
- '#soulbound-level#'
|
||||
- '#repair#'
|
||||
- '#item-cooldown#'
|
||||
- '#additional-experience#'
|
||||
- '#skill-cooldown-reduction#'
|
||||
- '#mana-cost#'
|
||||
- '#stamina-cost#'
|
||||
# - '{bar}&8&m--------&2&l &nElements&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#fire-damage#'
|
||||
- '#fire-defense#'
|
||||
- '#ice-damage#'
|
||||
- '#ice-defense#'
|
||||
- '#wind-damage#'
|
||||
- '#wind-defense#'
|
||||
- '#earth-damage#'
|
||||
- '#earth-defense#'
|
||||
- '#thunder-damage#'
|
||||
- '#thunder-defense#'
|
||||
- '#water-damage#'
|
||||
- '#water-defense#'
|
||||
- '#light-damage#'
|
||||
- '#light-defense#'
|
||||
- '#darkness-damage#'
|
||||
- '#darkness-defense#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
- '{bar}'
|
||||
- '#effects#'
|
||||
# - '{bar}&8&m--------&b&l &nAbilities&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#abilities#'
|
||||
- '{bar}'
|
||||
- '#commands#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
# - '#perm-effects#'
|
||||
# - '{bar}&8&m--------&e&l &nGem Stones&8 &m-----------'
|
||||
- '{bar}'
|
||||
- '#gem-stones#'
|
||||
# - '{sbar}&8&m--------------------------------'
|
||||
- '{bar}'
|
||||
- '#lore#'
|
||||
- '#gem-stone-lore#'
|
||||
- '{bar}'
|
||||
- '#set#'
|
||||
- '{bar}'
|
||||
- '#tier#'
|
@ -1,126 +0,0 @@
|
||||
# This is the way stats are organized in the item lore.
|
||||
# You can remove or change line positions as much as you like to.
|
||||
# Make sure each line ONLY has the placeholder as text.
|
||||
#
|
||||
# The lines starting with {bar} are strips that will be
|
||||
# removed from the lore if there is nothing under it.
|
||||
# The lines starting with {sbar} will stay whatever is below them.
|
||||
|
||||
lore-format:
|
||||
# - '{bar}&8&m--------&f&l &nGeneral&8 &m--------------'
|
||||
- '#item-type#'
|
||||
- '{bar}'
|
||||
- '#required-class#'
|
||||
- '#required-level#'
|
||||
- '#required-dexterity#'
|
||||
- '#required-strength#'
|
||||
- '#required-intelligence#'
|
||||
- '#durability-state#'
|
||||
- '#success-rate#'
|
||||
- '{bar}'
|
||||
- '#soulbound#'
|
||||
# - '{bar}&8&m--------&f&l &nStatistics&8 &m-------------'
|
||||
- '{bar}'
|
||||
- '#can-identify#'
|
||||
- '#can-deconstruct#'
|
||||
- '#attack-damage#'
|
||||
- '#knockback#'
|
||||
- '#recoil#'
|
||||
- '#note-weight#'
|
||||
- '#attack-speed#'
|
||||
- '#arrow-velocity#'
|
||||
- '#critical-strike-chance#'
|
||||
- '#critical-strike-power#'
|
||||
- '#range#'
|
||||
- '#pvp-damage#'
|
||||
- '#pve-damage#'
|
||||
- '#blunt-power#'
|
||||
- '#blunt-rating#'
|
||||
- '#weapon-damage#'
|
||||
- '#magic-damage#'
|
||||
- '#skill-damage#'
|
||||
- '#physical-damage#'
|
||||
- '#projectile-damage#'
|
||||
- '#damage-reduction#'
|
||||
- '#fall-damage-reduction#'
|
||||
- '#fire-damage-reduction#'
|
||||
- '#magic-damage-reduction#'
|
||||
- '#projectile-damage-reduction#'
|
||||
- '#physical-damage-reduction#'
|
||||
- '#undead-damage#'
|
||||
- '#regeneration#'
|
||||
- '#block-power#'
|
||||
- '#block-rating#'
|
||||
- '#dodge-rating#'
|
||||
- '#parry-rating#'
|
||||
- '#block-cooldown-reduction#'
|
||||
- '#dodge-cooldown-reduction#'
|
||||
- '#parry-cooldown-reduction#'
|
||||
- '#armor#'
|
||||
- '#armor-toughness#'
|
||||
- '#knockback-resistance#'
|
||||
- '#max-health#'
|
||||
- '#max-mana#'
|
||||
- '#mana-regeneration#'
|
||||
- '#max-stamina#'
|
||||
- '#stamina-regeneration#'
|
||||
- '#movement-speed#'
|
||||
- '#staff-spirit#'
|
||||
- '#lute-attack-effect#'
|
||||
- '#two-handed#'
|
||||
- '#autosmelt#'
|
||||
- '#bouncing-crack#'
|
||||
- '#pickaxe-power#'
|
||||
- '#restore-health#'
|
||||
- '#restore-food#'
|
||||
- '#restore-saturation#'
|
||||
- '#restore-mana#'
|
||||
- '#restore-stamina#'
|
||||
- '#soulbinding-chance#'
|
||||
- '#soulbound-break-chance#'
|
||||
- '#soulbound-level#'
|
||||
- '#repair#'
|
||||
- '#item-cooldown#'
|
||||
- '#additional-experience#'
|
||||
- '#skill-cooldown-reduction#'
|
||||
- '#mana-cost#'
|
||||
- '#stamina-cost#'
|
||||
# - '{bar}&8&m--------&2&l &nElements&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#fire-damage#'
|
||||
- '#fire-defense#'
|
||||
- '#ice-damage#'
|
||||
- '#ice-defense#'
|
||||
- '#wind-damage#'
|
||||
- '#wind-defense#'
|
||||
- '#earth-damage#'
|
||||
- '#earth-defense#'
|
||||
- '#thunder-damage#'
|
||||
- '#thunder-defense#'
|
||||
- '#water-damage#'
|
||||
- '#water-defense#'
|
||||
- '#light-damage#'
|
||||
- '#light-defense#'
|
||||
- '#darkness-damage#'
|
||||
- '#darkness-defense#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
- '{bar}'
|
||||
- '#effects#'
|
||||
# - '{bar}&8&m--------&b&l &nAbilities&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#abilities#'
|
||||
- '{bar}'
|
||||
- '#commands#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
# - '#perm-effects#'
|
||||
# - '{bar}&8&m--------&e&l &nGem Stones&8 &m-----------'
|
||||
- '{bar}'
|
||||
- '#gem-stones#'
|
||||
# - '{sbar}&8&m--------------------------------'
|
||||
- '{bar}'
|
||||
- '#lore#'
|
||||
- '#gem-stone-lore#'
|
||||
- '{bar}'
|
||||
- '#set#'
|
||||
- '{bar}'
|
||||
- '#tier#'
|
@ -1,126 +0,0 @@
|
||||
# This is the way stats are organized in the item lore.
|
||||
# You can remove or change line positions as much as you like to.
|
||||
# Make sure each line ONLY has the placeholder as text.
|
||||
#
|
||||
# The lines starting with {bar} are strips that will be
|
||||
# removed from the lore if there is nothing under it.
|
||||
# The lines starting with {sbar} will stay whatever is below them.
|
||||
|
||||
lore-format:
|
||||
# - '{bar}&8&m--------&f&l &nGeneral&8 &m--------------'
|
||||
- '#item-type#'
|
||||
- '{bar}'
|
||||
- '#required-class#'
|
||||
- '#required-level#'
|
||||
- '#required-dexterity#'
|
||||
- '#required-strength#'
|
||||
- '#required-intelligence#'
|
||||
- '#durability-state#'
|
||||
- '#success-rate#'
|
||||
- '{bar}'
|
||||
- '#soulbound#'
|
||||
# - '{bar}&8&m--------&f&l &nStatistics&8 &m-------------'
|
||||
- '{bar}'
|
||||
- '#can-identify#'
|
||||
- '#can-deconstruct#'
|
||||
- '#attack-damage#'
|
||||
- '#knockback#'
|
||||
- '#recoil#'
|
||||
- '#note-weight#'
|
||||
- '#attack-speed#'
|
||||
- '#arrow-velocity#'
|
||||
- '#critical-strike-chance#'
|
||||
- '#critical-strike-power#'
|
||||
- '#range#'
|
||||
- '#pvp-damage#'
|
||||
- '#pve-damage#'
|
||||
- '#blunt-power#'
|
||||
- '#blunt-rating#'
|
||||
- '#weapon-damage#'
|
||||
- '#magic-damage#'
|
||||
- '#skill-damage#'
|
||||
- '#physical-damage#'
|
||||
- '#projectile-damage#'
|
||||
- '#damage-reduction#'
|
||||
- '#fall-damage-reduction#'
|
||||
- '#fire-damage-reduction#'
|
||||
- '#magic-damage-reduction#'
|
||||
- '#projectile-damage-reduction#'
|
||||
- '#physical-damage-reduction#'
|
||||
- '#undead-damage#'
|
||||
- '#regeneration#'
|
||||
- '#block-power#'
|
||||
- '#block-rating#'
|
||||
- '#dodge-rating#'
|
||||
- '#parry-rating#'
|
||||
- '#block-cooldown-reduction#'
|
||||
- '#dodge-cooldown-reduction#'
|
||||
- '#parry-cooldown-reduction#'
|
||||
- '#armor#'
|
||||
- '#armor-toughness#'
|
||||
- '#knockback-resistance#'
|
||||
- '#max-health#'
|
||||
- '#max-mana#'
|
||||
- '#mana-regeneration#'
|
||||
- '#max-stamina#'
|
||||
- '#stamina-regeneration#'
|
||||
- '#movement-speed#'
|
||||
- '#staff-spirit#'
|
||||
- '#lute-attack-effect#'
|
||||
- '#two-handed#'
|
||||
- '#autosmelt#'
|
||||
- '#bouncing-crack#'
|
||||
- '#pickaxe-power#'
|
||||
- '#restore-health#'
|
||||
- '#restore-food#'
|
||||
- '#restore-saturation#'
|
||||
- '#restore-mana#'
|
||||
- '#restore-stamina#'
|
||||
- '#soulbinding-chance#'
|
||||
- '#soulbound-break-chance#'
|
||||
- '#soulbound-level#'
|
||||
- '#repair#'
|
||||
- '#item-cooldown#'
|
||||
- '#additional-experience#'
|
||||
- '#skill-cooldown-reduction#'
|
||||
- '#mana-cost#'
|
||||
- '#stamina-cost#'
|
||||
# - '{bar}&8&m--------&2&l &nElements&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#fire-damage#'
|
||||
- '#fire-defense#'
|
||||
- '#ice-damage#'
|
||||
- '#ice-defense#'
|
||||
- '#wind-damage#'
|
||||
- '#wind-defense#'
|
||||
- '#earth-damage#'
|
||||
- '#earth-defense#'
|
||||
- '#thunder-damage#'
|
||||
- '#thunder-defense#'
|
||||
- '#water-damage#'
|
||||
- '#water-defense#'
|
||||
- '#light-damage#'
|
||||
- '#light-defense#'
|
||||
- '#darkness-damage#'
|
||||
- '#darkness-defense#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
- '{bar}'
|
||||
- '#effects#'
|
||||
# - '{bar}&8&m--------&b&l &nAbilities&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#abilities#'
|
||||
- '{bar}'
|
||||
- '#commands#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
# - '#perm-effects#'
|
||||
# - '{bar}&8&m--------&e&l &nGem Stones&8 &m-----------'
|
||||
- '{bar}'
|
||||
- '#gem-stones#'
|
||||
# - '{sbar}&8&m--------------------------------'
|
||||
- '{bar}'
|
||||
- '#lore#'
|
||||
- '#gem-stone-lore#'
|
||||
- '{bar}'
|
||||
- '#set#'
|
||||
- '{bar}'
|
||||
- '#tier#'
|
@ -1,126 +0,0 @@
|
||||
# This is the way stats are organized in the item lore.
|
||||
# You can remove or change line positions as much as you like to.
|
||||
# Make sure each line ONLY has the placeholder as text.
|
||||
#
|
||||
# The lines starting with {bar} are strips that will be
|
||||
# removed from the lore if there is nothing under it.
|
||||
# The lines starting with {sbar} will stay whatever is below them.
|
||||
|
||||
lore-format:
|
||||
# - '{bar}&8&m--------&f&l &nGeneral&8 &m--------------'
|
||||
- '#item-type#'
|
||||
- '{bar}'
|
||||
- '#required-class#'
|
||||
- '#required-level#'
|
||||
- '#required-dexterity#'
|
||||
- '#required-strength#'
|
||||
- '#required-intelligence#'
|
||||
- '#durability-state#'
|
||||
- '#success-rate#'
|
||||
- '{bar}'
|
||||
- '#soulbound#'
|
||||
# - '{bar}&8&m--------&f&l &nStatistics&8 &m-------------'
|
||||
- '{bar}'
|
||||
- '#can-identify#'
|
||||
- '#can-deconstruct#'
|
||||
- '#attack-damage#'
|
||||
- '#knockback#'
|
||||
- '#recoil#'
|
||||
- '#note-weight#'
|
||||
- '#attack-speed#'
|
||||
- '#arrow-velocity#'
|
||||
- '#critical-strike-chance#'
|
||||
- '#critical-strike-power#'
|
||||
- '#range#'
|
||||
- '#pvp-damage#'
|
||||
- '#pve-damage#'
|
||||
- '#blunt-power#'
|
||||
- '#blunt-rating#'
|
||||
- '#weapon-damage#'
|
||||
- '#magic-damage#'
|
||||
- '#skill-damage#'
|
||||
- '#physical-damage#'
|
||||
- '#projectile-damage#'
|
||||
- '#damage-reduction#'
|
||||
- '#fall-damage-reduction#'
|
||||
- '#fire-damage-reduction#'
|
||||
- '#magic-damage-reduction#'
|
||||
- '#projectile-damage-reduction#'
|
||||
- '#physical-damage-reduction#'
|
||||
- '#undead-damage#'
|
||||
- '#regeneration#'
|
||||
- '#block-power#'
|
||||
- '#block-rating#'
|
||||
- '#dodge-rating#'
|
||||
- '#parry-rating#'
|
||||
- '#block-cooldown-reduction#'
|
||||
- '#dodge-cooldown-reduction#'
|
||||
- '#parry-cooldown-reduction#'
|
||||
- '#armor#'
|
||||
- '#armor-toughness#'
|
||||
- '#knockback-resistance#'
|
||||
- '#max-health#'
|
||||
- '#max-mana#'
|
||||
- '#mana-regeneration#'
|
||||
- '#max-stamina#'
|
||||
- '#stamina-regeneration#'
|
||||
- '#movement-speed#'
|
||||
- '#staff-spirit#'
|
||||
- '#lute-attack-effect#'
|
||||
- '#two-handed#'
|
||||
- '#autosmelt#'
|
||||
- '#bouncing-crack#'
|
||||
- '#pickaxe-power#'
|
||||
- '#restore-health#'
|
||||
- '#restore-food#'
|
||||
- '#restore-saturation#'
|
||||
- '#restore-mana#'
|
||||
- '#restore-stamina#'
|
||||
- '#soulbinding-chance#'
|
||||
- '#soulbound-break-chance#'
|
||||
- '#soulbound-level#'
|
||||
- '#repair#'
|
||||
- '#item-cooldown#'
|
||||
- '#additional-experience#'
|
||||
- '#skill-cooldown-reduction#'
|
||||
- '#mana-cost#'
|
||||
- '#stamina-cost#'
|
||||
# - '{bar}&8&m--------&2&l &nElements&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#fire-damage#'
|
||||
- '#fire-defense#'
|
||||
- '#ice-damage#'
|
||||
- '#ice-defense#'
|
||||
- '#wind-damage#'
|
||||
- '#wind-defense#'
|
||||
- '#earth-damage#'
|
||||
- '#earth-defense#'
|
||||
- '#thunder-damage#'
|
||||
- '#thunder-defense#'
|
||||
- '#water-damage#'
|
||||
- '#water-defense#'
|
||||
- '#light-damage#'
|
||||
- '#light-defense#'
|
||||
- '#darkness-damage#'
|
||||
- '#darkness-defense#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
- '{bar}'
|
||||
- '#effects#'
|
||||
# - '{bar}&8&m--------&b&l &nAbilities&8 &m--------------'
|
||||
- '{bar}'
|
||||
- '#abilities#'
|
||||
- '{bar}'
|
||||
- '#commands#'
|
||||
# - '{bar}&8&m--------&b&l &nEffects&8 &m---------------'
|
||||
# - '#perm-effects#'
|
||||
# - '{bar}&8&m--------&e&l &nGem Stones&8 &m-----------'
|
||||
- '{bar}'
|
||||
- '#gem-stones#'
|
||||
# - '{sbar}&8&m--------------------------------'
|
||||
- '{bar}'
|
||||
- '#lore#'
|
||||
- '#gem-stone-lore#'
|
||||
- '{bar}'
|
||||
- '#set#'
|
||||
- '{bar}'
|
||||
- '#tier#'
|
Loading…
Reference in New Issue
Block a user