refactoring
All checks were successful
Build / build (push) Successful in 7m43s

This commit is contained in:
unurled 2024-09-28 14:36:19 +02:00
parent c5acbc28ef
commit 7f326710b9
Signed by: unurled
GPG key ID: EFC5F5E709B47DDD
2 changed files with 87 additions and 47 deletions

View file

@ -43,6 +43,8 @@ public final class SR extends JavaPlugin {
PacketEvents.getAPI().init();
InvUI.getInstance().setPlugin(this);
SRCore.getInstance()
.getManagers()
.register(
@ -60,8 +62,6 @@ public final class SR extends JavaPlugin {
TreasureManager.class,
BackgroundManager.class,
ResourcePackManager.class));
InvUI.getInstance().setPlugin(this);
}
@Override

View file

@ -4,58 +4,98 @@ import org.bukkit.NamespacedKey;
import org.bukkit.persistence.PersistentDataType;
public enum Attribute {
HEALTH("HEALTH", "Health", 100, 100000, 0, new NamespacedKey("sr", "health")),
STRENGTH("STRENGTH", "Strength", 10, 10000, 0, new NamespacedKey("sr", "strength")),
DEFENSE("DEFENSE", "Defense", 10, 10000, 0, new NamespacedKey("sr", "defense")),
AGILITY("AGILITY", "Agility", 100, 10000, 0, new NamespacedKey("sr", "agility")),
LUCK("LUCK", "Luck", 100, 99999, -99999, new NamespacedKey("sr", "luck")),
MANA("MANA", "Mana", 100, 10000, 0, new NamespacedKey("sr", "mana")),
CHARISMA("CHARISMA", "Charisma", 0, 10000, -10000, new NamespacedKey("sr", "charisma")),
;
HEALTH(
"HEALTH",
"Health",
100,
100000,
0,
new NamespacedKey("sr", "health")
),
STRENGTH(
"STRENGTH",
"Strength",
10,
10000,
0,
new NamespacedKey("sr", "strength")
),
DEFENSE(
"DEFENSE",
"Defense",
10,
10000,
0,
new NamespacedKey("sr", "defense")
),
AGILITY(
"AGILITY",
"Agility",
100,
10000,
0,
new NamespacedKey("sr", "agility")
),
LUCK("LUCK", "Luck", 100, 99999, -99999, new NamespacedKey("sr", "luck")),
MANA("MANA", "Mana", 100, 10000, 0, new NamespacedKey("sr", "mana")),
CHARISMA(
"CHARISMA",
"Charisma",
0,
10000,
-10000,
new NamespacedKey("sr", "charisma")
);
private final String name;
private final String id;
private final double defaultValue;
private final int maxValue;
private final int minValue;
private final NamespacedKey key;
private final String name;
private final String id;
private final double defaultValue;
private final int maxValue;
private final int minValue;
private final NamespacedKey key;
Attribute(
String id, String name, int defaultValue, int maxValue, int minValue, NamespacedKey key) {
this.id = id;
this.name = name;
this.defaultValue = defaultValue;
this.maxValue = maxValue;
this.minValue = minValue;
this.key = key;
}
Attribute(
String id,
String name,
int defaultValue,
int maxValue,
int minValue,
NamespacedKey key
) {
this.id = id;
this.name = name;
this.defaultValue = defaultValue;
this.maxValue = maxValue;
this.minValue = minValue;
this.key = key;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public String getId() {
return id;
}
public String getId() {
return id;
}
public double getDefaultValue() {
return defaultValue;
}
public double getDefaultValue() {
return defaultValue;
}
public int getMaxValue() {
return maxValue;
}
public int getMaxValue() {
return maxValue;
}
public int getMinValue() {
return minValue;
}
public int getMinValue() {
return minValue;
}
@SuppressWarnings("SameReturnValue")
public PersistentDataType<Double, Double> getType() {
return PersistentDataType.DOUBLE;
}
@SuppressWarnings("SameReturnValue")
public PersistentDataType<Double, Double> getType() {
return PersistentDataType.DOUBLE;
}
public NamespacedKey getKey() {
return key;
}
public NamespacedKey getKey() {
return key;
}
}