Skip to content

Commit

Permalink
Add <player.region[name]> tag that checks whether or not a player is …
Browse files Browse the repository at this point in the history
…in a certain WorldGuard region.
  • Loading branch information
davidcernat committed Jun 26, 2013
1 parent 1562e84 commit d873c27
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import net.aufdemrand.denizen.tags.core.PlayerTags;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizen.utilities.depends.Depends;
import net.aufdemrand.denizen.utilities.depends.WorldGuardUtilities;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
Expand Down Expand Up @@ -337,6 +339,18 @@ else if ((float) getPlayerEntity().getFoodLevel() / maxHunger < 1)
return new Element(String.valueOf(Depends.permissions.playerInGroup(getPlayerEntity(), group)))
.getAttribute(attribute.fulfill(1));
}

if (attribute.startsWith("region")) {
if (Depends.worldGuard == null) {
dB.echoError("Cannot check region! WorldGuard is not loaded!");
return null;
}

String region = attribute.getContext(1);

return new Element(String.valueOf(WorldGuardUtilities.checkPlayerWGRegion(getPlayerEntity(), region)))
.getAttribute(attribute.fulfill(1));
}

if (attribute.startsWith("is_flying"))
return new Element(String.valueOf(getPlayerEntity().isFlying()))
Expand Down

0 comments on commit d873c27

Please sign in to comment.