Skip to content

Simple Galaxy Gate: Updates and fixes.#124

Merged
dm94 merged 5 commits intoDarkbot-Plugins:mainfrom
do-gamer:updates
Apr 10, 2026
Merged

Simple Galaxy Gate: Updates and fixes.#124
dm94 merged 5 commits intoDarkbot-Plugins:mainfrom
do-gamer:updates

Conversation

@do-gamer
Copy link
Copy Markdown
Contributor

@do-gamer do-gamer commented Apr 10, 2026

Summary by Sourcery

Add HTML-based configuration instructions for Simple Galaxy Gate and adjust gate handling behavior for maps without portals.

New Features:

  • Display rich HTML instructions at the top-level Simple Galaxy Gate config and within AnyGate and Kamikaze settings sections.

Enhancements:

  • Introduce a reusable HtmlInstructions option editor for rendering read-only instructional text in the configuration UI.
  • Move module instructions from the feature implementation into config-level, context-specific instruction fields.
  • Refine safe refresh logic to allow refreshing when no portals exist in the gate and mark Low Gate as having no in-gate portals.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 10, 2026

Reviewer's Guide

Refactors the Simple Galaxy Gate feature’s user instructions from a string-based provider into reusable HTML-based config editors, and adjusts gate refresh logic to support gates without portals (notably Low gate).

Class diagram for HTML-based instructions and related config changes

classDiagram
    class OptionEditor {
        <<interface>>
        +getEditorComponent(setting)
    }

    class HtmlInstructions {
        <<abstract>>
        +getEditorComponent(setting)
        +buildList(title, items)
    }

    OptionEditor <|.. HtmlInstructions

    class SimpleGalaxyGateConfig {
    }

    class SimpleGalaxyGateConfig_Instructions {
        +getEditorValue()
    }

    class AnyGateSettings {
        +instructions
        +npcRadius
        +minNpcMapAmount
    }

    class AnyGateSettings_Instructions {
        +getEditorValue()
    }

    class KamikazeSettings {
        +instructions
        +enabled
        +maxRange
        +minNpcAmount
        +minNpcHealthPercent
        +minPetHealthPercent
        +maxHeroHealthPercent
    }

    class KamikazeSettings_Instructions {
        +getEditorValue()
    }

    HtmlInstructions <|-- SimpleGalaxyGateConfig_Instructions
    HtmlInstructions <|-- AnyGateSettings_Instructions
    HtmlInstructions <|-- KamikazeSettings_Instructions

    SimpleGalaxyGateConfig *-- SimpleGalaxyGateConfig_Instructions
    SimpleGalaxyGateConfig *-- AnyGateSettings
    AnyGateSettings *-- AnyGateSettings_Instructions
    SimpleGalaxyGateConfig *-- KamikazeSettings
    KamikazeSettings *-- KamikazeSettings_Instructions

    class Module {
        <<interface>>
    }

    class Task {
        <<interface>>
    }

    class Configurable {
        <<interface>>
        +setConfig(config)
    }

    class NpcExtraProvider {
        <<interface>>
    }

    class SimpleGalaxyGate {
        -config
        -hero
        -movement
        -facade
        -backpage
        -stats
        -entities
        -mapManager
        -eventBroker
        -attackModule
        -lootModule
        -collectorModule
        -petModule
        -safetyModule
        -drive
        -gateHandler
        -gateBuilder
        +setConfig(config)
    }

    Module <|.. SimpleGalaxyGate
    Task <|.. SimpleGalaxyGate
    Configurable <|.. SimpleGalaxyGate
    NpcExtraProvider <|.. SimpleGalaxyGate
Loading

Class diagram for GateHandler and LowGate safe refresh logic

classDiagram
    class GateHandler {
        -skipFarTargets : boolean
        -fetchServerOffset : boolean
        -safeRefreshInGate : boolean
        -noPortalsInGate : boolean
        -statusDetails : String
        -useGuardableNpcAsSearchLocation : boolean
        -cachedGuardableNpc
        +canSafeRefreshInGate() boolean
    }

    class LowGate {
        +defaultNpcParam
        +jumpToNextMap : boolean
        +moveToCenter : boolean
        +approachToCenter : boolean
        +skipFarTargets : boolean
        +noPortalsInGate : boolean
        +repairRadius
        +farTargetDistance
    }

    GateHandler <|-- LowGate
Loading

Flow diagram for canSafeRefreshInGate with noPortalsInGate support

flowchart TD
    A[Check canSafeRefreshInGate] --> B{safeRefreshInGate is true?}
    B -- no --> Z[Return false]
    B -- yes --> C{module.isMapGG is true?}
    C -- no --> Z
    C -- yes --> D{lootModule has no NPCs?}
    D -- no --> Z
    D -- yes --> E{collectorModule has no box?}
    E -- no --> Z
    E -- yes --> F{noPortalsInGate is true?}
    F -- yes --> Y[Return true]
    F -- no --> G{any portal distanceTo hero < 1000?}
    G -- yes --> Y
    G -- no --> Z

    Z --> H[Result: safe refresh not allowed]
    Y --> I[Result: safe refresh allowed]
Loading

File-Level Changes

Change Details Files
Introduce reusable HTML-based instruction editor and wire it into Simple Galaxy Gate config sections.
  • Added abstract HtmlInstructions implementing OptionEditor that renders a non-editable HTML JEditorPane wrapped in a JScrollPane.
  • Implemented SimpleGalaxyGateConfig.Instructions to show top-level feature guidance as formatted HTML lists.
  • Added read-only, editor-backed instructions fields to main SimpleGalaxyGateConfig, AnyGateSettings, and KamikazeSettings for inline UI help.
src/main/java/dev/shared/do_gamer/module/simple_galaxy_gate/config/HtmlInstructions.java
src/main/java/dev/shared/do_gamer/module/simple_galaxy_gate/config/SimpleGalaxyGateConfig.java
Remove legacy string-based InstructionProvider implementation from the module class in favor of config-embedded HTML instructions.
  • Dropped InstructionProvider from SimpleGalaxyGate’s implemented interfaces.
  • Removed the instructions() method returning plain-text instructions now superseded by HTML config instructions.
src/main/java/dev/shared/do_gamer/module/simple_galaxy_gate/SimpleGalaxyGate.java
Allow safe in-gate refresh when there are no portals present and flag Low gate accordingly.
  • Extended GateHandler with a noPortalsInGate flag used in safe-refresh checks.
  • Updated canSafeRefreshInGate to allow refresh if either noPortalsInGate is true or a nearby portal is found within 1000 distance.
  • Configured LowGate to set noPortalsInGate to true, reflecting its portal-less behavior while leaving other gate behavior unchanged.
src/main/java/dev/shared/do_gamer/module/simple_galaxy_gate/gate/GateHandler.java
src/main/java/dev/shared/do_gamer/module/simple_galaxy_gate/gate/LowGate.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In HtmlInstructions, getEditorComponent calls this.getEditorValue() but the method isn’t declared in the base class—add an abstract protected String getEditorValue(); (or similar) to HtmlInstructions and annotate subclasses with @Override to avoid compilation issues and make the contract explicit.
  • The JScrollPane returned from HtmlInstructions#getEditorComponent will show default scrollbars and borders even for short texts; consider disabling scrollbars or borders (or setting a preferred size) to better integrate these instruction blocks visually with the rest of the config UI.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `HtmlInstructions`, `getEditorComponent` calls `this.getEditorValue()` but the method isn’t declared in the base class—add an abstract `protected String getEditorValue();` (or similar) to `HtmlInstructions` and annotate subclasses with `@Override` to avoid compilation issues and make the contract explicit.
- The `JScrollPane` returned from `HtmlInstructions#getEditorComponent` will show default scrollbars and borders even for short texts; consider disabling scrollbars or borders (or setting a preferred size) to better integrate these instruction blocks visually with the rest of the config UI.

## Individual Comments

### Comment 1
<location path="src/main/java/dev/shared/do_gamer/module/simple_galaxy_gate/config/SimpleGalaxyGateConfig.java" line_range="117-122" />
<code_context>
+            @Override
+            public String getEditorValue() {
+                return this.buildList(null,
+                        "This setting used for any Galaxy Gate if no specific selected.",
+                        "NPC radius overrides any attack radius. Set to 0 to use custom radius.");
+            }
</code_context>
<issue_to_address>
**suggestion (typo):** Polish the instruction string for clearer grammar.

Consider updating the text to: `"This setting is used for any Galaxy Gate if no specific gate is selected."` for more natural grammar.

```suggestion
            @Override
            public String getEditorValue() {
                return this.buildList(null,
                        "This setting is used for any Galaxy Gate if no specific gate is selected.",
                        "NPC radius overrides any attack radius. Set to 0 to use custom radius.");
            }
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

do-gamer and others added 3 commits April 11, 2026 01:09
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@do-gamer
Copy link
Copy Markdown
Contributor Author

@dm94 Tested and ready to merge.

@sonarqubecloud
Copy link
Copy Markdown

@dm94 dm94 merged commit 20a63f6 into Darkbot-Plugins:main Apr 10, 2026
3 of 4 checks passed
@do-gamer do-gamer deleted the updates branch April 10, 2026 19:57
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.

2 participants