yuvrau

create script for minecraft server that random rtp in overworld , nether and end by using command /rtp and this command will open a INVENTORY GUI in front of that player who run this command and that INVENTORY GUI is of single chest INVENTORY GUI in which it show 3 blocks : grassblock , nether wrack , endstone grassblock will teleport in overworld 10k by 10k area randomly and same in nether but clicking on endstone will show that the message to that player that end is closed and after player get teleported once it will show the cooldown of 5min to do rtp again and rtp cooldown will not apply when player clicked on end stone and name the INVENTORY GUI RTP menu

and add this features Safe-location detection (avoid oceans, lava, leaves, caves).

World border support instead of fixed ±10,000.

RTP warmup (e.g. 3 seconds).

Cancel RTP if the player moves during warmup.

BossBar countdown during teleport.

Particle and sound effects.

Permission nodes: survival.rtp survival.rtp.bypasscooldown Configurable cooldown and world names.

Blacklisted biomes (deep ocean, mushroom fields, etc.).

Async chunk loading for better performance

Kodari AI
KodariJul 28 at 11:14 am 5
SurvivalRandomTeleport
A configurable Minecraft RTP system for Overworld and Nether travel through a single-chest RTP Menu GUI. Players select grass or netherrack to begin a safe random teleport using world-border-aware coordinates, biome blacklists, asynchronous chunk loading, warmup cancellation on movement, bossbar countdowns, particles, sounds, permissions, and cooldown protection. Endstone displays that End travel is closed without applying cooldown.

Place rtp.sk in plugins/Skript/scripts/, configure the options at the top, then run:

Plain Text
/sk reload rtp

Permissions:

  • survival.rtp — use /rtp

  • survival.rtp.bypasscooldown — bypass the RTP cooldown

Kodari can make mistakes. Review important code before using.
Files
rtp.sk
Code
1 225
rtp.sk
# SurvivalRandomTeleport
# Requires Skript 2.8+ with modern world-border, bossbar, particle, and async chunk-loading support.
# Place this file in plugins/Skript/scripts/ and run: /sk reload rtp

options:
    menu-name: &8RTP Menu
    overworld-world: world
    nether-world: world_nether
    end-world: world_the_end
    use-world-border: true
    fallback-radius: 5000
    cooldown: 5 minutes
    warmup-seconds: 3
    move-threshold: 0.2
    max-attempts: 40
    chunk-load-wait: 2 ticks
    blacklisted-biomes: "ocean", "deep ocean", "lukewarm ocean", "deep lukewarm ocean", "cold ocean", "deep cold ocean", "frozen ocean", "deep frozen ocean", "mushroom fields"

function rtp-find-location(target: world) :: location:
    set {_min-x} to 0 - {@fallback-radius}
    set {_max-x} to {@fallback-radius}
    set {_min-z} to 0 - {@fallback-radius}
    set {_max-z} to {@fallback-radius}

    if {@use-world-border} is true:
        set {_border-size} to world border size of {_target}
        set {_border-center} to world border center of {_target}

        if {_border-size} is set:
            set {_half-border} to ({_border-size} / 2) - 16

            if {_half-border} > 16:
                set {_center-x} to x-coordinate of {_border-center}
                set {_center-z} to z-coordinate of {_border-center}
                set {_min-x} to {_center-x} - {_half-border}
                set {_max-x} to {_center-x} + {_half-border}
                set {_min-z} to {_center-z} - {_half-border}
                set {_max-z} to {_center-z} + {_half-border}

    loop {@max-attempts} times:
        set {_x} to random integer between {_min-x} and {_max-x}
        set {_z} to random integer between {_min-z} and {_max-z}
        set {_candidate} to location({_x}, 0, {_z}, {_target})

        load chunk at {_candidate} asynchronously
        wait {@chunk-load-wait}

        set {_ground} to highest solid block at {_candidate}

        if {_ground} is not set:
            continue loop

        set {_safe} to location of {_ground}
        add 1 to y-coordinate of {_safe}

        if y-coordinate of {_safe} < 1:
            continue loop

        if y-coordinate of {_safe} > 250:
            continue loop

        set {_biome} to "%biome at {_safe}%"

        if {_biome} is one of {@blacklisted-biomes}:
            continue loop

        if block below {_safe} is not solid:
            continue loop

        if block below {_safe} is water:
            continue loop

        if block below {_safe} is lava:
            continue loop

        if "%block below {_safe}%" contains "leaves":
            continue loop

        if block at {_safe} is not air:
            continue loop

        if block above {_safe} is not air:
            continue loop

        if "%block below {_safe}%" contains "fire":
            continue loop

        if "%block below {_safe}%" contains "magma":
            continue loop

        return {_safe}

function start-rtp(p: player, target: world):
    set {_uuid} to uuid of {_p}
    set {_bar} to "rtp-warmup-%{_uuid}%"
    set {_start-location} to location of {_p}

    delete bossbar {_bar}
    create bossbar titled "&dRTP Warmup &7- &f{@warmup-seconds}s" with id {_bar}
    set bossbar {_bar} color to purple
    set bossbar {_bar} style to segmented 10
    set bossbar {_bar} progress to 100
    add {_p} to bossbar {_bar}

    loop {@warmup-seconds} times:
        wait 1 second

        if {_p} is not online:
            delete bossbar {_bar}
            delete {rtp.busy::%{_uuid}%}
            return

        set {_current-location} to location of {_p}

        if world of {_current-location} is not world of {_start-location}:
            remove {_p} from bossbar {_bar}
            delete bossbar {_bar}
            delete {rtp.busy::%{_uuid}%}
            play sound "entity.item.break" with volume 1 and pitch 0.8 at {_p}
            send "&cRTP cancelled because you moved." to {_p}
            return

        if distance between {_current-location} and {_start-location} > {@move-threshold}:
            remove {_p} from bossbar {_bar}
            delete bossbar {_bar}
            delete {rtp.busy::%{_uuid}%}
            play sound "entity.item.break" with volume 1 and pitch 0.8 at {_p}
            send "&cRTP cancelled because you moved." to {_p}
            return

        set {_remaining} to {@warmup-seconds} - loop-number

        if {_remaining} > 0:
            set bossbar {_bar} title to "&dRTP Warmup &7- &f%{_remaining}%s"
            set {_progress} to {_remaining} * 100 / {@warmup-seconds}
            set bossbar {_bar} progress to {_progress}

    if {_p} is not online:
        delete bossbar {_bar}
        delete {rtp.busy::%{_uuid}%}
        return

    set {_safe-location} to rtp-find-location({_target})

    if {_safe-location} is not set:
        remove {_p} from bossbar {_bar}
        delete bossbar {_bar}
        delete {rtp.busy::%{_uuid}%}
        send "&cCould not find a safe RTP location. Please try again." to {_p}
        return

    remove {_p} from bossbar {_bar}
    delete bossbar {_bar}

    teleport {_p} to {_safe-location}
    set {rtp.cooldown::%{_uuid}%} to now
    delete {rtp.busy::%{_uuid}%}

    play particle "portal" at {_safe-location}
    play particle "cloud" at {_safe-location}
    play sound "entity.enderman.teleport" with volume 1 and pitch 1 at {_p}

    send "&aYou have been randomly teleported safely." to {_p}
    send "&7RTP cooldown: &f{@cooldown}&7." to {_p}

command /rtp:
    permission: survival.rtp
    permission message: &cYou do not have permission to use RTP.
    trigger:
        if {rtp.busy::%uuid of player%} is set:
            send "&eYou already have an RTP teleport in progress." to player
            stop

        open virtual chest inventory with 1 row named "{@menu-name}" to player

        set slot 3 of player's current inventory to grass block named "&aOverworld RTP" with lore "&7Teleport safely within the Overworld world border."
        set slot 4 of player's current inventory to netherrack named "&cNether RTP" with lore "&7Teleport safely within the Nether world border."
        set slot 5 of player's current inventory to end stone named "&5End RTP" with lore "&7The End is currently closed."

on inventory click:
    if name of event-inventory is not "{@menu-name}":
        stop

    cancel event

    if clicked inventory is not event-inventory:
        stop

    if clicked slot is 5:
        close player's inventory
        play sound "block_note_block_pling" with volume 1 and pitch 0.8 at player
        send "&5The End is currently closed." to player
        stop

    if clicked slot is not 3 and clicked slot is not 4:
        stop

    if player has permission "survival.rtp.bypasscooldown":
        set {_cooldown-bypassed} to true