Skip to content

Add generic Map API for addon web-map integration#2885

Merged
tastybento merged 1 commit intodevelopfrom
feature/map-api
Mar 23, 2026
Merged

Add generic Map API for addon web-map integration#2885
tastybento merged 1 commit intodevelopfrom
feature/map-api

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

  • Add MapHook abstract class (api/hooks/) defining a common contract for web-map plugins: marker sets, point markers, area markers, and polygon markers using only JDK/Bukkit types (java.awt.Color, Location, World)
  • Add MapManager facade (managers/) that fans out calls to all active MapHook implementations, with try-catch isolation per hook and silent no-op when no map plugins are installed
  • Refactor BlueMapHook and DynmapHook to extend MapHook instead of Hook
  • Wire MapManager into BentoBox.java — addons access it via BentoBox.getInstance().getMapManager()
  • Native API accessors (getBlueMapAPI(), getMarkerAPI()) remain for direct access when needed

Addon usage example

MapManager maps = BentoBox.getInstance().getMapManager();
maps.createMarkerSet("warps", "Warps");
maps.addPointMarker("warps", "warp_123", "Player's Warp", location);
maps.addAreaMarker("warps", "zone_1", "Safe Zone", world,
    0, 0, 100, 100,
    new Color(51, 136, 255),        // blue border
    new Color(51, 136, 255, 38),    // 15% blue fill
    2);

Test plan

  • MapManagerTest — fan-out to multiple hooks, silent no-op, exception isolation (14 tests)
  • BlueMapHookTest — existing + new abstract method tests (21 tests)
  • DynmapHookTest — existing + updated API tests (20 tests)
  • Full build passes

🤖 Generated with Claude Code

Introduce MapHook abstract class and MapManager facade so addons
can create markers, areas, and polygons without depending on a
specific map plugin. MapManager fans out calls to all active map
hooks (BlueMap, Dynmap, etc.) and silently no-ops when none are
installed. Both BlueMapHook and DynmapHook now extend MapHook.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@tastybento tastybento merged commit ee72db0 into develop Mar 23, 2026
3 checks passed
@tastybento tastybento deleted the feature/map-api branch March 23, 2026 01:08
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.

1 participant