Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
<parent>
<groupId>studio.magemonkey</groupId>
<artifactId>magemonkey-parent</artifactId>
<version>1.21.11-R2</version>
<version>1.21.11-R1</version>
</parent>

<artifactId>divinity</artifactId>
<version>1.0.2-R0.66-SNAPSHOT</version>
<version>1.0.2-R0.57-SNAPSHOT</version>
<name>Divinity</name>
<description>Custom items, combat, and more!</description>

<properties>
<codex.version>1.1.1-R1</codex.version>
<fabled.version>1.0.4-R0.76-SNAPSHOT</fabled.version>
<codex.version>1.1.1-R0.17-SNAPSHOT</codex.version>
<fabled.version>1.0.4-R0.90-SNAPSHOT</fabled.version>
</properties>

<repositories>
Expand All @@ -39,10 +39,6 @@
<id>neetgames</id>
<url>https://nexus.neetgames.com/repository/maven-releases/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
Expand Down Expand Up @@ -73,7 +69,7 @@
<scope>compile</scope>
</dependency>

<!-- VoidEdge -->
<!-- MageMonkeyStudio -->
<dependency>
<groupId>studio.magemonkey</groupId>
<artifactId>codex</artifactId>
Expand Down Expand Up @@ -145,7 +141,7 @@
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.2.051</version>
<version>2.2.049</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand Down Expand Up @@ -260,9 +256,9 @@

<developers>
<developer>
<name>VoidEdge</name>
<organization>VoidEdge</organization>
<organizationUrl>https://void.travja.dev</organizationUrl>
<name>MageMonkeyStudio</name>
<organization>MageMonkeyStudio</organization>
<organizationUrl>https://magemonkey.studio</organizationUrl>
</developer>
</developers>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/studio/magemonkey/divinity/Divinity.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/**
* Divinity
*
* @author © 2026 VoidEdge
* @author ©2025 MageMonkeyStudio
*/
public class Divinity extends CodexDataPlugin<Divinity, DivinityUser> {

Expand Down
20 changes: 1 addition & 19 deletions src/main/java/studio/magemonkey/divinity/Perms.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package studio.magemonkey.divinity;

import org.bukkit.permissions.Permissible;
import org.jetbrains.annotations.NotNull;
import studio.magemonkey.divinity.modules.api.socketing.ModuleSocket;

public class Perms {

private static final String PREFIX = "quantumrpg.";
private static final String DIVINITY = "divinity.";
private static final String PREFIX = "quantumrpg.";

public static final String USER = PREFIX + "user";
public static final String ADMIN = PREFIX + "admin";
Expand Down Expand Up @@ -100,20 +98,4 @@ public static String getSocketGuiUser(@NotNull ModuleSocket<?> module) {
public static String getSocketGuiMerchant(@NotNull ModuleSocket<?> module) {
return SOCKET_GUI_MERCHANT.replace("%module%", module.getId());
}

/**
* Checks whether the permissible has the given permission, accepting both
* the legacy {@code quantumrpg.*} namespace and the current {@code divinity.*}
* namespace as equivalent.
*/
public static boolean has(@NotNull Permissible permissible, @NotNull String permission) {
if (permissible.hasPermission(permission)) return true;
if (permission.startsWith(PREFIX)) {
return permissible.hasPermission(DIVINITY + permission.substring(PREFIX.length()));
}
if (permission.startsWith(DIVINITY)) {
return permissible.hasPermission(PREFIX + permission.substring(DIVINITY.length()));
}
return false;
}
}
118 changes: 110 additions & 8 deletions src/main/java/studio/magemonkey/divinity/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import studio.magemonkey.divinity.stats.items.attributes.api.TypedStat;
import studio.magemonkey.divinity.stats.items.attributes.stats.BleedStat;
import studio.magemonkey.divinity.stats.items.attributes.stats.DurabilityStat;
import studio.magemonkey.divinity.stats.items.attributes.stats.DynamicBuffStat;
import studio.magemonkey.divinity.stats.items.attributes.stats.PenetrationStat;
import studio.magemonkey.divinity.stats.tiers.Tier;
import studio.magemonkey.divinity.types.ItemGroup;
import studio.magemonkey.divinity.types.ItemSubType;
Expand Down Expand Up @@ -69,6 +71,9 @@ public void setupAttributes() {
this.setupDamages();
this.setupDefense();
this.setupStats();
this.setupDamageBuffs();
this.setupDefenseBuffs();
this.setupPenetrations();
this.setupHand();
this.setupAmmo();
this.setupSockets();
Expand Down Expand Up @@ -174,20 +179,14 @@ private void setupDefense() {
private void setupStats() {
JYML cfg;
try {
cfg = JYML.loadOrExtract(plugin, "/item_stats/stats.yml");
cfg = JYML.loadOrExtract(plugin, "/item_stats/stats/general_stats.yml");
} catch (InvalidConfigurationException e) {
this.plugin.error("Failed to load stats config (" + this.plugin.getName()
+ "/item_stats/stats.yml): Configuration error");
+ "/item_stats/stats/general_stats.yml): Configuration error");
e.printStackTrace();
return;
}

cfg.addMissing("ARMOR_TOUGHNESS.enabled", true);
cfg.addMissing("ARMOR_TOUGHNESS.name", "Armor Toughness");
cfg.addMissing("ARMOR_TOUGHNESS.format", "&9▸ %name%: &f%value% %condition%");
cfg.addMissing("ARMOR_TOUGHNESS.capacity", 100.0);
cfg.save();

for (SimpleStat.Type statType : TypedStat.Type.values()) {
String path2 = statType.name() + ".";
if (!cfg.getBoolean(path2 + "enabled")) {
Expand All @@ -214,6 +213,109 @@ private void setupStats() {
}
}

private void setupDamageBuffs() {
JYML cfg;
try {
cfg = JYML.loadOrExtract(plugin, "/item_stats/stats/damage_buffs_percent.yml");
} catch (InvalidConfigurationException e) {
this.plugin.error("Failed to load damage_buffs_percent config: Configuration error");
e.printStackTrace();
return;
}

for (DamageAttribute dmg : ItemStats.getDamages()) {
String id = dmg.getId();
String path = id + ".";
cfg.addMissing(path + "enabled", true);
cfg.addMissing(path + "name", dmg.getName() + " Buff %");
cfg.addMissing(path + "format", "&3▸ %name%: &f%value%%condition%");
cfg.addMissing(path + "capacity", -1.0);
cfg.addMissing(path + "hook", Collections.singletonList(id));
}
cfg.saveChanges();

for (String buffId : cfg.getSection("")) {
if (!cfg.getBoolean(buffId + ".enabled")) continue;
String name = StringUT.color(cfg.getString(buffId + ".name", buffId));
String format = StringUT.color(cfg.getString(buffId + ".format", "&3▸ %name%: &f%value%"));
double cap = cfg.getDouble(buffId + ".capacity", -1D);
Set<String> hooks = new HashSet<>(cfg.getStringList(buffId + ".hook"));

DynamicBuffStat buff = new DynamicBuffStat(
DynamicBuffStat.BuffTarget.DAMAGE, buffId, name, format, hooks, cap);
ItemStats.registerDamageBuff(buff);
}
}

private void setupDefenseBuffs() {
JYML cfg;
try {
cfg = JYML.loadOrExtract(plugin, "/item_stats/stats/defense_buffs_percent.yml");
} catch (InvalidConfigurationException e) {
this.plugin.error("Failed to load defense_buffs_percent config: Configuration error");
e.printStackTrace();
return;
}

for (DefenseAttribute def : ItemStats.getDefenses()) {
String id = def.getId();
String path = id + ".";
cfg.addMissing(path + "enabled", true);
cfg.addMissing(path + "name", def.getName() + " Buff %");
cfg.addMissing(path + "format", "&9▸ %name%: &f%value%%condition%");
cfg.addMissing(path + "capacity", -1.0);
cfg.addMissing(path + "hook", Collections.singletonList(id));
}
cfg.saveChanges();

for (String buffId : cfg.getSection("")) {
if (!cfg.getBoolean(buffId + ".enabled")) continue;
String name = StringUT.color(cfg.getString(buffId + ".name", buffId));
String format = StringUT.color(cfg.getString(buffId + ".format", "&9▸ %name%: &f%value%"));
double cap = cfg.getDouble(buffId + ".capacity", -1D);
Set<String> hooks = new HashSet<>(cfg.getStringList(buffId + ".hook"));

DynamicBuffStat buff = new DynamicBuffStat(
DynamicBuffStat.BuffTarget.DEFENSE, buffId, name, format, hooks, cap);
ItemStats.registerDefenseBuff(buff);
}
}

private void setupPenetrations() {
JYML cfg;
try {
cfg = JYML.loadOrExtract(plugin, "/item_stats/stats/penetration.yml");
} catch (InvalidConfigurationException e) {
this.plugin.error("Failed to load penetration config: Configuration error");
e.printStackTrace();
return;
}

// Auto-generate a flat-pen entry for every registered damage type (if missing)
for (DamageAttribute dmg : ItemStats.getDamages()) {
String id = dmg.getId() + "_pen";
String path = id + ".";
cfg.addMissing(path + "enabled", true);
cfg.addMissing(path + "name", dmg.getName() + " Penetration");
cfg.addMissing(path + "format", "&c▸ %name%: &f%value%%condition%");
cfg.addMissing(path + "capacity", -1.0);
cfg.addMissing(path + "percent-pen", false);
cfg.addMissing(path + "hooks", Collections.singletonList(dmg.getId()));
}
cfg.saveChanges();

for (String penId : cfg.getSection("")) {
if (!cfg.getBoolean(penId + ".enabled")) continue;
String name = StringUT.color(cfg.getString(penId + ".name", penId));
String format = StringUT.color(cfg.getString(penId + ".format", "&c▸ %name%: &f%value%"));
double cap = cfg.getDouble(penId + ".capacity", -1D);
boolean percentPen = cfg.getBoolean(penId + ".percent-pen", false);
Set<String> hooks = new HashSet<>(cfg.getStringList(penId + ".hooks"));

new PenetrationStat(penId, name, format, hooks, percentPen, cap);
}
}

private void setupHand() {
JYML cfg;
try {
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/studio/magemonkey/divinity/config/EngineCfg.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public EngineCfg(@NotNull Divinity plugin) throws InvalidConfigurationException
public static boolean ATTRIBUTES_ALLOW_HOLD_REQUIREMENTS;

public static boolean ATTRIBUTES_DURABILITY_BREAK_ITEMS;
public static boolean ATTRIBUTES_HIDE_FLAGS;
public static boolean ATTRIBUTES_DURABILITY_REDUCE_FOR_MOBS;
public static Set<String> ATTRIBUTES_DURABILITY_REDUCE_FOR_SKILL_API;

Expand All @@ -56,6 +57,11 @@ public EngineCfg(@NotNull Divinity plugin) throws InvalidConfigurationException
public static double COMBAT_SHIELD_BLOCK_BONUS_DAMAGE_MOD;
public static int COMBAT_SHIELD_BLOCK_COOLDOWN;
public static boolean LEGACY_COMBAT;
public static String DEFENSE_FORMULA_MODE;
public static String CUSTOM_DEFENSE_FORMULA;
public static boolean COMBAT_OVERFLOW_PEN_AMPLIFIES;
public static String COMBAT_OVERFLOW_PEN_FORMULA;
public static boolean FULL_LEGACY;
public static boolean COMBAT_DISABLE_VANILLA_SWEEP;
public static boolean COMBAT_REDUCE_PLAYER_HEALTH_BAR;
public static boolean COMBAT_FISHING_HOOK_DO_DAMAGE;
Expand Down Expand Up @@ -108,8 +114,9 @@ public EngineCfg(@NotNull Divinity plugin) throws InvalidConfigurationException
public static String LORE_STYLE_REQ_ITEM_MODULE_FORMAT_SEPAR;
public static String LORE_STYLE_REQ_ITEM_MODULE_FORMAT_COLOR;

public static String LORE_STYLE_ENCHANTMENTS_FORMAT_MAIN;
public static int LORE_STYLE_ENCHANTMENTS_FORMAT_MAX_ROMAN;
public static String LORE_STYLE_ENCHANTMENTS_FORMAT_MAIN;
public static int LORE_STYLE_ENCHANTMENTS_FORMAT_MAX_ROMAN;
public static boolean LORE_STYLE_ENCHANTMENTS_ROMAN_SYSTEM;

public static String LORE_STYLE_FABLED_ATTRIBUTE_FORMAT;

Expand Down Expand Up @@ -177,6 +184,7 @@ public void setup() {
EngineCfg.ATTRIBUTES_EFFECTIVE_FOR_MOBS = cfg.getBoolean(path + "effective-for-mobs");
EngineCfg.ATTRIBUTES_EFFECTIVE_IN_OFFHAND = cfg.getBoolean(path + "effective-in-offhand");
EngineCfg.ATTRIBUTES_ALLOW_HOLD_REQUIREMENTS = cfg.getBoolean(path + "allow-hold-items-you-cant-use");
EngineCfg.ATTRIBUTES_HIDE_FLAGS = cfg.getBoolean(path + "hide-flags");

path = "attributes.durability.";
EngineCfg.ATTRIBUTES_DURABILITY_BREAK_ITEMS = cfg.getBoolean(path + "break-items-on-zero");
Expand Down Expand Up @@ -208,6 +216,10 @@ public void setup() {

path = "combat.";
EngineCfg.LEGACY_COMBAT = cfg.getBoolean(path + "legacy-combat", false);
EngineCfg.DEFENSE_FORMULA_MODE = cfg.getString(path + "defense-formula", "FACTOR").toUpperCase();
EngineCfg.CUSTOM_DEFENSE_FORMULA = cfg.getString(path + "custom-defense-formula", "damage*(25/(25+defense))");
EngineCfg.COMBAT_OVERFLOW_PEN_AMPLIFIES = cfg.getBoolean(path + "overflow-pen-amplifies", false);
EngineCfg.COMBAT_OVERFLOW_PEN_FORMULA = cfg.getString(path + "overflow-pen-formula", "damage*(overflow/100)");
EngineCfg.COMBAT_DISABLE_VANILLA_SWEEP = cfg.getBoolean(path + "disable-vanilla-sweep-attack");
EngineCfg.COMBAT_REDUCE_PLAYER_HEALTH_BAR = cfg.getBoolean(path + "compress-player-health-bar");
EngineCfg.COMBAT_FISHING_HOOK_DO_DAMAGE = cfg.getBoolean(path + "fishing-hook-do-damage");
Expand Down Expand Up @@ -415,9 +427,11 @@ public void setup() {
path = "lore.stats.style.enchantments.";
cfg.addMissing(path + "format.main", "&c▸ %name% %value%");
cfg.addMissing(path + "format.max-roman", 10);
cfg.addMissing(path + "roman-system", true);
EngineCfg.LORE_STYLE_ENCHANTMENTS_FORMAT_MAIN =
StringUT.color(cfg.getString(path + "format.main", "&c▸ %name% %value%"));
EngineCfg.LORE_STYLE_ENCHANTMENTS_FORMAT_MAX_ROMAN = cfg.getInt(path + "format.max-roman", 10);
EngineCfg.LORE_STYLE_ENCHANTMENTS_ROMAN_SYSTEM = cfg.getBoolean(path + "roman-system", true);

path = "lore.stats.style.fabled-attribute-format";
cfg.addMissing(path, "&7%attrPre%&3%name%&7%attrPost%");
Expand Down
Loading
Loading