Support for 1.21.3

This commit is contained in:
Jules 2024-12-04 23:48:03 +01:00
parent 1de6d16e12
commit c41bba598e
46 changed files with 315 additions and 273 deletions

View File

@ -101,7 +101,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version>
<version>1.21.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<optional>true</optional>

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmoitems.api.block;
import io.lumine.mythic.lib.version.VersionUtils;
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Material;
@ -90,8 +91,8 @@ public class WorldGenTemplate {
// check biome list
Biome biome = pos.getWorld().getBiome(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
if ((!biomeWhitelist.isEmpty() && !biomeWhitelist.contains(biome.name()))
|| (!biomeBlacklist.isEmpty() && biomeBlacklist.contains(biome.name())))
if ((!biomeWhitelist.isEmpty() && !biomeWhitelist.contains(VersionUtils.name(biome)))
|| (!biomeBlacklist.isEmpty() && biomeBlacklist.contains(VersionUtils.name(biome))))
return false;
// check extra options

View File

@ -1,7 +1,9 @@
package net.Indyuce.mmoitems.api.crafting;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.util.PostLoadAction;
import io.lumine.mythic.lib.util.PreloadedObject;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.crafting.ingredient.inventory.IngredientInventory;
import net.Indyuce.mmoitems.api.crafting.recipe.CheckedRecipe;
@ -55,7 +57,7 @@ public class CraftingStation implements PreloadedObject {
this.id = id.toLowerCase().replace("_", "-").replace(" ", "-");
this.name = config.getString("name", "A Station With No Name");
this.layout = MMOItems.plugin.getLayouts().getLayout(config.getString("layout", "default"));
this.sound = Sound.valueOf(config.getString("sound", "ENTITY_EXPERIENCE_ORB_PICKUP").toUpperCase());
this.sound = Sounds.fromName(UtilityMethods.enumName(config.getString("sound", "ENTITY_EXPERIENCE_ORB_PICKUP")));
for (String key : config.getConfigurationSection("recipes").getKeys(false))
try {

View File

@ -7,6 +7,7 @@ import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackCategory;
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackMessage;
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.crafting.ConfigMMOItem;
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
@ -22,7 +23,6 @@ import net.Indyuce.mmoitems.api.util.message.FFPMMOItems;
import net.Indyuce.mmoitems.api.util.message.Message;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@ -284,7 +284,7 @@ public class CraftingRecipe extends Recipe {
return false;
Message.CRAFTING_QUEUE_FULL.format(ChatColor.RED).send(data.getPlayer());
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
data.getPlayer().playSound(data.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1);
return false;
}
return true;

View File

@ -1,8 +1,8 @@
package net.Indyuce.mmoitems.api.crafting.recipe;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.util.MMOUtils;
import net.Indyuce.mmoitems.api.crafting.ConfigMMOItem;
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
import net.Indyuce.mmoitems.api.crafting.ingredient.CheckedIngredient;
@ -15,9 +15,9 @@ import net.Indyuce.mmoitems.api.item.util.ConfigItems;
import net.Indyuce.mmoitems.api.player.PlayerData;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.data.UpgradeData;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
@ -76,7 +76,7 @@ public class UpgradingRecipe extends Recipe {
return false;
Message.NOT_HAVE_ITEM_UPGRADE.format(ChatColor.RED).send(data.getPlayer());
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
data.getPlayer().playSound(data.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 2);
return false;
}
@ -94,7 +94,7 @@ public class UpgradingRecipe extends Recipe {
return false;
Message.MAX_UPGRADES_HIT.format(ChatColor.RED).send(data.getPlayer());
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
data.getPlayer().playSound(data.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 2);
return false;
}
@ -112,7 +112,7 @@ public class UpgradingRecipe extends Recipe {
return false;
Message.UPGRADE_FAIL_STATION.format(ChatColor.RED).send(data.getPlayer());
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 2);
data.getPlayer().playSound(data.getPlayer().getLocation(), Sounds.ENTITY_ITEM_BREAK, 1, 2);
return false;
}

View File

@ -1,7 +1,8 @@
package net.Indyuce.mmoitems.api.crafting.trigger;
import net.Indyuce.mmoitems.api.player.PlayerData;
import io.lumine.mythic.lib.api.MMOLineConfig;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.api.player.PlayerData;
import org.bukkit.Sound;
public class SoundTrigger extends Trigger {
@ -13,7 +14,7 @@ public class SoundTrigger extends Trigger {
config.validate("sound");
sound = Sound.valueOf(config.getString("sound").toUpperCase().replace("-", "_"));
sound = Sounds.fromName(config.getString("sound").toUpperCase().replace("-", "_"));
vol = (float) config.getDouble("volume", 1);
pitch = (float) config.getDouble("pitch", 1);
}

View File

@ -1,6 +1,7 @@
package net.Indyuce.mmoitems.api.interaction;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.api.Type;
import net.Indyuce.mmoitems.api.event.item.ApplyGemStoneEvent;
@ -20,7 +21,6 @@ import net.Indyuce.mmoitems.stat.type.StatHistory;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -81,7 +81,7 @@ public class GemStone extends UseItem {
// Return if gem stone application failure
if (called.getResult() == ResultType.FAILURE) {
if (!silent) {
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
player.playSound(player.getLocation(), Sounds.ENTITY_ITEM_BREAK, 1, 1);
Message.GEM_STONE_BROKE.format(ChatColor.RED, "#gem#", MMOUtils.getDisplayName(getItem()), "#item#", itemName).send(player);
}
@ -133,7 +133,7 @@ public class GemStone extends UseItem {
}
if (!silent) {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
Message.GEM_STONE_APPLIED.format(ChatColor.YELLOW, "#gem#", MMOUtils.getDisplayName(getItem()), "#item#", itemName).send(player);
}

View File

@ -3,6 +3,7 @@ package net.Indyuce.mmoitems.api.interaction;
import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.Type;
@ -14,7 +15,6 @@ import net.Indyuce.mmoitems.stat.data.StringListData;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
@ -38,7 +38,7 @@ public class ItemSkin extends UseItem {
return new ApplyResult(ResultType.NONE);
if (MMOItems.plugin.getConfig().getBoolean("locked-skins") && MMOUtils.isNonEmpty(target.getString(ItemSkin.SKIN_ID_TAG))) {
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1);
Message.SKIN_REJECTED.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem())).send(player);
return new ApplyResult(ResultType.NONE);
}
@ -50,7 +50,7 @@ public class ItemSkin extends UseItem {
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a77 Testing that TYPE is compatible: ");
final List<String> acceptedTypes = ((StringListData) mmoitem.getData(ItemStats.COMPATIBLE_TYPES)).getList();
if (acceptedTypes.size() > 0 && acceptedTypes.stream().noneMatch(s -> s.equalsIgnoreCase(targetType.getId()))) {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
Message.SKIN_INCOMPATIBLE.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem()))
.send(player);
return new ApplyResult(ResultType.NONE);
@ -65,7 +65,7 @@ public class ItemSkin extends UseItem {
if (acceptedIDs.size() > 0 && acceptedIDs.stream()
.noneMatch(s -> s.equalsIgnoreCase(targetId))) {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
Message.SKIN_INCOMPATIBLE.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem()))
.send(player);
return new ApplyResult(ResultType.NONE);
@ -79,7 +79,7 @@ public class ItemSkin extends UseItem {
if (acceptedMaterials.size() > 0 && acceptedMaterials.stream()
.noneMatch(s -> s.equalsIgnoreCase(target.getItem().getType().name()))) {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
Message.SKIN_INCOMPATIBLE.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem()))
.send(player);
return new ApplyResult(ResultType.NONE);
@ -90,7 +90,7 @@ public class ItemSkin extends UseItem {
double successRate = getNBTItem().getStat(ItemStats.SUCCESS_RATE.getId());
if (successRate != 0)
if (RANDOM.nextDouble() < 1 - successRate / 100) {
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
player.playSound(player.getLocation(), Sounds.ENTITY_ITEM_BREAK, 1, 1);
Message.SKIN_BROKE.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem()))
.send(player);
return new ApplyResult(ResultType.FAILURE);
@ -99,7 +99,7 @@ public class ItemSkin extends UseItem {
// Apply skin
ItemStack item = applySkin(target, mmoitem);
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
Message.SKIN_APPLIED.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(target.getItem())).send(player);
return new ApplyResult(item);

View File

@ -4,9 +4,8 @@ import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.comp.flags.CustomFlag;
import io.lumine.mythic.lib.math3.geometry.euclidean.threed.Line;
import io.lumine.mythic.lib.math3.geometry.euclidean.threed.Vector3D;
import io.lumine.mythic.lib.version.OreDrops;
import io.lumine.mythic.lib.version.Sounds;
import io.lumine.mythic.lib.version.VEnchantment;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.event.BouncingCrackBlockBreakEvent;
@ -16,7 +15,6 @@ import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
@ -64,8 +62,8 @@ public class Tool extends Weapon {
getPlayerData().applyCooldown(PlayerData.CooldownType.BOUNCING_CRACK, 1);
new BukkitRunnable() {
final Vector globalDirection = player.getEyeLocation().getDirection();
final Vector3D sourcePoint = toJava(block.getLocation().add(.5, .5, .5).toVector());
final Line line = new Line(sourcePoint, sourcePoint.add(toJava(globalDirection)), 1e-10);
final Vector point1 = block.getLocation().add(.5, .5, .5).toVector();
final Vector point2 = point1.clone().add(globalDirection);
final double[] products = new double[NEIGHBORS.length];
{
@ -93,7 +91,7 @@ public class Tool extends Weapon {
}
curr.breakNaturally(getItem());
curr.getWorld().playSound(curr.getLocation(), Sound.BLOCK_GRAVEL_BREAK, 1, 1);
curr.getWorld().playSound(curr.getLocation(), Sounds.BLOCK_GRAVEL_BREAK, 1, 1);
}
@NotNull
@ -115,8 +113,8 @@ public class Tool extends Weapon {
}
private double findCost(BlockFace candidate, Block candidateBlock) {
final Vector3D center = toJava(candidateBlock.getLocation().add(.5, .5, .5).toVector());
return line.distance(center) - products[candidate.ordinal()];
final Vector center = candidateBlock.getLocation().add(.5, .5, .5).toVector();
return dist(center, point1, point2) - products[candidate.ordinal()];
}
}.runTaskTimer(MMOItems.plugin, 0, 1);
@ -125,7 +123,14 @@ public class Tool extends Weapon {
return cancel;
}
private Vector3D toJava(Vector vector) {
return new Vector3D(vector.getX(), vector.getY(), vector.getZ());
/**
* d(A, BC) = norm(BA x BC) / norm(BC)
*
* @return Distance from point A to line (BC)
*/
private double dist(Vector a, Vector b, Vector c) {
final Vector ab = b.clone().subtract(a);
final Vector bc = c.clone().subtract(b);
return ab.getCrossProduct(bc).length() / bc.length();
}
}

View File

@ -6,6 +6,7 @@ import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
import io.lumine.mythic.lib.gson.JsonParser;
import io.lumine.mythic.lib.gson.JsonSyntaxException;
import io.lumine.mythic.lib.version.Sounds;
import io.lumine.mythic.lib.version.VEnchantment;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.api.event.item.CustomDurabilityDamage;
@ -19,7 +20,6 @@ import net.Indyuce.mmoitems.util.MMOUtils;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
@ -170,7 +170,7 @@ public class DurabilityItem {
// Play sound when item breaks
if (isBroken()) {
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
player.getWorld().playSound(player.getLocation(), Sounds.ENTITY_ITEM_BREAK, 1, 1);
PlayerData.get(player).getInventory().scheduleUpdate();
}

View File

@ -6,7 +6,7 @@ import io.lumine.mythic.lib.api.player.EquipmentSlot;
import io.lumine.mythic.lib.comp.interaction.InteractionType;
import io.lumine.mythic.lib.damage.DamageType;
import io.lumine.mythic.lib.player.PlayerMetadata;
import io.lumine.mythic.lib.version.VSound;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
import net.Indyuce.mmoitems.api.player.PlayerData;
@ -48,7 +48,7 @@ public class Lute extends Weapon implements LegacyWeapon {
final Vector weight = new Vector(0, -.003 * stats.getStat("NOTE_WEIGHT"), 0);
final @Nullable LuteAttackEffect effect = LuteAttackEffect.get(getNBTItem());
@Deprecated final SoundReader sound = new SoundReader(getNBTItem().getString("MMOITEMS_LUTE_ATTACK_SOUND"), VSound.BLOCK_NOTE_BLOCK_BELL.get());
@Deprecated final SoundReader sound = new SoundReader(getNBTItem().getString("MMOITEMS_LUTE_ATTACK_SOUND"), Sounds.BLOCK_NOTE_BLOCK_BELL);
final @NotNull ProjectileParticlesData projParticle = getNBTItem().hasTag("MMOITEMS_PROJECTILE_PARTICLES") ?
new ProjectileParticlesData(getNBTItem().getString("MMOITEMS_PROJECTILE_PARTICLES")) : ProjectileParticlesData.DEFAULT;

View File

@ -7,12 +7,12 @@ import io.lumine.mythic.lib.comp.interaction.InteractionType;
import io.lumine.mythic.lib.damage.DamageType;
import io.lumine.mythic.lib.player.PlayerMetadata;
import io.lumine.mythic.lib.util.RayTrace;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
import net.Indyuce.mmoitems.api.player.PlayerData;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@Deprecated
@ -52,6 +52,6 @@ public class Musket extends Weapon implements LegacyWeapon {
stats.attack(trace.getHit(), stats.getStat("ATTACK_DAMAGE"), DamageType.WEAPON, DamageType.PHYSICAL, DamageType.PROJECTILE);
trace.draw(.5, Color.BLACK);
getPlayer().getWorld().playSound(getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, 2);
getPlayer().getWorld().playSound(getPlayer().getLocation(), Sounds.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, 2);
}
}

View File

@ -5,6 +5,7 @@ import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.gson.JsonArray;
import io.lumine.mythic.lib.util.AdventureUtils;
import io.lumine.mythic.lib.version.Attributes;
import io.lumine.mythic.lib.version.VersionUtils;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
@ -21,7 +22,6 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.attribute.AttributeModifier.Operation;
import org.bukkit.inventory.ItemFlag;
@ -254,7 +254,7 @@ public class ItemStackBuilder {
* modifiers, this way armor gives no ARMOR or ARMOR TOUGHNESS to the holder.
* Since 4.7 attributes are handled via custom calculations
*/
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, FAKE_MODIFIER);
meta.addAttributeModifier(Attributes.ATTACK_SPEED, FAKE_MODIFIER);
item.setItemMeta(meta);

View File

@ -1,12 +1,12 @@
package net.Indyuce.mmoitems.api.player;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@ -113,7 +113,7 @@ public abstract class RPGPlayer {
if (item.hasTag("MMOITEMS_UNIDENTIFIED_ITEM")) {
if (message) {
Message.UNIDENTIFIED_ITEM.format(ChatColor.RED).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmoitems.api.util;
import io.lumine.mythic.lib.version.Sounds;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -22,7 +23,7 @@ public class SoundReader {
Sound sound;
String soundKey;
try {
sound = Sound.valueOf(tag);
sound = Sounds.fromName(tag);
soundKey = null;
} catch (Exception exception) {
sound = null;

View File

@ -1,17 +1,15 @@
package net.Indyuce.mmoitems.command.mmoitems.debug;
import java.text.DecimalFormat;
import java.util.Arrays;
import io.lumine.mythic.lib.command.api.CommandTreeNode;
import io.lumine.mythic.lib.command.api.Parameter;
import io.lumine.mythic.lib.version.Attributes;
import org.bukkit.ChatColor;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import io.lumine.mythic.lib.command.api.CommandTreeNode;
import io.lumine.mythic.lib.command.api.Parameter;
import java.text.DecimalFormat;
public class CheckAttributeCommandTreeNode extends CommandTreeNode {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.####");
@ -20,7 +18,7 @@ public class CheckAttributeCommandTreeNode extends CommandTreeNode {
super(parent, "checkattribute");
addParameter(
new Parameter("<attribute>", (explorer, list) -> Arrays.asList(Attribute.values()).forEach(attribute -> list.add(attribute.name()))));
new Parameter("<attribute>", (explorer, list) -> Attributes.getAll().forEach(attribute -> list.add(Attributes.name(attribute)))));
}
@Override
@ -35,7 +33,7 @@ public class CheckAttributeCommandTreeNode extends CommandTreeNode {
Player player = (Player) sender;
try {
AttributeInstance att = player.getAttribute(Attribute.valueOf(args[2].toUpperCase().replace("-", "_")));
AttributeInstance att = player.getAttribute(Attributes.fromName(args[2].toUpperCase().replace("-", "_")));
sender.sendMessage(ChatColor.DARK_GRAY + "" + ChatColor.STRIKETHROUGH + "--------------------------------------------------");
sender.sendMessage(ChatColor.AQUA + "Default Value = " + ChatColor.RESET + att.getDefaultValue());
sender.sendMessage(ChatColor.AQUA + "Base Value = " + ChatColor.RESET + att.getBaseValue());

View File

@ -1,14 +1,13 @@
package net.Indyuce.mmoitems.command.mmoitems.debug;
import io.lumine.mythic.lib.command.api.CommandTreeNode;
import io.lumine.mythic.lib.version.Attributes;
import io.lumine.mythic.lib.version.VPotionEffectType;
import org.bukkit.ChatColor;
import org.bukkit.attribute.Attribute;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import io.lumine.mythic.lib.command.api.CommandTreeNode;
public class HealCommandTreeNode extends CommandTreeNode {
public HealCommandTreeNode(CommandTreeNode parent) {
super(parent, "heal");
@ -22,7 +21,7 @@ public class HealCommandTreeNode extends CommandTreeNode {
}
Player player = (Player) sender;
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
player.setHealth(player.getAttribute(Attributes.MAX_HEALTH).getValue());
player.setFoodLevel(20);
player.setFireTicks(0);
player.setSaturation(12);

View File

@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.comp.mmocore.stat;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
import net.Indyuce.mmoitems.api.player.RPGPlayer;
@ -9,7 +10,6 @@ import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.type.RequiredLevelStat;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
public class RequiredAttribute extends RequiredLevelStat {
private final PlayerAttribute attribute;
@ -30,7 +30,7 @@ public class RequiredAttribute extends RequiredLevelStat {
if (message) {
Message.NOT_ENOUGH_ATTRIBUTE.format(ChatColor.RED, "#attribute#", attribute.getName()).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.comp.mmocore.stat;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmoitems.api.player.RPGPlayer;
@ -9,7 +10,6 @@ import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.type.RequiredLevelStat;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
public class RequiredProfession extends RequiredLevelStat {
private final Profession profession;
@ -30,7 +30,7 @@ public class RequiredProfession extends RequiredLevelStat {
if (message) {
Message.NOT_ENOUGH_PROFESSION.format(ChatColor.RED, "#profession#", profession.getName()).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -12,6 +12,7 @@ import dev.aurelium.auraskills.api.trait.Traits;
import dev.aurelium.auraskills.api.user.SkillsUser;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.player.EmptyRPGPlayer;
@ -24,7 +25,6 @@ import net.Indyuce.mmoitems.stat.type.RequiredLevelStat;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -169,7 +169,7 @@ public class AuraSkillsHook implements RPGHandler, Listener {
if (message) {
Message.NOT_ENOUGH_PROFESSION.format(ChatColor.RED, "#profession#", skill.getDisplayName(Locale.getDefault())).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -9,6 +9,7 @@ import com.archyx.aureliumskills.skills.Skills;
import com.archyx.aureliumskills.stats.Stats;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.player.EmptyRPGPlayer;
import net.Indyuce.mmoitems.api.player.PlayerData;
@ -17,7 +18,10 @@ import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.type.DoubleStat;
import net.Indyuce.mmoitems.stat.type.ItemStat;
import net.Indyuce.mmoitems.stat.type.RequiredLevelStat;
import org.bukkit.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -158,7 +162,7 @@ public class AureliumSkillsHook implements RPGHandler, Listener {
if (message) {
Message.NOT_ENOUGH_PROFESSION.format(ChatColor.RED, "#profession#", skill.getDisplayName(Locale.getDefault())).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -15,6 +15,7 @@ import io.lumine.mythic.lib.damage.AttackHandler;
import io.lumine.mythic.lib.damage.AttackMetadata;
import io.lumine.mythic.lib.damage.DamageMetadata;
import io.lumine.mythic.lib.damage.DamageType;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.api.player.PlayerData;
import net.Indyuce.mmoitems.api.player.RPGPlayer;
@ -26,7 +27,6 @@ import net.Indyuce.mmoitems.stat.type.RequiredLevelStat;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -171,7 +171,7 @@ public class HeroesHook implements RPGHandler, Listener, AttackHandler {
if (message) {
Message.NOT_ENOUGH_LEVELS.format(ChatColor.RED).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -3,6 +3,7 @@ package net.Indyuce.mmoitems.gui;
import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.util.SmartGive;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.CustomSound;
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
@ -23,7 +24,6 @@ import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
@ -246,13 +246,13 @@ public class CraftingStationView extends PluginInventory {
public void processRecipe(CheckedRecipe recipe) {
if (!recipe.areConditionsMet()) {
Message.CONDITIONS_NOT_MET.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1);
return;
}
if (!recipe.allIngredientsHad()) {
Message.NOT_ENOUGH_MATERIALS.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1);
return;
}

View File

@ -5,6 +5,7 @@ import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.util.AltChar;
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
import io.lumine.mythic.lib.util.AdventureUtils;
import io.lumine.mythic.lib.version.Sounds;
import io.lumine.mythic.lib.version.VersionUtils;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.Type;
@ -13,8 +14,10 @@ import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
import net.Indyuce.mmoitems.gui.edition.ItemEdition;
import net.Indyuce.mmoitems.stat.BrowserDisplayIDX;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.*;
import org.bukkit.attribute.Attribute;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
@ -383,7 +386,7 @@ public class ItemBrowser extends PluginInventory {
} else {
if (event.getAction() == InventoryAction.PICKUP_ALL) {
getPlayer().getInventory().addItem(MMOItems.plugin.getItem(type, id, playerData));
getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
getPlayer().playSound(getPlayer().getLocation(), Sounds.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
}
if (event.getAction() == InventoryAction.PICKUP_HALF)

View File

@ -1,14 +1,14 @@
package net.Indyuce.mmoitems.gui.edition.recipe.button;
import io.lumine.mythic.lib.api.util.AltChar;
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
import io.lumine.mythic.lib.api.util.ItemFactory;
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.gui.edition.recipe.button.type.RBA_BooleanButton;
import net.Indyuce.mmoitems.gui.edition.recipe.gui.RecipeEditorGUI;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.KnowledgeBookMeta;
@ -54,7 +54,7 @@ public class RBA_HideFromBook extends RBA_BooleanButton {
// Give it to the player
getInv().getPlayer().getInventory().addItem(book);
getInv().getPlayer().playSound(getInv().getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
getInv().getPlayer().playSound(getInv().getPlayer().getLocation(), Sounds.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
// Done
return true; }

View File

@ -1,10 +1,10 @@
package net.Indyuce.mmoitems.gui.edition.recipe.button;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.api.edition.StatEdition;
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
import net.Indyuce.mmoitems.gui.edition.recipe.gui.RecipeEditorGUI;
import net.Indyuce.mmoitems.stat.type.ItemStat;
import org.bukkit.Sound;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -92,5 +92,5 @@ public abstract class RecipeButtonAction {
/**
* Plays a clicking sound
*/
public void clickSFX() { getInv().getPlayer().playSound(getInv().getPlayer().getLocation(), Sound.UI_BUTTON_CLICK, 1, 1); }
public void clickSFX() { getInv().getPlayer().playSound(getInv().getPlayer().getLocation(), Sounds.UI_BUTTON_CLICK, 1, 1); }
}

View File

@ -1,9 +1,9 @@
package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.version.Attributes;
import net.Indyuce.mmoitems.stat.annotation.HasCategory;
import net.Indyuce.mmoitems.stat.type.AttackWeaponStat;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
@HasCategory(cat = "vanilla_attribute")
public class AttackDamage extends AttackWeaponStat {
@ -12,6 +12,6 @@ public class AttackDamage extends AttackWeaponStat {
Material.IRON_SWORD,
"Attack Damage",
new String[]{"The amount of damage your weapon deals."},
Attribute.GENERIC_ATTACK_DAMAGE);
Attributes.ATTACK_DAMAGE);
}
}

View File

@ -1,9 +1,9 @@
package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.version.Attributes;
import net.Indyuce.mmoitems.stat.annotation.HasCategory;
import net.Indyuce.mmoitems.stat.type.AttackWeaponStat;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
@HasCategory(cat = "vanilla_attribute")
public class AttackSpeed extends AttackWeaponStat {
@ -12,6 +12,6 @@ public class AttackSpeed extends AttackWeaponStat {
Material.LIGHT_GRAY_DYE,
"Attack Speed",
new String[]{"The speed at which your weapon strikes.", "In attacks/sec."},
Attribute.GENERIC_ATTACK_SPEED);
Attributes.ATTACK_SPEED);
}
}

View File

@ -1,17 +1,8 @@
package net.Indyuce.mmoitems.stat;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.util.MMOUtils;
import net.Indyuce.mmoitems.api.ItemTier;
import net.Indyuce.mmoitems.api.Type;
import net.Indyuce.mmoitems.api.event.item.DeconstructItemEvent;
@ -20,9 +11,17 @@ import net.Indyuce.mmoitems.api.player.PlayerData;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.type.BooleanStat;
import net.Indyuce.mmoitems.stat.type.ConsumableItemInteraction;
import io.lumine.mythic.lib.api.item.NBTItem;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class CanDeconstruct extends BooleanStat implements ConsumableItemInteraction {
public CanDeconstruct() {
super("CAN_DECONSTRUCT", Material.PAPER, "Can Deconstruct?",
@ -51,7 +50,7 @@ public class CanDeconstruct extends BooleanStat implements ConsumableItemInterac
event.getCurrentItem().setAmount(event.getCurrentItem().getAmount() - 1);
for (ItemStack drop : player.getInventory().addItem(loot.toArray(new ItemStack[0])).values())
player.getWorld().dropItem(player.getLocation(), drop);
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
return true;
}
}

View File

@ -1,13 +1,7 @@
package net.Indyuce.mmoitems.stat;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import net.Indyuce.mmoitems.util.MMOUtils;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.api.Type;
import net.Indyuce.mmoitems.api.event.item.IdentifyItemEvent;
import net.Indyuce.mmoitems.api.interaction.Consumable;
@ -16,7 +10,12 @@ import net.Indyuce.mmoitems.api.player.PlayerData;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.type.BooleanStat;
import net.Indyuce.mmoitems.stat.type.ConsumableItemInteraction;
import io.lumine.mythic.lib.api.item.NBTItem;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
public class CanIdentify extends BooleanStat implements ConsumableItemInteraction {
@ -46,7 +45,7 @@ public class CanIdentify extends BooleanStat implements ConsumableItemInteractio
event.setCurrentItem(new IdentifiedItem(target).identify());
Message.SUCCESSFULLY_IDENTIFIED.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(target.getItem())).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
return true;
}
}

View File

@ -4,9 +4,9 @@ import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
import io.lumine.mythic.lib.api.util.AltChar;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.util.MMOUtils;
import net.Indyuce.mmoitems.api.CustomSound;
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
@ -18,10 +18,10 @@ import net.Indyuce.mmoitems.stat.data.SoundListData;
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
import net.Indyuce.mmoitems.stat.type.ItemStat;
import net.Indyuce.mmoitems.stat.type.PlayerConsumable;
import net.Indyuce.mmoitems.util.MMOUtils;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryAction;
@ -243,5 +243,5 @@ public class CustomSounds extends ItemStat<SoundListData, SoundListData> impleme
}
}
void playDefaultSound(@NotNull Player player) { player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EAT, 1, 1); }
void playDefaultSound(@NotNull Player player) { player.getWorld().playSound(player.getLocation(), Sounds.ENTITY_GENERIC_EAT, 1, 1); }
}

View File

@ -26,7 +26,7 @@ public class HidePotionEffects extends BooleanStat {
}
@BackwardsCompatibility(version = "1.20.5")
public static final ItemFlag ITEM_FLAG = UtilityMethods.resolveEnumField(ItemFlag::valueOf,
public static final ItemFlag ITEM_FLAG = UtilityMethods.resolveField(ItemFlag::valueOf,
() -> Arrays.stream(ItemFlag.values()).findAny().get(),
"HIDE_ADDITIONAL_TOOLTIP", "HIDE_POTION_EFFECTS");

View File

@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
@ -16,7 +17,6 @@ import net.Indyuce.mmoitems.stat.type.ItemRestriction;
import net.Indyuce.mmoitems.stat.type.Upgradable;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.configuration.ConfigurationSection;
import org.jetbrains.annotations.NotNull;
@ -97,7 +97,7 @@ public class MaximumDurability extends DoubleStat implements ItemRestriction, Ge
if (item.getDouble(ItemStats.CUSTOM_DURABILITY.getNBTPath()) <= 0) {
if (message) {
Message.ZERO_DURABILITY.format(ChatColor.RED).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -4,6 +4,7 @@ import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
import io.lumine.mythic.lib.api.util.AltChar;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.edition.StatEdition;
@ -18,7 +19,6 @@ import net.Indyuce.mmoitems.stat.type.StringListStat;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
@ -147,7 +147,7 @@ public class Permission extends StringListStat implements ItemRestriction {
if (!player.getPlayer().hasPermission(s)) {
if (message) {
Message.NOT_ENOUGH_PERMS.format(ChatColor.RED).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.Type;
@ -17,13 +18,11 @@ import net.Indyuce.mmoitems.stat.data.GemSocketsData;
import net.Indyuce.mmoitems.stat.data.GemstoneData;
import net.Indyuce.mmoitems.stat.type.ConsumableItemInteraction;
import net.Indyuce.mmoitems.stat.type.DoubleStat;
import net.Indyuce.mmoitems.stat.type.StatHistory;
import net.Indyuce.mmoitems.util.MMOUtils;
import net.Indyuce.mmoitems.util.Pair;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
@ -147,7 +146,7 @@ public class RandomUnsocket extends DoubleStat implements ConsumableItemInteract
// Give the gems back
for (ItemStack drop : player.getInventory().addItem(items2Drop.toArray(new ItemStack[0])).values()) player.getWorld().dropItem(player.getLocation(), drop);
player.playSound(player.getLocation(), Sound.BLOCK_IRON_DOOR_OPEN, 1, 2);
player.playSound(player.getLocation(), Sounds.BLOCK_IRON_DOOR_OPEN, 1, 2);
return true;
}
}

View File

@ -1,6 +1,7 @@
package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.api.CustomSound;
import net.Indyuce.mmoitems.api.Type;
@ -15,7 +16,6 @@ import net.Indyuce.mmoitems.util.MMOUtils;
import net.Indyuce.mmoitems.util.RepairUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
@ -50,7 +50,7 @@ public class RepairPower extends DoubleStat implements ConsumableItemInteraction
final @Nullable String repairType2 = target.getString(REPAIR_TYPE_TAG_KEY);
if (!MMOUtils.checkReference(repairType1, repairType2)) {
Message.UNABLE_TO_REPAIR.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem())).send(player);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
return false;
}

View File

@ -4,6 +4,7 @@ import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
import io.lumine.mythic.lib.api.util.AltChar;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.edition.StatEdition;
@ -19,7 +20,6 @@ import net.Indyuce.mmoitems.stat.type.StringListStat;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
@ -141,7 +141,7 @@ public class RequiredClass extends StringListStat implements ItemRestriction, Ge
if (!requiredClass.equals("") && !hasRightClass(player, requiredClass) && !player.getPlayer().hasPermission("mmoitems.bypass.class")) {
if (message) {
Message.WRONG_CLASS.format(ChatColor.RED).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -1,14 +1,13 @@
package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.api.item.NBTItem;
import net.Indyuce.mmoitems.ItemStats;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.api.player.RPGPlayer;
import net.Indyuce.mmoitems.api.util.message.Message;
import net.Indyuce.mmoitems.stat.data.RequiredLevelData;
import net.Indyuce.mmoitems.stat.type.RequiredLevelStat;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.jetbrains.annotations.NotNull;
public class RequiredLevel extends RequiredLevelStat {
@ -31,7 +30,7 @@ public class RequiredLevel extends RequiredLevelStat {
if (message) {
Message.NOT_ENOUGH_LEVELS.format(ChatColor.RED).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
}
return false;
}

View File

@ -3,6 +3,7 @@ package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.item.ItemTag;
import io.lumine.mythic.lib.api.util.AltChar;
import io.lumine.mythic.lib.util.annotation.BackwardsCompatibility;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.edition.StatEdition;
@ -21,20 +22,47 @@ import org.bukkit.block.banner.PatternType;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
public class ShieldPatternStat extends ItemStat<ShieldPatternData, ShieldPatternData> {
@BackwardsCompatibility(version = "1.21.2")
private final Method PatternType__valueOf, PatternType__name;
public ShieldPatternStat() {
super("SHIELD_PATTERN", Material.SHIELD, "Shield Pattern", new String[]{"The color & patterns", "of your shield."},
new String[0], Material.SHIELD);
try {
PatternType__valueOf = PatternType.class.getDeclaredMethod("valueOf", String.class);
PatternType__name = PatternType.class.getMethod("name");
} catch (Exception exception) {
throw new RuntimeException("Reflection error: " + exception.getMessage());
}
}
private PatternType PatternType__valueOf(String str) {
try {
return (PatternType) PatternType__valueOf.invoke(null, str);
} catch (Exception exception) {
throw new RuntimeException("Reflection exception", exception);
}
}
private String PatternType__name(PatternType type) {
try {
return (String) PatternType__name.invoke(type);
} catch (Exception exception) {
throw new RuntimeException("Reflection exception", exception);
}
}
@Override
@ -49,7 +77,7 @@ public class ShieldPatternStat extends ItemStat<ShieldPatternData, ShieldPattern
for (String key : config.getKeys(false))
if (!key.equalsIgnoreCase("color")) {
String format = config.getString(key + ".pattern").toUpperCase().replace("-", "_").replace(" ", "_");
PatternType type = PatternType.valueOf(format);
PatternType type = PatternType__valueOf(format);
format = config.getString(key + ".color").toUpperCase().replace("-", "_").replace(" ", "_");
DyeColor color = DyeColor.valueOf(format);
@ -76,7 +104,9 @@ public class ShieldPatternStat extends ItemStat<ShieldPatternData, ShieldPattern
*/
@NotNull
@Override
public ArrayList<ItemTag> getAppliedNBT(@NotNull ShieldPatternData data) { return new ArrayList<>(); }
public ArrayList<ItemTag> getAppliedNBT(@NotNull ShieldPatternData data) {
return new ArrayList<>();
}
@Override
public void whenClicked(@NotNull EditionInventory inv, @NotNull InventoryClickEvent event) {
@ -114,17 +144,17 @@ public class ShieldPatternStat extends ItemStat<ShieldPatternData, ShieldPattern
String[] split = message.split(" ");
Validate.isTrue(split.length == 2, message + " is not a valid [PATTERN_TYPE] [DYE_COLOR].");
PatternType patternType = PatternType.valueOf(split[0].toUpperCase().replace("-", "_").replace(" ", "_"));
PatternType patternType = PatternType__valueOf(split[0].toUpperCase().replace("-", "_").replace(" ", "_"));
DyeColor dyeColor = DyeColor.valueOf(split[1].toUpperCase().replace("-", "_").replace(" ", "_"));
int availableKey = getNextAvailableKey(inv.getEditedSection().getConfigurationSection("shield-pattern"));
Validate.isTrue(availableKey >= 0, "You can have more than 100 shield patterns on a single item.");
inv.getEditedSection().set("shield-pattern." + availableKey + ".pattern", patternType.name());
inv.getEditedSection().set("shield-pattern." + availableKey + ".pattern", PatternType__name(patternType));
inv.getEditedSection().set("shield-pattern." + availableKey + ".color", dyeColor.name());
inv.registerTemplateEdition();
inv.getPlayer().sendMessage(
MMOItems.plugin.getPrefix() + UtilityMethods.caseOnWords(patternType.name().toLowerCase().replace("_", " ")) + " successfully added.");
MMOItems.plugin.getPrefix() + UtilityMethods.caseOnWords(PatternType__name(patternType).toLowerCase().replace("_", " ")) + " successfully added.");
return;
}
@ -144,7 +174,7 @@ public class ShieldPatternStat extends ItemStat<ShieldPatternData, ShieldPattern
+ (data.getBaseColor() != null
? ChatColor.GREEN + UtilityMethods.caseOnWords(data.getBaseColor().name().toLowerCase().replace("_", " "))
: ChatColor.RED + "None"));
data.getPatterns().forEach(pattern -> lore.add(ChatColor.GRAY + "* " + ChatColor.GREEN + pattern.getPattern().name() + ChatColor.GRAY
data.getPatterns().forEach(pattern -> lore.add(ChatColor.GRAY + "* " + ChatColor.GREEN + PatternType__name(pattern.getPattern()) + ChatColor.GRAY
+ " - " + ChatColor.GREEN + pattern.getColor().name()));
} else
@ -182,7 +212,9 @@ public class ShieldPatternStat extends ItemStat<ShieldPatternData, ShieldPattern
*/
@Nullable
@Override
public ShieldPatternData getLoadedNBT(@NotNull ArrayList<ItemTag> storedTags) { return null; }
public ShieldPatternData getLoadedNBT(@NotNull ArrayList<ItemTag> storedTags) {
return null;
}
private int getNextAvailableKey(ConfigurationSection section) {
for (int j = 0; j < 100; j++)

View File

@ -1,6 +1,7 @@
package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.api.Type;
import net.Indyuce.mmoitems.api.event.item.BreakSoulboundEvent;
@ -18,7 +19,6 @@ import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
@ -47,7 +47,7 @@ public class SoulbindingBreakChance extends DoubleStat implements ConsumableItem
MMOItem targetMMO = new VolatileMMOItem(target);
if (!targetMMO.hasData(ItemStats.SOULBOUND)) {
Message.NO_SOULBOUND.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1);
return false;
}
@ -67,11 +67,11 @@ public class SoulbindingBreakChance extends DoubleStat implements ConsumableItem
(targetMMO = new LiveMMOItem(target)).removeData(ItemStats.SOULBOUND);
target.getItem().setItemMeta(targetMMO.newBuilder().build().getItemMeta());
Message.SUCCESSFULLY_BREAK_BIND.format(ChatColor.YELLOW, "#level#", MMOUtils.intToRoman(soulbound.getLevel())).send(player);
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, 1, 2);
player.playSound(player.getLocation(), Sounds.BLOCK_ANVIL_LAND, 1, 2);
} else {
Message.UNSUCCESSFUL_SOULBOUND_BREAK.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 0);
player.playSound(player.getLocation(), Sounds.ENTITY_ITEM_BREAK, 1, 0);
}
return true;

View File

@ -1,6 +1,7 @@
package net.Indyuce.mmoitems.stat;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.api.Type;
import net.Indyuce.mmoitems.api.event.item.ApplySoulboundEvent;
@ -18,7 +19,6 @@ import net.Indyuce.mmoitems.util.MMOUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
@ -72,12 +72,12 @@ public class SoulbindingChance extends DoubleStat implements ConsumableItemInter
Message.SUCCESSFULLY_BIND_ITEM
.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(target.getItem()), "#level#", MMOUtils.intToRoman(soulboundLevel))
.send(player);
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
return true;
}
Message.UNSUCCESSFUL_SOULBOUND.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1);
return true;
}
}

View File

@ -5,6 +5,7 @@ import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
import io.lumine.mythic.lib.gson.JsonParser;
import io.lumine.mythic.lib.gson.JsonSyntaxException;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
@ -23,7 +24,6 @@ import net.Indyuce.mmoitems.util.MMOUtils;
import org.apache.commons.lang.NotImplementedException;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -116,7 +116,7 @@ public class Soulbound extends ItemStat<RandomStatData<SoulboundData>, Soulbound
if (message) {
int level = new JsonParser().parse(item.getString(ItemStats.SOULBOUND.getNBTPath())).getAsJsonObject().get("Level").getAsInt();
Message.SOULBOUND_RESTRICTION.format(ChatColor.RED).send(player.getPlayer());
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer().playSound(player.getPlayer().getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 1.5f);
player.getPlayer()
.damage(MMOItems.plugin.getLanguage().soulboundBaseDamage + level * MMOItems.plugin.getLanguage().soulboundPerLvlDamage);
}

View File

@ -6,6 +6,7 @@ import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
import io.lumine.mythic.lib.api.util.AltChar;
import io.lumine.mythic.lib.gson.JsonParser;
import io.lumine.mythic.lib.gson.JsonSyntaxException;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.ItemStats;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.Type;
@ -29,7 +30,6 @@ import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryAction;
@ -193,7 +193,7 @@ public class UpgradeStat extends ItemStat<UpgradeData, UpgradeData> implements C
if (mmoitem.hasData(ItemStats.UPGRADE) && target.hasTag(ItemStats.UPGRADE.getNBTPath())) {
if (target.getItem().getAmount() > 1) {
Message.CANT_UPGRADED_STACK.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 2);
return false;
}
@ -204,14 +204,14 @@ public class UpgradeStat extends ItemStat<UpgradeData, UpgradeData> implements C
if (!targetSharpening.canLevelUp()) {
Message.MAX_UPGRADES_HIT.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 2);
return false;
}
UpgradeData consumableSharpening = (UpgradeData) mmoitem.getData(ItemStats.UPGRADE);
if (!MMOUtils.checkReference(consumableSharpening.getReference(), targetSharpening.getReference())) {
Message.WRONG_UPGRADE_REFERENCE.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 2);
return false;
}
@ -230,7 +230,7 @@ public class UpgradeStat extends ItemStat<UpgradeData, UpgradeData> implements C
*/
if (MMOItems.plugin.getLanguage().upgradeRequirementsCheck && !playerData.getRPG().canUse(result, false)) {
Message.UPGRADE_REQUIREMENT_SAFE_CHECK.format(ChatColor.RED).send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_VILLAGER_NO, 1, 2);
return false;
}
@ -238,13 +238,13 @@ public class UpgradeStat extends ItemStat<UpgradeData, UpgradeData> implements C
Message.UPGRADE_FAIL.format(ChatColor.RED).send(player);
if (targetSharpening.destroysOnFail())
event.getCurrentItem().setAmount(0);
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_ITEM_BREAK, 1, 2);
return true;
}
Message.UPGRADE_SUCCESS.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(event.getCurrentItem())).send(player);
event.getCurrentItem().setItemMeta(result.toItem().getItemMeta());
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
player.playSound(player.getLocation(), Sounds.ENTITY_PLAYER_LEVELUP, 1, 2);
return true;
}
return false;

View File

@ -8,12 +8,12 @@ import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
import io.lumine.mythic.lib.skill.trigger.TriggerType;
import io.lumine.mythic.lib.util.annotation.BackwardsCompatibility;
import io.lumine.mythic.lib.version.Attributes;
import io.lumine.mythic.lib.version.VPotionEffectType;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.Type;
import org.apache.commons.lang.Validate;
import org.bukkit.*;
import org.bukkit.attribute.Attribute;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -418,7 +418,7 @@ public class MMOUtils {
if (entity.isDead() || entity.getHealth() <= 0) return;
if (heal < 0 && !allowNegatives) return;
final double maxHealth = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
final double maxHealth = entity.getAttribute(Attributes.MAX_HEALTH).getValue();
entity.setHealth(Math.min(maxHealth, entity.getHealth() + heal));
}
//endregion

View File

@ -1,8 +1,8 @@
package net.Indyuce.mmoitems.listener;
import io.lumine.mythic.lib.version.Sounds;
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -116,7 +116,7 @@ public class DurabilityListener implements Listener {
ItemStack newVersion = item.toItem();
if (newVersion == null) {
player.getInventory().setItem(slot, null);
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
player.getWorld().playSound(player.getLocation(), Sounds.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
return;
}

View File

@ -99,7 +99,7 @@
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib-dist</artifactId>
<version>1.6.2-SNAPSHOT</version>
<version>1.7.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Jetbrains Annotations -->