Skip to content

Check for errors#177

Open
mallusrgreatv2 wants to merge 5 commits intoSolara-Development:masterfrom
mallusrgreatv2:error-checking
Open

Check for errors#177
mallusrgreatv2 wants to merge 5 commits intoSolara-Development:masterfrom
mallusrgreatv2:error-checking

Conversation

@mallusrgreatv2
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces error handling across several core services in the Neptune Minecraft plugin. It adds a centralized errored flag on the Neptune plugin instance, wraps arena/kit loading and player profile creation in try-catch blocks, and skips the onDisable shutdown sequence when a load-time error is detected.

Changes:

  • Adds errored flag and setErrored() to Neptune.java, with onDisable guarded by this flag
  • Wraps arena and kit loading loops in try-catch blocks that log the error, set the errored flag, and rethrow
  • Adds error handling for player profile creation in ProfileService, including kicking the player

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Neptune.java Adds errored boolean flag + setErrored() method; guards onDisable cleanup
ArenaService.java Wraps arena loading in try-catch with logging, errored flag, and rethrow
KitService.java Wraps kit loading in try-catch with logging, errored flag, and rethrow
ProfileService.java Wraps async profile creation with a try-catch to log and kick the player
PotionEffectUtils.java Adds unused import dev.lrxh.neptune.Neptune

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Setter
private boolean allowMatches;

private boolean errored;
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The errored field is a plain boolean without the volatile keyword. When setErrored() is called, it could theoretically be called from a thread other than the main server thread (e.g., if an error were to occur in a background task that triggers this). The onDisable() method reads errored on the main server thread. Without volatile, there is no guarantee that the write from one thread is visible to the read on another thread. Consider declaring errored as volatile boolean errored or using AtomicBoolean to ensure safe cross-thread visibility.

Suggested change
private boolean errored;
private volatile boolean errored;

Copilot uses AI. Check for mistakes.
@@ -1,5 +1,6 @@
package dev.lrxh.neptune.utils;

import dev.lrxh.neptune.Neptune;
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import dev.lrxh.neptune.Neptune added in this file is unused. The PotionEffectUtils class only contains serialize and deserialize methods, neither of which references Neptune. This import should be removed to avoid confusion.

Suggested change
import dev.lrxh.neptune.Neptune;

Copilot uses AI. Check for mistakes.
Devlrxxh and others added 3 commits March 7, 2026 11:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants