Sacred realms

This commit is contained in:
unurled 2024-02-26 21:04:42 +01:00
commit aa1c13c74c
Signed by: unurled
GPG key ID: FDBC9CBE1F82423F
28 changed files with 1651 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -0,0 +1,3 @@
package me.unurled.sacredrealms.sr.components.item.abilities;
public class Ability {}

View file

@ -0,0 +1,3 @@
package me.unurled.sacredrealms.sr.components.item.enchantments;
public class Enchantment {}