Skript Region without using Worldguard

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

DieKatzeyt

Member
Jun 2, 2022
4
0
1
Hello i wanna protect a specific region but don't want to use Worldguard is there a way to do it with Skript only

Thx for everyone's help
 
The standard events built into the script do not allow you to fully do this.
But the base concept of is:

Code:
createRegion(loc1: location, loc2: location, name: text):
    set {-regions::%{_name}%::point1} to {_loc1}
    set {-regions::%{_name}%::point2} to {_loc2}

isInRegion(loc: location) :: text:
    loop indexes of {-regions::*}:
        {_loc} is within {-regions::%loop-value%::point1} and {-regions::%loop-value%::point2}
        return loop-value

addMember(region: text, member: offlineplayer):
    {-regions::%{_region}%::*} is set
    {-regions::%{_region}%::members::*} doesn't contain {_member}
    add {_member} to {-regions::%{_region}%::members::*}

isRegionMember(region: text, member: offlineplayer) :: boolean:
    {-regions::%{_region}%::members::*} contains {_member}
    return true

on break:
    set {_region} to isInRegion(location of event-block)
    {_region} is set
    isRegionMember({_region},player) is false
    cancel event
    send "This is region %{_region}%. You cant break block there" to player