diff --git a/.env.example b/.env.example index 38002c7..d17ae0f 100644 --- a/.env.example +++ b/.env.example @@ -11,6 +11,4 @@ PUBLIC_URL= # Comma-separated IPs of your reverse proxies; blank means forwarded IP headers are ignored. SCOPENET_TRUSTED_PROXIES= -# Live Map: optional static Vantage Linux release to bundle, and memory for the panel. -VANTAGE_URL= PANEL_MEMORY=256M diff --git a/Dockerfile b/Dockerfile index 483a241..38f8b7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,20 +36,6 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry,sharin # Data dir owned by the non-root runtime user. RUN mkdir -p /out/data && chown 65532:65532 /out/data -# ---- 2b. Vantage generator (optional) ---------------------------------------- -# The live map renders with Vantage. Point VANTAGE_URL at a static Linux -# release archive (tar.gz or zip) for the target arch to bake it into the image; -# leave it empty to mount your own binary at /opt/vantage/vantage instead. -FROM --platform=$BUILDPLATFORM alpine:3 AS vantage -ARG VANTAGE_URL="" -RUN apk add --no-cache curl tar unzip && mkdir -p /out/vantage /out/assets \ - && if [ -n "$VANTAGE_URL" ]; then \ - curl -fsSL "$VANTAGE_URL" -o /tmp/vantage.pkg \ - && (tar -xzf /tmp/vantage.pkg -C /out/vantage 2>/dev/null || unzip -q /tmp/vantage.pkg -d /out/vantage) \ - && find /out/vantage -type f -name vantage -exec chmod 755 {} + \ - && (f=$(find /out/vantage -type f -name vantage | head -n1) && [ -n "$f" ] && [ "$f" != /out/vantage/vantage ] && mv "$f" /out/vantage/vantage || true); \ - fi - # ---- 3. Runtime -------------------------------------------------------------- FROM scratch LABEL org.opencontainers.image.title="SCOPENET Panel" \ @@ -58,12 +44,9 @@ LABEL org.opencontainers.image.title="SCOPENET Panel" \ COPY --from=build /scopenet-panel /scopenet-panel COPY --from=web /src/panel/web/dist /web COPY --from=build --chown=65532:65532 /out/data /data -COPY --from=vantage /out/vantage /opt/vantage ENV SCOPENET_BIND=0.0.0.0:8080 \ SCOPENET_DATA_DIR=/data \ SCOPENET_WEB_DIR=/web \ - SCOPENET_VANTAGE_BIN=/opt/vantage/vantage \ - SCOPENET_VANTAGE_ASSETS=/data/livemap/assets \ RUST_LOG=info USER 65532:65532 VOLUME ["/data"] diff --git a/docker-compose.yml b/docker-compose.yml index 208a2ea..68f8d9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,9 +10,6 @@ services: image: scopenet-panel:local build: context: . - args: - # Optional: URL of a static Vantage Linux release to bundle. - VANTAGE_URL: ${VANTAGE_URL:-} container_name: scopenet-panel restart: unless-stopped ports: @@ -29,10 +26,6 @@ services: MAX_UPLOAD_MB: ${MAX_UPLOAD_MB:-2048} PUBLIC_URL: ${PUBLIC_URL:-} SCOPENET_TRUSTED_PROXIES: ${SCOPENET_TRUSTED_PROXIES:-} - # Live Map: Vantage generator + Minecraft client assets (see docs/live-map.md). - SCOPENET_VANTAGE_BIN: ${SCOPENET_VANTAGE_BIN:-/opt/vantage/vantage} - SCOPENET_VANTAGE_ASSETS: ${SCOPENET_VANTAGE_ASSETS:-/data/livemap/assets} - SCOPENET_VANTAGE_ARGS: ${SCOPENET_VANTAGE_ARGS:-} RUST_LOG: ${RUST_LOG:-info} volumes: - panel-data:/data @@ -40,7 +33,6 @@ services: deploy: resources: limits: - # Raise this if you enable Live Map: Vantage bakes tiles in memory. memory: ${PANEL_MEMORY:-256M} volumes: diff --git a/docs/deployment.md b/docs/deployment.md index f9183b3..81d2ab4 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -23,11 +23,9 @@ The panel listens on `PANEL_PORT` (default `8080`). Docker checks `docker compose ps` before directing players to it. If `ADMIN_PASSWORD` is blank on first start, the generated password appears in the panel logs. -To show a Vantage world map in the launcher, deploy Vantage next to each game -server and configure its manifest URL in the panel. See -[Live map setup](live-map.md). Vantage needs access to the game world's saved -files, so it runs alongside the game server rather than inside the panel -container. +To show a 2D world map and claim land in the launcher, install BlueMap on the +game server and configure its public web address in the panel. See +[Live map setup](live-map.md). The named `panel-data` volume holds the database, uploads, hosted launcher downloads, and the generated JWT signing key. Preserve that volume when diff --git a/docs/live-map.md b/docs/live-map.md index e82f02c..38970a1 100644 --- a/docs/live-map.md +++ b/docs/live-map.md @@ -1,75 +1,21 @@ -# Live Map (central Vantage) +# Live map and land claims -> **Looking for the simplest map?** Use BlueMap: [bluemap.md](bluemap.md). It needs nothing on the panel, adds guild claims, pins and a player panel, and shows inside the launcher. -> -> **Setting up the panel-hosted Vantage map?** Follow [vantage-setup.md](vantage-setup.md). This page is the overview. +SCOPENET uses [BlueMap](https://bluemap.bluecolored.de/) for terrain. Install BlueMap on the Minecraft server and make its web app reachable from players' computers. In the panel's **Servers → server settings**, enter the BlueMap **Map address**. The launcher opens the same map in its Live Map window and reads BlueMap's low resolution 2D tile images for the Guilds territory view. -The panel hosts a [Vantage](https://github.com/thoughts-on-things/vantage-mc) 3D map -**for every game server**, so nobody has to run Vantage next to Minecraft. +The terrain address must serve BlueMap's `settings.json`, per-map `settings.json`, and low resolution PNG tiles from the same URL path. A URL such as `https://maps.example.com/` works. If BlueMap is hosted below a path, include the trailing slash, for example `https://example.com/bluemap/`. -``` -Minecraft server ──(SCOPENET plugin/mod)──► Admin panel ──► Launcher "Live Map" button - chunks + players HTTPS / WebSocket mirror + Vantage Vantage viewer in-app -``` +## Center on the player -1. **Collect** – the SCOPENET Paper plugin / Fabric / Forge mod reads the world's - region files (only chunks newer than what the panel already has) and sends them to - the panel over HTTPS. Player positions stream over a WebSocket (HTTPS fallback). -2. **Store & render** – the panel keeps a region-file mirror per server under - `/livemap//world` and runs a `vantage server` sidecar over it on - demand (stopped again after 15 idle minutes). Sidecars listen on loopback only. -3. **Serve** – `GET /api/livemap///v1/worlds/default/…` proxies the - sidecar to signed-in launcher/admin sessions. Player markers come straight from - memory. One map per server and dimension (`overworld`, `the_nether`, `the_end`). -4. **View** – the launcher checks `GET /api/v1/servers//livemap`; when Live Map is - on for a server linked to the instance, the instance page shows a **Live Map** - button that opens the map inside the launcher (and the Guilds territory view uses - it too). Admins see the same map on *Servers → your server*. +Turn on **Live player positions** in the server settings and leave `livemap.enabled: true` in the SCOPENET plugin or mod configuration. The game server sends current positions to the panel. The panel returns each signed-in player only their own position to the launcher. The **Find me** button centers the territory view on it; the blue dot marks their position. Positions expire when the server stops sending updates. -Chunk data only reaches the panel when the game server has written it, so the map -follows autosaves (and `/save-all`) rather than every block change. +The BlueMap map itself remains available when position relay is off. In that case, players can pan manually, but **Find me** is unavailable. -## Turn it on +## Claim controls -1. **Servers → your server → Settings → Live Map** (on by default for new servers). -2. Update the plugin/mod. `livemap.enabled: true` (Paper `config.yml`) or - `livemap.enabled=true` (`config/scopenet.properties`) is the default; set it to - `false` to keep a server off the map locally. -3. The server page shows a checklist: generator, assets, world data, player positions. +In **Guilds & Territories**, select the game server and dimension. Left click a chunk to claim it for your guild, or drag across chunks to claim an area. Right click or right drag unclaims your guild's chunks. Alt drag pans; the wheel zooms. The overlay shows your guild's claims in green and other guilds' claims in red. The panel checks membership and claim limits for every request; only successful claims appear in the final map state. -## Panel requirements +BlueMap must have rendered the area to show terrain. Claims can still be managed by the in-game `/claim` and `/unclaim` commands when the web map is unavailable. -Rendering needs two things on the machine running the panel: +## Existing world mirror -| Setting | Meaning | -| --- | --- | -| `SCOPENET_VANTAGE_BIN` | The `vantage` executable (default: `vantage` on `PATH`, then `/opt/vantage/vantage`). | -| `SCOPENET_VANTAGE_ASSETS` | Minecraft client assets directory passed as `--assets` (default `/livemap/assets`). | -| `SCOPENET_VANTAGE_ARGS` | Optional extra `vantage server` flags, e.g. `--radius 2048 --memory 1024`. | - -With Docker, either mount your binary at `/opt/vantage/vantage` and the assets at -`/data/livemap/assets`, or bake a static Linux release in with -`VANTAGE_URL= docker compose build`. Until both exist the panel still -stores what servers send and launchers show "the map is being prepared". -Give the container more than the default 256 MB if Live Map is on (`PANEL_MEMORY`). - -## Security - -* Game servers authenticate with their existing `sn_…` token; the endpoints refuse - servers whose Live Map switch is off. -* Viewers must be signed in; the launcher attaches its session token natively, so it - never reaches page scripts. Anyone with an account can view a server's map — use - the server's access rules and leave Live Map off for private worlds. -* The sidecar gets a random per-process bearer token and never leaves loopback. - -## Ingest API (for reference) - -All under `/api/server/v1/livemap/` with `Authorization: Bearer `: -`GET config`, `GET manifest?dim=`, `POST chunks?dim=` (binary records of -`i32 x, i32 z, u32 timestamp, u8 compression, u32 length, bytes`), `POST level` -(`level.dat`), `POST players`, `GET ws` (WebSocket: JSON `players` frames). - -## External Vantage (advanced) - -Under *Use an external Vantage map instead* you can still point a server at a -`manifest.json` / `world.json` you host yourself. It is only used when Live Map is off. +Older SCOPENET game integrations uploaded region chunks to the panel under `/api/server/v1/livemap`. The panel retains those ingest endpoints for compatibility with existing servers, but the launcher terrain comes from BlueMap. Current integrations send player positions only. diff --git a/docs/ranks-guilds-and-warps.md b/docs/ranks-guilds-and-warps.md new file mode 100644 index 0000000..97a9df9 --- /dev/null +++ b/docs/ranks-guilds-and-warps.md @@ -0,0 +1,21 @@ +# Ranks, guild roles, chat and warps + +## Level ranks + +In the panel's **Leveling** page, create a **Player Title / Prefix** reward at each global level milestone. A title can name a LuckPerms group and a Discord role ID. The highest title the player has earned is shown in Paper chat and, when LuckPerms is installed, its configured group is assigned automatically. SCOPENET only changes LuckPerms groups explicitly named on title rewards. Existing panel group to LuckPerms mappings still work independently. + +In **Settings → Discord community**, enable role sync and optionally set a base role ID. Linked players receive the Discord role for their highest earned title; players without a mapped title receive the base role. When a higher title replaces a lower one, the old managed title role is removed. Players without a linked Discord account cannot receive a Discord role; in-game chat shows the base `Novice` title until they earn a title. + +Paper chat shows `[Guild tag] [Level title] [LuckPerms group display] nickname: message`. LuckPerms prefixes and suffixes decorate the name. Messages support `**bold**`, `*italic*`, `__underline__`, `~~strikethrough~~`, backtick code, and Bukkit `&` formatting. `&#RRGGBB` colors and `&` codes require `scopenet.chat.color`, which is granted to operators by default. Players set or clear a persistent nickname with `/nick `; chat also respects display names set by other plugins. + +## Guilds + +Players can request to join a guild from the launcher directory. Leaders and officers review those requests from the guild roster. Leaders can edit the guild description, message of the day, icon and banner from **Guild settings**. They can create and assign custom roles with permissions for invites, kicks, claims, posts and guild details. Deleting a role returns its members to `member`. + +The in-app territory view uses the configured BlueMap 2D tile address for each server. It centers on the player's last position when position relay is enabled. Left click or drag to claim; right click or drag to unclaim. On Paper, `/autoclaim on` claims each new unclaimed chunk entered while walking; `/autoclaim off` stops it. Auto-claim stops on a failed claim so it does not repeatedly send requests at the claim limit or in another guild's territory. + +## Warps and item sharing on Paper + +Players use `/reqwarp ` at the requested location. An operator or player with `scopenet.command.warp.manage` uses `/warprequests`, then `/warpapprove ` or `/warpdeny `. Admins can create and remove warps directly with `/setwarp ` and `/delwarp `. Pending requests are stored in `plugins/SCOPENET/warp_requests.yml`; approved warps are stored in `warps.yml`. + +`/hand` sends the held item as a clickable chat entry. Other players can inspect a read-only snapshot for five minutes. The launcher **Command Guide** lists these commands and their permission nodes. diff --git a/docs/vantage-setup.md b/docs/vantage-setup.md deleted file mode 100644 index df3cb38..0000000 --- a/docs/vantage-setup.md +++ /dev/null @@ -1,254 +0,0 @@ -# Setting up the Vantage 3D Live Map - -This is the complete, step-by-step guide. For a short overview of how the pieces fit, see [live-map.md](live-map.md). - -**What you end up with:** every SCOPENET-connected server gets a 3D map inside the admin panel and a **Live Map** button in the launcher. You install Vantage **once, on the panel machine**. Nothing runs next to your Minecraft servers except the SCOPENET plugin or mod you already use. - -``` -Minecraft server ──(SCOPENET plugin/mod)──► Panel ──runs──► vantage server ──► Admin page + Launcher button - region files + players HTTPS / WebSocket mirror of the world (loopback only) -``` - -> **Two things you must provide on the panel machine:** the `vantage` program, and the Minecraft **client assets** (textures and models) that Vantage needs to draw blocks. The panel will not draw a map until both exist. Everything else works out of the box. - ---- - -## 0. Before you start - -| You need | Notes | -| --- | --- | -| A running SCOPENET panel | With a **Public address** set in Settings, served over HTTPS. | -| A game server running the SCOPENET plugin/mod | Paper plugin, or the Fabric/Forge mod. The server must be online with `online-mode=true` (the same requirement as SCOPENET itself). | -| RAM | Allow **1 GB or more** for the panel when Live Map is on (the default 256 MB is too small). See [sizing](#7-sizing-and-performance). | -| Disk | Roughly the size of the world's region files, plus the rendered tile cache (often the same again). | -| A copy of Minecraft Java Edition | Needed **once**, to extract assets (step 2). It can be on any computer. | - -Vantage is an MIT-licensed third-party project: (product site ). Its own server documentation is the authority on its flags. - ---- - -## 1. Get the `vantage` program - -Download the latest **CLI release** for the panel machine's operating system and CPU from the Vantage releases page: . - -* **Docker panel image:** the image has no shell and no libraries (it is built `FROM scratch`), so it needs a **statically linked Linux build** of `vantage` for the right architecture (x86_64 or arm64). If the release you pick is not static, it will fail to start inside the container with a "not found" error. In that case run the panel on the host, or use a static build. -* **Bare-metal panel:** any build that runs on your OS works. - -Put the file somewhere permanent and make it executable (`chmod 755 vantage`). Check it runs: - -```sh -./vantage --help -``` - ---- - -## 2. Get the Minecraft client assets - -Vantage draws blocks from the textures and models inside Minecraft's client `.jar`. You extract them once with Vantage's own command: - -```sh -vantage extract -``` - -It automatically finds an installed Minecraft client jar (the launcher's `versions//.jar`) and writes the assets out. Run `vantage extract --help` for the flags (for example to choose the jar or the output folder). - -**Which version?** Use a client jar for the same Minecraft version your servers run, or a newer one. Newer is safer if the world contains newer blocks. - -**Running extract on a different computer is fine.** Do it on your own PC (which has Minecraft installed), then copy the resulting folder to the panel machine. You do not need Minecraft on the server. - -**Where the panel looks:** it passes the folder in `SCOPENET_VANTAGE_ASSETS` (default `/livemap/assets`) to `vantage server --assets`. Vantage's own examples point `--assets` at a folder ending in `assets/minecraft`. So **copy the extracted folder to the panel, then point the setting at the folder Vantage expects**. If unsure, test it directly (this command should start and print that it is listening, then stop it with Ctrl+C): - -```sh -vantage server /path/to/any/world --assets /path/to/your/assets/folder --out /tmp/vantage-test -``` - -If Vantage complains about missing assets, try the parent or the `minecraft` subfolder and use whichever works. - -> **Licence note:** the assets are Mojang's. Extract them from a client you own, and do not redistribute them. - ---- - -## 3. Install them on the panel - -Pick **one** of the two layouts. - -### Option A: Docker (recommended) - -The provided `docker-compose.yml` already defines the three settings. Mount your files into the data volume or bake Vantage into the image. - -**A1. Mount the files** (simplest; no rebuild). Put the binary and assets on the Docker host, then add volumes to the `panel` service in `docker-compose.yml`: - -```yaml - volumes: - - panel-data:/data - - ./vantage/vantage:/opt/vantage/vantage:ro # the static binary from step 1 - - ./vantage/assets:/data/livemap/assets:ro # the folder from step 2 -``` - -`SCOPENET_VANTAGE_BIN` (`/opt/vantage/vantage`) and `SCOPENET_VANTAGE_ASSETS` (`/data/livemap/assets`) already default to those paths. - -**A2. Bake the binary in** (assets still come from a mount): - -```sh -VANTAGE_URL="https://…/vantage-x86_64-unknown-linux-musl.tar.gz" docker compose build -``` - -`VANTAGE_URL` must be a direct link to a `.tar.gz` or `.zip` containing the `vantage` file for the **build machine's target architecture**. - -**Raise the memory limit** in `.env` (or the compose file): - -```env -PANEL_MEMORY=1536M -``` - -Then recreate the container: - -```sh -docker compose up -d --build -``` - -### Option B: Panel running directly on the host - -```sh -export SCOPENET_VANTAGE_BIN=/opt/vantage/vantage -export SCOPENET_VANTAGE_ASSETS=/var/lib/scopenet/livemap/assets -# Optional extra flags for `vantage server`: -export SCOPENET_VANTAGE_ARGS="--memory 1024 --threads 4" -``` - -If you leave the two variables unset, the panel looks for `vantage` on `PATH` and then `/opt/vantage/vantage`, and for assets in `/livemap/assets`. With systemd, put these in the unit's `Environment=` lines. - ---- - -## 4. Turn the map on for a server - -1. In the panel: **Servers → your server → Settings → Live Map** (on by default for new servers). Save. -2. On the game server, make sure the plugin/mod has Live Map enabled. It is on by default: - * **Paper** `plugins/SCOPENET/config.yml`: `livemap.enabled: true` - * **Fabric/Forge** `config/scopenet.properties`: `livemap.enabled=true` -3. **Restart the game server** (or reload the SCOPENET config) so it starts sending data. - -The plugin reads the world's saved region files, sends only chunks newer than what the panel already has, and streams player positions every second. - -**World location:** the plugin reads the main world's folder (the first world Paper loads, normally `world`), and the Fabric/Forge mod reads `level-name` from `server.properties`. The Nether and End are found either inside that folder (`DIM-1`, `DIM1`) or in Paper's sibling folders (`world_nether`, `world_the_end`). - ---- - -## 5. Check that it works - -Open **Servers → your server**. The Live Map card shows four checks: - -| Check | Green when | If it is red | -| --- | --- | --- | -| **Vantage generator** | The panel found the `vantage` file. | Fix `SCOPENET_VANTAGE_BIN` / the mount (step 3). | -| **Minecraft assets** | The assets folder exists. | Fix `SCOPENET_VANTAGE_ASSETS` (step 2–3). | -| **World data** | Region files have arrived. | Wait for the server to upload. Big worlds take a while the first time. | -| **Player positions** | Players are online and the server is sending them. | Have someone join; positions only flow while the server runs the plugin/mod. | - -When all are green the map appears under **Overworld / Nether / End** tabs. In the launcher, the instance linked to that server shows a **Live Map** button. (The instance must be linked to the server in the panel, under the server's **Launcher instance** setting.) - -**How fresh is it?** Chunk data only reaches the panel once the game server has *written it to disk*. The map therefore follows the server's autosaves (every few minutes by default). To refresh right now, run `/save-all` on the game server. Player positions are real-time. - ---- - -## 6. How it behaves (good to know) - -* **Sidecars start on demand.** The panel starts one `vantage server` per server and dimension when someone opens a map, and **stops it after 15 idle minutes**. The first open after idle takes a few seconds. -* **Loopback only.** The sidecars listen on `127.0.0.1` with a random per-process token. They are never exposed. All map traffic goes through the panel and needs a signed-in session. -* **The world mirror** lives in `/livemap//world`, and rendered tiles in a cache beside it. **Servers → Live Map → Reset map data** deletes both; the game server then uploads everything again. -* **Pre-baking.** Vantage renders tiles in the background around spawn and players, so the map gets smoother after the first visit. - ---- - -## 7. Sizing and performance - -Put extra `vantage server` flags in `SCOPENET_VANTAGE_ARGS` (space separated). The useful ones: - -| Flag | What it does | -| --- | --- | -| `--memory ` | Memory budget for rendering. Start at `1024`. | -| `--threads ` | Maximum parallel tile renders. Give at least `2`. | -| `--radius ` | Limit how far from spawn the map extends. Saves CPU and disk on huge worlds. | -| `--prebake off` | Only render what people look at. Lower CPU, slower first views. | -| `--lod off` | Skip the zoomed-out overview. Smaller cache, but the map is only visible where tiles are loaded. | -| `--scan-interval ` | How often it checks for changed regions (default `5`). | -| `--caves`, `--light`, `--biome-blend` | Render quality options. See Vantage's docs. | - -Rules of thumb: - -* **1 server, modest world:** 1 GB panel memory, `--threads 2`. -* **Several servers:** each open map dimension is its own process, and they stop after 15 idle minutes. Budget memory for the number of maps opened at once, not the number of servers. -* **Huge worlds:** set `--radius`, or `--prebake off`, and be patient on the first upload. -* **Disk:** watch `/livemap`. **Reset map data** frees it. - ---- - -## 8. Reverse proxy and HTTPS - -The map is served from the panel's own address, so no new ports are needed. If the panel sits behind nginx, Caddy, Traefik or Cloudflare: - -* Forward **WebSocket upgrades** to `/api/server/v1/livemap/ws`. The plugin falls back to plain HTTPS if WebSockets are blocked, but positions update faster with them. -* Allow **large request bodies** for chunk uploads (`client_max_body_size 64m;` in nginx). -* Do not cache `/api/livemap/` responses. -* Keep the panel's **Public address** set to the HTTPS URL players use. - ---- - -## 9. Privacy and access - -* Anyone with a **signed-in account** can open a server's map. To keep a world private, leave Live Map **off** for that server, or restrict the server with its access rules. -* The panel feeds Vantage **only the players who are online right now** (positions from the server plugin/mod). It does **not** expose the last-known positions of everyone who has ever logged in. -* Game servers authenticate with their normal `sn_…` token; servers with Live Map off are refused. - ---- - -## 10. Troubleshooting - -| You see | Cause and fix | -| --- | --- | -| Generator "Not installed on the panel" | The panel can't find `vantage`. Check `SCOPENET_VANTAGE_BIN`, the volume mount, and that the file is executable. In Docker, check the file is a **static** Linux build for the right CPU. | -| "Minecraft client assets for Vantage aren't configured" | The assets folder is missing or the path is wrong. Re-check step 2–3 and that the folder is readable by the container user (uid 65532). | -| "Waiting for the game server to upload this world" | The panel has no `level.dat` or region files for that dimension yet. Check the plugin/mod is connected (server page shows Online), Live Map is on in **both** the panel and the plugin config, and wait for an autosave or run `/save-all`. | -| Launcher shows "the map is being prepared" | Same as above, or the generator/assets check is red. | -| "couldn't start the Vantage generator" | The file isn't executable, is for another CPU/OS, or (in Docker) isn't static. Try running it by hand. | -| Map loads but is blank or shows pink/black blocks | Wrong or incomplete assets. Re-extract from a client jar of the right version. | -| Map is out of date | Chunks appear only after the server saves. Run `/save-all`, or lower the autosave interval in the server settings. | -| Some dimensions are greyed out | That dimension has no region data yet. Visit it in-game and save. | -| Everything is slow | Raise `PANEL_MEMORY` and `--threads`, set `--radius`, or use `--prebake off`. | -| No players on the map | Positions only arrive while the plugin/mod is running and someone is online. Confirm the "Player positions" check. | -| Panel logs: generator stopped | Normal after 15 idle minutes. It restarts on the next open. | - -Still stuck? Open the server page, read **"Generator: …"** under the checklist (it shows the last error from Vantage), and check the panel logs with `RUST_LOG=debug`. - ---- - -## 11. Reference - -**Panel settings (environment variables)** - -| Variable | Default | Meaning | -| --- | --- | --- | -| `SCOPENET_VANTAGE_BIN` | `vantage` on `PATH`, then `/opt/vantage/vantage` | The Vantage executable. | -| `SCOPENET_VANTAGE_ASSETS` | `/livemap/assets` | Extracted Minecraft client assets. | -| `SCOPENET_VANTAGE_ARGS` | none | Extra flags appended to `vantage server`. | -| `PANEL_MEMORY` (Docker) | `256M` | Container memory limit. Use `1G` or more for Live Map. | -| `VANTAGE_URL` (Docker build arg) | empty | Direct link to a static Vantage release to bake into the image. | - -**Game server settings** - -| Where | Key | Default | -| --- | --- | --- | -| Paper `config.yml` | `livemap.enabled` | `true` | -| Fabric/Forge `config/scopenet.properties` | `livemap.enabled` | `true` | -| Panel, per server | Live Map switch | on for new servers | - -**What the panel runs for each map** (for reference): - -``` -vantage server /livemap//world --assets --out \ - --host 127.0.0.1 --port --players-file --dimension -``` - -with the secret passed in `VANTAGE_SERVER_TOKEN`. - -**Not verified here:** the exact names of Vantage's release files and the exact folder layout that `vantage extract` produces change between Vantage versions. This guide was written against Vantage's published README and server documentation; follow Vantage's own `--help` if they differ. diff --git a/examples/paper/config.yml b/examples/paper/config.yml index bcf6ab3..600a84d 100644 --- a/examples/paper/config.yml +++ b/examples/paper/config.yml @@ -64,10 +64,8 @@ essentials: rtp-radius: 2500 livemap: - # Send world chunks and player positions to the panel's central 3D Live Map. - # Nothing runs on this server; the panel renders it. Needs "Live Map" switched on - # for this server in the panel, and Vantage installed on the panel. - # Setup guide: docs/vantage-setup.md + # Send live player positions to the panel so the launcher can center its + # BlueMap territory view. Configure BlueMap's public address in the panel. enabled: true economy: diff --git a/integrations/api/src/main/java/net/scopenet/api/ScopenetPlayer.java b/integrations/api/src/main/java/net/scopenet/api/ScopenetPlayer.java index 3141c2b..ac7955d 100644 --- a/integrations/api/src/main/java/net/scopenet/api/ScopenetPlayer.java +++ b/integrations/api/src/main/java/net/scopenet/api/ScopenetPlayer.java @@ -36,7 +36,9 @@ public record ScopenetPlayer( QuestProgress weeklyQuests, String joined, String rankGroup, - String rankPrefix) { + String rankDisplay, + String rankPrefix, + String rankSuffix) { public boolean inGuild() { return guild != null; } diff --git a/integrations/common/src/main/java/net/scopenet/integration/Integration.java b/integrations/common/src/main/java/net/scopenet/integration/Integration.java index aca37ac..6c144fc 100644 --- a/integrations/common/src/main/java/net/scopenet/integration/Integration.java +++ b/integrations/common/src/main/java/net/scopenet/integration/Integration.java @@ -144,13 +144,10 @@ public final class Integration implements AutoCloseable { this.notificationHandler = handler; } - /** - * Start mirroring this server's world and player positions to the panel's - * central live map. {@code worldRoot} is the level folder (e.g. {@code world}). - */ - public void enableLiveMap(java.nio.file.Path worldRoot) { + /** Start sending player positions for the in-app BlueMap territory view. */ + public void enableLiveMap() { if (closed || liveMap != null) return; - liveMap = new LiveMapSync(client, worldRoot, log); + liveMap = new LiveMapSync(client); liveMap.start(); } @@ -160,12 +157,6 @@ public final class Integration implements AutoCloseable { if (map != null) map.offerPlayers(players); } - /** The world was just saved: pick up its changed chunks soon. */ - public void liveMapSaved() { - LiveMapSync map = liveMap; - if (map != null) map.requestScan(); - } - public ChunkCheckResult checkChunk(String dimension, int chunkX, int chunkZ, UUID uuid) { return client.checkChunk(dimension, chunkX, chunkZ, uuid); } diff --git a/integrations/common/src/main/java/net/scopenet/integration/LiveMapSync.java b/integrations/common/src/main/java/net/scopenet/integration/LiveMapSync.java index 3d73045..0657a8d 100644 --- a/integrations/common/src/main/java/net/scopenet/integration/LiveMapSync.java +++ b/integrations/common/src/main/java/net/scopenet/integration/LiveMapSync.java @@ -1,363 +1,70 @@ package net.scopenet.integration; -import com.google.gson.*; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.net.URI; -import java.net.http.WebSocket; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.file.*; -import java.time.Duration; -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Consumer; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; -/** - * Mirrors the world to the panel's central Live Map: changed chunks (raw, - * already-compressed Anvil payloads read straight from the region files) over - * HTTPS, and live player positions over a WebSocket (HTTPS as fallback). - * Nothing here touches the server thread except {@link #offerPlayers}. - */ +/** Sends live player positions to the panel for the in-app BlueMap territory view. */ public final class LiveMapSync implements AutoCloseable { public record Player(String uuid, String name, String dimension, double x, double y, double z, float yaw, float pitch) {} - private static final String[] DIMS = {"overworld", "the_nether", "the_end"}; - private static final int SECTOR = 4096; - private static final int BATCH_BYTES = 6 * 1024 * 1024; - private static final int SCAN_BUDGET_BYTES = 48 * 1024 * 1024; - private final PanelClient client; - private final Path root; - private final Consumer log; - private final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor(r -> { - Thread t = new Thread(r, "scopenet-livemap"); - t.setDaemon(true); - return t; + private final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor(task -> { + Thread thread = new Thread(task, "scopenet-positions"); + thread.setDaemon(true); + return thread; }); - /** Per region, the timestamp the panel already holds for each of its 1024 chunks. */ - private final Map known = new HashMap<>(); - private final Set manifestLoaded = new HashSet<>(); - private final AtomicBoolean scanQueued = new AtomicBoolean(); - private volatile boolean panelEnabled; - private volatile boolean closed; private volatile List players = List.of(); - private volatile boolean playersChanged; - private volatile WebSocket socket; - private volatile long socketRetryAt; - private long nextScan; - private long configCheckAt; - private long levelModified = -1; - private long lastPlayersSent; - private long chunkIntervalSecs = 20; - private boolean warnedMissing; + private volatile boolean changed; + private volatile boolean closed; + private long lastSent; - public LiveMapSync(PanelClient client, Path root, Consumer log) { - this.client = client; - this.root = root; - this.log = log; - } + public LiveMapSync(PanelClient client) { this.client = client; } - public void start() { - worker.scheduleWithFixedDelay(this::scanSafely, 10, 5, TimeUnit.SECONDS); - worker.scheduleWithFixedDelay(this::sendPlayersSafely, 5, 1, TimeUnit.SECONDS); - } + public void start() { worker.scheduleWithFixedDelay(this::sendSafely, 1, 1, TimeUnit.SECONDS); } public void offerPlayers(List next) { if (!next.equals(players)) { players = List.copyOf(next); - playersChanged = true; + changed = true; } } - /** A save just happened; scan soon instead of waiting for the next interval. */ - public void requestScan() { - if (closed || !scanQueued.compareAndSet(false, true)) return; + private void sendSafely() { + if (closed) return; + long now = System.nanoTime(); + if (!changed && now - lastSent < TimeUnit.SECONDS.toNanos(10)) return; + JsonArray list = new JsonArray(); + for (Player p : players) { + JsonObject entry = new JsonObject(); + entry.addProperty("uuid", p.uuid()); + entry.addProperty("name", p.name()); + entry.addProperty("dimension", p.dimension()); + entry.addProperty("x", p.x()); + entry.addProperty("y", p.y()); + entry.addProperty("z", p.z()); + entry.addProperty("yaw", p.yaw()); + entry.addProperty("pitch", p.pitch()); + list.add(entry); + } + JsonObject body = new JsonObject(); + body.add("players", list); try { - worker.schedule(() -> { - scanQueued.set(false); - nextScan = 0; - scanSafely(); - }, 3, TimeUnit.SECONDS); - } catch (RejectedExecutionException e) { - scanQueued.set(false); + client.post("livemap/players", body); + changed = false; + lastSent = now; + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (Exception ignored) { + // Keep the latest snapshot and retry on the next interval. } } @Override public void close() { closed = true; - WebSocket ws = socket; - if (ws != null) ws.abort(); worker.shutdownNow(); } - - // ---- chunks ---- - - private void scanSafely() { - if (closed || System.nanoTime() < nextScan) return; - try { - if (!refreshEnabled()) return; - long uploaded = scan(); - nextScan = System.nanoTime() + TimeUnit.SECONDS.toNanos(uploaded >= SCAN_BUDGET_BYTES ? 1 : chunkIntervalSecs); - } catch (PanelClient.HttpFailure e) { - if (e.status == 403) panelEnabled = false; - else log.accept("SCOPENET live map: the panel refused an upload (" + e.getMessage() + ")"); - nextScan = System.nanoTime() + TimeUnit.SECONDS.toNanos(30); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (Exception e) { - log.accept("SCOPENET live map sync failed: " + e.getClass().getSimpleName() + ": " + e.getMessage()); - nextScan = System.nanoTime() + TimeUnit.SECONDS.toNanos(60); - } - } - - /** True when the panel wants this server's map. Rechecks once a minute while it doesn't. */ - private boolean refreshEnabled() throws IOException, InterruptedException { - if (panelEnabled) return true; - long now = System.nanoTime(); - if (now < configCheckAt) return false; - configCheckAt = now + TimeUnit.SECONDS.toNanos(60); - try { - JsonObject config = client.get("livemap/config"); - panelEnabled = config.has("enabled") && config.get("enabled").getAsBoolean(); - if (config.has("chunk_interval_secs")) chunkIntervalSecs = Math.max(5, config.get("chunk_interval_secs").getAsLong()); - if (panelEnabled) log.accept("SCOPENET live map is on: sending this world to the panel."); - } catch (PanelClient.HttpFailure e) { - panelEnabled = false; // an older panel without live map support - } - return panelEnabled; - } - - /** Returns how many bytes of chunk data were uploaded. */ - private long scan() throws IOException, InterruptedException { - if (!Files.isDirectory(root)) { - if (!warnedMissing) { - warnedMissing = true; - log.accept("SCOPENET live map: world folder " + root + " not found"); - } - return 0; - } - uploadLevelIfChanged(); - long total = 0; - for (String dim : DIMS) { - Path dir = regionDir(dim); - if (dir == null) continue; - loadManifest(dim); - Batch batch = new Batch(dim); - List files = new ArrayList<>(); - try (DirectoryStream stream = Files.newDirectoryStream(dir, "r.*.*.mca")) { - stream.forEach(files::add); - } - files.sort(Comparator.comparing(Path::toString)); - for (Path file : files) { - if (closed || total + batch.size >= SCAN_BUDGET_BYTES) break; - total += readRegion(dim, file, batch); - } - total += batch.flush(); - if (total >= SCAN_BUDGET_BYTES) break; - } - return total; - } - - private Path regionDir(String dim) { - String name = root.getFileName() == null ? "world" : root.getFileName().toString(); - Path parent = root.toAbsolutePath().getParent(); - List candidates = switch (dim) { - case "the_nether" -> Arrays.asList(root.resolve("DIM-1/region"), sibling(parent, name + "_nether", "DIM-1/region"), - root.resolve("dimensions/minecraft/the_nether/region")); - case "the_end" -> Arrays.asList(root.resolve("DIM1/region"), sibling(parent, name + "_the_end", "DIM1/region"), - root.resolve("dimensions/minecraft/the_end/region")); - default -> List.of(root.resolve("region"), root.resolve("dimensions/minecraft/overworld/region")); - }; - for (Path p : candidates) if (p != null && Files.isDirectory(p)) return p; - return null; - } - - private static Path sibling(Path parent, String name, String rel) { - return parent == null ? null : parent.resolve(name).resolve(rel); - } - - private void loadManifest(String dim) throws IOException, InterruptedException { - if (manifestLoaded.contains(dim)) return; - JsonObject manifest = client.get("livemap/manifest?dim=" + dim); - for (JsonElement el : manifest.getAsJsonArray("regions")) { - JsonObject region = el.getAsJsonObject(); - byte[] raw = Base64.getDecoder().decode(region.get("timestamps").getAsString()); - int[] ts = new int[1024]; - ByteBuffer.wrap(raw).asIntBuffer().get(ts, 0, Math.min(1024, raw.length / 4)); - known.put(key(dim, region.get("x").getAsInt(), region.get("z").getAsInt()), ts); - } - manifestLoaded.add(dim); - } - - private static String key(String dim, int rx, int rz) { - return dim + ":" + rx + ":" + rz; - } - - /** Adds every newer chunk of one region file to the batch; returns bytes uploaded by flushes. */ - private long readRegion(String dim, Path file, Batch batch) throws IOException, InterruptedException { - String[] parts = file.getFileName().toString().split("\\."); - int rx, rz; - try { - rx = Integer.parseInt(parts[1]); - rz = Integer.parseInt(parts[2]); - } catch (RuntimeException e) { - return 0; - } - long flushed = 0; - int[] have = known.getOrDefault(key(dim, rx, rz), new int[1024]); - try (FileChannel ch = FileChannel.open(file, StandardOpenOption.READ)) { - long size = ch.size(); - if (size < 2L * SECTOR) return 0; - ByteBuffer header = ByteBuffer.allocate(2 * SECTOR); - while (header.hasRemaining()) if (ch.read(header, header.position()) < 0) return 0; - for (int i = 0; i < 1024; i++) { - int loc = header.getInt(i * 4); - int ts = header.getInt(SECTOR + i * 4); - int count = loc & 0xff; - long offset = (loc >>> 8) & 0xffffffL; - if (count == 0 || Integer.toUnsignedLong(ts) <= Integer.toUnsignedLong(have[i])) continue; - if (offset < 2 || (offset + count) * SECTOR > size) continue; - ByteBuffer prefix = ByteBuffer.allocate(5); - while (prefix.hasRemaining()) if (ch.read(prefix, offset * SECTOR + prefix.position()) < 0) break; - if (prefix.hasRemaining()) continue; - int length = prefix.getInt(0); - int compression = prefix.get(4) & 0xff; - // Oversized chunks live in external .mcc files; skip those and anything malformed. - if (length < 2 || length - 1 > count * SECTOR - 5 || (compression & 0x80) != 0 || compression == 0 || compression > 4) continue; - ByteBuffer data = ByteBuffer.allocate(length - 1); - while (data.hasRemaining()) if (ch.read(data, offset * SECTOR + 5 + data.position()) < 0) break; - if (data.hasRemaining()) continue; - batch.add(rx, rz, i, rx * 32 + (i & 31), rz * 32 + (i >> 5), ts, compression, data.array()); - if (batch.size >= BATCH_BYTES) flushed += batch.flush(); - } - } - return flushed; - } - - /** Chunk records waiting to be uploaded; a chunk counts as sent only once the panel accepted it. */ - private final class Batch { - final String dim; - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - final List marks = new ArrayList<>(); - int size; - - Batch(String dim) { - this.dim = dim; - } - - void add(int rx, int rz, int index, int x, int z, int ts, int compression, byte[] data) { - ByteBuffer rec = ByteBuffer.allocate(17 + data.length); - rec.putInt(x).putInt(z).putInt(ts).put((byte) compression).putInt(data.length).put(data); - out.write(rec.array(), 0, rec.capacity()); - marks.add(new int[]{rx, rz, index, ts}); - size += rec.capacity(); - } - - long flush() throws IOException, InterruptedException { - if (marks.isEmpty()) return 0; - long sent = size; - try { - client.postBytes("livemap/chunks?dim=" + dim, out.toByteArray()); - for (int[] m : marks) known.computeIfAbsent(key(dim, m[0], m[1]), k -> new int[1024])[m[2]] = m[3]; - } finally { - out.reset(); - marks.clear(); - size = 0; - } - return sent; - } - } - - private void uploadLevelIfChanged() throws IOException, InterruptedException { - Path level = root.resolve("level.dat"); - if (!Files.isRegularFile(level)) return; - long modified = Files.getLastModifiedTime(level).toMillis(); - if (modified == levelModified) return; - byte[] bytes = Files.readAllBytes(level); - if (bytes.length > 2 * 1024 * 1024) return; - client.postBytes("livemap/level", bytes); - levelModified = modified; - } - - // ---- players ---- - - private void sendPlayersSafely() { - if (closed || !panelEnabled) return; - long now = System.nanoTime(); - // Resend unchanged rosters now and then so the panel knows we're alive. - boolean heartbeat = now - lastPlayersSent > TimeUnit.SECONDS.toNanos(10); - if (!playersChanged && !heartbeat) return; - playersChanged = false; - lastPlayersSent = now; - JsonArray list = new JsonArray(); - for (Player p : players) { - JsonObject o = new JsonObject(); - o.addProperty("uuid", p.uuid()); - o.addProperty("name", p.name()); - o.addProperty("dimension", p.dimension()); - o.addProperty("x", p.x()); - o.addProperty("y", p.y()); - o.addProperty("z", p.z()); - o.addProperty("yaw", p.yaw()); - o.addProperty("pitch", p.pitch()); - list.add(o); - } - JsonObject body = new JsonObject(); - body.addProperty("type", "players"); - body.add("players", list); - try { - WebSocket ws = socket; - if (ws != null && !ws.isOutputClosed()) { - ws.sendText(body.toString(), true).get(5, TimeUnit.SECONDS); - return; - } - connectSocket(); - client.post("livemap/players", body); - } catch (PanelClient.HttpFailure e) { - if (e.status == 403) panelEnabled = false; - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (Exception e) { - socket = null; // reconnect later; HTTPS covers the gap - } - } - - private void connectSocket() { - long now = System.nanoTime(); - if (now < socketRetryAt) return; - socketRetryAt = now + TimeUnit.SECONDS.toNanos(30); - try { - Settings settings = client.settings(); - URI panel = settings.panel(); - String scheme = "https".equals(panel.getScheme()) ? "wss" : "ws"; - String path = panel.getRawPath() == null ? "" : panel.getRawPath(); - URI uri = URI.create(scheme + "://" + panel.getRawAuthority() + path + "/api/server/v1/livemap/ws"); - client.http().newWebSocketBuilder() - .header("Authorization", "Bearer " + settings.token()) - .connectTimeout(Duration.ofSeconds(5)) - .buildAsync(uri, new WebSocket.Listener() { - @Override public CompletionStage onText(WebSocket ws, CharSequence data, boolean last) { - if (data.toString().contains("\"disabled\"")) panelEnabled = false; - ws.request(1); - return null; - } - - @Override public CompletionStage onClose(WebSocket ws, int code, String reason) { - if (socket == ws) socket = null; - return null; - } - - @Override public void onError(WebSocket ws, Throwable error) { - if (socket == ws) socket = null; - } - }).thenAccept(ws -> { - if (closed) ws.abort(); - else socket = ws; - }); - } catch (RuntimeException ignored) { - // The HTTPS fallback keeps working. - } - } } diff --git a/integrations/minecraft/src/main/java/net/scopenet/minecraft/Bridge.java b/integrations/minecraft/src/main/java/net/scopenet/minecraft/Bridge.java index 8ddf3fd..ff6a8c3 100644 --- a/integrations/minecraft/src/main/java/net/scopenet/minecraft/Bridge.java +++ b/integrations/minecraft/src/main/java/net/scopenet/minecraft/Bridge.java @@ -33,24 +33,13 @@ public final class Bridge { })); integration.startClaimSync(); Path config = Path.of("config/scopenet.properties"); - if (Settings.liveMapEnabled(config)) integration.enableLiveMap(worldFolder()); + if (Settings.liveMapEnabled(config)) integration.enableLiveMap(); } catch (Exception e) { // Throwing aborts startup; silently disabling an auth mod is unsafe. throw new IllegalStateException("SCOPENET cannot start: " + e.getMessage(), e); } } - /** The level folder: `level-name` from server.properties, like the game itself reads it. */ - private static Path worldFolder() { - Properties props = new Properties(); - try (var in = java.nio.file.Files.newBufferedReader(Path.of("server.properties"))) { - props.load(in); - } catch (java.io.IOException ignored) { - // Fall back to the default level name. - } - return Path.of(props.getProperty("level-name", "world")); - } - public static CompletableFuture login(UUID uuid, String name, SocketAddress address) { Integration current = integration; if (current == null) return CompletableFuture.completedFuture(Integration.UNAVAILABLE); diff --git a/integrations/paper/src/main/java/net/scopenet/paper/ChatFormatter.java b/integrations/paper/src/main/java/net/scopenet/paper/ChatFormatter.java new file mode 100644 index 0000000..710cc90 --- /dev/null +++ b/integrations/paper/src/main/java/net/scopenet/paper/ChatFormatter.java @@ -0,0 +1,57 @@ +package net.scopenet.paper; + +import net.scopenet.api.ScopenetPlayer; +import net.scopenet.paper.compat.ScopenetApiImpl; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** Formats player chat from the cached SCOPENET profile without a network call on the chat thread. */ +public final class ChatFormatter { + private static final Pattern MARKDOWN = Pattern.compile("(\\*\\*(.+?)\\*\\*|__(.+?)__|~~(.+?)~~|`(.+?)`|\\*(.+?)\\*)"); + private static final Pattern HEX = Pattern.compile("&#([0-9a-fA-F]{6})"); + private final ScopenetApiImpl profiles; + + public ChatFormatter(ScopenetApiImpl profiles) { this.profiles = profiles; } + + private static String clean(String value) { + return value == null ? "" : ChatColor.stripColor(value).replace('%', ' ').replace('[', ' ').replace(']', ' ').trim(); + } + + public String format(Player player) { + ScopenetPlayer p = profiles.peek(player.getUniqueId()).orElse(null); + String guild = p == null || p.guild() == null ? "" : "§3[" + clean(p.guild().tag()) + "] "; + String title = p == null || p.rankTitle() == null || p.rankTitle().isBlank() ? "Novice" : clean(p.rankTitle()); + String group = p == null || p.rankGroup() == null || p.rankGroup().isBlank() ? "Member" + : p.rankDisplay() == null || p.rankDisplay().isBlank() ? clean(p.rankGroup()) : clean(p.rankDisplay()); + String prefix = p == null ? "" : p.rankPrefix(); + String suffix = p == null ? "" : p.rankSuffix(); + String decorated = prefix == null || prefix.isBlank() ? "" : ChatColor.translateAlternateColorCodes('&', prefix.replace("%", "%%")) + " "; + String name = player.getDisplayName().replace("%", "%%"); + String tail = suffix == null || suffix.isBlank() ? "" : " " + ChatColor.translateAlternateColorCodes('&', suffix.replace("%", "%%")); + return guild + "§6[" + title + "] §b[" + group + "] §r" + decorated + name + tail + "§7: §f%2$s"; + } + + public String message(Player player, String raw) { + String input = player.hasPermission("scopenet.chat.color") ? ChatColor.translateAlternateColorCodes('&', raw) : ChatColor.stripColor(raw); + if (player.hasPermission("scopenet.chat.color")) { + Matcher hex = HEX.matcher(input); + StringBuffer colored = new StringBuffer(); + while (hex.find()) hex.appendReplacement(colored, Matcher.quoteReplacement(net.md_5.bungee.api.ChatColor.of('#' + hex.group(1)).toString())); + hex.appendTail(colored); + input = colored.toString(); + } + Matcher matcher = MARKDOWN.matcher(input); + StringBuffer out = new StringBuffer(); + while (matcher.find()) { + String code = matcher.group(2) != null ? "§l" : matcher.group(3) != null ? "§n" : matcher.group(4) != null ? "§m" : matcher.group(5) != null ? "§7" : "§o"; + String text = matcher.group(2) != null ? matcher.group(2) : matcher.group(3) != null ? matcher.group(3) + : matcher.group(4) != null ? matcher.group(4) : matcher.group(5) != null ? matcher.group(5) : matcher.group(6); + matcher.appendReplacement(out, Matcher.quoteReplacement(code + text + "§r§f")); + } + matcher.appendTail(out); + return out.toString(); + } +} diff --git a/integrations/paper/src/main/java/net/scopenet/paper/ScopenetPlugin.java b/integrations/paper/src/main/java/net/scopenet/paper/ScopenetPlugin.java index efd9c21..e071d21 100644 --- a/integrations/paper/src/main/java/net/scopenet/paper/ScopenetPlugin.java +++ b/integrations/paper/src/main/java/net/scopenet/paper/ScopenetPlugin.java @@ -27,7 +27,7 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener { private ClientLinkBridge clientLink; private EssentialsHandler essentialsHandler; private GuildHandler guildHandler; - private boolean liveMapStarted; + private ChatFormatter chatFormatter; @Override public void onEnable() { // Install the deny-by-default listener even if configuration is invalid. @@ -51,17 +51,16 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener { // Claim protection runs from a local copy of the panel's claims, refreshed in the background. integration.startClaimSync(); - // Central Live Map: mirror chunks and player positions to the panel. + // Live positions center the in-app BlueMap claim view on the player. if (getConfig().getBoolean("livemap.enabled", true)) { - // STARTUP plugins enable before Paper loads any worlds. WorldLoadEvent starts - // the map on a fresh boot; this also handles enabling after worlds exist. - for (World world : Bukkit.getWorlds()) startLiveMap(world); + integration.enableLiveMap(); Bukkit.getScheduler().runTaskTimer(this, this::snapshotPlayers, 40, 20); } // Developer API: other plugins use SCOPENET through ScopenetApiProvider / the services manager, // and receive level-ups, achievements and guild changes as ordinary Bukkit events. api = new ScopenetApiImpl(integration.client()); + chatFormatter = new ChatFormatter(api); ScopenetApiProvider.register(api); getServer().getServicesManager().register(ScopenetApi.class, api, this, org.bukkit.plugin.ServicePriority.Normal); // Optional client mod (HUD, claim overlay, shop and market windows). @@ -85,9 +84,16 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener { EssentialsHandler essentials = new EssentialsHandler(this); essentialsHandler = essentials; getServer().getPluginManager().registerEvents(essentials, this); - String[] essCmds = {"spawn", "home", "sethome", "delhome", "back", "tpa", "tpaccept", "tpdeny", "rtp", "warp", "playtime"}; + String[] essCmds = {"spawn", "home", "sethome", "delhome", "back", "tpa", "tpaccept", "tpdeny", "rtp", "warp", "reqwarp", "warprequests", "warpapprove", "warpdeny", "setwarp", "delwarp", "playtime"}; for (String c : essCmds) bindCommand(c, essentials); } + HandHandler hand = new HandHandler(this); + getServer().getPluginManager().registerEvents(hand, this); + bindCommand("hand", hand); + bindCommand("handview", hand); + NicknameHandler nick = new NicknameHandler(this); + getServer().getPluginManager().registerEvents(nick, this); + bindCommand("nick", nick); // Register Economy commands & GUI { @@ -105,6 +111,7 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener { bindCommand("guild", guilds); bindCommand("claim", guilds); bindCommand("unclaim", guilds); + bindCommand("autoclaim", guilds); } // Physical shops, actions from the map, and (when BlueMap is installed) claims, pins and the player panel on it. @@ -126,18 +133,6 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener { } } - @EventHandler - public void worldLoaded(org.bukkit.event.world.WorldLoadEvent event) { - startLiveMap(event.getWorld()); - } - - private void startLiveMap(World world) { - if (liveMapStarted || integration == null || world.getEnvironment() != World.Environment.NORMAL - || !getConfig().getBoolean("livemap.enabled", true)) return; - integration.enableLiveMap(world.getWorldFolder().toPath()); - liveMapStarted = true; - } - private Settings readSettings() { return Settings.of( getConfig().getString("panel-url", ""), @@ -181,11 +176,6 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener { integration.liveMapPlayers(list); } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void worldSaved(org.bukkit.event.world.WorldSaveEvent event) { - if (integration != null) integration.liveMapSaved(); - } - public static String dimension(World world) { return world.getKey().toString(); } @@ -372,8 +362,12 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener { if (claimed(event.getBlock())) event.setCancelled(true); } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void chat(AsyncPlayerChatEvent event) { + if (integration != null && integration.settings().socialEnabled() && integration.settings().chatPrefixesEnabled() && chatFormatter != null) { + event.setFormat(chatFormatter.format(event.getPlayer())); + event.setMessage(chatFormatter.message(event.getPlayer(), event.getMessage())); + } add(event.getPlayer(), "messages"); } diff --git a/integrations/paper/src/main/java/net/scopenet/paper/commands/EssentialsHandler.java b/integrations/paper/src/main/java/net/scopenet/paper/commands/EssentialsHandler.java index b845155..9a01edc 100644 --- a/integrations/paper/src/main/java/net/scopenet/paper/commands/EssentialsHandler.java +++ b/integrations/paper/src/main/java/net/scopenet/paper/commands/EssentialsHandler.java @@ -27,8 +27,10 @@ public final class EssentialsHandler implements CommandExecutor, Listener { private final ScopenetPlugin plugin; private final File homesFile; private final File warpsFile; + private final File warpRequestsFile; private final YamlConfiguration homesConfig; private final YamlConfiguration warpsConfig; + private final YamlConfiguration warpRequestsConfig; private final Map> homes = new ConcurrentHashMap<>(); private final Map warps = new ConcurrentHashMap<>(); @@ -43,8 +45,10 @@ public final class EssentialsHandler implements CommandExecutor, Listener { this.plugin = plugin; this.homesFile = new File(plugin.getDataFolder(), "homes.yml"); this.warpsFile = new File(plugin.getDataFolder(), "warps.yml"); + this.warpRequestsFile = new File(plugin.getDataFolder(), "warp_requests.yml"); this.homesConfig = YamlConfiguration.loadConfiguration(homesFile); this.warpsConfig = YamlConfiguration.loadConfiguration(warpsFile); + this.warpRequestsConfig = YamlConfiguration.loadConfiguration(warpRequestsFile); loadHomes(); loadWarps(); } @@ -100,6 +104,11 @@ public final class EssentialsHandler implements CommandExecutor, Listener { } } + private void saveWarpRequests() { + try { warpRequestsConfig.save(warpRequestsFile); } + catch (IOException e) { plugin.getLogger().warning("Failed to save warp requests: " + e.getMessage()); } + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onTeleport(PlayerTeleportEvent event) { if (event.getFrom() != null && event.getCause() != PlayerTeleportEvent.TeleportCause.UNKNOWN) { @@ -160,6 +169,12 @@ public final class EssentialsHandler implements CommandExecutor, Listener { case "tpdeny" -> handleTpDeny(player); case "rtp" -> handleRtp(player); case "warp" -> handleWarp(player, args); + case "reqwarp" -> requestWarp(player, args); + case "warprequests" -> listWarpRequests(player); + case "warpapprove" -> reviewWarp(player, args, true); + case "warpdeny" -> reviewWarp(player, args, false); + case "setwarp" -> setWarp(player, args); + case "delwarp" -> deleteWarp(player, args); case "playtime" -> handlePlaytime(player, args); default -> { return false; } } @@ -389,6 +404,88 @@ public final class EssentialsHandler implements CommandExecutor, Listener { player.sendMessage(ChatColor.GREEN + "Teleported to warp " + ChatColor.YELLOW + warpName + ChatColor.GREEN + "."); } + private String warpName(Player player, String[] args, String usage) { + if (args.length != 1 || !args[0].matches("[A-Za-z0-9_-]{2,24}")) { + player.sendMessage(ChatColor.RED + "Usage: " + usage + " (2–24 letters, numbers, _ or -)"); + return null; + } + return args[0].toLowerCase(Locale.ROOT); + } + + private void requestWarp(Player player, String[] args) { + String name = warpName(player, args, "/reqwarp "); + if (name == null) return; + if (warps.containsKey(name)) { player.sendMessage(ChatColor.RED + "That warp already exists."); return; } + if (warpRequestsConfig.contains(name) && !player.getUniqueId().toString().equals(warpRequestsConfig.getString(name + ".uuid"))) { + player.sendMessage(ChatColor.RED + "That warp name has already been requested."); return; + } + warpRequestsConfig.set(name + ".location", player.getLocation()); + warpRequestsConfig.set(name + ".uuid", player.getUniqueId().toString()); + warpRequestsConfig.set(name + ".requester", player.getName()); + warpRequestsConfig.set(name + ".created_at", System.currentTimeMillis()); + saveWarpRequests(); + player.sendMessage(ChatColor.GREEN + "Warp request sent. A server admin can approve it with /warpapprove " + name + "."); + Bukkit.getOnlinePlayers().stream().filter(p -> p.hasPermission("scopenet.command.warp.manage")) + .forEach(p -> p.sendMessage(ChatColor.YELLOW + player.getName() + " requested warp '" + name + "'. Use /warprequests to review.")); + } + + private boolean warpAdmin(Player player) { + if (player.hasPermission("scopenet.command.warp.manage")) return true; + player.sendMessage(ChatColor.RED + "Only server admins can manage warps."); + return false; + } + + private void listWarpRequests(Player player) { + if (!warpAdmin(player)) return; + if (warpRequestsConfig.getKeys(false).isEmpty()) { player.sendMessage(ChatColor.YELLOW + "No pending warp requests."); return; } + player.sendMessage(ChatColor.GOLD + "Pending warp requests:"); + for (String name : warpRequestsConfig.getKeys(false)) { + Location at = warpRequestsConfig.getLocation(name + ".location"); + player.sendMessage(ChatColor.YELLOW + name + ChatColor.GRAY + " by " + warpRequestsConfig.getString(name + ".requester", "unknown") + + (at == null || at.getWorld() == null ? "" : " at " + at.getWorld().getName() + " " + at.getBlockX() + ", " + at.getBlockY() + ", " + at.getBlockZ())); + } + } + + private void reviewWarp(Player player, String[] args, boolean approve) { + if (!warpAdmin(player)) return; + String name = warpName(player, args, approve ? "/warpapprove " : "/warpdeny "); + if (name == null) return; + Location at = warpRequestsConfig.getLocation(name + ".location"); + if (at == null || at.getWorld() == null) { player.sendMessage(ChatColor.RED + "No pending request with a loaded world has that name."); return; } + if (approve) { + if (warps.containsKey(name)) { player.sendMessage(ChatColor.RED + "Warp already exists. Deny this request or choose another name."); return; } + warps.put(name, at); + saveWarps(); + } + String uuid = warpRequestsConfig.getString(name + ".uuid", ""); + warpRequestsConfig.set(name, null); + saveWarpRequests(); + player.sendMessage(ChatColor.GREEN + "Warp request " + (approve ? "approved" : "denied") + ": " + name); + try { + Player requester = Bukkit.getPlayer(UUID.fromString(uuid)); + if (requester != null) requester.sendMessage(ChatColor.YELLOW + "Your warp request '" + name + "' was " + (approve ? "approved" : "denied") + "."); + } catch (IllegalArgumentException ignored) {} + } + + private void setWarp(Player player, String[] args) { + if (!warpAdmin(player)) return; + String name = warpName(player, args, "/setwarp "); + if (name == null) return; + warps.put(name, player.getLocation()); + saveWarps(); + player.sendMessage(ChatColor.GREEN + "Warp set: " + name); + } + + private void deleteWarp(Player player, String[] args) { + if (!warpAdmin(player)) return; + String name = warpName(player, args, "/delwarp "); + if (name == null) return; + if (warps.remove(name) == null) { player.sendMessage(ChatColor.RED + "Warp not found."); return; } + warpsConfig.set(name, null); + saveWarps(); + player.sendMessage(ChatColor.GREEN + "Warp deleted: " + name); + } + private void openWarpPicker(Player player) { Inventory inv = Bukkit.createInventory(null, 27, GUI_WARPS_TITLE); int slot = 11; diff --git a/integrations/paper/src/main/java/net/scopenet/paper/commands/GuildHandler.java b/integrations/paper/src/main/java/net/scopenet/paper/commands/GuildHandler.java index 830a225..5fb4b6f 100644 --- a/integrations/paper/src/main/java/net/scopenet/paper/commands/GuildHandler.java +++ b/integrations/paper/src/main/java/net/scopenet/paper/commands/GuildHandler.java @@ -20,6 +20,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -34,6 +36,8 @@ public final class GuildHandler implements CommandExecutor, Listener { private final File guildHomesFile; private final YamlConfiguration guildHomesConfig; private final Map guildHomes = new ConcurrentHashMap<>(); + private final Set autoClaim = ConcurrentHashMap.newKeySet(); + private final Map lastAutoClaim = new ConcurrentHashMap<>(); private static final String GUI_GUILD_TITLE = ChatColor.DARK_AQUA + "Guild Dashboard"; @@ -86,6 +90,23 @@ public final class GuildHandler implements CommandExecutor, Listener { handleUnclaim(player); return true; } + if (cmd.equals("autoclaim")) { + if (!player.hasPermission("scopenet.command.claim")) { player.sendMessage(ChatColor.RED + "You cannot claim land."); return true; } + if (args.length != 1 || (!args[0].equalsIgnoreCase("on") && !args[0].equalsIgnoreCase("off"))) { + player.sendMessage(ChatColor.YELLOW + "Usage: /autoclaim on|off"); return true; + } + if (args[0].equalsIgnoreCase("on")) { + autoClaim.add(player.getUniqueId()); + lastAutoClaim.remove(player.getUniqueId()); + player.sendMessage(ChatColor.GREEN + "Auto-claim is on. New chunks you walk into will be claimed for your guild."); + claimOnMove(player, player.getLocation()); + } else { + autoClaim.remove(player.getUniqueId()); + lastAutoClaim.remove(player.getUniqueId()); + player.sendMessage(ChatColor.YELLOW + "Auto-claim is off."); + } + return true; + } if (cmd.equals("guild") || cmd.equals("g")) { if (args.length == 0 || args[0].equalsIgnoreCase("info") || args[0].equalsIgnoreCase("gui")) { @@ -211,6 +232,39 @@ public final class GuildHandler implements CommandExecutor, Listener { }); } + @EventHandler + public void onMove(PlayerMoveEvent event) { + if (event.getTo() == null || !autoClaim.contains(event.getPlayer().getUniqueId())) return; + if (event.getFrom().getWorld() == event.getTo().getWorld() + && event.getFrom().getChunk().getX() == event.getTo().getChunk().getX() + && event.getFrom().getChunk().getZ() == event.getTo().getChunk().getZ()) return; + claimOnMove(event.getPlayer(), event.getTo()); + } + + @EventHandler public void onQuit(PlayerQuitEvent event) { + autoClaim.remove(event.getPlayer().getUniqueId()); + lastAutoClaim.remove(event.getPlayer().getUniqueId()); + } + + private void claimOnMove(Player player, Location location) { + if (!integration.settings().landClaimingEnabled()) return; + int x = location.getBlockX() >> 4, z = location.getBlockZ() >> 4; + String dim = ScopenetPlugin.dimension(location.getWorld()); + String key = dim + ':' + x + ':' + z; + if (key.equals(lastAutoClaim.put(player.getUniqueId(), key))) return; + if (integration.isClaimed(dim, x, z)) return; + UUID uuid = player.getUniqueId(); + Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { + try { + integration.client().claimChunk(dim, x, z, uuid); + player.sendMessage(ChatColor.GREEN + "Auto-claimed chunk [" + x + ", " + z + "]."); + } catch (Exception e) { + autoClaim.remove(uuid); + player.sendMessage(ChatColor.RED + "Auto-claim stopped: " + e.getMessage()); + } + }); + } + private void handleUnclaim(Player player) { Chunk chunk = player.getLocation().getChunk(); String dim = ScopenetPlugin.dimension(player.getWorld()); diff --git a/integrations/paper/src/main/java/net/scopenet/paper/commands/HandHandler.java b/integrations/paper/src/main/java/net/scopenet/paper/commands/HandHandler.java new file mode 100644 index 0000000..195268c --- /dev/null +++ b/integrations/paper/src/main/java/net/scopenet/paper/commands/HandHandler.java @@ -0,0 +1,71 @@ +package net.scopenet.paper.commands; + +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.TextComponent; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryDragEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.Plugin; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +/** Share a read-only snapshot of the held item through a clickable chat message. */ +public final class HandHandler implements CommandExecutor, Listener { + private record Shared(ItemStack item, long expires) {} + private final Map shares = new ConcurrentHashMap<>(); + private static final String TITLE = ChatColor.DARK_GRAY + "Shared item"; + + public HandHandler(Plugin plugin) { + Bukkit.getScheduler().runTaskTimer(plugin, () -> shares.entrySet().removeIf(e -> e.getValue().expires < System.currentTimeMillis()), 1200, 1200); + } + + @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!(sender instanceof Player player)) { sender.sendMessage("Only players can use this command."); return true; } + if (command.getName().equalsIgnoreCase("handview")) { + if (args.length != 1) return false; + Shared shared = shares.get(args[0]); + if (shared == null || shared.expires < System.currentTimeMillis()) { player.sendMessage(ChatColor.RED + "That item share has expired."); return true; } + Inventory view = Bukkit.createInventory(null, 9, TITLE); + view.setItem(4, shared.item.clone()); + player.openInventory(view); + return true; + } + ItemStack item = player.getInventory().getItemInMainHand(); + if (item.getType() == Material.AIR) { player.sendMessage(ChatColor.RED + "Hold an item first."); return true; } + String token = UUID.randomUUID().toString().substring(0, 8); + shares.put(token, new Shared(item.clone(), System.currentTimeMillis() + 300_000)); + String name = item.hasItemMeta() && item.getItemMeta().hasDisplayName() + ? item.getItemMeta().getDisplayName() : item.getType().name().toLowerCase().replace('_', ' '); + TextComponent link = new TextComponent("[" + name + " ×" + item.getAmount() + "]"); + link.setColor(net.md_5.bungee.api.ChatColor.AQUA); + link.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/handview " + token)); + link.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click to inspect " + name + " (5 minutes)").create())); + TextComponent line = new TextComponent(player.getDisplayName() + ChatColor.WHITE + " is holding "); + line.addExtra(link); + for (Player target : Bukkit.getOnlinePlayers()) { + target.spigot().sendMessage(line); + } + return true; + } + + @EventHandler public void onInventoryClick(InventoryClickEvent event) { + if (TITLE.equals(event.getView().getTitle())) event.setCancelled(true); + } + @EventHandler public void onInventoryDrag(InventoryDragEvent event) { + if (TITLE.equals(event.getView().getTitle())) event.setCancelled(true); + } +} diff --git a/integrations/paper/src/main/java/net/scopenet/paper/commands/NicknameHandler.java b/integrations/paper/src/main/java/net/scopenet/paper/commands/NicknameHandler.java new file mode 100644 index 0000000..313d2c2 --- /dev/null +++ b/integrations/paper/src/main/java/net/scopenet/paper/commands/NicknameHandler.java @@ -0,0 +1,63 @@ +package net.scopenet.paper.commands; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.Plugin; + +import java.io.File; +import java.io.IOException; + +/** Player-owned chat nicknames, keyed by UUID and restored on every join. */ +public final class NicknameHandler implements CommandExecutor, Listener { + private final Plugin plugin; + private final File file; + private final YamlConfiguration config; + + public NicknameHandler(Plugin plugin) { + this.plugin = plugin; + this.file = new File(plugin.getDataFolder(), "nicknames.yml"); + this.config = YamlConfiguration.loadConfiguration(file); + } + + @EventHandler public void join(PlayerJoinEvent event) { + Player player = event.getPlayer(); + String saved = config.getString(player.getUniqueId().toString()); + if (saved != null && !saved.isBlank()) player.setDisplayName(ChatColor.translateAlternateColorCodes('&', saved)); + } + + @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!(sender instanceof Player player)) { sender.sendMessage("Only players can set a nickname."); return true; } + if (args.length != 1) { player.sendMessage(ChatColor.YELLOW + "Usage: /nick "); return true; } + String value = args[0]; + if (value.equalsIgnoreCase("off")) { + config.set(player.getUniqueId().toString(), null); + player.setDisplayName(player.getName()); + save(); + player.sendMessage(ChatColor.GREEN + "Nickname removed."); + return true; + } + String plain = ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', value)); + if (plain.length() < 2 || plain.length() > 24 || !plain.matches("[A-Za-z0-9_ -]+")) { + player.sendMessage(ChatColor.RED + "Nicknames must be 2–24 letters, numbers, spaces, _ or -."); + return true; + } + if (!player.hasPermission("scopenet.chat.color")) value = plain; + config.set(player.getUniqueId().toString(), value); + player.setDisplayName(ChatColor.translateAlternateColorCodes('&', value)); + save(); + player.sendMessage(ChatColor.GREEN + "Nickname set to " + player.getDisplayName() + ChatColor.GREEN + "."); + return true; + } + + private void save() { + try { config.save(file); } + catch (IOException e) { plugin.getLogger().warning("Failed to save nicknames: " + e.getMessage()); } + } +} diff --git a/integrations/paper/src/main/java/net/scopenet/paper/compat/LuckPermsModule.java b/integrations/paper/src/main/java/net/scopenet/paper/compat/LuckPermsModule.java index b75c4f0..e0ae6f5 100644 --- a/integrations/paper/src/main/java/net/scopenet/paper/compat/LuckPermsModule.java +++ b/integrations/paper/src/main/java/net/scopenet/paper/compat/LuckPermsModule.java @@ -102,6 +102,7 @@ public final class LuckPermsModule implements IntegrationModule { JsonObject config = answer.has("config") && answer.get("config").isJsonObject() ? answer.getAsJsonObject("config") : new JsonObject(); if (config.has("mode")) lastMode = config.get("mode").getAsString(); if (context.getBoolean("luckperms", "apply-panel-groups", false) && config.has("assign")) apply(config.getAsJsonArray("assign")); + if (config.has("level_assign")) apply(config.getAsJsonArray("level_assign")); } catch (Exception e) { context.log().fine("LuckPerms report failed: " + e.getMessage()); } diff --git a/integrations/paper/src/main/java/net/scopenet/paper/compat/ScopenetApiImpl.java b/integrations/paper/src/main/java/net/scopenet/paper/compat/ScopenetApiImpl.java index 76adf87..6c4e65c 100644 --- a/integrations/paper/src/main/java/net/scopenet/paper/compat/ScopenetApiImpl.java +++ b/integrations/paper/src/main/java/net/scopenet/paper/compat/ScopenetApiImpl.java @@ -69,7 +69,7 @@ public final class ScopenetApiImpl implements ScopenetApi, AutoCloseable { guild == null ? null : new GuildSummary(str(guild, "id"), str(guild, "name"), str(guild, "tag"), str(guild, "role"), (int) num(guild, "claims")), dbl(j, "balance"), num(j, "playtime_secs"), num(j, "server_playtime_secs"), (int) num(j, "kills"), (int) num(j, "deaths"), (int) num(j, "friends"), (int) num(j, "achievements"), quests(j, "daily"), quests(j, "weekly"), - str(j, "joined"), str(rank, "group"), str(rank, "prefix")); + str(j, "joined"), str(rank, "group"), str(rank, "display"), str(rank, "prefix"), str(rank, "suffix")); } static ScopenetGuild guild(JsonObject j) { diff --git a/integrations/paper/src/main/resources/config.yml b/integrations/paper/src/main/resources/config.yml index 44f1f3d..d6db894 100644 --- a/integrations/paper/src/main/resources/config.yml +++ b/integrations/paper/src/main/resources/config.yml @@ -52,9 +52,8 @@ essentials: rtp-radius: 2500 livemap: - # Send world chunks and live player positions to the panel's central Live Map. - # Players open it from the launcher; you don't run Vantage on this server. - # It also needs "Live Map" switched on for this server in the panel. + # Send live player positions to the panel for the launcher BlueMap claim view. + # Configure BlueMap's public address and enable live positions in the panel. enabled: true economy: diff --git a/integrations/paper/src/main/resources/plugin.yml b/integrations/paper/src/main/resources/plugin.yml index 9b62606..3d1c682 100644 --- a/integrations/paper/src/main/resources/plugin.yml +++ b/integrations/paper/src/main/resources/plugin.yml @@ -50,10 +50,37 @@ commands: permission: scopenet.command.warp description: Teleport to a server warp or open the warps GUI aliases: [warps] + reqwarp: + permission: scopenet.command.reqwarp + description: Request a new public warp at your location + warprequests: + permission: scopenet.command.warp.manage + description: List pending warp requests + warpapprove: + permission: scopenet.command.warp.manage + description: Approve a pending warp request + warpdeny: + permission: scopenet.command.warp.manage + description: Deny a pending warp request + setwarp: + permission: scopenet.command.warp.manage + description: Set a public warp at your location + delwarp: + permission: scopenet.command.warp.manage + description: Delete a public warp playtime: permission: scopenet.command.playtime description: Check total and session playtime aliases: [ontime] + hand: + permission: scopenet.command.hand + description: Share your held item in chat + handview: + permission: scopenet.command.hand + description: Inspect a shared item + nick: + permission: scopenet.command.nick + description: Set or remove your chat nickname balance: permission: scopenet.command.balance description: Check your server economy balance @@ -94,6 +121,9 @@ commands: unclaim: permission: scopenet.command.unclaim description: Unclaim the current chunk + autoclaim: + permission: scopenet.command.claim + description: Claim chunks as you walk into them permissions: @@ -137,9 +167,21 @@ permissions: scopenet.command.warp: description: Use /warp default: true + scopenet.command.reqwarp: + description: Request a public warp + default: true + scopenet.command.warp.manage: + description: Review and manage public warps + default: op scopenet.command.playtime: description: Use /playtime default: true + scopenet.command.hand: + description: Share and inspect held items in chat + default: true + scopenet.command.nick: + description: Set or remove your chat nickname + default: true scopenet.command.balance: description: Use /balance default: true @@ -176,6 +218,9 @@ permissions: scopenet.command.unclaim: description: Use /unclaim default: true + scopenet.chat.color: + description: Use Minecraft color codes in chat + default: op scopenet.command.scopenet.help: description: Use /scopenet help default: true diff --git a/launcher/package-lock.json b/launcher/package-lock.json index 60789dc..cdd9e51 100644 --- a/launcher/package-lock.json +++ b/launcher/package-lock.json @@ -1,12 +1,12 @@ { "name": "scopenet-launcher", - "version": "0.4.0", + "version": "0.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "scopenet-launcher", - "version": "0.4.0", + "version": "0.5.0", "dependencies": { "@fontsource-variable/inter": "^5.3.0", "@fontsource-variable/jetbrains-mono": "^5.3.0", @@ -15,29 +15,19 @@ "@fontsource-variable/space-grotesk": "^5.3.0", "@tauri-apps/api": "^2.12.0", "@tauri-apps/plugin-dialog": "^2.8.0", - "@tauri-apps/plugin-opener": "^2.6.0", - "@thoughts-on-things/vantage-mc": "^0.15.1", - "three": "^0.180.0" + "@tauri-apps/plugin-opener": "^2.6.0" }, "devDependencies": { "@lucide/svelte": "^1.48.0", "@sveltejs/vite-plugin-svelte": "^7.3.1", "@tauri-apps/cli": "^2.12.0", "@tsconfig/svelte": "^5.0.8", - "@types/three": "^0.180.0", "svelte": "^5.57.1", "svelte-check": "^4.7.6", "typescript": "~5.9.0", "vite": "^8.3.1" } }, - "node_modules/@dimforge/rapier3d-compat": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz", - "integrity": "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==", - "dev": true, - "license": "Apache-2.0" - }, "node_modules/@fontsource-variable/inter": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/@fontsource-variable/inter/-/inter-5.3.0.tgz", @@ -700,25 +690,6 @@ "@tauri-apps/api": "^2.12.0" } }, - "node_modules/@thoughts-on-things/vantage-mc": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/@thoughts-on-things/vantage-mc/-/vantage-mc-0.15.1.tgz", - "integrity": "sha512-muhg9950CgOa8keoCUV+utDHUKhkckwWGVn5O3HFMrgr7OrPo3VpEsBYVSUVL/RjmQDiqEaC19FPLGMTH97jpg==", - "license": "MIT", - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18", - "three": ">=0.160" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-dom": { - "optional": true - } - } - }, "node_modules/@tsconfig/svelte": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-5.0.8.tgz", @@ -726,13 +697,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@tweenjs/tween.js": { - "version": "23.1.3", - "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz", - "integrity": "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", @@ -740,43 +704,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/stats.js": { - "version": "0.17.4", - "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.4.tgz", - "integrity": "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/three": { - "version": "0.180.0", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.180.0.tgz", - "integrity": "sha512-ykFtgCqNnY0IPvDro7h+9ZeLY+qjgUWv+qEvUt84grhenO60Hqd4hScHE7VTB9nOQ/3QM8lkbNE+4vKjEpUxKg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@dimforge/rapier3d-compat": "~0.12.0", - "@tweenjs/tween.js": "~23.1.3", - "@types/stats.js": "*", - "@types/webxr": "*", - "@webgpu/types": "*", - "fflate": "~0.8.2", - "meshoptimizer": "~0.22.0" - } - }, - "node_modules/@types/webxr": { - "version": "0.5.24", - "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.24.tgz", - "integrity": "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@webgpu/types": { - "version": "0.1.74", - "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.74.tgz", - "integrity": "sha512-lgiI4hbuLcI9unnm2cL/tvCaQU45dp0xcLWJh5uB/9MBGvIA4F8XIk7nSiBeg+K4xWGYwgZKn80LmERI5CxoTA==", - "dev": true, - "license": "BSD-3-Clause" - }, "node_modules/acorn": { "version": "8.18.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz", @@ -906,13 +833,6 @@ } } }, - "node_modules/fflate": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz", - "integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==", - "dev": true, - "license": "MIT" - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -1216,13 +1136,6 @@ "@jridgewell/sourcemap-codec": "^1.6.0" } }, - "node_modules/meshoptimizer": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-0.22.0.tgz", - "integrity": "sha512-IebiK79sqIy+E4EgOr+CAw+Ke8hAspXKzBd0JdgEmPHiAwmvEj2S4h1rfvo+o/BnfEYd/jAOg5IeeIjzlzSnDg==", - "dev": true, - "license": "MIT" - }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -1448,12 +1361,6 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, - "node_modules/three": { - "version": "0.180.0", - "resolved": "https://registry.npmjs.org/three/-/three-0.180.0.tgz", - "integrity": "sha512-o+qycAMZrh+TsE01GqWUxUIKR1AL0S8pq7zDkYOQw8GqfX8b8VoCKYUoHbhiX5j+7hr8XsuHDVU6+gkQJQKg9w==", - "license": "MIT" - }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", diff --git a/launcher/package.json b/launcher/package.json index 543a132..f34bd14 100644 --- a/launcher/package.json +++ b/launcher/package.json @@ -18,16 +18,13 @@ "@fontsource-variable/space-grotesk": "^5.3.0", "@tauri-apps/api": "^2.12.0", "@tauri-apps/plugin-dialog": "^2.8.0", - "@tauri-apps/plugin-opener": "^2.6.0", - "@thoughts-on-things/vantage-mc": "^0.15.1", - "three": "^0.180.0" + "@tauri-apps/plugin-opener": "^2.6.0" }, "devDependencies": { "@lucide/svelte": "^1.48.0", "@sveltejs/vite-plugin-svelte": "^7.3.1", "@tauri-apps/cli": "^2.12.0", "@tsconfig/svelte": "^5.0.8", - "@types/three": "^0.180.0", "svelte": "^5.57.1", "svelte-check": "^4.7.6", "typescript": "~5.9.0", diff --git a/launcher/src-tauri/src/commands.rs b/launcher/src-tauri/src/commands.rs index c3a6603..fada24a 100644 --- a/launcher/src-tauri/src/commands.rs +++ b/launcher/src-tauri/src/commands.rs @@ -150,6 +150,16 @@ pub fn save_instance_options(state: State<'_, AppState>, instance_id: String) -> Ok(options) } +#[tauri::command] +pub fn set_instance_fov(state: State<'_, AppState>, instance_id: String, fov: f64) -> Res<()> { + if !(-1.0..=1.0).contains(&fov) || !fov.is_finite() { + return Err("FOV must be between 30 and 110 degrees".into()); + } + state.settings.write().unwrap().instance_game_options.entry(instance_id).or_default() + .insert("fov".into(), format!("{fov:.3}")); + state.save_settings().map_err(aerr) +} + // ---- accounts ---- #[tauri::command] @@ -630,7 +640,7 @@ pub async fn get_public_servers(state: State<'_, AppState>) -> Res, } -/// Native transport for Vantage assets. Browser WebViews cannot fetch a -/// cross-origin Vantage live server, so the launcher uses its HTTP client. -/// Only paths under a map URL supplied by the panel can be fetched. +/// Native transport for BlueMap settings and 2D tiles. Only paths under the +/// BlueMap address supplied by the panel can be fetched. #[tauri::command] -pub async fn fetch_vantage_resource(state: State<'_, AppState>, server_id: i64, url: String, etag: Option) -> Res { +pub async fn fetch_bluemap_resource(state: State<'_, AppState>, server_id: i64, url: String, etag: Option) -> Res { let configured = state.map_urls.lock().unwrap().get(&server_id).cloned().ok_or("map not configured for this server")?; - let base = reqwest::Url::parse(&configured).map_err(err)?; + let base = reqwest::Url::parse(&format!("{}/", configured.trim_end_matches('/'))).map_err(err)?; let target = reqwest::Url::parse(&url).map_err(err)?; - let root = base.join(".").map_err(err)?; + let root = base.clone(); if !matches!(target.scheme(), "http" | "https") || target.origin() != base.origin() || !target.path().starts_with(root.path()) @@ -659,7 +668,7 @@ pub async fn fetch_vantage_resource(state: State<'_, AppState>, server_id: i64, || target.password().is_some() || target.fragment().is_some() { - return Err("map asset is outside the configured Vantage world".into()); + return Err("map asset is outside the configured BlueMap site".into()); } fetch_map_asset(target, etag, None).await } @@ -676,26 +685,6 @@ pub async fn get_livemap_info(state: State<'_, AppState>, server_id: i64) -> Res resp.json().await.map_err(err) } -/// Native transport for the panel-hosted live map. The session token is -/// attached here, so it never reaches page scripts, and only URLs under -/// this panel's `/api/livemap//` can be fetched. -#[tauri::command] -pub async fn fetch_livemap_resource(state: State<'_, AppState>, server_id: i64, url: String, etag: Option) -> Res { - let panel = state.panel_url().ok_or("no panel configured")?; - let token = accounts::panel_token(&state).ok_or("sign in to view the live map")?; - let base = reqwest::Url::parse(&format!("{}/api/livemap/{server_id}/", panel.trim_end_matches('/'))).map_err(err)?; - let target = reqwest::Url::parse(&url).map_err(err)?; - if target.origin() != base.origin() - || !target.path().starts_with(base.path()) - || target.username() != "" - || target.password().is_some() - || target.fragment().is_some() - { - return Err("map asset is outside this server's live map".into()); - } - fetch_map_asset(target, etag, Some(token)).await -} - async fn fetch_map_asset(target: reqwest::Url, etag: Option, bearer: Option) -> Res { use base64::Engine; if target.as_str().len() > 2048 { @@ -723,11 +712,11 @@ async fn fetch_map_asset(target: reqwest::Url, etag: Option, bearer: Opt return Ok(MapResource { status, data: None, etag }); } if response.content_length().is_some_and(|n| n > 64 * 1024 * 1024) { - return Err("Vantage asset exceeds 64 MiB".into()); + return Err("BlueMap asset exceeds 64 MiB".into()); } let bytes = response.bytes().await.map_err(err)?; if bytes.len() > 64 * 1024 * 1024 { - return Err("Vantage asset exceeds 64 MiB".into()); + return Err("BlueMap asset exceeds 64 MiB".into()); } Ok(MapResource { status, data: Some(base64::engine::general_purpose::STANDARD.encode(bytes)), etag }) } @@ -807,6 +796,71 @@ pub async fn get_my_guild(state: State<'_, AppState>, instance_id: Option String { + let body: serde_json::Value = resp.json().await.unwrap_or_default(); + body["error"].as_str().unwrap_or(fallback).to_string() +} + +#[tauri::command] +pub async fn request_guild_join(state: State<'_, AppState>, guild_id: String, message: String) -> Res<()> { + let req = account_api(&state, reqwest::Method::POST, &format!("/guilds/{guild_id}/requests")).await?; + let resp = req.json(&serde_json::json!({"message": message})).send().await.map_err(err)?; + if !resp.status().is_success() { return Err(guild_response_error(resp, "could not request to join guild").await); } + Ok(()) +} + +#[tauri::command] +pub async fn get_guild_join_requests(state: State<'_, AppState>, guild_id: String) -> Res { + let resp = account_api(&state, reqwest::Method::GET, &format!("/guilds/{guild_id}/requests")).await?.send().await.map_err(err)?; + if !resp.status().is_success() { return Err(guild_response_error(resp, "could not load guild requests").await); } + resp.json().await.map_err(err) +} + +#[tauri::command] +pub async fn respond_guild_join_request(state: State<'_, AppState>, guild_id: String, uuid: String, accept: bool) -> Res<()> { + let req = account_api(&state, reqwest::Method::POST, &format!("/guilds/{guild_id}/requests/{uuid}/respond")).await?; + let resp = req.json(&serde_json::json!({"accept": accept})).send().await.map_err(err)?; + if !resp.status().is_success() { return Err(guild_response_error(resp, "could not review guild request").await); } + Ok(()) +} + +#[tauri::command] +pub async fn get_guild_roles(state: State<'_, AppState>, guild_id: String) -> Res { + let resp = account_api(&state, reqwest::Method::GET, &format!("/guilds/{guild_id}/roles")).await?.send().await.map_err(err)?; + if !resp.status().is_success() { return Err(guild_response_error(resp, "could not load guild roles").await); } + resp.json().await.map_err(err) +} + +#[tauri::command] +pub async fn create_guild_role(state: State<'_, AppState>, guild_id: String, role: serde_json::Value) -> Res<()> { + let resp = account_api(&state, reqwest::Method::POST, &format!("/guilds/{guild_id}/roles")).await?.json(&role).send().await.map_err(err)?; + if !resp.status().is_success() { return Err(guild_response_error(resp, "could not create guild role").await); } + Ok(()) +} + +#[tauri::command] +pub async fn assign_guild_role(state: State<'_, AppState>, guild_id: String, uuid: String, role: String) -> Res<()> { + let resp = account_api(&state, reqwest::Method::PUT, &format!("/guilds/{guild_id}/members/{uuid}/role")).await?.json(&serde_json::json!({"role":role})).send().await.map_err(err)?; + if !resp.status().is_success() { return Err(guild_response_error(resp, "could not assign guild role").await); } + Ok(()) +} + +#[tauri::command] +pub async fn delete_guild_role(state: State<'_, AppState>, guild_id: String, role_id: i64) -> Res<()> { + let resp = account_api(&state, reqwest::Method::DELETE, &format!("/guilds/{guild_id}/roles/{role_id}")).await?.send().await.map_err(err)?; + if !resp.status().is_success() { return Err(guild_response_error(resp, "could not delete guild role").await); } + Ok(()) +} + +#[tauri::command] +pub async fn update_guild(state: State<'_, AppState>, guild_id: String, description: String, motd: String, icon_url: String, banner_url: String) -> Res<()> { + let resp = account_api(&state, reqwest::Method::PUT, &format!("/guilds/{guild_id}")).await? + .json(&serde_json::json!({"description":description,"motd":motd,"icon_url":icon_url,"banner_url":banner_url})) + .send().await.map_err(err)?; + if !resp.status().is_success() { return Err(guild_response_error(resp, "could not update guild").await); } + Ok(()) +} + #[tauri::command] pub async fn create_guild( state: State<'_, AppState>, diff --git a/launcher/src-tauri/src/game.rs b/launcher/src-tauri/src/game.rs index d393c28..0304616 100644 --- a/launcher/src-tauri/src/game.rs +++ b/launcher/src-tauri/src/game.rs @@ -129,6 +129,9 @@ pub async fn run(app: AppHandle, instance_id: String, start: bool, deep: bool) - } else { current_options }; + if let Some(fov) = settings.instance_game_options.get(&instance_id).and_then(|o| o.get("fov")) { + saved_options.insert("fov".into(), fov.clone()); + } // Do not rewrite pack files or options while another copy is using this directory. if !already_running { sync::sync(&state.http, &panel, &game_dir, inst.revision, &manifest.files, spec.concurrency, deep, &report).await?; diff --git a/launcher/src-tauri/src/lib.rs b/launcher/src-tauri/src/lib.rs index 88bd91b..f0ab3c5 100644 --- a/launcher/src-tauri/src/lib.rs +++ b/launcher/src-tauri/src/lib.rs @@ -52,6 +52,7 @@ pub fn run() { commands::set_panel_url, commands::save_settings, commands::save_instance_options, + commands::set_instance_fov, commands::login_panel, commands::discord_sign_in_start, commands::discord_sign_in_poll, @@ -96,8 +97,7 @@ pub fn run() { commands::get_player_stats, commands::get_leaderboard, commands::get_public_servers, - commands::fetch_vantage_resource, - commands::fetch_livemap_resource, + commands::fetch_bluemap_resource, commands::get_livemap_info, commands::get_my_level, commands::get_my_quests, @@ -105,6 +105,14 @@ pub fn run() { commands::get_my_achievements, commands::get_guilds, commands::get_my_guild, + commands::request_guild_join, + commands::get_guild_join_requests, + commands::respond_guild_join_request, + commands::get_guild_roles, + commands::create_guild_role, + commands::assign_guild_role, + commands::delete_guild_role, + commands::update_guild, commands::create_guild, commands::get_guild_claims, commands::claim_guild_chunk, diff --git a/launcher/src-tauri/src/state.rs b/launcher/src-tauri/src/state.rs index 8a77960..a4a1f3e 100644 --- a/launcher/src-tauri/src/state.rs +++ b/launcher/src-tauri/src/state.rs @@ -41,7 +41,7 @@ pub struct AppState { pub accounts: RwLock, pub secrets: Secrets, pub manifest: RwLock>, - /// Vantage URLs received from the panel, keyed by linked game server. + /// BlueMap addresses received from the panel, keyed by linked game server. pub map_urls: Mutex>, /// Install/launch pipeline in progress (abortable). pub task: Mutex>, diff --git a/launcher/src/components/BlueMapTiles.svelte b/launcher/src/components/BlueMapTiles.svelte new file mode 100644 index 0000000..1f46adc --- /dev/null +++ b/launcher/src/components/BlueMapTiles.svelte @@ -0,0 +1,214 @@ + + +
{ if (e.key === 'Enter') onpaint([{ x: Math.floor(worldX / 16), z: Math.floor(worldZ / 16) }], 'claim'); }} + onpointerdown={down} onpointermove={move} onpointerup={up} onpointercancel={up} onwheel={wheel} oncontextmenu={(e) => e.preventDefault()}> + {#each visibleTiles as tile (tile.key)} + {#if images[tile.key]}{/if} + {/each} +
+ {#each visibleClaims as claim (claim.id)} +
+ {/each} + {#each paint as chunk (`${chunk.x}:${chunk.z}`)} +
+ {/each} + {#if playerHere}
{/if} + {#if loading}
Loading BlueMap tiles…
{/if} + {#if error}
{error}
{/if} +
Left click or drag: claim · Right click or drag: unclaim · Alt drag: pan · Wheel: zoom
+
{mapId} · {Math.floor(worldX)}, {Math.floor(worldZ)}
+
+ + diff --git a/launcher/src/components/ChunkMap.svelte b/launcher/src/components/ChunkMap.svelte index a47e595..9864184 100644 --- a/launcher/src/components/ChunkMap.svelte +++ b/launcher/src/components/ChunkMap.svelte @@ -1,524 +1,169 @@ -
+
-
+
{#if instanceServers.length > 1} - - {:else if instanceServers[0]} - {instanceServers[0].name} - {/if} -
+ + {:else if selectedServer} {selectedServer.name}{/if} +
{#each dimensions as dim} - {@const DimIcon = dim.icon} - + {@const Icon = dim.icon} + {/each}
- {#if central} Live map{/if}
- -
- Chunk {centerX}, {centerZ} -
- - - - - -
- +
+ {#if player}You: {Math.floor(player.x)}, {Math.floor(player.z)}{:else}Player position unavailable{/if} + +
- {#if !serverId} -
Link a game server to this instance in the panel before claiming territory.
- {/if} - - - {#if mapUrl && !mapFailed} - {#key `${serverId}:${mapUrl}`} - { selectedChunk = { x, z }; }} - ondimension={(value) => { if (dimension !== value) { dimension = value; claims = []; selectedChunk = null; } }} - ondimensions={(value) => { mapDimensions = value; }} - oncenterchange={(x, z) => { centerX = x; centerZ = z; }} - onerror={(message) => { toast(`Live map unavailable: ${message}. Showing chunk grid.`, 'error'); mapFailed = true; }} - /> + {#if selectedServer?.map_address} + {#key `${serverId}:${selectedServer.map_address}`} + { centerX = x; centerZ = z; }} /> {/key} {:else} -
-
- {#each Array.from({ length: radius * 2 + 1 }, (_, r) => centerZ - radius + r) as cz} - {#each Array.from({ length: radius * 2 + 1 }, (_, c) => centerX - radius + c) as cx} - {@const claim = getClaimAt(cx, cz)} - {@const isMyClaim = claim && myGuildId && claim.guild_id === myGuildId} - {@const isOtherClaim = claim && (!myGuildId || claim.guild_id !== myGuildId)} - {@const isSelected = selectedChunk && selectedChunk.x === cx && selectedChunk.z === cz} - {@const isCenter = cx === 0 && cz === 0} - - - {/each} - {/each} -
-
+
Configure this server's BlueMap address in the panel to show its 2D terrain and claim land.
{/if} - - - diff --git a/launcher/src/components/InstanceSettings.svelte b/launcher/src/components/InstanceSettings.svelte index 4f12b6f..0e1c346 100644 --- a/launcher/src/components/InstanceSettings.svelte +++ b/launcher/src/components/InstanceSettings.svelte @@ -71,6 +71,15 @@
Vanilla game settings Brightness, graphics, FOV, view distance, sound and other vanilla options are saved automatically when the game closes, then restored after instance updates. + {Object.keys(app.settings.instance_game_options?.[inst.id] ?? {}).length} saved options for this instance - {/each} - - {/if} - {#if info?.ready} {info.players}{/if} - - - -
- {#if url && !failed} - {#key `${serverId}:${slug}`} - (loaded = true)} - onerror={(m) => (failed = m)} - /> - {/key} - {#if !loaded}
Rendering terrain…
{/if} - {:else} -
- {#if failed} - -

Couldn't load the map

-

{failed}

- - {:else if error} - -

Live Map unavailable

-

{error}

- - {:else if info} - -

{info.enabled ? 'The map is being prepared' : 'Live Map is off'}

-

{info.message || 'Hang on…'}

-

This page checks again automatically.

- {:else} - - {/if} -
- {/if} -
-
- - diff --git a/launcher/src/components/VantageMap.svelte b/launcher/src/components/VantageMap.svelte deleted file mode 100644 index 250cba4..0000000 --- a/launcher/src/components/VantageMap.svelte +++ /dev/null @@ -1,208 +0,0 @@ - - -
- {#if !ready && !error}
Loading live terrain map…
{/if} - {#if error}
Map unavailable: {error}
{/if} -
- - diff --git a/launcher/src/lib/mock.ts b/launcher/src/lib/mock.ts index cf3a9d8..63e6144 100644 --- a/launcher/src/lib/mock.ts +++ b/launcher/src/lib/mock.ts @@ -137,9 +137,9 @@ export async function mockInvoke(cmd: string, args: Record): Promis await sleep(40); switch (cmd) { case 'get_public_servers': - return { servers: [{ id: 1, name: 'Survival SMP', instance_id: 'survival-smp', map_url: '', live_map: true, online: true, players_online: 42, players_max: 100 }] }; + return { servers: [{ id: 1, name: 'Survival SMP', instance_id: 'survival-smp', map_address: '', live_map: true, online: true, players_online: 42, players_max: 100 }] }; case 'get_livemap_info': - return { enabled: true, ready: false, message: 'The map generator isn\'t set up on the panel yet.', base: '/api/livemap/1', players: 0, + return { enabled: true, ready: true, message: '', me: null, players: 0, dimensions: [{ id: 'minecraft:overworld', slug: 'overworld', label: 'Overworld', available: true }, { id: 'minecraft:the_nether', slug: 'the_nether', label: 'The Nether', available: false }, { id: 'minecraft:the_end', slug: 'the_end', label: 'The End', available: false }] }; case 'get_player_stats': return { username: 'Notch', uuid: 'b50ad385-829d-3141-a216-7e7d7539ba7f', total: null, servers: [], events: [] }; diff --git a/launcher/src/lib/types.ts b/launcher/src/lib/types.ts index bc2f31f..ccaf705 100644 --- a/launcher/src/lib/types.ts +++ b/launcher/src/lib/types.ts @@ -222,6 +222,7 @@ export interface Guild { name: string; tag: string; description: string; + motd?: string; icon_url: string | null; banner_url: string | null; leader_uuid: string; @@ -234,7 +235,7 @@ export interface Guild { export interface GuildMember { uuid: string; name: string; - role: 'leader' | 'officer' | 'member'; + role: string; joined_at: string; online?: boolean; } diff --git a/launcher/src/pages/Commands.svelte b/launcher/src/pages/Commands.svelte index edbd6e8..6b84dbf 100644 --- a/launcher/src/pages/Commands.svelte +++ b/launcher/src/pages/Commands.svelte @@ -12,6 +12,10 @@ { usage: '/delhome ', does: 'Delete one of your homes.', perm: 'scopenet.command.delhome', aliases: ['rmhome'] }, { usage: '/back', does: 'Return to where you were, or where you died.', perm: 'scopenet.command.back', aliases: ['return'] }, { usage: '/warp [name]', does: 'Go to a server warp, or open the warps menu.', perm: 'scopenet.command.warp', aliases: ['warps'] }, + { usage: '/reqwarp ', does: 'Request a public warp at your current location.', perm: 'scopenet.command.reqwarp' }, + { usage: '/warprequests', does: 'Staff: list pending warp requests.', perm: 'scopenet.command.warp.manage' }, + { usage: '/warpapprove · /warpdeny ', does: 'Staff: approve or deny a warp request.', perm: 'scopenet.command.warp.manage' }, + { usage: '/setwarp · /delwarp ', does: 'Staff: create or delete public warps.', perm: 'scopenet.command.warp.manage' }, { usage: '/rtp', does: 'Jump to a random safe spot in the wild.', perm: 'scopenet.command.rtp', aliases: ['wild', 'randomtp'] }, { usage: '/tpa ', does: 'Ask to teleport to another player.', perm: 'scopenet.command.tpa' }, { usage: '/tpaccept', does: 'Accept a teleport request.', perm: 'scopenet.command.tpaccept', aliases: ['tpyes'] }, @@ -43,6 +47,7 @@ { usage: '/guild accept [tag] · /guild decline [tag]', does: 'Answer a guild invitation. You can also answer in the launcher.', perm: 'scopenet.command.guild.accept' }, { usage: '/claim', does: 'Claim the chunk you stand in for your guild.', perm: 'scopenet.command.claim' }, { usage: '/unclaim', does: 'Give up the chunk you stand in.', perm: 'scopenet.command.unclaim' }, + { usage: '/autoclaim on|off', does: 'Automatically claim new chunks as you walk.', perm: 'scopenet.command.claim' }, ] }, { title: 'Guild bank', blurb: 'Shared guild money. Officers and leaders can spend it.', cmds: [ { usage: '/guild bank', does: 'Show the bank balance and recent activity.', perm: 'scopenet.command.guild.bank' }, @@ -54,6 +59,8 @@ ] }, { title: 'Info & admin', blurb: 'Status and help.', cmds: [ { usage: '/playtime', does: 'Check your total and session playtime.', perm: 'scopenet.command.playtime', aliases: ['ontime'] }, + { usage: '/hand', does: 'Share your held item as an inspectable chat link.', perm: 'scopenet.command.hand' }, + { usage: '/nick ', does: 'Set or remove your chat nickname.', perm: 'scopenet.command.nick' }, { usage: '/scopenet help', does: 'List SCOPENET commands.', perm: 'scopenet.command.scopenet.help', aliases: ['sn'] }, { usage: '/scopenet status', does: 'Panel connection, features and plugin integrations (admins).', perm: 'scopenet.command.scopenet.status' }, { usage: '/scopenet reload', does: 'Reload the plugin config (admins).', perm: 'scopenet.command.scopenet.reload' }, diff --git a/launcher/src/pages/Guilds.svelte b/launcher/src/pages/Guilds.svelte index 9d2208f..3509c44 100644 --- a/launcher/src/pages/Guilds.svelte +++ b/launcher/src/pages/Guilds.svelte @@ -17,7 +17,16 @@ let allGuilds = $state([]); let members = $state([]); let posts = $state([]); - let activeTab = $state<'territory' | 'members' | 'feed' | 'wallet'>('territory'); + let activeTab = $state<'territory' | 'members' | 'feed' | 'wallet' | 'settings'>('territory'); + type GuildRole = { id: number; name: string; can_invite: boolean; can_kick: boolean; can_claim: boolean; can_post: boolean; can_manage: boolean }; + type JoinRequest = { uuid: string; name: string; message: string; created_at: string }; + let roles = $state([]); + let joinRequests = $state([]); + let newRoleName = $state(''); + let roleFlags = $state({ can_invite: false, can_kick: false, can_claim: false, can_post: true, can_manage: false }); + let guildEdit = $state({ description: '', motd: '', icon_url: '', banner_url: '' }); + const myRole = $derived(members.find((m) => m.uuid === activeAccount()?.uuid)?.role ?? ''); + const canManageDetails = $derived(myRole === 'leader' || myRole === 'officer' || !!roles.find((r) => r.name === myRole)?.can_manage); let loading = $state(false); let walletServers = $state>([]); @@ -58,9 +67,14 @@ ]); members = mList; posts = pList; + roles = await invoke('get_guild_roles', { guildId: mine.id }).catch(() => []); + joinRequests = await invoke('get_guild_join_requests', { guildId: mine.id }).catch(() => []); + guildEdit = { description: mine.description ?? '', motd: mine.motd ?? '', icon_url: mine.icon_url ?? '', banner_url: mine.banner_url ?? '' }; } else { members = []; posts = []; + roles = []; + joinRequests = []; } } catch (e: any) { toast(e?.message ?? 'Failed to load guild data', 'error'); @@ -85,6 +99,59 @@ } } + async function requestJoin(guild: Guild) { + try { + await invoke('request_guild_join', { guildId: guild.id, message: '' }); + toast(`Request sent to ${guild.name}`, 'ok'); + } catch (e: any) { toast(String(e), 'error'); } + } + + async function answerJoin(req: JoinRequest, accept: boolean) { + if (!myGuild) return; + try { + await invoke('respond_guild_join_request', { guildId: myGuild.id, uuid: req.uuid, accept }); + toast(accept ? `${req.name} joined the guild` : 'Request declined', 'ok'); + await loadInstanceGuildData(); + } catch (e: any) { toast(String(e), 'error'); } + } + + async function createRole() { + if (!myGuild || !newRoleName.trim()) return; + try { + await invoke('create_guild_role', { guildId: myGuild.id, role: { name: newRoleName.trim(), ...roleFlags } }); + newRoleName = ''; + roles = await invoke('get_guild_roles', { guildId: myGuild.id }); + toast('Guild role created', 'ok'); + } catch (e: any) { toast(String(e), 'error'); } + } + + async function assignRole(member: GuildMember, role: string) { + if (!myGuild) return; + try { + await invoke('assign_guild_role', { guildId: myGuild.id, uuid: member.uuid, role }); + member.role = role as GuildMember['role']; + toast('Guild role assigned', 'ok'); + } catch (e: any) { toast(String(e), 'error'); } + } + + async function deleteRole(role: GuildRole) { + if (!myGuild) return; + try { + await invoke('delete_guild_role', { guildId: myGuild.id, roleId: role.id }); + await loadInstanceGuildData(); + toast('Guild role deleted', 'ok'); + } catch (e: any) { toast(String(e), 'error'); } + } + + async function saveGuild() { + if (!myGuild) return; + try { + await invoke('update_guild', { guildId: myGuild.id, description: guildEdit.description, motd: guildEdit.motd, iconUrl: guildEdit.icon_url, bannerUrl: guildEdit.banner_url }); + await loadInstanceGuildData(); + toast('Guild details saved', 'ok'); + } catch (e: any) { toast(String(e), 'error'); } + } + onMount(async () => { loadInvites(); try { walletServers = (await invoke<{ servers: typeof walletServers }>('get_public_servers')).servers; } @@ -242,6 +309,7 @@ + {#if canManageDetails}{/if}
@@ -270,6 +338,13 @@ {:else if activeTab === 'members'}
+ {#if joinRequests.length} +

Join requests

+ {#each joinRequests as req} +
{req.name}{req.message}
+ {/each} +
+ {/if}
{#each members as m (m.uuid)}
Leader {:else if m.role === 'officer'} Officer - {:else} + {:else if m.role === 'member'} Member + {:else} + {m.role} {/if}
Joined {new Date(m.joined_at).toLocaleDateString()} + {#if myGuild.leader_uuid === activeAccount()?.uuid && m.uuid !== activeAccount()?.uuid} + + {/if}
{/each}
+ {:else if activeTab === 'settings'} +
+

Guild appearance

+ + + + + +
+ {#if myRole === 'leader'}
+

Guild roles

+ {#each roles as role} +
{role.name}{[role.can_invite && 'Invite', role.can_kick && 'Kick', role.can_claim && 'Claim', role.can_post && 'Post', role.can_manage && 'Manage'].filter(Boolean).join(', ') || 'No extra permissions'}
+ {/each} + +
+ +
{/if} {:else if activeTab === 'feed'}
@@ -407,6 +508,7 @@ {#if g.description}

{g.description}

{/if} +
{/each}
@@ -436,6 +538,10 @@ Banner Image URL (Optional) + {#snippet footer()} diff --git a/launcher/src/pages/Home.svelte b/launcher/src/pages/Home.svelte index 4f78dea..1547577 100644 --- a/launcher/src/pages/Home.svelte +++ b/launcher/src/pages/Home.svelte @@ -4,7 +4,6 @@ import ServerStatus from '../components/ServerStatus.svelte'; import NewsFeed from '../components/NewsFeed.svelte'; import Console from '../components/Console.svelte'; - import LiveMapModal from '../components/LiveMapModal.svelte'; import BlueMapModal from '../components/BlueMapModal.svelte'; import { abs, activeAccount, app, instances, selectedInstance } from '../lib/store.svelte'; import { loaderName, shortLoaderVersion } from '../lib/format'; @@ -14,7 +13,7 @@ const b = $derived(app.manifest!.branding); // Lucide ships no brand logos, so each platform gets a recognisable generic icon. const linkIcon: Record = { discord: MessageCircle, website: Globe, store: ShoppingBag, youtube: CirclePlay, twitch: Tv, github: Code, twitter: AtSign }; - // A game server linked to this instance with the panel's Live Map switched on. + // A game server linked to this instance with BlueMap configured. let mapServer = $state<{ id: number; name: string; map_address?: string } | null>(null); let mapOpen = $state(false); $effect(() => { @@ -23,8 +22,8 @@ mapOpen = false; if (!id) return; let alive = true; - invoke<{ servers: Array<{ id: number; name: string; instance_id: string; live_map?: boolean; map_address?: string }> }>('get_public_servers') - .then((r) => { if (alive) mapServer = r.servers.find((s) => s.instance_id === id && (s.map_address || s.live_map)) ?? null; }) + invoke<{ servers: Array<{ id: number; name: string; instance_id: string; map_address?: string }> }>('get_public_servers') + .then((r) => { if (alive) mapServer = r.servers.find((s) => s.instance_id === id && s.map_address) ?? null; }) .catch(() => {}); return () => { alive = false; }; }); @@ -58,7 +57,7 @@ - {#if mapServer}{/if} + {#if mapServer}{/if} {#if inst.server && b.features.server_status}{/if} @@ -83,7 +82,7 @@ {#if app.consoleOpen}{/if} - {#if mapOpen && mapServer?.map_address} (mapOpen = false)} />{:else if mapOpen && mapServer} (mapOpen = false)} />{/if} + {#if mapOpen && mapServer?.map_address} (mapOpen = false)} />{/if} diff --git a/panel/web/src/components/ServerForm.svelte b/panel/web/src/components/ServerForm.svelte index 14d1465..73a45b1 100644 --- a/panel/web/src/components/ServerForm.svelte +++ b/panel/web/src/components/ServerForm.svelte @@ -21,14 +21,10 @@ -
- Use an external Vantage map instead - -
Who can join
@@ -68,8 +64,5 @@ .opt.on :global(svg) { color: var(--accent-2); } .gpick { padding: 6px 12px; border-radius: 99px; font-size: 0.85rem; background: var(--bg-2); } .gpick.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); } - .adv { border: 1px dashed var(--line, rgba(255, 255, 255, 0.12)); border-radius: 10px; padding: 10px 12px; } - .adv summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); } - .adv[open] summary { margin-bottom: 10px; } .dot { width: 10px; height: 10px; border-radius: 50%; } diff --git a/panel/web/src/lib/types.ts b/panel/web/src/lib/types.ts index f838fa1..36f0365 100644 --- a/panel/web/src/lib/types.ts +++ b/panel/web/src/lib/types.ts @@ -93,7 +93,6 @@ export interface AuthServerInfo { public_url: string; yggdrasil_url: string; pub export interface GameServer { instance_id: string; - map_url: string; live_map_enabled: boolean; map_address: string; economy_group: string; @@ -149,19 +148,14 @@ export interface LiveMapStatus { enabled: boolean; ready: boolean; message: string; - base: string; dimensions: { id: string; slug: string; label: string; available: boolean }[]; players: number; - generator: { installed: boolean; path: string | null }; - assets: { configured: boolean; path: string | null }; world: { level_dat: boolean; dimensions: { id: string; slug: string; regions: number; bytes: number }[] }; stats: { chunks_received: number; last_chunk_at: string | null; last_players_at: string | null }; - running: string[]; - last_error: string | null; roster: { uuid: string; name: string; dimension: string; x: number; y: number; z: number }[]; } -export type ServerDraft = { instance_id?: string; name: string; map_url?: string; live_map_enabled: boolean; economy_group?: string; map_address?: string; access: 'all' | 'members' | 'groups'; allowed_groups: string[]; require_launcher: boolean }; +export type ServerDraft = { instance_id?: string; name: string; live_map_enabled: boolean; economy_group?: string; map_address?: string; access: 'all' | 'members' | 'groups'; allowed_groups: string[]; require_launcher: boolean }; export interface HostedDownload { platform: 'windows' | 'mac' | 'linux'; @@ -216,6 +210,8 @@ export interface LevelReward { reward_value: string; description: string; icon?: string; + discord_role_id?: string; + luckperms_group?: string; } export interface UserLevelInfo { diff --git a/panel/web/src/pages/Dashboard.svelte b/panel/web/src/pages/Dashboard.svelte index 677fb4b..c3cb4d9 100644 --- a/panel/web/src/pages/Dashboard.svelte +++ b/panel/web/src/pages/Dashboard.svelte @@ -8,6 +8,16 @@ let stats = $state(null); let instances = $state([]); let branding = $state(null); + let showGettingStarted = $state(localStorage.getItem('scopenet_hide_getting_started') !== 'true'); + + function hideGettingStarted() { + showGettingStarted = false; + localStorage.setItem('scopenet_hide_getting_started', 'true'); + } + function showGuide() { + showGettingStarted = true; + localStorage.removeItem('scopenet_hide_getting_started'); + } $effect(() => { get('/api/admin/stats').then((s) => (stats = s)); @@ -38,6 +48,7 @@ {#if stats?.launcher_download_url} Launcher download {/if} + {#if !showGettingStarted}{/if}
@@ -69,8 +80,8 @@ {/if} -
-

Getting started

+ {#if showGettingStarted}
+

Getting started

{#each steps as s} @@ -80,7 +91,7 @@ {/each}
-
+
{/if} {#if stats?.live?.servers?.length}
diff --git a/panel/web/src/pages/LevelingAdmin.svelte b/panel/web/src/pages/LevelingAdmin.svelte index 35e52f5..a4cdf20 100644 --- a/panel/web/src/pages/LevelingAdmin.svelte +++ b/panel/web/src/pages/LevelingAdmin.svelte @@ -38,6 +38,8 @@ reward_value: x.reward_value ?? x.reward_name ?? '', description: x.description ?? '', icon: x.icon ?? '🎁', + discord_role_id: x.reward_data?.discord_role_id ?? '', + luckperms_group: x.reward_data?.luckperms_group ?? '', })).sort((a, b) => a.level - b.level); leaderboard = lb || []; const p = await get<{ settings: { level_base: number; level_exponent: number; max_level: number } }>('/api/admin/progression'); @@ -77,10 +79,10 @@ saving = true; try { if (draft.id) { - await put(`/api/admin/levels/rewards/${draft.id}`, draft); + await put(`/api/admin/levels/rewards/${draft.id}`, { ...draft, reward_data: { discord_role_id: draft.discord_role_id ?? '', luckperms_group: draft.luckperms_group ?? '' } }); toast('Reward updated'); } else { - await post('/api/admin/levels/rewards', draft); + await post('/api/admin/levels/rewards', { ...draft, reward_data: { discord_role_id: draft.discord_role_id ?? '', luckperms_group: draft.luckperms_group ?? '' } }); toast('Reward created'); } draftOpen = false; @@ -209,7 +211,7 @@
- +
@@ -236,6 +238,12 @@
+ {#if draft.reward_type === 'title'} +
+
+
+
+ {/if} - + diff --git a/panel/web/src/pages/Settings.svelte b/panel/web/src/pages/Settings.svelte index 75a1f51..588c1d1 100644 --- a/panel/web/src/pages/Settings.svelte +++ b/panel/web/src/pages/Settings.svelte @@ -25,7 +25,7 @@ async function saveDisc() { savingDisc = true; try { - disc = await put('/api/admin/discord', { role_sync: disc.role_sync, invite_url: disc.invite_url, webhook_url: discWebhook, notify_achievements: disc.notify_achievements, notify_guilds: disc.notify_guilds, notify_members: disc.notify_members }); + disc = await put('/api/admin/discord', { role_sync: disc.role_sync, base_role_id: disc.base_role_id, invite_url: disc.invite_url, webhook_url: discWebhook, notify_achievements: disc.notify_achievements, notify_guilds: disc.notify_guilds, notify_members: disc.notify_members }); discWebhook = ''; toast('Discord community settings saved'); loadDisc(); @@ -203,7 +203,7 @@ {#if disc}

Discord community

-

{disc.linked_accounts} linked account{disc.linked_accounts === 1 ? '' : 's'}. Role sync needs the bot token and server ID above{disc.bot_ready ? '' : ' (not saved yet)'}. Sync only ever adds: it never removes a role or group. Map roles to groups under Players → Groups.

+

{disc.linked_accounts} linked account{disc.linked_accounts === 1 ? '' : 's'}. Role sync needs the bot token and server ID above{disc.bot_ready ? '' : ' (not saved yet)'}. Map group roles under Players → Groups and title roles under Leveling. The highest earned title role takes priority; obsolete title roles are removed.

+ diff --git a/release-artifacts/0.5.0/SHA256SUMS b/release-artifacts/0.5.0/SHA256SUMS index dd94b7e..697b964 100644 --- a/release-artifacts/0.5.0/SHA256SUMS +++ b/release-artifacts/0.5.0/SHA256SUMS @@ -5,5 +5,5 @@ a54a1478c0740eb4aef20797037738355e3482ac1f4eaaa9b408d16e2303b7ed scopenet-fabri d9a22725d0b2554f31e010a6f596a73c023b339490ef982b5d53e8f866a8c447 scopenet-forge-1.20.1-0.5.0.jar 49098a90919fdea02f4eec26e332cd6a51fc7bb398ba1d55f87528f52610e250 scopenet-forge-1.21.1-0.5.0.jar 31e5076947f33ad1ec0037d92736b28eb8a47e4be84a6bacbf1dfd11308f579a scopenet-forge-26.3-0.5.0.jar -4963fad47421c8c4c9ff96cfa44fd808a5ecda2da1c2b08b0c18c43eaef5cb1c scopenet-paper-0.5.0.jar +1f4428de07b3061862c5dac3c7214ae87f9525385533a8c244ab67ec31ee76da scopenet-paper-0.5.0.jar 3ade714b0869b9fbb0e6175280b69d5bb6531543ce8ce48c7f231f170081dd5f SCOPENET Launcher_0.5.0_x64-setup.exe diff --git a/release-artifacts/0.5.0/scopenet-paper-0.5.0.jar b/release-artifacts/0.5.0/scopenet-paper-0.5.0.jar index b2b226c..45771d6 100644 Binary files a/release-artifacts/0.5.0/scopenet-paper-0.5.0.jar and b/release-artifacts/0.5.0/scopenet-paper-0.5.0.jar differ