You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are no unit tests in this project. CI (`.github/workflows/build.yml`) runs `mvn clean package` on Ubuntu with JDK 21.
16
+
17
+
## What This Is
18
+
19
+
Peek is a Minecraft Paper/Folia plugin (Java 17, API 1.20+) that lets players observe other players' perspectives by switching to spectator mode. The plugin uses a fantasy/magic theme in its user-facing messages. All code is in the `ict.minesunshineone.peek` package.
20
+
21
+
## Architecture
22
+
23
+
**Entry point:**`PeekPlugin` extends `JavaPlugin` — initializes all managers/handlers, registers listeners and commands, validates config.
-`util/` — `Messages` (i18n with language files in `lang/`), `PlayerStateUtil` (player state helpers)
33
+
-`placeholder/` — `PeekPlaceholderExpansion` for PlaceholderAPI integration
34
+
35
+
## Key Patterns
36
+
37
+
-**Folia thread safety:** Uses Paper's entity scheduler (`player.getScheduler().execute/run/runAtFixedRate`) throughout, not Bukkit scheduler. All location-aware operations run on the correct region thread.
38
+
-**Async teleport:** Uses `teleportAsync()` with `thenAccept()` callbacks, never blocking teleport.
39
+
-**Optional dependencies:** ProtocolLib and PlaceholderAPI are soft dependencies — the plugin detects their presence at runtime and gracefully degrades without them.
40
+
-**State recovery:** Player state is serialized to YAML files in `states/` on peek start. If a player disconnects mid-peek, state is restored on rejoin.
41
+
-**Concurrency:**`ConcurrentHashMap` in CooldownManager/StatisticsManager, `synchronized` blocks in PrivacyManager, copy-on-write iteration over `activePeeks`.
42
+
43
+
## Permissions
44
+
45
+
-`peek.use` — base command access (default: op)
46
+
-`peek.self` — self-peek in spectator mode (default: op)
0 commit comments