|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Chat is a BentoBox addon for Minecraft (Paper) that provides Team Chat and Island Chat for island-type game modes (BSkyBlock, AcidIsland, CaveBlock, SkyGrid). It requires Java 21 and targets Paper 1.21.11. |
| 8 | + |
| 9 | +## Build Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +mvn clean package # Build (default goal) |
| 13 | +mvn test # Run all tests |
| 14 | +mvn -Dtest=ChatListenerTest test # Run a single test class |
| 15 | +mvn -Dtest=ChatListenerTest#onChat test # Run a single test method |
| 16 | +``` |
| 17 | + |
| 18 | +The build produces `target/Chat-{version}-SNAPSHOT-LOCAL.jar`. |
| 19 | + |
| 20 | +## Architecture |
| 21 | + |
| 22 | +This is a **BentoBox Pladdon** (plugin-addon): |
| 23 | + |
| 24 | +- `ChatPladdon` — Entry point loaded by BentoBox's Pladdon system, creates the `Chat` addon instance |
| 25 | +- `Chat` — Main addon class. On enable: loads `Settings` from config.yml, registers commands per game mode, creates `ChatListener`, and registers the `IsTeamChatHandler` request handler |
| 26 | +- `ChatListener` — Core logic. Implements both `Listener` and `EventExecutor`. Intercepts `AsyncPlayerChatEvent` (registered manually with configurable priority from Settings). Maintains in-memory sets for team chat users, island chatters, team spies, and island spies. All toggle state is held in memory (not persisted) |
| 27 | +- `Settings` — BentoBox `ConfigObject` stored at `addons/Chat/config.yml`. Controls which game modes have team/island chat, logging, event priority, and default chat game mode |
| 28 | +- `IsTeamChatHandler` — BentoBox request handler that lets other addons query if a player has team chat enabled |
| 29 | + |
| 30 | +Commands follow BentoBox's `CompositeCommand` pattern and are registered dynamically onto each game mode's player/admin command trees: |
| 31 | +- Player: `IslandChatCommand` (chat), `IslandTeamChatCommand` (teamchat), `IslandTeamMuteCommand` (muteteamchat) |
| 32 | +- Admin: `AdminIslandChatSpyCommand` (chatspy), `AdminTeamChatSpyCommand` (teamchatspy) |
| 33 | + |
| 34 | +## Testing |
| 35 | + |
| 36 | +Tests use JUnit 5 + Mockito + MockBukkit. The `CommonTestSetup` base class provides standard mocks for BentoBox, Bukkit, Player, World, Island, etc. New test classes should extend `CommonTestSetup` and call `super.setUp()`/`super.tearDown()`. The `WhiteBox` utility sets private/static fields via reflection for test setup. |
| 37 | + |
| 38 | +Localization strings are defined in `src/main/resources/locales/` (en-US.yml is the primary locale). |
| 39 | + |
| 40 | + |
| 41 | +## Dependency Source Lookup |
| 42 | + |
| 43 | +When you need to inspect source code for a dependency (e.g., BentoBox, addons): |
| 44 | + |
| 45 | +1. **Check local Maven repo first**: `~/.m2/repository/` — sources jars are named `*-sources.jar` |
| 46 | +2. **Check the workspace**: Look for sibling directories or Git submodules that may contain the dependency as a local project (e.g., `../bentoBox`, `../addon-*`) |
| 47 | +3. **Check Maven local cache for already-extracted sources** before downloading anything |
| 48 | +4. Only download a jar or fetch from the internet if the above steps yield nothing useful |
| 49 | + |
| 50 | +Prefer reading `.java` source files directly from a local Git clone over decompiling or extracting a jar. |
| 51 | + |
| 52 | +In general, the latest version of BentoBox should be targeted. |
| 53 | + |
| 54 | +## Project Layout |
| 55 | + |
| 56 | +Related projects are checked out as siblings under `~/git/`: |
| 57 | + |
| 58 | +**Core:** |
| 59 | +- `bentobox/` — core BentoBox framework |
| 60 | + |
| 61 | +**Game modes:** |
| 62 | +- `addon-acidisland/` — AcidIsland game mode |
| 63 | +- `addon-bskyblock/` — BSkyBlock game mode |
| 64 | +- `Boxed/` — Boxed game mode (expandable box area) |
| 65 | +- `CaveBlock/` — CaveBlock game mode |
| 66 | +- `OneBlock/` — AOneBlock game mode |
| 67 | +- `SkyGrid/` — SkyGrid game mode |
| 68 | +- `RaftMode/` — Raft survival game mode |
| 69 | +- `StrangerRealms/` — StrangerRealms game mode |
| 70 | +- `Brix/` — plot game mode |
| 71 | +- `parkour/` — Parkour game mode |
| 72 | +- `poseidon/` — Poseidon game mode |
| 73 | +- `gg/` — gg game mode |
| 74 | + |
| 75 | +**Addons:** |
| 76 | +- `addon-level/` — island level calculation |
| 77 | +- `addon-challenges/` — challenges system |
| 78 | +- `addon-welcomewarpsigns/` — warp signs |
| 79 | +- `addon-limits/` — block/entity limits |
| 80 | +- `addon-invSwitcher/` / `invSwitcher/` — inventory switcher |
| 81 | +- `addon-biomes/` / `Biomes/` — biomes management |
| 82 | +- `Bank/` — island bank |
| 83 | +- `Border/` — world border for islands |
| 84 | +- `Chat/` — island chat |
| 85 | +- `CheckMeOut/` — island submission/voting |
| 86 | +- `ControlPanel/` — game mode control panel |
| 87 | +- `Converter/` — ASkyBlock to BSkyBlock converter |
| 88 | +- `DimensionalTrees/` — dimension-specific trees |
| 89 | +- `discordwebhook/` — Discord integration |
| 90 | +- `Downloads/` — BentoBox downloads site |
| 91 | +- `DragonFights/` — per-island ender dragon fights |
| 92 | +- `ExtraMobs/` — additional mob spawning rules |
| 93 | +- `FarmersDance/` — twerking crop growth |
| 94 | +- `GravityFlux/` — gravity addon |
| 95 | +- `Greenhouses-addon/` — greenhouse biomes |
| 96 | +- `IslandFly/` — island flight permission |
| 97 | +- `IslandRankup/` — island rankup system |
| 98 | +- `Likes/` — island likes/dislikes |
| 99 | +- `Limits/` — block/entity limits |
| 100 | +- `lost-sheep/` — lost sheep adventure |
| 101 | +- `MagicCobblestoneGenerator/` — custom cobblestone generator |
| 102 | +- `PortalStart/` — portal-based island start |
| 103 | +- `pp/` — pp addon |
| 104 | +- `Regionerator/` — region management |
| 105 | +- `Residence/` — residence addon |
| 106 | +- `TopBlock/` — top ten for OneBlock |
| 107 | +- `TwerkingForTrees/` — twerking tree growth |
| 108 | +- `Upgrades/` — island upgrades (Vault) |
| 109 | +- `Visit/` — island visiting |
| 110 | +- `weblink/` — web link addon |
| 111 | +- `CrowdBound/` — CrowdBound addon |
| 112 | + |
| 113 | +**Data packs:** |
| 114 | +- `BoxedDataPack/` — advancement datapack for Boxed |
| 115 | + |
| 116 | +**Documentation & tools:** |
| 117 | +- `docs/` — main documentation site |
| 118 | +- `docs-chinese/` — Chinese documentation |
| 119 | +- `docs-french/` — French documentation |
| 120 | +- `BentoBoxWorld.github.io/` — GitHub Pages site |
| 121 | +- `website/` — website |
| 122 | +- `translation-tool/` — translation tool |
| 123 | + |
| 124 | +Check these for source before any network fetch. |
| 125 | + |
| 126 | +## Key Dependencies (source locations) |
| 127 | + |
| 128 | +- `world.bentobox:bentobox` `3.14.0-SNAPSHOT` → `~/git/bentobox/src/` |
0 commit comments