getter for WorldGuard flags - Via Skript-reflect

  • 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 comminuty!

    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!

Status
Not open for further replies.

zahrajsi.net

Supporter
Apr 22, 2022
2
0
1
30
Czech Republick
Mc Version : git-Purpur-1613 (MC: 1.18.2)
Skript ver: 2.6.1

hello I have a problem with this code, no matter what I do it still gives me the same error, I would like to make a snipset out of it but at the moment I can't move on either way,

what exactly is it supposed to do?

Returning a flag value for example the flag status "pvp" and it will return "deny or allow" or "true or false"

Thank you so much for the help..
I'm already desperate.
The code
Code:
import:
    org.bukkit.Bukkit
    com.sk89q.worldguard.bukkit.WorldGuardPlugin
    com.sk89q.worldguard.util.Enums
on load:
    set {world} to "main" parsed as world

command 333:
    trigger:
        set {loc} to new Location({world}, 10, 64, 100)
        set {_container} to (class "com.sk89q.worldguard.WorldGuard").getInstance().getPlatform().getRegionContainer()
        broadcast "&cDebug[CONTAINER]: &e%{_container}%"
        set {_query} to {_container}.createQuery()
        broadcast "&cDebug[emptyQuery]: &e%{_query}%"

        broadcast "&cDebug: &e%{_query}.testState({loc}, player, Flags.PVP)%"

function wgFlag(flag: string, region: string, s: sender) :: string:
    set {result} to {query}.testState({_region}, {_s}, Enum.valueOf(Flags.%{_flag}%))
    if {result} is "allow":
        return "allow"
    else:
        return "deny"


Error
[14:50:16 ERROR]: Line 16: (snipset\worlguard.sk)
Variables cannot be used here.
Line: broadcast "&cDebug: &e%{_query}.testState({loc}, player, Flags.PVP)%"

[14:50:16 INFO]: [Skript] Encountered 1 error while reloading 3 scripts in snipset! (62ms)
> 333
[14:50:41 INFO]: Debug[CONTAINER]: com.sk89q.worldguard.bukkit.BukkitRegionContainer@64bbb892
[14:50:41 INFO]: Debug[emptyQuery]: com.sk89q.worldguard.protection.regions.RegionQuery@4f6d56b7
 
Last edited:
Status
Not open for further replies.