mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-28 00:55:29 +01:00
custom durability bug from ticket 410 fix?
This commit is contained in:
parent
ba1ceb957e
commit
414cb0abd4
@ -1,11 +1,9 @@
|
|||||||
package net.Indyuce.mmocore.api.util;
|
package net.Indyuce.mmocore.api.util;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import io.lumine.mythic.lib.MythicLib;
|
||||||
import java.io.ByteArrayOutputStream;
|
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||||
import java.util.ArrayList;
|
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||||
import java.util.Arrays;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -25,10 +23,11 @@ import org.bukkit.util.io.BukkitObjectInputStream;
|
|||||||
import org.bukkit.util.io.BukkitObjectOutputStream;
|
import org.bukkit.util.io.BukkitObjectOutputStream;
|
||||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import java.io.ByteArrayInputStream;
|
||||||
import io.lumine.mythic.lib.MythicLib;
|
import java.io.ByteArrayOutputStream;
|
||||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
import java.util.ArrayList;
|
||||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MMOCoreUtils {
|
public class MMOCoreUtils {
|
||||||
public static boolean pluginItem(ItemStack item) {
|
public static boolean pluginItem(ItemStack item) {
|
||||||
@ -211,13 +210,18 @@ public class MMOCoreUtils {
|
|||||||
*/
|
*/
|
||||||
public static void decreaseDurability(Player player, EquipmentSlot slot, int damage) {
|
public static void decreaseDurability(Player player, EquipmentSlot slot, int damage) {
|
||||||
ItemStack item = player.getInventory().getItem(slot);
|
ItemStack item = player.getInventory().getItem(slot);
|
||||||
|
NBTItem nbt = NBTItem.get(item);
|
||||||
|
|
||||||
|
if(!nbt.hasTag("MMOITEMS_MAX_DURABILITY")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PlayerItemDamageEvent event = new PlayerItemDamageEvent(player, item, damage);
|
PlayerItemDamageEvent event = new PlayerItemDamageEvent(player, item, damage);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NBTItem nbt = NBTItem.get(item);
|
|
||||||
if (!nbt.getBoolean("Unbreakable") && item.getItemMeta() instanceof Damageable) {
|
if (!nbt.getBoolean("Unbreakable") && item.getItemMeta() instanceof Damageable) {
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
((Damageable) meta).setDamage(((Damageable) meta).getDamage() + damage);
|
((Damageable) meta).setDamage(((Damageable) meta).getDamage() + damage);
|
||||||
|
@ -24,7 +24,7 @@ public class MythicMobSkill extends Skill {
|
|||||||
private final io.lumine.xikage.mythicmobs.skills.Skill skill;
|
private final io.lumine.xikage.mythicmobs.skills.Skill skill;
|
||||||
private final Map<CheatType, Integer> antiCheat = new HashMap<>();
|
private final Map<CheatType, Integer> antiCheat = new HashMap<>();
|
||||||
|
|
||||||
// private final BiFunction<PlayerDataManager, SkillInfo, SkillResult> cast;
|
//private final BiFunction<PlayerDataManager, SkillInfo, SkillResult> cast;
|
||||||
|
|
||||||
public MythicMobSkill(String id, FileConfiguration config) {
|
public MythicMobSkill(String id, FileConfiguration config) {
|
||||||
super(id);
|
super(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user