more work on the spears update

This commit is contained in:
nossr50
2025-12-13 11:55:13 -08:00
parent 1664ca005d
commit 4f01439892
12 changed files with 70 additions and 14 deletions

View File

@@ -1,21 +1,20 @@
Version 2.2.046
TODO: Test FlatFile DB
TODO: Double check locale
TODO: Double check plugin.yml permissions
TODO: Add notes about permission nodes
TODO: Investigate when right click air sends events for offhand
TODO: Unarmed XP gained from spear offhand interactions
Added Spears combat skill
Added Spears to repair.vanilla.yml and salvage.vanilla.yml (see notes)
Added permissions related to Spears
Added /spears skill command
Added Nautilus to taming XP in experience.yml
Fixed bug where converting from SQL to FlatFile would not copy data for tridents, crossbows, maces, or spears
(Codebase) Added dockerized unit tests for SQL databases (See notes)
(Codebase) Added dockerized unit tests for SQL databases (see notes)
(Codebase) Large refactor to both SQLDatabaseManager and FlatFileDatabaseManager
(Codebase) Database related errors are now more descriptive and have had their logging improved
NOTES:
You will need to manually update repair.vanilla.yml and salvage.vanilla.yml to get support for Spears.
Or you can delete these config files to have mcMMO regenerate them with the new entries.
You can find the default config files in the defaults folder at plugins\mcMMO\defaults after running this mcMMO update at least once.
You will need to manually update repair.vanilla.yml and salvage.vanilla.yml to get support for Spears, or...
If you want to update salvage/repair configs the easy way, you simply can delete these config files to have mcMMO regenerate them with the new entries.
If you don't want to delete them, you can find the default values for these config files in the defaults folder at plugins\mcMMO\defaults after running this mcMMO update at least once.
You can use this default file to copy paste if you please.
If you compile mcMMO you will likely run into errors during unit tests for SQL databases, this is because they now rely on docker being present on the system to load up test containers.
New SQL database unit tests have been added which leverage test containers to test against real installs of MySQL/MariaDB, which require Docker (or an equivalent) to run.

View File

@@ -16,7 +16,7 @@
<properties>
<!-- <spigot.version>1.19-R0.1-SNAPSHOT</spigot.version>-->
<spigot.version>1.21.10-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.21.11-R0.1-SNAPSHOT</spigot.version>
<kyori.adventure.version>4.23.0</kyori.adventure.version>
<kyori.adventure.platform.version>4.4.1-SNAPSHOT</kyori.adventure.platform.version>
<kyori.option.version>1.1.0</kyori.option.version>

View File

@@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.skills;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.SPEARS_MOMENTUM;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.SPEARS_SPEARS_LIMIT_BREAK;
import static com.gmail.nossr50.datatypes.skills.SubSkillType.SPEARS_SPEAR_MASTERY;
import static com.gmail.nossr50.util.skills.SkillUtils.canUseSubskill;
import static com.gmail.nossr50.util.text.TextComponentFactory.appendSubSkillTextComponents;
@@ -10,6 +11,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.spears.SpearsManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
@@ -46,6 +48,9 @@ public class SpearsCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance,
boolean isLucky) {
final SpearsManager spearsManager = UserManager.getPlayer(player).getSpearsManager();
final double spearMasteryBonusDmg = spearsManager.getSpearMasteryBonusDamage();
List<String> messages = new ArrayList<>();
if (canUseSubskill(player, SPEARS_SPEARS_LIMIT_BREAK)) {
@@ -54,6 +59,11 @@ public class SpearsCommand extends SkillCommand {
SPEARS_SPEARS_LIMIT_BREAK, 1000))));
}
if (canUseSubskill(player, SPEARS_SPEAR_MASTERY)) {
messages.add(getStatMessage(SPEARS_SPEAR_MASTERY,
String.valueOf(spearMasteryBonusDmg)));
}
if (SkillUtils.canUseSubskill(player, SPEARS_MOMENTUM)) {
messages.add(getStatMessage(SPEARS_MOMENTUM, momentumChanceToApply)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus",

View File

@@ -894,4 +894,8 @@ public class AdvancedConfig extends BukkitConfig {
return config.getDouble("Skills.Spears.Momentum.Chance_To_Apply_On_Hit.Rank_" + rank,
defaultMomentumValues[rank - 1]);
}
public double getSpearMasteryRankDamageMultiplier() {
return config.getDouble("Skills.Spears.SpearMastery.Rank_Damage_Multiplier", 0.4D);
}
}

View File

@@ -86,6 +86,7 @@ public enum SubSkillType {
/* Spears */
SPEARS_SPEARS_LIMIT_BREAK(10),
SPEARS_MOMENTUM(10),
SPEARS_SPEAR_MASTERY(8),
/* Swords */
SWORDS_COUNTER_ATTACK(1),

View File

@@ -168,6 +168,7 @@ public class PlayerListener implements Listener {
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
return;
}
// world guard main flag check
if (WorldGuardUtils.isWorldGuardLoaded() && !WorldGuardManager.getInstance()
.hasMainFlag((Player) event.getEntity())) {
@@ -342,8 +343,8 @@ public class PlayerListener implements Listener {
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
switch (event.getState()) {
// CAUGHT_FISH happens for any item caught (including junk and treasure)
case CAUGHT_FISH:
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE
if (event.getCaught() != null) {
Item fishingCatch = (Item) event.getCaught();
@@ -675,6 +676,10 @@ public class PlayerListener implements Listener {
*/
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerInteractLowest(PlayerInteractEvent event) {
if (event.getAction() == Action.PHYSICAL) {
return;
}
/* WORLD BLACKLIST CHECK */
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
return;
@@ -817,6 +822,10 @@ public class PlayerListener implements Listener {
*/
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
if (event.getAction() == Action.PHYSICAL) {
return;
}
/* WORLD BLACKLIST CHECK */
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
return;

View File

@@ -113,4 +113,9 @@ public class SpearsManager extends SkillManager {
return false;
}
public double getSpearMasteryBonusDamage() {
return mcMMO.p.getAdvancedConfig().getSpearMasteryRankDamageMultiplier()
* getRank(getPlayer(), SubSkillType.SPEARS_SPEAR_MASTERY);
}
}

View File

@@ -649,6 +649,8 @@ Skills:
Rank_3: 20
Rank_4: 33
Spears:
SpearMastery:
Rank_Damage_Multiplier: 0.4
Momentum:
Chance_To_Apply_On_Hit:
Rank_1: 5

View File

@@ -606,6 +606,7 @@ Experience_Values:
Goat: 250
Axolotl: 600
Frog: 900
Nautilus: 1700
Combat:
Multiplier:
Animals: 1.0

View File

@@ -486,10 +486,13 @@ Spears.SubSkill.SpearsLimitBreak.Description=Breaking your limits. Increased dam
Spears.SubSkill.SpearsLimitBreak.Stat=Limit Break Max DMG
Spears.SubSkill.SpearAbility.Name=WIP
Spears.SubSkill.Momentum.Name=Momentum
Spears.SubSkill.Momentum.Description=Adds a chance to increase movement speed when attacking.
Spears.SubSkill.Momentum.Description=Adds a chance to increase movement speed for a short duration when attacking.
Spears.SubSkill.Momentum.Stat=Momentum Chance
Spears.SubSkill.Momentum.Stat.Extra=[[DARK_AQUA]]Momentum Duration: &e{0}s
Spears.SubSkill.Momentum.Activated=MOMENTUM ACTIVATED!
Spears.SubSkill.SpearMastery.Name=Spear Mastery
Spears.SubSkill.SpearMastery.Description=Adds bonus damage to your attacks.
Spears.SubSkill.SpearMastery.Stat=Spear Mastery Bonus DMG
Spears.Listener=Spears:
#SWORDS

View File

@@ -660,10 +660,13 @@ permissions:
children:
mcmmo.ability.spears.spearslimitbreak: true
mcmmo.ability.spears.momentum: true
mcmmo.ability.spears.spearmastery: true
mcmmo.ability.spears.spearslimitbreak:
description: Adds damage to spears
mcmmo.ability.spears.momentum:
description: Adds a chance to increase movement speed temporarily after hitting an entity
description: Allows access to the Spear Momentum ability
mcmmo.ability.spears.spearmastery:
description: Allows access to the Spear Mastery ability
mcmmo.ability.swords.*:
default: false
description: Allows access to all Swords abilities

View File

@@ -428,6 +428,25 @@ Spears:
Rank_8: 800
Rank_9: 900
Rank_10: 1000
SpearMastery:
Standard:
Rank_1: 5
Rank_2: 15
Rank_3: 30
Rank_4: 45
Rank_5: 60
Rank_6: 75
Rank_7: 90
Rank_8: 100
RetroMode:
Rank_1: 50
Rank_2: 150
Rank_3: 300
Rank_4: 450
Rank_5: 600
Rank_6: 750
Rank_7: 900
Rank_8: 1000
Momentum:
Standard:
Rank_1: 1
@@ -439,7 +458,7 @@ Spears:
Rank_7: 50
Rank_8: 60
Rank_9: 80
Rank_10: 100
Rank_10: 95
RetroMode:
Rank_1: 1
Rank_2: 100
@@ -450,7 +469,7 @@ Spears:
Rank_7: 500
Rank_8: 600
Rank_9: 800
Rank_10: 1000
Rank_10: 950
Salvage:
ScrapCollector:
Standard: