PlaceholderAPI with 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!

MrBenjaroo

Member
Aug 20, 2024
1
0
1
So, I am trying to make a certain command with skript in WorldGuard. If the flag is allowed, deny it. If the flag is denied, allow it. It is a quick way to swap values over, as WorldGuard doesn't have a toggle feature. This is my buggy code:
command /toggleflag <text>:
permission: skript.command.toggleflag
trigger:
# Set the flag based on the argument
set {_flag} to arg-1

# Retrieve the placeholder value directly
set {_flagValue} to "%worldguard_region_has_flag_{_flag}%"

# Debugging output
send "Resolved placeholder value: %{_flagValue}%"

# Check if the value is 'yes'
if {worldguard::worldguard_region_has_flag_pvp} is "yes":
execute console command "/rg flag event %{_flag}% deny"
send "Flag %{_flag}% is set to 'allow' and changed to 'deny'."
else if {worldguard::worldguard_region_has_flag_pvp} is "no":
execute console command "/rg flag event %{_flag}% allow"
send "Flag %{_flag}% is set to 'deny' and changed to 'allow'."
else:
send "Flag %{_flag}% is either 'null' or not recognized."

My issues are as follows:

When reloading this script, it comes up with:

Line 8:
Region "%worldguard_region_has_flag_{_flag}%" could not be found

When executing the command:

Resolved placeholder value: <none>
Flag event is either 'null' or not recognised.

Server version: 1.20.4
I have: WorldGuard, PlaceholderAPI, Skript (and others but they don't matter in this situation)

These plugins are all used massively so replacing is not an option

Please help!