mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-08 12:21:21 +01:00
Made Unidentified Items unusable
This commit is contained in:
parent
1be8e8ca79
commit
31ca777678
@ -3,6 +3,7 @@ package net.Indyuce.mmoitems.api.player;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
@ -54,7 +55,14 @@ public abstract class RPGPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUse(NBTItem item, boolean message) {
|
public boolean canUse(NBTItem item, boolean message) {
|
||||||
|
if (item.hasTag("MMOITEMS_UNIDENTIFIED_ITEM")) {
|
||||||
|
if (message) {
|
||||||
|
Message.UNIDENTIFIED_ITEM.format(ChatColor.RED).send(player.getPlayer(), "cant-use-item");
|
||||||
|
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (Conditional condition : MMOItems.plugin.getStats().getConditionals())
|
for (Conditional condition : MMOItems.plugin.getStats().getConditionals())
|
||||||
if (!condition.canUse(this, item, message))
|
if (!condition.canUse(this, item, message))
|
||||||
return false;
|
return false;
|
||||||
|
@ -27,6 +27,7 @@ public enum Message {
|
|||||||
WRONG_CLASS("You don't have the right class!"),
|
WRONG_CLASS("You don't have the right class!"),
|
||||||
NOT_ENOUGH_MANA("You don't have enough mana!"),
|
NOT_ENOUGH_MANA("You don't have enough mana!"),
|
||||||
NOT_ENOUGH_STAMINA("You don't have enough stamina!"),
|
NOT_ENOUGH_STAMINA("You don't have enough stamina!"),
|
||||||
|
UNIDENTIFIED_ITEM("You can't use an unidentified item!"),
|
||||||
|
|
||||||
// custom durability
|
// custom durability
|
||||||
ITEM_BROKE("Your #item#&c broke."),
|
ITEM_BROKE("Your #item#&c broke."),
|
||||||
|
Loading…
Reference in New Issue
Block a user