Sacred realms
This commit is contained in:
commit
aa1c13c74c
28 changed files with 1651 additions and 0 deletions
|
@ -0,0 +1,110 @@
|
|||
package me.unurled.sacredrealms.sr.components.attributes;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
public enum Attribute {
|
||||
HEALTH(
|
||||
"HEALTH",
|
||||
"Health",
|
||||
100,
|
||||
100000,
|
||||
0,
|
||||
PersistentDataType.DOUBLE,
|
||||
new NamespacedKey("sr", "HEALTH")),
|
||||
STRENGTH(
|
||||
"STRENGTH",
|
||||
"Strength",
|
||||
10,
|
||||
10000,
|
||||
0,
|
||||
PersistentDataType.DOUBLE,
|
||||
new NamespacedKey("sr", "STRENGTH")),
|
||||
DEFENSE(
|
||||
"DEFENSE",
|
||||
"Defense",
|
||||
10,
|
||||
10000,
|
||||
0,
|
||||
PersistentDataType.DOUBLE,
|
||||
new NamespacedKey("sr", "DEFENSE")),
|
||||
AGILITY(
|
||||
"AGILITY",
|
||||
"Agility",
|
||||
100,
|
||||
10000,
|
||||
100,
|
||||
PersistentDataType.DOUBLE,
|
||||
new NamespacedKey("sr", "AGILITY")),
|
||||
LUCK(
|
||||
"LUCK",
|
||||
"Luck",
|
||||
100,
|
||||
99999,
|
||||
-99999,
|
||||
PersistentDataType.INTEGER,
|
||||
new NamespacedKey("sr", "LUCK")),
|
||||
MANA("MANA", "Mana", 100, 10000, 0, PersistentDataType.DOUBLE, new NamespacedKey("sr", "MANA")),
|
||||
CHARISMA(
|
||||
"CHARISMA",
|
||||
"Charisma",
|
||||
0,
|
||||
10000,
|
||||
-10000,
|
||||
PersistentDataType.INTEGER,
|
||||
new NamespacedKey("sr", "CHARISMA")),
|
||||
;
|
||||
|
||||
private final String name;
|
||||
private final String ID;
|
||||
private final int defaultValue;
|
||||
private final int maxValue;
|
||||
private final int minValue;
|
||||
private final PersistentDataType type;
|
||||
private final NamespacedKey key;
|
||||
|
||||
Attribute(
|
||||
String ID,
|
||||
String name,
|
||||
int defaultValue,
|
||||
int maxValue,
|
||||
int minValue,
|
||||
PersistentDataType type,
|
||||
NamespacedKey key) {
|
||||
this.ID = ID;
|
||||
this.name = name;
|
||||
this.defaultValue = defaultValue;
|
||||
this.maxValue = maxValue;
|
||||
this.minValue = minValue;
|
||||
this.type = type;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public int getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public int getMaxValue() {
|
||||
return maxValue;
|
||||
}
|
||||
|
||||
public int getMinValue() {
|
||||
return minValue;
|
||||
}
|
||||
|
||||
public PersistentDataType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package me.unurled.sacredrealms.sr.components.combat;
|
||||
|
||||
import static me.unurled.sacredrealms.sr.utils.Component.comp;
|
||||
|
||||
import me.unurled.sacredrealms.sr.components.attributes.Attribute;
|
||||
import me.unurled.sacredrealms.sr.managers.Manager;
|
||||
import me.unurled.sacredrealms.sr.utils.Items;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
|
||||
public class CombatManager extends Manager {
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageByBlockEvent e) {
|
||||
// TODO: Implement
|
||||
// blast enchant :shrug:
|
||||
}
|
||||
|
||||
// TODO: Finish this
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageByEntityEvent e) {
|
||||
e.setDamage(0.0);
|
||||
|
||||
if (!(e.getDamager() instanceof LivingEntity) || !(e.getEntity() instanceof LivingEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LivingEntity damager = (LivingEntity) e.getDamager();
|
||||
LivingEntity entity = (LivingEntity) e.getEntity();
|
||||
|
||||
if (damager instanceof Player d) {
|
||||
if (entity instanceof Player) {
|
||||
// no pvp
|
||||
e.setCancelled(true);
|
||||
d.sendMessage(comp("<red>You can't attack players!"));
|
||||
d.playSound(d, Sound.BLOCK_ANVIL_HIT, 1.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
if (entity instanceof Mob) {
|
||||
Double dStrength = Items.getTotalAttribute(d, Attribute.STRENGTH);
|
||||
EntityEquipment equipment = ((Mob) entity).getEquipment();
|
||||
Double eDefense = Items.getTotalAttribute(equipment, Attribute.DEFENSE);
|
||||
|
||||
Double dLuck = Items.getTotalAttribute(d, Attribute.LUCK);
|
||||
Double eLuck = Items.getTotalAttribute(equipment, Attribute.LUCK);
|
||||
|
||||
Double luck = dLuck - eLuck;
|
||||
if (luck < -1000) {
|
||||
// 100% chance of miss
|
||||
luck = -10000d;
|
||||
d.sendMessage(comp("<red>You missed!"));
|
||||
// TODO: play miss sound
|
||||
// d.playSound();
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
} else if (luck > 1000) {
|
||||
// 100% chance of critical hit
|
||||
luck = 10000d;
|
||||
}
|
||||
|
||||
if (luck < 0) {
|
||||
// chances of miss
|
||||
|
||||
} else if (luck > 0) {
|
||||
// chance of critical hit
|
||||
} else {
|
||||
}
|
||||
|
||||
}
|
||||
} else if (entity instanceof Player) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageEvent e) {}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package me.unurled.sacredrealms.sr.components.item;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import me.unurled.sacredrealms.sr.components.attributes.Attribute;
|
||||
import me.unurled.sacredrealms.sr.components.item.abilities.Ability;
|
||||
import me.unurled.sacredrealms.sr.components.item.enchantments.Enchantment;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/* <b><color of the rarity>rarity
|
||||
* <dark_gray>Description: blablabla
|
||||
* <dark_gray>blabbla
|
||||
* <dark_gray>blabla
|
||||
* <gray>Attributes:
|
||||
* <gray>➤ Health: <green>+100
|
||||
* <gray>➤ Strength: <red>+10
|
||||
* <gray>➤ Mana: <dark_aqua>+10
|
||||
* <gray>Abilities:
|
||||
* <gray>➤ Ability 1,<yellow> On Rightclick unleash a powerful attack
|
||||
* <dark_gray>cooldown: 10s,
|
||||
* <dark_gray>damage: 100,
|
||||
* <dark_gray>mana cost: <dark_aqua>50
|
||||
* <gray>➤ Ability 2,<yellow> On Rightclick unleash a powerful attack
|
||||
* <dark_gray>cooldown: 10s,
|
||||
* <dark_gray>damage: 100,
|
||||
* <dark_gray>mana cost: <dark_aqua>50
|
||||
* <dark_purple>Enchantments:
|
||||
* <blue>➤ Enchantment <if max level gold>1
|
||||
* <blue>➤ Enchantment <if max level gold>2
|
||||
* */
|
||||
public class Item {
|
||||
|
||||
private final String ID;
|
||||
|
||||
private String name;
|
||||
|
||||
private Material material;
|
||||
|
||||
private String description;
|
||||
|
||||
private Rarity rarity;
|
||||
|
||||
private HashMap<Attribute, Double> attributes;
|
||||
|
||||
private HashMap<Enchantment, Integer> enchantments;
|
||||
|
||||
private List<Ability> abilities;
|
||||
|
||||
public Item(String ID, String name, Material material) {
|
||||
this.ID = ID;
|
||||
this.name = name;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public void setMaterial(Material material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Rarity getRarity() {
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public void setRarity(Rarity rarity) {
|
||||
this.rarity = rarity;
|
||||
}
|
||||
|
||||
public HashMap<Attribute, Double> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
public Double getAttribute(Attribute attribute) {
|
||||
return attributes.get(attribute);
|
||||
}
|
||||
|
||||
public void setAttributes(HashMap<Attribute, Double> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
public void addAttribute(Attribute attribute, double value) {
|
||||
attributes.put(attribute, value);
|
||||
}
|
||||
|
||||
public void removeAttribute(Attribute attribute) {
|
||||
attributes.remove(attribute);
|
||||
}
|
||||
|
||||
public HashMap<Enchantment, Integer> getEnchantments() {
|
||||
return enchantments;
|
||||
}
|
||||
|
||||
public void setEnchantments(HashMap<Enchantment, Integer> enchantments) {
|
||||
this.enchantments = enchantments;
|
||||
}
|
||||
|
||||
public void addEnchantment(Enchantment enchantment, int level) {
|
||||
enchantments.put(enchantment, level);
|
||||
}
|
||||
|
||||
public void removeEnchantment(Enchantment enchantment) {
|
||||
enchantments.remove(enchantment);
|
||||
}
|
||||
|
||||
public List<Ability> getAbilities() {
|
||||
return abilities;
|
||||
}
|
||||
|
||||
public void setAbilities(List<Ability> abilities) {
|
||||
this.abilities = abilities;
|
||||
}
|
||||
|
||||
public void addAbility(Ability ability) {
|
||||
abilities.add(ability);
|
||||
}
|
||||
|
||||
public void removeAbility(Ability ability) {
|
||||
abilities.remove(ability);
|
||||
}
|
||||
|
||||
public ItemStack toItemStack() {
|
||||
ItemStack item = new ItemStack(material);
|
||||
// set item meta
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package me.unurled.sacredrealms.sr.components.item;
|
||||
|
||||
import java.util.HashMap;
|
||||
import me.unurled.sacredrealms.sr.managers.Manager;
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
||||
public class ItemManager extends Manager {
|
||||
public static final NamespacedKey ID = new NamespacedKey("sr", "ID");
|
||||
|
||||
public HashMap<String, Item> items;
|
||||
|
||||
public ItemManager() {
|
||||
super();
|
||||
items = new HashMap<>();
|
||||
}
|
||||
|
||||
public void addItem(Item item) {
|
||||
items.put(item.getID(), item);
|
||||
}
|
||||
|
||||
public Item getItem(String id) {
|
||||
return items.get(id);
|
||||
}
|
||||
|
||||
public void removeItem(String id) {
|
||||
items.remove(id);
|
||||
}
|
||||
|
||||
public boolean isItem(String id) {
|
||||
return items.containsKey(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package me.unurled.sacredrealms.sr.components.item;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
||||
public enum Rarity {
|
||||
|
||||
COMMON("<white>Common", "COMMON", 1),
|
||||
UNCOMMON("<green>UnCommon", "UnCOMMON", 2),
|
||||
RARE("<dark_aqua>Rare", "RARE", 3),
|
||||
EPIC("<dark_purple>Epic", "EPIC", 4),
|
||||
LEGENDARY("<gold>Legendary", "LEGENDARY", 5),
|
||||
MYTHIC("<light_purple>Mythic", "MYTHIC", 6),
|
||||
SPECIAL("<red>Special", "SPECIAL", 7),
|
||||
UNIQUE("<yellow>Unique", "UNIQUE", 8),
|
||||
ADMIN("<color:#800000><obf>aa</obf><dark_red>Admin</dark_red><obf>aa</obf></color>", "ADMIN",
|
||||
100);
|
||||
|
||||
|
||||
private final String name;
|
||||
private final String ID;
|
||||
private final Integer weight;
|
||||
|
||||
Rarity(String name, String ID, Integer weight) {
|
||||
this.name = name;
|
||||
this.ID = ID;
|
||||
this.weight = weight;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package me.unurled.sacredrealms.sr.components.item.abilities;
|
||||
|
||||
public class Ability {}
|
|
@ -0,0 +1,3 @@
|
|||
package me.unurled.sacredrealms.sr.components.item.enchantments;
|
||||
|
||||
public class Enchantment {}
|
|
@ -0,0 +1,94 @@
|
|||
package me.unurled.sacredrealms.sr.components.player;
|
||||
|
||||
import static me.unurled.sacredrealms.sr.utils.Logger.error;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import me.unurled.sacredrealms.sr.data.DataHandler;
|
||||
import me.unurled.sacredrealms.sr.data.DataManager;
|
||||
import me.unurled.sacredrealms.sr.managers.Manager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class PlayerManager extends Manager {
|
||||
|
||||
private final HashMap<UUID, SRPlayer> players;
|
||||
|
||||
public PlayerManager() {
|
||||
super();
|
||||
players = new HashMap<>();
|
||||
}
|
||||
|
||||
/** Save the data */
|
||||
@Override
|
||||
public void saveData() {
|
||||
DataManager dm = (DataManager) DataManager.getInstance(DataManager.class);
|
||||
if (dm == null) {
|
||||
error("DataManager is null, Can't save player data.");
|
||||
return;
|
||||
}
|
||||
DataHandler dh = dm.getDataHandler();
|
||||
Gson gson = new Gson();
|
||||
dh.set("sr.players", gson.toJson(players));
|
||||
}
|
||||
|
||||
/** Load the data */
|
||||
@Override
|
||||
public void loadData() {}
|
||||
|
||||
@Nullable
|
||||
public SRPlayer getPlayer(UUID uuid) {
|
||||
return players.get(uuid);
|
||||
}
|
||||
|
||||
public void addPlayer(@NotNull SRPlayer player) {
|
||||
players.put(player.getUuid(), player);
|
||||
}
|
||||
|
||||
public void removePlayer(UUID uuid) {
|
||||
players.remove(uuid);
|
||||
}
|
||||
|
||||
public boolean isSRPlayer(UUID uuid) {
|
||||
return players.containsKey(uuid);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent e) {
|
||||
SRPlayer player = new SRPlayer(e.getPlayer());
|
||||
// load data from db // TODO: test this after redis cache
|
||||
/*DataManager dm = (DataManager) DataManager.getInstance(DataManager.class);
|
||||
if (dm == null) {
|
||||
error("DataManager is null, Can't load player " + e.getPlayer().getName() + "'s data" + ".");
|
||||
return;
|
||||
}
|
||||
DataHandler dh = dm.getDataHandler();
|
||||
Gson gson = new Gson();
|
||||
Object json = dh.getGson("sr.players." + e.getPlayer().getUniqueId());*/
|
||||
addPlayer(player);
|
||||
}
|
||||
|
||||
// TODO: test if it works, i have a doubt about the jsonAppend (key + path seems weird)
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent e) {
|
||||
SRPlayer player = getPlayer(e.getPlayer().getUniqueId());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
// save for player
|
||||
DataManager dm = (DataManager) DataManager.getInstance(DataManager.class);
|
||||
if (dm == null) {
|
||||
error("DataManager is null, Can't save player " + e.getPlayer().getName() + "'s data" + ".");
|
||||
return;
|
||||
}
|
||||
DataHandler dh = dm.getDataHandler();
|
||||
Gson gson = new Gson();
|
||||
dh.set("sr.players." + e.getPlayer().getUniqueId(), gson.toJson(player));
|
||||
|
||||
removePlayer(e.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package me.unurled.sacredrealms.sr.components.player;
|
||||
|
||||
import static me.unurled.sacredrealms.sr.utils.Logger.warn;
|
||||
|
||||
import java.util.UUID;
|
||||
import me.unurled.sacredrealms.sr.components.attributes.Attribute;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SRPlayer {
|
||||
|
||||
private final UUID uuid;
|
||||
|
||||
public SRPlayer(@NotNull Player player) {
|
||||
this.uuid = player.getUniqueId();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Object getAttribute(@NotNull Attribute attribute) {
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
if (p == null) {
|
||||
return null;
|
||||
}
|
||||
PersistentDataContainer pdc = p.getPersistentDataContainer();
|
||||
return pdc.get(new NamespacedKey("sr", attribute.getID()), attribute.getType());
|
||||
}
|
||||
|
||||
public void setAttribute(@NotNull Attribute attribute, @NotNull Object value) {
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
if (p == null) {
|
||||
return;
|
||||
}
|
||||
PersistentDataContainer pdc = p.getPersistentDataContainer();
|
||||
if (!attribute.getType().getComplexType().isInstance(value)) {
|
||||
return;
|
||||
}
|
||||
if (attribute.getType().equals(PersistentDataType.DOUBLE)) {
|
||||
double d = (double) value;
|
||||
if (d < attribute.getMinValue() || d > attribute.getMaxValue()) {
|
||||
warn(
|
||||
"(Player "
|
||||
+ p.getName()
|
||||
+ ") Value "
|
||||
+ d
|
||||
+ " for attribute "
|
||||
+ attribute.getID()
|
||||
+ " is out of bounds. Min: "
|
||||
+ attribute.getMinValue()
|
||||
+ " Max: "
|
||||
+ attribute.getMaxValue()
|
||||
+ " Value: "
|
||||
+ d);
|
||||
return;
|
||||
}
|
||||
} else if (attribute.getType().equals(PersistentDataType.INTEGER)) {
|
||||
int i = (int) value;
|
||||
if (i < attribute.getMinValue() || i > attribute.getMaxValue()) {
|
||||
warn(
|
||||
"(Player "
|
||||
+ p.getName()
|
||||
+ ") Value "
|
||||
+ i
|
||||
+ " for attribute "
|
||||
+ attribute.getID()
|
||||
+ " is out of bounds. Min: "
|
||||
+ attribute.getMinValue()
|
||||
+ " Max: "
|
||||
+ attribute.getMaxValue()
|
||||
+ " Value: "
|
||||
+ i);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
pdc.set(new NamespacedKey("sr", attribute.getID()), attribute.getType(), value);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Object getHandItemAttribute(@NotNull Attribute attribute) {
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
if (p == null) {
|
||||
return null;
|
||||
}
|
||||
return p.getInventory()
|
||||
.getItemInMainHand()
|
||||
.getItemMeta()
|
||||
.getPersistentDataContainer()
|
||||
.get(new NamespacedKey("sr", attribute.getID()), attribute.getType());
|
||||
}
|
||||
|
||||
public void setHandItemAttribute(@NotNull Attribute attribute, @NotNull Object value) {
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
if (p == null) {
|
||||
return;
|
||||
}
|
||||
if (!attribute.getType().getComplexType().isInstance(value)) {
|
||||
return;
|
||||
}
|
||||
if (attribute.getType().equals(PersistentDataType.DOUBLE)) {
|
||||
double d = (double) value;
|
||||
if (d < attribute.getMinValue() || d > attribute.getMaxValue()) {
|
||||
warn(
|
||||
"(Player "
|
||||
+ p.getName()
|
||||
+ ") Value "
|
||||
+ d
|
||||
+ " for attribute "
|
||||
+ attribute.getID()
|
||||
+ " is out of bounds. Min: "
|
||||
+ attribute.getMinValue()
|
||||
+ " Max: "
|
||||
+ attribute.getMaxValue()
|
||||
+ " Value: "
|
||||
+ d);
|
||||
return;
|
||||
}
|
||||
} else if (attribute.getType().equals(PersistentDataType.INTEGER)) {
|
||||
int i = (int) value;
|
||||
if (i < attribute.getMinValue() || i > attribute.getMaxValue()) {
|
||||
warn(
|
||||
"(Player "
|
||||
+ p.getName()
|
||||
+ ") Value "
|
||||
+ i
|
||||
+ " for attribute "
|
||||
+ attribute.getID()
|
||||
+ " is out of bounds. Min: "
|
||||
+ attribute.getMinValue()
|
||||
+ " Max: "
|
||||
+ attribute.getMaxValue()
|
||||
+ " Value: "
|
||||
+ i);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
ItemStack i = p.getInventory().getItemInMainHand();
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.getPersistentDataContainer()
|
||||
.set(new NamespacedKey("sr", attribute.getID()), attribute.getType(), value);
|
||||
im.lore();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue