Skip to content

Commit

Permalink
Add <player.location.block> and <npc.location.block> tags for getting…
Browse files Browse the repository at this point in the history
… int coordinates for locations.
  • Loading branch information
davidcernat committed Mar 15, 2013
1 parent 72b1135 commit 4267b8d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
24 changes: 13 additions & 11 deletions src/main/java/net/aufdemrand/denizen/tags/core/LocationTags.java
Expand Up @@ -52,6 +52,19 @@ else if (subType.equals("TEMPERATURE"))
event.setReplaced(fromLocation.getBlock().getBiome().name());
}

else if (type.equals("BLOCK"))
{
if (subType.equals("BELOW"))
{
fromLocation = new Location(fromLocation.add(0, -1, 0));
}

else if (subType.equals("MATERIAL") || specifier.equals("MATERIAL"))
{
event.setReplaced(fromLocation.getBlock().getType().toString());
}
}

else if (type.equals("DIRECTION"))
{
if (fromLocation != null && toLocation != null)
Expand Down Expand Up @@ -146,17 +159,6 @@ else if (type.equals("Y"))
else if (type.equals("Z"))
event.setReplaced(String.valueOf(fromLocation.getZ()));

else if (type.equals("BLOCK")) {
if (subType.equals("BELOW")) {
fromLocation = new Location(fromLocation.add(0, -1, 0));
}

if (subType.equals("MATERIAL") || specifier.equals("MATERIAL")) {
event.setReplaced(fromLocation.getBlock().getType().toString());
}
}
}



}
7 changes: 6 additions & 1 deletion src/main/java/net/aufdemrand/denizen/tags/core/NPCTags.java
Expand Up @@ -67,7 +67,12 @@ public void npcTags(ReplaceableTagEvent event) {
+ "," + loc.getY()
+ "," + loc.getZ()
+ "," + n.getWorld().getName());
if (subType.equals("FORMATTED"))
if (subType.equals("BLOCK"))
event.setReplaced(loc.getBlockX()
+ "," + loc.getBlockY()
+ "," + loc.getBlockZ()
+ "," + n.getWorld().getName());
else if (subType.equals("FORMATTED"))
event.setReplaced("X '" + loc.getX()
+ "', Y '" + loc.getY()
+ "', Z '" + loc.getZ()
Expand Down
Expand Up @@ -265,7 +265,12 @@ else if (subType.equalsIgnoreCase("LIST"))
+ "," + p.getLocation().getY()
+ "," + p.getLocation().getZ()
+ "," + p.getWorld().getName());
if (subType.equalsIgnoreCase("FORMATTED"))
if (subType.equalsIgnoreCase("BLOCK"))
event.setReplaced(p.getLocation().getBlockX()
+ "," + p.getLocation().getBlockY()
+ "," + p.getLocation().getBlockZ()
+ "," + p.getWorld().getName());
else if (subType.equalsIgnoreCase("FORMATTED"))
event.setReplaced("X '" + p.getLocation().getX()
+ "', Y '" + p.getLocation().getY()
+ "', Z '" + p.getLocation().getZ()
Expand Down

0 comments on commit 4267b8d

Please sign in to comment.