This commit is contained in:
parent
1febc27d67
commit
072521f228
5 changed files with 164 additions and 34 deletions
|
@ -1,6 +1,6 @@
|
|||
package me.unurled.sacredrealms.sr.components.item;
|
||||
|
||||
import static me.unurled.sacredrealms.sr.utils.Component.comp;
|
||||
import static me.unurled.sacredrealms.sr.utils.Component.textComp;
|
||||
import static me.unurled.sacredrealms.sr.utils.Items.lore;
|
||||
import static me.unurled.sacredrealms.sr.utils.Logger.error;
|
||||
|
||||
|
@ -96,6 +96,10 @@ public class Item {
|
|||
return id;
|
||||
}
|
||||
|
||||
public void setId(@NotNull String arg) {
|
||||
this.id = arg;
|
||||
}
|
||||
|
||||
public @NotNull String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -104,18 +108,14 @@ public class Item {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public void setId(@NotNull String arg) {
|
||||
this.id = arg;
|
||||
public @NotNull Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public void setMaterial(@NotNull Material material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
public @NotNull Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public @NotNull String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
@ -144,6 +144,10 @@ public class Item {
|
|||
return attributes;
|
||||
}
|
||||
|
||||
public void setAttributes(@NotNull Map<Attribute, Double> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
public Double getAttribute(Attribute attribute) {
|
||||
return attributes.get(attribute);
|
||||
}
|
||||
|
@ -156,10 +160,6 @@ public class Item {
|
|||
attributes.remove(attribute);
|
||||
}
|
||||
|
||||
public void setAttributes(@NotNull Map<Attribute, Double> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
public @NotNull Map<Enchantment, Integer> getEnchantments() {
|
||||
return enchantments;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class Item {
|
|||
PersistentDataContainer p = meta.getPersistentDataContainer();
|
||||
p.set(ItemManager.ID, PersistentDataType.STRING, id);
|
||||
|
||||
meta.displayName(comp(name).color(rarity.getColor()));
|
||||
meta.displayName(textComp(name).color(rarity.getColor()));
|
||||
|
||||
if (customModelData != 0) {
|
||||
meta.setCustomModelData(customModelData);
|
||||
|
|
|
@ -1,10 +1,67 @@
|
|||
package me.unurled.sacredrealms.sr.components.item.abilities;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/** Represents an ability that an item can have. TODO: Implement this class */
|
||||
@SuppressWarnings("unused")
|
||||
public record Ability(
|
||||
String name, String description, Integer cooldown, Integer manaCost, Integer damage) {
|
||||
public enum Ability {
|
||||
TEST("TEST", "Test", "Test", 1, 1, 1);
|
||||
|
||||
private final String id;
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final Integer cooldown;
|
||||
private final Integer manaCost;
|
||||
private final Integer damage;
|
||||
|
||||
Ability(
|
||||
String id,
|
||||
String name,
|
||||
String description,
|
||||
Integer cooldown,
|
||||
Integer manaCost,
|
||||
Integer damage) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.cooldown = cooldown;
|
||||
this.manaCost = manaCost;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
public static @Nullable Ability getAbility(@NotNull String id) {
|
||||
for (Ability ability : Ability.values()) {
|
||||
if (ability.getId().equalsIgnoreCase(id)) {
|
||||
return ability;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Integer getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
public Integer getManaCost() {
|
||||
return manaCost;
|
||||
}
|
||||
|
||||
public Integer getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -1,3 +1,44 @@
|
|||
package me.unurled.sacredrealms.sr.components.item.enchantments;
|
||||
|
||||
public record Enchantment(String name, String ID, Integer maxLevel) {}
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public enum Enchantment {
|
||||
TEST("TEST", "test", "", 255);
|
||||
|
||||
private final String id;
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final Integer maxLevel;
|
||||
|
||||
Enchantment(String id, String name, String description, Integer maxLevel) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.maxLevel = maxLevel;
|
||||
}
|
||||
|
||||
public static @Nullable Enchantment getEnchantment(String id) {
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
if (enchantment.getId().equalsIgnoreCase(id)) {
|
||||
return enchantment;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Integer getMaxLevel() {
|
||||
return maxLevel;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue