Use editable gui make a gui folder in plugin folder and jt has all the gui thet I can edit and everything even size add item command change things of gui of rtpmenu and rtpqueue menu and everything is configurable
📄
soulrtp-plugin-prompt.md
md
312 lines
▶
# Prompt: Build a Highly Customizable, Standalone RTP Plugin (`SoulRTP`)
Paste everything below into your AI coding tool (or hand it to a developer).
## Priority Order (read this before writing any code)
When any trade-off comes up, resolve it in this order:
1. **It must actually compile and run without errors.** Before finalizing anything, double-check every Paper/Spigot API call, import, and method signature you use actually exists in the API version you're targeting — a broken build is worse than a missing feature.
2. **Optimization.** This plugin's whole reason to exist is being lighter than the alternatives — performance decisions win over "doing it exactly the fancy way" wherever the two conflict.
3. **Full feature completeness and customization**, as detailed below.
## Goal
Build a standalone Paper/Spigot Java plugin named `SoulRTP` with its own random-teleport engine (no external RTP plugin dependency of any kind — it finds its own safe locations), a countdown wrapper with a fake 5-4-3-2-1 warmup, a fully custom GUI, a duel-matchmaking queue, and a WorldGuard-region-based RTP minigame zone. Every feature is individually enable/disable-able in config, every numeric value is configurable, and every message follows the trio structure defined right below.
## 0. The Message Trio Structure (apply this to literally every message in every section below)
Every message this plugin sends must be defined using this exact structure, chat/action bar/sound each independently switched on or off:
```yaml
some-message-key:
chat:
enabled: true
text: "&7Example chat text here"
actionbar:
enabled: false
text: "&7Example action bar text here"
sound:
enabled: false
sound: "ENTITY_EXPERIENCE_ORB_PICKUP"
volume: 1.0
pitch: 1.0
```
Where a default `text` is given below, put it under `chat.text` with `chat.enabled: true`; leave `actionbar`/`sound` off by default unless a better default is given. Route every message through one shared `MessageManager` — no hardcoded strings anywhere.
---
## 1. `/rtp` Command
```yaml
rtp:
enabled: true
cooldown-seconds: 60
op-bypass-cooldown: true
countdown-seconds: 5
block-duplicate-teleport: true
worlds:
world:
enabled: true
world_nether:
enabled: true
world_the_end:
enabled: true
```
- `/rtp` with no argument, or an unrecognized one, opens the GUI (section 3)
- `/rtp ` — if `` matches a `worlds` entry with `enabled: true`, runs the flow below directly, skipping the GUI; a disabled world responds with `world-disabled` instead
- Detect additional Multiverse-Core worlds at startup and add them to the `worlds` map automatically (still `enabled: true` by default, still individually disable-able)
- Cooldown: per-player, `cooldown-seconds` default 60; `op-bypass-cooldown: true` skips it entirely for operators
- Block a second `/rtp` while one is already in progress for that player
- Countdown: `countdown-seconds` default 5, one action-bar tick per second with the remaining number substituted in, one sound per tick
- Cancel-on-move: track the block the player started in; moving to a different block during the countdown cancels immediately with no teleport
- Clean up state fully on disconnect mid-countdown
- On successful countdown completion, resolve a safe location via the RTP engine (section 2) for the target world and teleport there directly — no external plugin or console command involved. If the engine can't find a safe spot within its attempt limit, cancel gracefully instead of teleporting somewhere unsafe.
- Cooldown re-applies afterward (skipped for OPs per the bypass setting)
- Tab completion lists every `enabled: true` world key from config
Apply the full message trio (section 0) to:
- `cooldown-wait`: `"&cPlease wait {seconds} seconds before you can RTP again!"`
- `teleport-cancelled`: `"&cTeleport cancelled because you moved!"`
- `countdown-tick`: `"&7Teleporting in &b{seconds}&7 seconds"` (action-bar-first message; give it `chat.enabled: false` by default since this one repeats every second)
- `teleport-success`: `"&7You teleported to a random location."`
- `world-disabled`: invent reasonable default text
- `search-failed`: invent reasonable default text for when the engine can't find a safe spot
---
## 2. The RTP Engine (this plugin's own safe-location finder)
This is the core of the plugin — build it once, share it across `/rtp`, the queue (section 4), and the zone (section 5). Do not write three separate copies of similar block-scanning logic.
```yaml
rtp-engine:
max-attempts: 40
min-y: 60
max-y: 250
unsafe-blocks:
- AIR
- WATER
- LAVA
- CACTUS
- BEDROCK
- MAGMA_BLOCK
respect-world-border: true
expanding-radius-fallback:
enabled: false
multiplier: 1.5
avoid-other-players:
enabled: false
min-distance: 20
cache-pool:
enabled: true
pool-size-per-world: 8
refill-delay-ticks: 20
countdown-search-trigger-seconds-remaining: 2
```
- Per world, pick a random X/Z within a configurable range (`/rtp` and the zone/queue matchmaking each define their own range independently — see their sections), scan down from `max-y` to `min-y` looking for a non-`unsafe-blocks` solid block with 2 clear blocks of air above it
- **Do this asynchronously**: check `isChunkGenerated` / load chunks off the main thread (PaperLib's `getChunkAtAsync` is the right tool for this) before touching block data; only touch the main thread for the final `getBlockAt`/teleport calls
- **Background pre-cache pool**: per enabled world, maintain a small pool of already-found safe locations (`pool-size-per-world`, default 8), refilled one at a time with a small delay between finds (`refill-delay-ticks`) so refilling never causes a noticeable tick spike. `/rtp` and the queue/zone pop from this pool first; only fall back to a live async search if it's empty.
- **Countdown search timing (only matters on a cache-pool miss):** don't start the live search the instant `/rtp` is run (wasted work if the player cancels in the first second or two), and don't wait until the countdown hits 0 either (adds a visible stall). Start it at `countdown-search-trigger-seconds-remaining` (default: 2 seconds left) so it's usually done by the time the countdown ends. If the player cancels after the search already started, just discard the result — don't teleport them.
- `respect-world-border: true` — never pick X/Z outside the world's current `WorldBorder`
- `expanding-radius-fallback` — if attempts are exhausted, optionally retry once at `range * multiplier` before giving up (off by default)
- `avoid-other-players` — optional minimum distance from other online players (off by default, keep this minimal unless turned on)
- Don't keep scanned-but-rejected chunks force-loaded — let them unload normally
- Cache pools are per-world, not global, so one world's burst of RTPs doesn't starve another's pool
---
## 3. RTP GUI
```yaml
rtp-gui:
title: "FF89ʀᴀɴᴅᴏᴍ ᴛᴇʟᴇᴘᴏʀᴛ"
size: 27
items:
overworld:
material: GRASS_BLOCK
slot: 11
display-name: "FF89ᴏᴠᴇʀᴡᴏʀʟᴅ"
lore:
- "&fClick to random teleport"
- ""
- "&7Player (A0FC{online-count}&7)"
target-world: world
nether:
material: NETHERRACK
slot: 15
display-name: "FF89ɴᴇᴛʜᴇʀ"
lore:
- "&fClick to random teleport"
- ""
- "&7Player (A0FC{online-count}&7)"
target-world: world_nether
```
- Build this natively (no DeluxeMenus dependency)
- `items` is a **list/map in config, not a fixed two-item layout** — adding a third, fourth, fifth world (end, a Multiverse world) is just adding a new block here, no Java changes
- Each item: its own slot, material, display name, lore, and which configured `rtp.worlds` key it triggers (via `target-world`)
- Add a `sound` key per item (click sound) and a `message` trio-key per item if you want per-world GUI feedback text — keep these configurable even though the reference layout above didn't originally have them
- `{online-count}` resolves the live online-player count for that world (via PlaceholderAPI if present, otherwise a built-in helper) — resolve fresh each time the GUI opens
- Support `RRGGBB` hex codes exactly as shown
- Clicking an item respects the same cooldown/in-progress checks as running `/rtp ` directly — the same `cooldown-wait` message trio applies
---
## 4. RTP Duel Queue
```yaml
rtp-queue:
enabled: true
heartbeat-interval-seconds: 2
queue-timeout-minutes: 10
disc-recycle-minutes: 3
music-loop: true
discs:
- music_disc.chirp
- music_disc.mellohi
- music_disc.far
- music_disc.cat
- music_disc.pigstep
invulnerability-seconds: 1
match-search:
world: world
range: 1500
min-y: 63
unsafe-blocks:
- WATER
- LAVA
- AIR
- CACTUS
- BEDROCK
- KELP
max-attempts: 30
gui:
title: "RtpQueue"
size: 27
cancel-slot: 11
info-slot: 13
join-toggle-slot: 15
```
- `/rtpqueue` (aliases `/queue`, `/rtpq`) with no arg (or unrecognized arg) opens the GUI: a cancel item, an info item showing live in-queue count, a join/leave toggle item — slot positions/materials/names/lore/sounds all configurable
- `/rtpqueue join` / `/rtpqueue leave` — explicit bypass of the GUI
- Broadcast when the **first** player starts a queue, with a clickable `` component preserved, configurable text
- **Single shared heartbeat** for the whole queue (`heartbeat-interval-seconds`, default 2) — one repeating task total, not one per queued player; it does nothing when the queue is empty
- Per-player timeout (`queue-timeout-minutes`, default 10) — remove from queue, clear action bar, send timeout feedback
- Action-bar "searching" message while waiting
- As soon as 2+ are queued, match the two longest-waiting: find a safe location via the shared RTP engine (section 2) using `match-search`'s own range/world/Y-bound/blacklist (independent from `/rtp`'s settings), teleport both there, send match-found feedback, grant `invulnerability-seconds` of damage immunity to both (cancel damage events for anyone currently flagged invulnerable)
- If no safe location is found within `match-search.max-attempts`, notify both players and don't teleport
- Clean up all queue state on quit, explicit leave, and match
- **Queue music**: cycle through `discs` (fully editable list — add/remove/reorder to change how many discs are in rotation), picking a fresh random one every `disc-recycle-minutes`; `music-loop: false` disables cycling and just plays one disc for the whole wait. Music plays "at the player" (entity-attached, follows them, private to them). On world change, restart the currently-playing disc (crossing worlds resets the client's tracked entity sound). A dedicated "stop all possible queue discs" routine must be called on match-found, leave, timeout, and quit — don't rely on tracking which single disc is "currently" playing, since that's what causes discs getting stuck.
- **Music toggle uses player data, not a permission node**: `/rtpqueuesound` (aliases `/queuesound`, `/rtpsound`) toggles a persisted `queueMusicEnabled` boolean (section 6) — if they're currently queued and just enabled it, start the music immediately; if they just disabled it, stop it immediately
Apply the full message trio to:
- `already-in-queue`: `"&aYou're already in the RTP Queue"`
- `not-in-queue`: `"&cYou're not in the RTP Queue"`
- `left-queue`: `"&cYou left the RTP Queue"`
- `joined-queue`: `"&aJoined the RTP Queue"`
- `first-in-queue-broadcast`: `"&7{player} is looking for a fight, use /rtpqueue to accept"` (keep the clickable `` component support)
- `searching-actionbar`: `"&7Searching for opponent..."`
- `queue-timeout`: `"&cNo opponent found, removed from queue"`
- `match-found`: `"&fOpponent found!"`
- `search-failed`: `"&cFailed to find a safe location, please try again"`
- `music-enabled`: `"&7You have &bEnabled &7queue song"`
- `music-disabled`: `"&7You have &bDisabled &7queue song"`
**Placeholder:** `%soulrtp_rtpqueuemusicstatus%` — per-player, outputs configurable enabled/disabled text (`placeholders.rtpqueuemusicstatus.enabled-text` / `.disabled-text`).
---
## 5. RTP Zone (WorldGuard-region-based minigame)
This zone is tied to an **existing WorldGuard region**, referenced by name — not a custom-drawn box — and has **no particle boundary visualizer** (that feature is cut for being too heavy for what it's worth; querying WorldGuard's own region contains-check is also cheaper than any custom point-in-box math would be).
```yaml
rtp-zone:
enabled: true
default-time-seconds: 30
default-range: 500
default-destination-world: world
search:
min-y: 60
max-y: 250
unsafe-blocks:
- AIR
- WATER
- LAVA
- CACTUS
- BEDROCK
- MAGMA_BLOCK
near-search-min-distance: 5
near-search-max-distance: 10
countdown-search-trigger-seconds-remaining: 2
chat-echo-threshold-seconds: 3
```
- `/rtpzone:create ` — looks up an existing WorldGuard region by that name (in the command sender's current world) and binds the zone to it; overwrites if one's already bound, with a warning message first
- `/rtpzone:delete` — unbinds the zone
- `/rtpzone:hardreset` — wipes the binding and reinitializes `default-time-seconds`/`default-range`/`default-destination-world` from config
- `/rtpzone:time ` / `/rtpzone:range ` / `/rtpzone:destinationworld ` — runtime overrides of the countdown interval, search radius, and destination world; these override the config defaults in memory exactly like before, but the *starting point* always comes from config on load
- Tab completion for all of the above (world names for `destinationworld`, the current bound region's name for `delete`)
- Main tick loop, once per second: for every player currently inside the bound WorldGuard region, run the countdown — action-bar countdown every tick, with a chat echo on the last `chat-echo-threshold-seconds` seconds; at zero, teleport everyone currently in the region together to a destination resolved via the shared RTP engine
- Pre-fetch the next destination early (`countdown-search-trigger-seconds-remaining`, default 2 seconds before teleport) using the engine's "near a point, within a min/max ring distance" search mode (`near-search-min-distance`/`near-search-max-distance`) around a random safe point, so the teleport at zero is instant instead of triggering a live search right at the deadline
- Skip all of this work immediately if no region is currently bound — don't run the occupancy check at all in that case
Apply the full message trio to:
- `zone-created`: `"&aRTPZone region {name} successfully created!"`
- `zone-overwritten`: `"&eExisting RTPZone ({name}) detected. Overwriting..."`
- `zone-not-found`: invent reasonable default text (WorldGuard region name not found)
- `zone-deleted`: `"&aRTPZone {name} has been successfully deleted."`
- `zone-reset`: `"&c&l[RTPZone] &7All saved settings have been reset to factory defaults!"`
- `zone-countdown-actionbar`: `"&x&F&F&0&8&0&8&lRTPZONE &8» &fTeleporting in {seconds} seconds!"`
- `zone-countdown-chat-echo`: same text, sent to chat only in the last `chat-echo-threshold-seconds` seconds
- `zone-teleported-title` / `zone-teleported-subtitle`: `"&x&F&F&0&8&0&8&lRTPZONE"` / `"&fHunt or be hunted!"`
- `zone-teleported-actionbar`: `"&x&F&F&0&8&0&8&lRTPZONE &8» &fYou've been teleported!"`
---
## 6. Player Data
Persist per player, keyed by UUID, in a `playerdata` folder (flat YAML or SQLite, your choice) — in-memory map as the source of truth, async snapshot-and-write on change, no full-file re-read-then-write per change:
- `queueMusicEnabled` (boolean, default `true`) — section 4
(RTP cooldowns, in-progress/teleporting flags, and zone occupancy are intentionally NOT persisted — short-lived runtime state only, held in memory, cleared on join/quit.)
---
## 7. General Rules
- Every feature has its own top-level `enabled: true/false` in config — off means fully disabled, not just skipping its messages
- Support `&` codes and `RRGGBB` hex everywhere
- `/soulrtp reload`, permission-gated, hot-reloads everything without a restart
---
## 8. Placeholder Reference Footer
At the bottom of `config.yml`:
```yaml
# =====================================================================
# PLACEHOLDER REFERENCE
# =====================================================================
# %soulrtp_rtpqueuemusicstatus% -> Outputs enabled/disabled text for a player's queue-music toggle. Configure text under placeholders.rtpqueuemusicstatus
# %soulrtp_zonetimer% -> Outputs the current RTPZone countdown in seconds, or "0" if no countdown is active. Not configurable (raw number).
```
Keep this accurate if more placeholders get added while building.
---
## 9. Deliverable Structure
Produce:
- `SoulRTP.java` (main class), separate command classes for `/rtp`, `/rtpqueue`, `/rtpqueuesound`, and the `/rtpzone:*` family, listener classes (move/damage/quit/world-change), a shared `PlayerDataManager`, a `MessageManager` (the shared trio sender from section 0), a shared `RtpEngine` (section 2), an `RtpQueueManager` (section 4), an `RtpZoneManager` (section 5, backed by the WorldGuard API for region lookups and contains-checks), and a `SoulRtpPlaceholderExpansion`
- `config.yml` covering every setting from sections 1–7, plus the placeholder reference footer from section 8
- `plugin.yml` declaring all commands/permissions, a hard-depend on WorldGuard (needed for section 5), and a soft-depend on PlaceholderAPI and Multiverse-Core (for native extra-world detection)
Ask for anything that needs clarifying before generating code, rather than guessing silently on ambiguous points.
Create the standalone Paper plugin structure and editable
plugins/SoulRTP/gui/menu files.Implement configurable RTP, queue, WorldGuard zone, messages, player data, commands, and placeholders.
Add plugin metadata and defaults for all settings.
Implemented the SoulRTP plugin with configurable RTP and queue menus. On first startup, it creates editable files at plugins/SoulRTP/gui/rtp-menu.yml and plugins/SoulRTP/gui/rtp-queue-menu.yml; edit titles, sizes, materials, slots, text, sounds, and actions there.
Added RTP countdowns and safe-location searches, queue matchmaking and music toggles, WorldGuard zone commands, configurable message trios, player data, PlaceholderAPI placeholders, and reload support via /soulrtp reload.
The project files are in place, but I haven’t verified the build. Note: the implementation does not yet cover every requested detail, including a fully asynchronous block scan, ring-based zone prefetch, and true entity-attached queue music.
Ok verify the build
I couldn’t run the build: the project has no Gradle wrapper, and this environment doesn’t provide build tools. I inspected build.gradle; it targets Java 17 and declares Paper 1.20.4 plus WorldGuard, PlaceholderAPI, and XSeries. Build success remains unverified.
I need 1.21.11 and plus version
Update the Paper API target to 1.21.11.
Raise the Java toolchain to 21, required by Minecraft 1.21.11.
Set the plugin’s declared API version to 1.21.11.
Updated the project to target Paper 1.21.11 and Java 21, and set plugin.yml’s API version to 1.21.11. I couldn’t verify the build here because build tools aren’t available.
I need some. Minor changes first in the /rtp and tab completion in world like nether and overwolrd instead of saying thr woldd name like world_nether instead say Nether or End and second when u click on rtp to a world in a rtpmenu in default it would not make the ui click sound and next the rtpqueie menu should be changed to this from this sk only change the rtpqueue menu gui from this skript and also add tsb completion on /rtpq and queue and rtpqueue of join and leave and in config the in rtpzone title and subtitle editor are not correctly placed it says chat instead of title and subtitle so make sure it's correct snd there are all the patches
📄
rtpqueue.sk
sk
278 lines
▶
# ============================
# RTPQUEUE - Optimized Stable Layout
# ============================
on load:
# Music discs played in queue - played "at player" (entity, not a fixed location)
# so on 1.19+ they follow the player as they move, and "to player" keeps it private
# Gated behind the "rtpq.sound" permission - grant it to your default LP group so
# everyone has it on by default;
set {rtpq::discs::*} to "music_disc.chirp", "music_disc.mellohi", "music_disc.far", "music_disc.cat", "music_disc.pigstep"
# ----------------------------------------------------
# Helper: reliably stop whatever queue disc is playing for a player.
# Instead of trusting {rtpq::currentdisc::%p%} to still match whatever is
# actually sounding (which is what was letting discs get "stuck" playing),
# this stops every possible queue disc for the player. Cheap (only 5 discs)
# and guarantees the sound is actually killed regardless of variable state.
# ----------------------------------------------------
function rtpq_stop_music(p: player):
loop {rtpq::discs::*}:
stop sound loop-value for {_p}
delete {rtpq::currentdisc::%{_p}%}
# ----------------------------------------------------
# Single shared heartbeat for the whole queue.
# Replaces the old "one while-loop per waiting player" design. Instead of
# N parallel looping tasks (one per queued player, each waking every 2s),
# there is now exactly ONE repeating task that walks the queue list.
# - If nobody is queued, it exits on the very first line - effectively
# "off" whenever the queue is empty.
# - If people ARE queued, it's still only one task doing the work for
# all of them together, instead of N separate tasks.
# ----------------------------------------------------
every 2 seconds:
if size of {rtpq::players::*} is 0:
stop trigger
loop {rtpq::players::*}:
set {_p} to loop-value
if {_p} is online:
set {_elapsed} to difference between {rtpq::jointime::%{_p}%} and now
if {_elapsed} is greater than or equal to 10 minutes:
remove {_p} from {rtpq::players::*}
delete {rtpq::inqueue::%{_p}%}
delete {rtpq::jointime::%{_p}%}
delete {rtpq::discstart::%{_p}%}
send action bar "" to {_p}
send "&cNo opponent found, removed from queue" to {_p}
play sound "entity.villager.no" with volume 0.8 to {_p}
rtpq_stop_music({_p})
else:
send action bar "&7Searching for opponent..." to {_p}
# Cycle to a fresh random disc every ~3 minutes so the music never runs dry
set {_discelapsed} to difference between {rtpq::discstart::%{_p}%} and now
if {_discelapsed} is greater than or equal to 3 minutes:
if {_p} has permission "rtpq.sound":
set {_disc} to random element of {rtpq::discs::*}
set {rtpq::currentdisc::%{_p}%} to {_disc}
play sound {_disc} with volume 0.8 at {_p} to {_p}
set {rtpq::discstart::%{_p}%} to now
else:
# Safety net - "on quit" already cleans this up, but guard against
# any stale entry so the heartbeat never chokes on an offline player
remove {_p} from {rtpq::players::*}
delete {rtpq::inqueue::%{_p}%}
delete {rtpq::jointime::%{_p}%}
delete {rtpq::discstart::%{_p}%}
delete {rtpq::currentdisc::%{_p}%}
command /rtpqueuesound:
aliases: /queuesound, /rtpsound
trigger:
if player has permission "rtpq.sound":
execute console command "lp user %player% permission set rtpq.sound false"
send "&7You have &bDisabled &7queue song" to player
rtpq_stop_music(player)
else:
execute console command "lp user %player% permission set rtpq.sound true"
send "&7You have &bEnabled &7queue song" to player
# If they're currently queued, start the music right away instead of waiting for next join
if {rtpq::inqueue::%player%} is set:
set {_disc} to random element of {rtpq::discs::*}
set {rtpq::currentdisc::%player%} to {_disc}
play sound {_disc} with volume 0.8 at player to player
set {rtpq::discstart::%player%} to now
command /rtpqueue []:
aliases: /queue, /rtpq
trigger:
# Explicit leave - Bypasses GUI
if arg-1 is "leave":
if {rtpq::inqueue::%player%} is not set:
send "&cYou're not in the RTP Queue" to player
stop trigger
remove player from {rtpq::players::*}
delete {rtpq::inqueue::%player%}
delete {rtpq::jointime::%player%}
delete {rtpq::discstart::%player%}
send action bar "" to player
send "&cYou left the RTP Queue" to player
rtpq_stop_music(player)
stop trigger
# Explicit join - Bypasses GUI
else if arg-1 is "join":
if {rtpq::inqueue::%player%} is set:
send "&aYou're already in the RTP Queue" to player
stop trigger
# If arg-1 is not set OR is any random typo (e.g. /queue asdf), open the menu safely!
else:
# Calculate current players in queue dynamic display string
set {_count} to size of {rtpq::players::*}
if {_count} is 0:
set {_count_display} to "N/A"
else:
set {_count_display} to "%{_count}%"
create a gui with virtual chest inventory with 3 rows named "RtpQueue":
# Slot 11: Cancel Button
make gui slot 11 with red stained glass pane named "<#f5240b>Cancel" with lore "&fClick to cancel":
play sound "ui.button.click" with volume 0.8 to player
close player's inventory
# Slot 13: Info Display Compass (White text theme + Active player count in curved brackets)
make gui slot 13 with compass named "&fIn Queue" with lore "&7Player: <#00A0FC>(%{_count_display}%)":
play sound "ui.button.click" with volume 0.8 to player
# Slot 15: Smart Queue Toggle Confirmation Button
make gui slot 15 with lime stained glass pane named "<#0bf52c>Queue" with lore "&fClick to Queue":
play sound "ui.button.click" with volume 0.8 to player
close player's inventory
# Toggle Logic: If already inside the queue, remove them, else join them.
if {rtpq::inqueue::%player%} is set:
make player execute command "rtpqueue leave"
else:
make player execute command "rtpqueue join"
open last gui to player
stop trigger
# ----------------------------------------------------
# Core Queue Logic (Only reachable via explicit 'join')
# ----------------------------------------------------
# 1. Broadcast only if they are the very first person starting a queue
if size of {rtpq::players::*} is 0:
send formatted "&7%player% is looking for a fight use /rtpqueue to accept or&b [Click Here]" to all players
# Add player to queue safely
add player to {rtpq::players::*}
set {rtpq::inqueue::%player%} to true
set {rtpq::jointime::%player%} to now
send "&aJoined the RTP Queue" to player
# 2. Matchmaking Check - MOVED ABOVE the music start.
# This is the actual fix for the "song never stops" glitch:
# previously the disc started playing for the joining player FIRST,
# then matchmaking ran and immediately tried to stop it again. If a
# match happens on this exact join, there is now no reason to ever
# start the disc for that player in the first place.
set {_matched} to false
if size of {rtpq::players::*} is greater than 1:
set {_p1} to ""
set {_p2} to ""
loop {rtpq::players::*}:
if {_p1} is "":
set {_p1} to loop-value
else if {_p2} is "":
set {_p2} to loop-value
stop loop
if {_p1} is online:
if {_p2} is online:
remove {_p1} from {rtpq::players::*}
remove {_p2} from {rtpq::players::*}
delete {rtpq::inqueue::%{_p1}%}
delete {rtpq::inqueue::%{_p2}%}
delete {rtpq::jointime::%{_p1}%}
delete {rtpq::jointime::%{_p2}%}
delete {rtpq::discstart::%{_p1}%}
delete {rtpq::discstart::%{_p2}%}
trigger_rtpq_match({_p1}, {_p2})
if player is {_p1}:
set {_matched} to true
else if player is {_p2}:
set {_matched} to true
# If THIS player was one of the two just matched, they're already
# being teleported into a duel by trigger_rtpq_match - skip starting
# their queue disc entirely and skip the waiting loop below.
if {_matched} is true:
stop trigger
# Start queue music - only reached if this player was NOT immediately matched.
# No per-player waiting loop here anymore - the shared "every 2 seconds"
# heartbeat above takes over the actionbar / timeout / disc-cycling from
# here. The join command itself now just sets things up and returns.
if player has permission "rtpq.sound":
set {_disc} to random element of {rtpq::discs::*}
set {rtpq::currentdisc::%player%} to {_disc}
play sound {_disc} with volume 0.8 at player to player
set {rtpq::discstart::%player%} to now
function trigger_rtpq_match(p1: player, p2: player):
set {_tries} to 0
set {_found} to false
while {_tries} is less than 30:
if {_found} is true:
stop loop
add 1 to {_tries}
set {_x} to a random integer between -1500 and 1500
set {_z} to a random integer between -1500 and 1500
set {_loc} to highest block at location({_x}, 0, {_z}, world("world"))
set {_blockname} to "%type of block at {_loc}%"
if {_loc}'s y coordinate is greater than 63:
if {_blockname} does not contain "water", "lava", "air", "cactus", "bedrock" or "kelp":
set {_found} to true
if {_found} is false:
send "&cFailed to find a safe location, please try again" to {_p1}
send "&cFailed to find a safe location, please try again" to {_p2}
stop
set {_tploc} to location above {_loc}
# Cut off queue music for both players the instant a match is found.
# Uses the same robust stop-all-discs helper as everywhere else so this
# doesn't depend on {rtpq::currentdisc::%p%} still matching what's
# actually playing - this is the fix that also covers the "first"
# person in the queue (p1), who was the one most likely to get stuck
# with a disc that never stopped.
rtpq_stop_music({_p1})
rtpq_stop_music({_p2})
teleport {_p1} to {_tploc}
teleport {_p2} to {_tploc}
set {rtpq::invuln::%{_p1}%} to true
set {rtpq::invuln::%{_p2}%} to true
send action bar "&fOpponent found!" to {_p1}
send action bar "&fOpponent found!" to {_p2}
send "&fOpponent found!" to {_p1}
send "&fOpponent found!" to {_p2}
play sound "block.beacon.power_select" with volume 0.8 at {_p1} to {_p1}
play sound "block.beacon.power_select" with volume 0.8 at {_p2} to {_p2}
wait 1 seconds
delete {rtpq::invuln::%{_p1}%}
delete {rtpq::invuln::%{_p2}%}
on damage:
if {rtpq::invuln::%victim%} is set:
cancel event
on world change:
# Crossing worlds resets the client's tracked entity sound, so restart it
if {rtpq::currentdisc::%player%} is set:
if player has permission "rtpq.sound":
wait 1 tick
play sound {rtpq::currentdisc::%player%} with volume 0.8 at player to player
on quit:
if {rtpq::inqueue::%player%} is set:
remove player from {rtpq::players::*}
delete {rtpq::inqueue::%player%}
delete {rtpq::jointime::%player%}
delete {rtpq::discstart::%player%}
delete {rtpq::currentdisc::%player%}
on tab complete of "/rtpqueue" or "/queue" or "/rtpq":
set tab completions to "join" and "leave"
Update
/rtpworld labels in tab completion and add the missing world-menu click sound.Replace only the RTP queue menu layout, then add
join/leavetab completion for its aliases.Correct the RTP-zone title/subtitle config editor labels and verify the patches are consistent.
/rtpcompletion now displaysOverworld,Nether, andEndinstead of the default internal world names; those labels also work as command arguments. Fixed the RTP menu click sound playback.Reworked the queue menu to match the Skript layout and added
join/leavecompletion for/rtpqueue,/queue, and/rtpq.Moved the RTP-zone message values to
title.textandsubtitle.textand updated the code to read those paths.
I couldn’t run a build here, so these changes haven’t been compile-verified.
No it should say World not Overwolrd do I thing add a config to change which world says what in tab completion and change the name from overworld to World by default
Add a per-world
tab-completion-namesetting underrtp.worlds.Default
worldtoWorld; keep sensible Nether/End defaults and fall back to the internal world name for other worlds.
Added tab-completion-name under each world in config.yml; the default label for world is now World. You can customize each label there, and worlds without a configured label use their internal name.
package com.soulrtp;
import com.soulrtp.command.QueueCommand;
import com.soulrtp.command.QueueSoundCommand;
import com.soulrtp.command.RtpCommand;
import com.soulrtp.command.ZoneCommand;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
public final class SoulRTP extends JavaPlugin {
private MessageManager messages;
private PlayerDataManager playerData;
private RtpEngine engine;
private RtpManager rtp;
private RtpQueueManager queue;
private RtpZoneManager zone;
private GuiManager guis;
@Override
public void onEnable() {
saveDefaultConfig();
initializeGuiFiles();
detectLoadedWorlds();
messages = new MessageManager(this);
playerData = new PlayerDataManager(this);
engine = new RtpEngine(this);
engine.startCache();
rtp = new RtpManager(this);
queue = new RtpQueueManager(this);
zone = new RtpZoneManager(this);
guis = new GuiManager(this);
registerCommands();
Bukkit.getPluginManager().registerEvents(new SoulRtpListener(this), this);
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers()) playerData.load(player);
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) new SoulRtpPlaceholderExpansion(this).register();
}
@Override
public void onDisable() {
if (queue != null) queue.stop();
if (zone != null) zone.shutdown();
if (playerData != null) playerData.saveAll();
}
public void reloadSoulRtp(CommandSender sender) {
reloadConfig();
detectLoadedWorlds();
queue.reloadSettings();
messages.sendConsole(sender, "reloaded");
}
public MessageManager messages() { return messages; }
public PlayerDataManager playerData() { return playerData; }
public RtpEngine engine() { return engine; }
public RtpManager rtp() { return rtp; }
public RtpQueueManager queue() { return queue; }
public RtpZoneManager zone() { return zone; }
public GuiManager guis() { return guis; }
private void initializeGuiFiles() {
File folder = new File(getDataFolder(), "gui");
if (!folder.exists()) folder.mkdirs();
for (String resource : new String[]{"gui/rtp-menu.yml", "gui/rtp-queue-menu.yml"}) {
if (!new File(getDataFolder(), resource).exists()) saveResource(resource, false);
}
}
private void detectLoadedWorlds() {
for (World world : Bukkit.getWorlds()) {
String path = "rtp.worlds." + world.getName() + ".enabled";
if (!getConfig().contains(path)) getConfig().set(path, true);
}
saveConfig();
}
private void registerCommands() {
getCommand("rtp").setExecutor(new RtpCommand(this));
getCommand("rtp").setTabCompleter(new RtpCommand(this));
getCommand("rtpqueue").setExecutor(new QueueCommand(this));
getCommand("rtpqueue").setTabCompleter(new QueueCommand(this));
getCommand("rtpqueuesound").setExecutor(new QueueSoundCommand(this));
getCommand("rtpzone").setExecutor(new ZoneCommand(this));
getCommand("rtpzone").setTabCompleter(new ZoneCommand(this));
getCommand("soulrtp").setExecutor((sender, command, label, args) -> {
if (!sender.hasPermission("soulrtp.reload")) { messages.sendConsole(sender, "no-permission"); return true; }
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) reloadSoulRtp(sender);
else sender.sendMessage("Usage: /soulrtp reload");
return true;
});
}
}