Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4c15a1b
Update README.md
tastybento Dec 21, 2024
a96d9a3
Fast implementation for allowing to define icon as item stack.
BONNe Mar 7, 2025
5cd588a
Add ItemsAdder dependencies
K0bus Apr 21, 2025
1941ae6
Add ItemsAdder parser
K0bus Apr 21, 2025
50c2a82
Check icon only if set in config
K0bus Apr 21, 2025
d167ac2
Change raw string to config getter
K0bus Apr 21, 2025
de4c07b
Implement ItemsAdder parser
K0bus Apr 21, 2025
624a4cd
Remove javadoc return on void method
K0bus Apr 21, 2025
fadc4c5
Simplify if
K0bus Apr 21, 2025
947f0fe
Remove redundant aggregator
K0bus Apr 21, 2025
7122953
Make variable as final
K0bus Apr 21, 2025
da3d0cd
Add readIntArray allowing to parse String list to int array
K0bus Apr 21, 2025
8648a02
Add string to int array parse to allow multiple slot in config key li…
K0bus Apr 21, 2025
afafce5
Merge pull request #33 from K0bus/develop
tastybento Apr 21, 2025
9c451ee
Update pom.xml for Java 21 and dependency changes
tastybento Apr 2, 2026
d94d419
Upgrade GitHub Actions to use latest versions
tastybento Apr 2, 2026
d7a4baf
Add JUnit 5 test suite with 97 tests covering all classes
tastybento Apr 2, 2026
9b4efc5
Merge pull request #34 from BentoBoxWorld/add-junit5-tests
tastybento Apr 2, 2026
8bd395c
Initial plan
Copilot Apr 2, 2026
b968b07
Add right_click_command and shift_click_command support for panel but…
Copilot Apr 2, 2026
95e8474
Address code review: clarify click type documentation
Copilot Apr 2, 2026
00eb108
Update README.md to enhance documentation and feature descriptions
tastybento Apr 2, 2026
3705bb6
Merge pull request #35 from BentoBoxWorld/copilot/add-new-command-styles
tastybento Apr 2, 2026
6888a41
Update README.md to clarify command click types and add support for r…
tastybento Apr 2, 2026
e0d0d10
Revise compatibility and documentation references
tastybento Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ jobs:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu' # Alternative distribution options are available.
- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand All @@ -34,4 +34,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BentoBoxWorld_ControlPanel
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BentoBoxWorld_ControlPanel
62 changes: 62 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

ControlPanel is a BentoBox addon for Minecraft (Paper) that provides customizable GUI menus for players to execute common commands. It supports multiple gamemodes (AcidIsland, BSkyBlock, CaveBlock, SkyGrid, AOneBlock) and 13 localizations.

## Build Commands

```bash
# Build the project
mvn clean package

# Run tests
mvn clean test

# Run tests and SonarCloud analysis (as CI does)
mvn -B verify

# Run a single test class
mvn test -Dtest=UtilsTest

# Build without tests
mvn clean package -DskipTests
```

**Requires Java 21.** The output JAR is placed in `target/`.

## Testing

Tests use **JUnit 5 + Mockito 5 + MockBukkit**. All integration tests extend `CommonTestSetup` which provides pre-configured mocks for BentoBox, Bukkit, Player, World, Island, and other framework objects.

Key test infrastructure in `src/test/java/world/bentobox/controlpanel/`:
- `CommonTestSetup.java` — abstract base class with `@BeforeEach`/`@AfterEach` lifecycle, static mocks for `Bukkit` and `Util`
- `WhiteBox.java` — reflection utility for setting private static fields (e.g., BentoBox singleton)
- `TestWorldSettings.java` — stub `WorldSettings` implementation for tests

For tests requiring database access, mock `DatabaseSetup` statically and use `WhiteBox.setInternalState(Database.class, "databaseSetup", dbSetup)` to inject the mock handler.

## Architecture

This is a **BentoBox Addon** — it extends BentoBox's `Addon` class and follows its lifecycle (`onLoad` → `onEnable` → `onReload` → `onDisable`).

**Entry point:** `ControlPanelAddon.java` — registers commands, loads settings, initializes the manager.

**Key flow:**
1. `ControlPanelAddon` hooks `PlayerCommand` and `AdminCommand` into each registered BentoBox gamemode's command tree
2. `ControlPanelManager` loads/saves `ControlPanelObject` data from YAML files and caches them per-world
3. `ControlPanelGenerator` builds the GUI using BentoBox's `PanelBuilder` API, resolving button actions, permissions, and placeholders (`[player]`, `[server]`, `[label]`)

**Data model:** `ControlPanelObject` (implements `DataObject`) represents a single control panel with its button layout. The manager parses the YAML template (`controlPanelTemplate.yml`) into these objects.

**Configuration:** `Settings.java` uses BentoBox's `@StoreAt`/`@ConfigEntry` annotations for YAML-backed config. The `config.yml` controls which gamemodes the addon is disabled for.

**Localization:** 13 locale YAML files in `src/main/resources/locales/`. Translation key constants are centralized in `Constants.java`.

**Optional integration:** `ItemsAdderParse.java` provides soft-dependency support for the ItemsAdder plugin's custom items.

## CI

GitHub Actions on push to `develop` and PRs: builds with Maven + runs SonarCloud analysis (project: `BentoBoxWorld_ControlPanel`).
Loading
Loading