feat: fishing gameplay - #32
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe plugin replaces command registration with a shared framework, adds and migrates commands, expands fishing content and item behavior, configures Iron Golem AI, adds block-break ability handling, and updates build metadata and player-facing formatting. ChangesCommand system
Content expansion
Ability event handling
Project maintenance
Estimated code review effort: 5 (Critical) | ~120 minutes Mergeability Score: 🔵 Low · up to The fishing gameplay changes can cause an ability exception to cancel an interaction even when normal block-breaking behavior would otherwise be preserved. This is a bounded behavior risk that is mergeable with explicit owner awareness or a documented cancellation policy. Sequence Diagram(s)sequenceDiagram
participant Player
participant BlightedMC
participant CommandsRegistry
participant CommandRegistrar
participant AdminCommand
Player->>BlightedMC: plugin startup
BlightedMC->>CommandsRegistry: register(plugin)
CommandsRegistry->>CommandRegistrar: register(command, executor)
CommandRegistrar->>AdminCommand: assign executor
Player->>AdminCommand: execute command
AdminCommand->>AdminCommand: validate player and permission
AdminCommand-->>Player: execute command behavior
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/main/java/fr/moussax/blightedMC/utils/Formatter.java (1)
155-161: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate the
inform(List<String>)Javadoc.The implementation now sends messages without a prefix, but the Javadoc still promises a gray prefix.
Proposed fix
- * Sends informational messages to a command sender with a gray prefix. + * Sends informational messages to a command sender without a prefix.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/fr/moussax/blightedMC/utils/Formatter.java` around lines 155 - 161, Update the Javadoc for Formatter.inform(CommandSender, List<String>) to remove the inaccurate claim that messages include a gray prefix, and describe that it sends the provided messages directly to the command sender.src/main/java/fr/moussax/blightedMC/commands/impl/TeleportPositionCommand.java (1)
66-78: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winHandle a failed teleport.
Entity#teleport(Location)returnsfalsewhen cancellation or server conditions prevent the teleport. Check this return value and show failure feedback instead of posting success messages and playing the success sound.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/fr/moussax/blightedMC/commands/impl/TeleportPositionCommand.java` around lines 66 - 78, Check the boolean result of target.teleport(location) in the TeleportPositionCommand flow before sending success messages or playing the teleport sound. If it returns false, provide failure feedback and exit without executing the existing success branch; retain the current messaging and sound behavior only for successful teleports.src/main/java/fr/moussax/blightedMC/commands/impl/GiveItemCommand.java (1)
45-58: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winHandle unknown item IDs before formatting the success message.
ItemRegistry.getItem(itemId)throwsIllegalArgumentExceptionfor unknown ids, so a simple typo ingaveitem <player> <id>is not converted into the warning shown at line 41. Catch the lookup failure, send a warning toplayer, and returnfalsebeforetarget.getInventory().addItem(stack)at line 60.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/fr/moussax/blightedMC/commands/impl/GiveItemCommand.java` around lines 45 - 58, Update GiveItemCommand around ItemRegistry.getItem(itemId) to catch IllegalArgumentException for unknown item IDs, warn player with an appropriate invalid-item message, and return false before creating or adding the ItemStack; preserve the existing amount validation and successful give flow.
🧹 Nitpick comments (4)
src/main/java/fr/moussax/blightedMC/commands/impl/GiveItemCommand.java (1)
17-20: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTab completion never suggests items at position 0 for self-give.
The command treats
args[0]as an item id whenever it does not resolve to an online player (Lines 34-38), yet@CommandArgument(position = 0, ...)only listssuggestions = {"$players"}. Self-give usage (/give <item>) has no item tab-completion at position 0.Also applies to: 31-38
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/fr/moussax/blightedMC/commands/impl/GiveItemCommand.java` around lines 17 - 20, Update the `@CommandArguments` declaration for GiveItemCommand so position 0 includes both player and item suggestions, matching the command logic that treats an unresolved first argument as an item id for self-give; leave position 1’s item suggestions unchanged.src/main/java/fr/moussax/blightedMC/commands/impl/FlyCommand.java (1)
16-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueToggle-off branches bypass the shared
Formatterhelpers.
FlyCommandandGodCommandboth useFormatter.text(...).send(player)for the ON branch but callplayer.sendMessage(...)directly for the OFF branch. The shared root cause is the same duplicated toggle pattern in both files.
src/main/java/fr/moussax/blightedMC/commands/impl/FlyCommand.java#L16-L26: route the OFF branch oftoggleFlightModethroughFormatter.informorFormatter.text(...).send(player)instead ofplayer.sendMessage(...).src/main/java/fr/moussax/blightedMC/commands/impl/GodCommand.java#L16-L26: route the OFF branch oftoggleGodModethroughFormatter.informorFormatter.text(...).send(player)instead ofplayer.sendMessage(...).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/fr/moussax/blightedMC/commands/impl/FlyCommand.java` around lines 16 - 26, Route the toggle-off notification through the shared Formatter helpers instead of calling player.sendMessage directly. Update toggleFlightMode in src/main/java/fr/moussax/blightedMC/commands/impl/FlyCommand.java lines 16-26 and toggleGodMode in src/main/java/fr/moussax/blightedMC/commands/impl/GodCommand.java lines 16-26, using Formatter.inform or Formatter.text(...).send(player), while preserving the existing OFF message.src/main/java/fr/moussax/blightedMC/content/fishing/OverworldFishing.java (1)
51-51: 📐 Maintainability & Code Quality | 🔵 TrivialResolve the TODO before merging fishing gameplay.
The comment
// TODO : Finish the fishing modssignals unfinished work in a file this PR adds as part of the fishing feature. State what remains, or remove the comment if the table is complete.Do you want me to open an issue to track the remaining fishing-mob work?
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/fr/moussax/blightedMC/content/fishing/OverworldFishing.java` at line 51, Resolve the unfinished-work marker in OverworldFishing by completing the remaining fishing-mob implementation and documenting what is still missing, or remove the “Finish the fishing mods” TODO when the fishing table is complete. Ensure the final state accurately reflects the implementation status before merging.src/main/java/fr/moussax/blightedMC/engine/items/rules/ItemRuleListener.java (1)
98-105: 📐 Maintainability & Code Quality | 🔵 TrivialMove item-specific consume effects out of the generic rule listener.
onItemConsumenow hardcodes"FISHERMANS_STEW"and"BLIGHTED_SUSHI"string literals to decide which potion effects to apply. This duplicates the item IDs already declared inFishingMaterials.javawith no compiler link between the two. If an ID changes there, this listener silently stops applying the effect.Consider modeling consume effects as data on
BlightedItem(for example a list ofPotionEffectsuppliers applied on successful consume) soItemRuleListenerstays generic and item behavior lives with the item definition.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/fr/moussax/blightedMC/engine/items/rules/ItemRuleListener.java` around lines 98 - 105, Move the FISHERMANS_STEW and BLIGHTED_SUSHI consume-effect definitions from ItemRuleListener.onItemConsume into BlightedItem data, using the existing item definitions in FishingMaterials.java and PotionEffect suppliers or equivalent. Update onItemConsume to apply configured effects generically after a successful consume, removing the hardcoded item ID checks while preserving each item’s durations, amplifiers, and random sushi hunger effect.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Line 32: Update the Spigot BuildTools link in the README download instruction
to replace the vague “here” link text with descriptive text identifying the
BuildTools documentation, while preserving the existing URL and sentence
meaning.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/ButcherCommand.java`:
- Around line 27-39: Validate the parsed radius in ButcherCommand before the
existing positive-value check by requiring Double.isFinite(radius). Reject NaN
and positive or negative infinity through the same invalid-radius warning and
return path, while preserving the current handling for finite non-positive
values.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/GemsCommand.java`:
- Around line 21-30: Update the usage strings in GemsCommand’s
CommandFormatter.sendCommands call so amount is shown as required with angle
brackets for gems add, remove, set, and giveall. Keep the existing player and
command descriptions unchanged, matching the validation behavior in
handleModify, handleSet, and handleGiveAll.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/LoopCommand.java`:
- Around line 54-59: Update the nested-loop check in LoopCommand by normalizing
commandToExecute’s case before testing its “loop ” prefix, so commands such as
“LOOP” are rejected while preserving the existing warning and return behavior.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/SpeedCommand.java`:
- Around line 40-53: Update applySpeed so intensity 1 uses the normal fly-speed
baseline of 0.1f when flying, while retaining the existing 0.2f walking baseline
and all other intensity mappings. Keep the reset notification behavior
unchanged.
In `@src/main/java/fr/moussax/blightedMC/content/utils/ai/GolemAI.java`:
- Line 20: Wire GolemAI.init into the Iron Golem lifecycle by invoking it when
an Iron Golem is spawned, attached, or configured, using the existing lifecycle
hook such as onConfigureAI or attachToExisting. Ensure every relevant Iron Golem
instance receives the custom goals; otherwise remove the unused GolemAI
implementation.
In `@src/main/resources/plugin.yml`:
- Around line 46-49: Add short descriptions to the god, butcher, speed, and fly
command entries in plugin.yml, matching the concise style of the other command
definitions so Bukkit help output includes each command’s purpose.
---
Outside diff comments:
In `@src/main/java/fr/moussax/blightedMC/commands/impl/GiveItemCommand.java`:
- Around line 45-58: Update GiveItemCommand around ItemRegistry.getItem(itemId)
to catch IllegalArgumentException for unknown item IDs, warn player with an
appropriate invalid-item message, and return false before creating or adding the
ItemStack; preserve the existing amount validation and successful give flow.
In
`@src/main/java/fr/moussax/blightedMC/commands/impl/TeleportPositionCommand.java`:
- Around line 66-78: Check the boolean result of target.teleport(location) in
the TeleportPositionCommand flow before sending success messages or playing the
teleport sound. If it returns false, provide failure feedback and exit without
executing the existing success branch; retain the current messaging and sound
behavior only for successful teleports.
In `@src/main/java/fr/moussax/blightedMC/utils/Formatter.java`:
- Around line 155-161: Update the Javadoc for Formatter.inform(CommandSender,
List<String>) to remove the inaccurate claim that messages include a gray
prefix, and describe that it sends the provided messages directly to the command
sender.
---
Nitpick comments:
In `@src/main/java/fr/moussax/blightedMC/commands/impl/FlyCommand.java`:
- Around line 16-26: Route the toggle-off notification through the shared
Formatter helpers instead of calling player.sendMessage directly. Update
toggleFlightMode in
src/main/java/fr/moussax/blightedMC/commands/impl/FlyCommand.java lines 16-26
and toggleGodMode in
src/main/java/fr/moussax/blightedMC/commands/impl/GodCommand.java lines 16-26,
using Formatter.inform or Formatter.text(...).send(player), while preserving the
existing OFF message.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/GiveItemCommand.java`:
- Around line 17-20: Update the `@CommandArguments` declaration for
GiveItemCommand so position 0 includes both player and item suggestions,
matching the command logic that treats an unresolved first argument as an item
id for self-give; leave position 1’s item suggestions unchanged.
In `@src/main/java/fr/moussax/blightedMC/content/fishing/OverworldFishing.java`:
- Line 51: Resolve the unfinished-work marker in OverworldFishing by completing
the remaining fishing-mob implementation and documenting what is still missing,
or remove the “Finish the fishing mods” TODO when the fishing table is complete.
Ensure the final state accurately reflects the implementation status before
merging.
In
`@src/main/java/fr/moussax/blightedMC/engine/items/rules/ItemRuleListener.java`:
- Around line 98-105: Move the FISHERMANS_STEW and BLIGHTED_SUSHI consume-effect
definitions from ItemRuleListener.onItemConsume into BlightedItem data, using
the existing item definitions in FishingMaterials.java and PotionEffect
suppliers or equivalent. Update onItemConsume to apply configured effects
generically after a successful consume, removing the hardcoded item ID checks
while preserving each item’s durations, amplifiers, and random sushi hunger
effect.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 99eb1b58-3ad8-4c96-9c34-83d81c9cf8a8
📒 Files selected for processing (55)
.github/workflows/maven.ymlREADME.mdsrc/main/java/fr/moussax/blightedMC/BlightedMC.javasrc/main/java/fr/moussax/blightedMC/commands/AdminCommand.javasrc/main/java/fr/moussax/blightedMC/commands/AltarCommand.javasrc/main/java/fr/moussax/blightedMC/commands/CommandRegistrar.javasrc/main/java/fr/moussax/blightedMC/commands/CraftCommand.javasrc/main/java/fr/moussax/blightedMC/commands/FlyCommand.javasrc/main/java/fr/moussax/blightedMC/commands/ForgeCommand.javasrc/main/java/fr/moussax/blightedMC/commands/GemsCommand.javasrc/main/java/fr/moussax/blightedMC/commands/PlayerCommand.javasrc/main/java/fr/moussax/blightedMC/commands/SpawnCustomMobCommand.javasrc/main/java/fr/moussax/blightedMC/commands/TestCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/AltarCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/ButcherCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/CraftCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/EnderseeCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/FlyCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/ForgeCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/GamemodeCommands.javasrc/main/java/fr/moussax/blightedMC/commands/impl/GemsCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/GiveItemCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/GodCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/InvseeCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/LoopCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/NightVisionCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/SpawnCustomMobCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/SpeedCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/TeleportPositionCommand.javasrc/main/java/fr/moussax/blightedMC/commands/impl/TestCommand.javasrc/main/java/fr/moussax/blightedMC/commands/see/EnderSeeCommand.javasrc/main/java/fr/moussax/blightedMC/commands/see/InvSeeCommand.javasrc/main/java/fr/moussax/blightedMC/commands/utils/CommandArgument.javasrc/main/java/fr/moussax/blightedMC/commands/utils/CommandArguments.javasrc/main/java/fr/moussax/blightedMC/commands/utils/CommandFormatter.javasrc/main/java/fr/moussax/blightedMC/commands/utils/TabSuggestionBuilder.javasrc/main/java/fr/moussax/blightedMC/commands/utils/TabSuggestionRegistry.javasrc/main/java/fr/moussax/blightedMC/content/fishing/OverworldFishing.javasrc/main/java/fr/moussax/blightedMC/content/fishing/OverworldLavaFishing.javasrc/main/java/fr/moussax/blightedMC/content/items/BlightedItems.javasrc/main/java/fr/moussax/blightedMC/content/items/materials/FishingMaterials.javasrc/main/java/fr/moussax/blightedMC/content/items/materials/NetherMaterials.javasrc/main/java/fr/moussax/blightedMC/content/utils/ai/GolemAI.javasrc/main/java/fr/moussax/blightedMC/engine/items/registry/ItemRegistry.javasrc/main/java/fr/moussax/blightedMC/engine/items/rules/ItemRuleListener.javasrc/main/java/fr/moussax/blightedMC/engine/player/PlayerListener.javasrc/main/java/fr/moussax/blightedMC/registry/CommandsRegistry.javasrc/main/java/fr/moussax/blightedMC/server/PluginSettings.javasrc/main/java/fr/moussax/blightedMC/utils/Formatter.javasrc/main/java/fr/moussax/blightedMC/utils/commands/CommandArgument.javasrc/main/java/fr/moussax/blightedMC/utils/commands/CommandBuilder.javasrc/main/java/fr/moussax/blightedMC/utils/commands/CommandInfo.javasrc/main/java/fr/moussax/blightedMC/utils/commands/TabSuggestionBuilder.javasrc/main/java/fr/moussax/blightedMC/utils/commands/TabSuggestionRegistry.javasrc/main/resources/plugin.yml
💤 Files with no reviewable changes (14)
- src/main/java/fr/moussax/blightedMC/commands/ForgeCommand.java
- src/main/java/fr/moussax/blightedMC/commands/FlyCommand.java
- src/main/java/fr/moussax/blightedMC/commands/AltarCommand.java
- src/main/java/fr/moussax/blightedMC/utils/commands/CommandArgument.java
- src/main/java/fr/moussax/blightedMC/commands/CraftCommand.java
- src/main/java/fr/moussax/blightedMC/utils/commands/TabSuggestionRegistry.java
- src/main/java/fr/moussax/blightedMC/commands/SpawnCustomMobCommand.java
- src/main/java/fr/moussax/blightedMC/utils/commands/CommandBuilder.java
- src/main/java/fr/moussax/blightedMC/utils/commands/CommandInfo.java
- src/main/java/fr/moussax/blightedMC/commands/see/EnderSeeCommand.java
- src/main/java/fr/moussax/blightedMC/commands/GemsCommand.java
- src/main/java/fr/moussax/blightedMC/utils/commands/TabSuggestionBuilder.java
- src/main/java/fr/moussax/blightedMC/commands/see/InvSeeCommand.java
- src/main/java/fr/moussax/blightedMC/commands/TestCommand.java
|
|
||
| ### Server Setup | ||
| * Download and install Spigot's build tools for version `26.1.2` from [here](https://www.spigotmc.org/wiki/buildtools/) | ||
| * Download and install Spigot's build tools for version `26.2` from [here](https://www.spigotmc.org/wiki/buildtools/) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use descriptive link text.
Replace here with text that identifies the BuildTools documentation.
Proposed fix
-* Download and install Spigot's build tools for version `26.2` from [here](https://www.spigotmc.org/wiki/buildtools/)
+* Download and install Spigot's build tools for version `26.2` from [Spigot's BuildTools documentation](https://www.spigotmc.org/wiki/buildtools/)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * Download and install Spigot's build tools for version `26.2` from [here](https://www.spigotmc.org/wiki/buildtools/) | |
| * Download and install Spigot's build tools for version `26.2` from [Spigot's BuildTools documentation](https://www.spigotmc.org/wiki/buildtools/) |
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 32-32: Link text should be descriptive
(MD059, descriptive-link-text)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` at line 32, Update the Spigot BuildTools link in the README
download instruction to replace the vague “here” link text with descriptive text
identifying the BuildTools documentation, while preserving the existing URL and
sentence meaning.
Source: Linters/SAST tools
| try { | ||
| radius = Double.parseDouble(args[0]); | ||
| } catch (NumberFormatException exception) { | ||
| warn(player, "Radius must be a valid number."); | ||
| return true; | ||
| } | ||
|
|
||
| if (radius <= 0) { | ||
| warn(player, "Radius must be greater than 0."); | ||
| return true; | ||
| } | ||
|
|
||
| player.sendMessage(" §eRemoved §d" + butcher(player, radius) + " §eentities in a §b" + Math.round(radius) + " §eblocks radius."); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file='src/main/java/fr/moussax/blightedMC/commands/impl/ButcherCommand.java'
rg -n -C 3 'Double\.parseDouble|Double\.isFinite|radius <= 0' "$file"Repository: MrInspection/BlightedMC
Length of output: 564
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file='src/main/java/fr/moussax/blightedMC/commands/impl/ButcherCommand.java'
echo "FILE LINE COUNT:"
wc -l "$file"
echo
echo "FILE CONTENT:"
cat -n "$file"
echo
echo "RELATED butcher method references:"
rg -n -C 4 '\bbutcher\s*\(|butcher\(player, radius\)|distanceSquared|radiusSquared' src/main/java || trueRepository: MrInspection/BlightedMC
Length of output: 12207
🏁 Script executed:
#!/bin/bash
set -euo pipefail
java -version >/dev/null || true
python3 - <<'PY'
import math
radius = float("nan")
radius_squared = radius * radius
distance_squared_cases = [0.0, 10.0, 1e100]
print("radius_nan:", radius)
print("radius_squared_nan:", radius_squared)
print("radius_nan_le_0:", radius_nan() is False)
print("radius_nan_gt_0:", radius_nan() is False)
for d2 in distance_squared_cases:
print(f"{d2} > radius_squared_nan = {d2 > radius_squared}")
PYRepository: MrInspection/BlightedMC
Length of output: 523
🏁 Script executed:
#!/bin/bash
set -euo pipefail
cat > /tmp/ButcherNaNProbe.java <<'JAVA'
public class ButcherNaNProbe {
public static void main(String[] args) {
double[] inputs = {"NaN", "-NaN", "Infinity", "-Infinity", "0", "5"};
for (String s : inputs) {
try {
double r = Double.parseDouble(s);
boolean passesPositive = 0 < r;
System.out.println(s + " -> parseDouble ok: true, finite: " + Double.isFinite(r) + ", is NaN: " + Double.isNaN(r) + ", positive: " + passesPositive + ", r*r " + (r*r));
} catch (NumberFormatException x) {
System.out.println(s + " -> parseDouble ok: false");
}
}
double radius = Double.parseDouble("NaN");
double radiusSquared = radius * radius;
double[] distancesSquared = {0.0, 10.0, 1e20};
for (double d : distancesSquared) {
System.out.println("distanceSquared=" + d + " > radiusSquared(" + radiusSquared + ") = " + (d > radiusSquared));
}
}
}
JAVA
javac /tmp/ButcherNaNProbe.java
java -cp /tmp ButcherNaNProbeRepository: MrInspection/BlightedMC
Length of output: 205
🌐 Web query:
Java Double.parseDouble NaN Double.parseDouble Infinity documentation
💡 Result:
In Java, the method Double.parseDouble(String s) is designed to parse strings representing floating-point numbers [1][2]. It supports specific string representations for NaN (Not-a-Number) and infinity, meaning these are considered valid inputs rather than errors [3]. When the input string is "NaN", "Infinity", or "-Infinity", Double.parseDouble successfully parses these into their corresponding double values [3]. Specifically: 1. "NaN": Parses to Double.NaN [3]. 2. "Infinity": Parses to Double.POSITIVE_INFINITY [3]. 3. "-Infinity": Parses to Double.NEGATIVE_INFINITY [3]. Because these are considered valid floating-point values according to the IEEE 754 standard, Double.parseDouble does not throw a NumberFormatException for these inputs [1][2][3]. If your application requires that these specific values be treated as invalid, you must explicitly check the result of the parsing operation using methods such as Double.isNaN or Double.isInfinite [1][3].
Citations:
- 1: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Double.html
- 2: https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/lang/Double.html
- 3: https://michaelbfullan.com/the-limitations-of-double-parsedouble/
Reject non-finite radii.
Double.parseDouble("NaN"), "Infinity", and "-Infinity" do not throw. NaN also fails the radius <= 0 check and makes the distance comparison false, so /butcher NaN removes every non-player living entity. Add Double.isFinite(radius) before accepting the radius.
Proposed fix
- if (radius <= 0) {
- warn(player, "Radius must be greater than 0.");
+ if (!Double.isFinite(radius) || radius <= 0) {
+ warn(player, "Radius must be a finite number greater than 0.");
return true;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| try { | |
| radius = Double.parseDouble(args[0]); | |
| } catch (NumberFormatException exception) { | |
| warn(player, "Radius must be a valid number."); | |
| return true; | |
| } | |
| if (radius <= 0) { | |
| warn(player, "Radius must be greater than 0."); | |
| return true; | |
| } | |
| player.sendMessage(" §eRemoved §d" + butcher(player, radius) + " §eentities in a §b" + Math.round(radius) + " §eblocks radius."); | |
| try { | |
| radius = Double.parseDouble(args[0]); | |
| } catch (NumberFormatException exception) { | |
| warn(player, "Radius must be a valid number."); | |
| return true; | |
| } | |
| if (!Double.isFinite(radius) || radius <= 0) { | |
| warn(player, "Radius must be a finite number greater than 0."); | |
| return true; | |
| } | |
| player.sendMessage(" §eRemoved §d" + butcher(player, radius) + " §eentities in a §b" + Math.round(radius) + " §eblocks radius."); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/ButcherCommand.java` around
lines 27 - 39, Validate the parsed radius in ButcherCommand before the existing
positive-value check by requiring Double.isFinite(radius). Reject NaN and
positive or negative infinity through the same invalid-radius warning and return
path, while preserving the current handling for finite non-positive values.
| CommandFormatter.sendCommands( | ||
| player, "COMMANDS", "Gems Currency", | ||
| CommandFormatter.CommandInfo.of("gems add <player> [amount]", "Give gems to a player."), | ||
| CommandFormatter.CommandInfo.of("gems remove <player> [amount]", "Take gems from a player."), | ||
| CommandFormatter.CommandInfo.of("gems set <player> [amount]", "Set gems for a player."), | ||
| CommandFormatter.CommandInfo.of("gems reset <player>", "Reset gems for a player."), | ||
| CommandFormatter.CommandInfo.of("gems giveall [amount]", "Give gems to everyone."), | ||
| CommandFormatter.CommandInfo.of("gems resetall", "Reset everyone's balance."), | ||
| CommandFormatter.CommandInfo.of("gems help", "Prints this help message.") | ||
| ); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Usage text marks required amount as optional.
gems add <player> [amount], gems remove <player> [amount], gems set <player> [amount], and gems giveall [amount] all use square brackets for amount. handleModify (Line 50), handleSet (Line 83), and handleGiveAll (Line 139) each reject a call when amount is missing, so amount is required, not optional. Use angle brackets for amount in these usage strings to match the actual requirement.
Also applies to: 138-148
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/GemsCommand.java` around
lines 21 - 30, Update the usage strings in GemsCommand’s
CommandFormatter.sendCommands call so amount is shown as required with angle
brackets for gems add, remove, set, and giveall. Keep the existing player and
command descriptions unchanged, matching the validation behavior in
handleModify, handleSet, and handleGiveAll.
| String commandToExecute = String.join(" ", Arrays.copyOfRange(args, 2, args.length)); | ||
|
|
||
| if (commandToExecute.startsWith("loop ")) { | ||
| warn(sender, "You cannot loop the §4loop §ccommand."); | ||
| warn(player, "You cannot loop the §4loop §ccommand."); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Nested-loop guard is bypassed by a different letter case.
commandToExecute.startsWith("loop ") is case-sensitive. A command like LOOP 5 5 give ... bypasses the guard and can still schedule a nested loop. Normalize the case before the comparison.
🛡️ Proposed fix for case-insensitive comparison
- if (commandToExecute.startsWith("loop ")) {
+ if (commandToExecute.toLowerCase().startsWith("loop ")) {
warn(player, "You cannot loop the §4loop §ccommand.");
return false;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| String commandToExecute = String.join(" ", Arrays.copyOfRange(args, 2, args.length)); | |
| if (commandToExecute.startsWith("loop ")) { | |
| warn(sender, "You cannot loop the §4loop §ccommand."); | |
| warn(player, "You cannot loop the §4loop §ccommand."); | |
| return false; | |
| } | |
| String commandToExecute = String.join(" ", Arrays.copyOfRange(args, 2, args.length)); | |
| if (commandToExecute.toLowerCase().startsWith("loop ")) { | |
| warn(player, "You cannot loop the §4loop §ccommand."); | |
| return false; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/LoopCommand.java` around
lines 54 - 59, Update the nested-loop check in LoopCommand by normalizing
commandToExecute’s case before testing its “loop ” prefix, so commands such as
“LOOP” are rejected while preserving the existing warning and return behavior.
| private void applySpeed(Player player, int intensity) { | ||
| float speed = Math.min(1.0f, (intensity + 1) / 10.0f); | ||
|
|
||
| boolean flying = player.getAllowFlight() && player.isFlying(); | ||
| String type = flying ? "Flying" : "Walking"; | ||
|
|
||
| if (flying) { | ||
| player.setFlySpeed(speed); | ||
| } else { | ||
| player.setWalkSpeed(speed); | ||
| } | ||
|
|
||
| if (intensity == 1) { | ||
| inform(player, " §f" + type + " Speed §ehas been reset."); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Files matching SpeedCommand:\n'
fd -i 'SpeedCommand\.java$' . || true
printf '\nRelevant file excerpt if found:\n'
file="$(fd -i 'SpeedCommand\.java$' . | head -n 1 || true)"
if [ -n "${file:-}" ]; then
wc -l "$file"
sed -n '1,120p' "$file" | cat -n
fi
printf '\nSearch for setFlySpeed/getAllowFlight/isFlying usage (limited):\n'
rg -n "setFlySpeed|getAllowFlight|isFlying|setWalkSpeed|speed" -S --glob '*.java' . | head -n 120Repository: MrInspection/BlightedMC
Length of output: 6504
🌐 Web query:
Spigot API Player default fly speed setFlySpeed default 0.1 walk speed setWalkSpeed default 0.2
💡 Result:
In the Spigot API, the default values for player movement speeds are as follows: Walk Speed: 0.2 [1] Fly Speed: 0.1 [2] The Player interface provides the methods setWalkSpeed(float value) and setFlySpeed(float value) to modify these speeds [3][4]. According to the API documentation, the value parameter for both methods accepts a float between -1 and 1 [3][5]. Setting a value outside of this range will throw an IllegalArgumentException [3][6]. Note that these methods modify the player's movement speed settings directly [3]. Because these changes may persist until explicitly reset or until the player disconnects (depending on the server implementation), it is common practice to manually reset these values to their defaults (0.2 for walking and 0.1 for flying) when necessary [2][1].
Citations:
- 1: https://bukkit.org/threads/default-walk-speed.131599/
- 2: https://bukkit.org/threads/setflyspeed.408547/
- 3: https://github.com/SpigotMC/Spigot-API/blob/master/src/main/java/org/bukkit/entity/Player.java
- 4: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html
- 5: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html
- 6: https://helpch.at/docs/1.16.4/org/bukkit/entity/Player.html
Use the normal fly-speed baseline for /speed 1.
Spigot sets the default walk speed to 0.2f and the default fly speed to 0.1f. When the player is flying, intensity == 1 currently calls player.setFlySpeed(0.2f) but reports a speed reset; keep the walking mapping and map flying intensity 1 to 0.1f.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/fr/moussax/blightedMC/commands/impl/SpeedCommand.java` around
lines 40 - 53, Update applySpeed so intensity 1 uses the normal fly-speed
baseline of 0.1f when flying, while retaining the existing 0.2f walking baseline
and all other intensity mappings. Keep the reset notification behavior
unchanged.
| private GolemAI() { | ||
| } | ||
|
|
||
| public static void init(LivingEntity spawned) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 8 '\bGolemAI\.init\s*\(|\bonConfigureAI\s*\(|\battachToExisting\s*\(' src/main/javaRepository: MrInspection/BlightedMC
Length of output: 13331
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '--- GolemAI file ---\n'
cat -n src/main/java/fr/moussax/blightedMC/content/utils/ai/GolemAI.java
printf '\n--- GolemAI usages ---\n'
rg -n 'GolemAI|IRONGOLEM|IronGolem|Iron Golem|onConfigureAI|onRehydrate' src/main/java || true
printf '\n--- candidate entity files ---\n'
fd -e java . src/main/java | sed -n '1,160p' | rg -n 'Golem|Iron|EntitiesRegistry|BlightedEntity' || true
printf '\n--- precise GolemAI text search (entire tracked files) ---\n'
git ls-files | xargs rg -n 'GolemAI|onConfigureAI\s*\(|attachToExisting\s*\(' || trueRepository: MrInspection/BlightedMC
Length of output: 252
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- GolemAI file ---'
cat -n src/main/java/fr/moussax/blightedMC/content/utils/ai/GolemAI.java
printf '%s\n' ''
printf '%s\n' '--- GolemAI usages ---'
rg -n 'GolemAI|IRONGOLEM|IronGolem|Iron Golem|onConfigureAI|onRehydrate' src/main/java || true
printf '%s\n' ''
printf '%s\n' '--- candidate entity files ---'
fd -e java . src/main/java | sed -n '1,160p' | rg -n 'Golem|Iron|EntitiesRegistry|BlightedEntity' || true
printf '%s\n' ''
printf '%s\n' '--- precise GolemAI text search (entire tracked files) ---'
git ls-files | xargs rg -n 'GolemAI|onConfigureAI\s*\(|attachToExisting\s*\(' || trueRepository: MrInspection/BlightedMC
Length of output: 5790
Wire GolemAI.init into the Iron Golem lifecycle.
GolemAI.init only clears goals/targets and adds Iron Golem-specific goals, but the repository has no caller for GolemAI.init. If no Iron Golem subtype overrides onConfigureAI or calls this method from attachToExisting/spawn, this code has no runtime effect. Add the lifecycle call for Iron Golems or remove the file.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/fr/moussax/blightedMC/content/utils/ai/GolemAI.java` at line
20, Wire GolemAI.init into the Iron Golem lifecycle by invoking it when an Iron
Golem is spawned, attached, or configured, using the existing lifecycle hook
such as onConfigureAI or attachToExisting. Ensure every relevant Iron Golem
instance receives the custom goals; otherwise remove the unused GolemAI
implementation.
| god: | ||
| butcher: | ||
| speed: | ||
| fly: No newline at end of file |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add descriptions for god, butcher, speed, fly.
Every other command in this file declares a description. These four commands have none, so Bukkit's /help output shows no description for them.
Add a short description for each command, consistent with the rest of the file.
📝 Proposed fix
god:
+ description: Toggle invulnerability for yourself
butcher:
+ description: Remove nearby hostile mobs
speed:
+ description: Adjust your movement speed
fly:
+ description: Toggle flight for yourself📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| god: | |
| butcher: | |
| speed: | |
| fly: | |
| god: | |
| description: Toggle invulnerability for yourself | |
| butcher: | |
| description: Remove nearby hostile mobs | |
| speed: | |
| description: Adjust your movement speed | |
| fly: | |
| description: Toggle flight for yourself |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/resources/plugin.yml` around lines 46 - 49, Add short descriptions
to the god, butcher, speed, and fly command entries in plugin.yml, matching the
concise style of the other command definitions so Bukkit help output includes
each command’s purpose.
…n and tab completion
…layerCommand or AdminCommand
…ate builder for rituals
…rticle rendering, enhance inventory handling, and fix sound/message formatting
…cks and message formatting
…nimation, and time-based defeat logic
3350937 to
2aa0b0f
Compare
Summary by CodeRabbit
New Features
Updates