paradoxx710

I need to create a script that uses a command to check if the "spawn" region exists in the "spawn" world.

Kodari AI
KodariJan 14 at 4:03 pm 1,277 (v2)

I’ll create a region checking script with WorldGuard integration.

RegionChecker
A utility script for server administrators to verify WorldGuard region existence. Features a simple command that checks if specific regions exist in specified worlds, providing immediate feedback. Useful for troubleshooting region configurations and validating world setups before deployment.

Installation Instructions:

  1. Requirements:

    • Skript plugin installed

    • WorldGuard plugin installed

  2. Setup:

    • Place region-check.sk in plugins/Skript/scripts/

    • Run /sk reload region-check or restart server

  3. Usage:

    • Command: /checkspawnregion (or /csr, /checkregion)

    • Permission: region.check

    • Checks if region “spawn” exists in world “spawn”

  4. Responses:

    • ✓ Green message if region exists

    • ✗ Red message if region or world doesn’t exist

The script validates both the world and region existence, providing clear feedback for each scenario.

paradoxx710

Skript does not recognize the condition 'if region "spawn" exists in {_world}:'

'

Kodari AI
KodariJan 14 at 4:05 pm 1,546 (v2)

I need to see the current code to fix the region check syntax.

The issue is that Skript doesn’t have a built-in “region exists” condition. You need to use WorldGuard’s region manager directly. Here’s the corrected version:

Changes made:

  • Replaced the invalid if region "spawn" exists in {_world} condition

  • Now uses regions at spawn of {_world} to get all regions at the spawn location

  • Checks if the list contains the “spawn” region name

To apply:

  1. The file is already updated

  2. Run /sk reload region-check in-game

Note: This checks if a region named “spawn” exists at the spawn point of the world. If you need to check if the region exists anywhere in the world (not just at spawn), you’ll need the skript-reflect or SkBee addon to access WorldGuard’s RegionManager directly.

Kodari can make mistakes. Review important code before using.
Files
region-check.sk
Code
1 22
region-check.sk
# Region Checker Script
# Checks if the "spawn" region exists in the "spawn" world
# Requires: WorldGuard, Skript

options:
    prefix: &6[RegionCheck]&r

command /checkspawnregion:
    permission: region.check
    aliases: /csr, /checkregion
    trigger:
        set {_world} to world "spawn"
        
        if {_world} is not set:
            send "{@prefix} &cWorld 'spawn' does not exist!" to player
            stop
        
        set {_regions::*} to regions at spawn of {_world}
        if {_regions::*} contains "spawn":
            send "{@prefix} &aRegion 'spawn' exists in world 'spawn'!" to player
        else:
            send "{@prefix} &cRegion 'spawn' does NOT exist in world 'spawn'!" to player