Skip to content

Commit

Permalink
Add methods to dNPC and dPlayer to see if the links contained are val…
Browse files Browse the repository at this point in the history
…id with Bukkit/Citizens.
  • Loading branch information
aufdemrand committed Jul 2, 2013
1 parent 8f230c8 commit 165fc99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dNPC.java
Expand Up @@ -71,10 +71,12 @@ public static boolean matches(String string) {
return false;
}


public boolean isValid() {
if (getCitizen() == null) return false;
else return true;
}

private int npcid = -1;
private boolean is_valid = true;
private final org.bukkit.Location locationCache = new org.bukkit.Location(null, 0, 0, 0);

public dNPC(NPC citizensNPC) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -103,6 +103,11 @@ public dPlayer(OfflinePlayer player) {

String player_name;

public boolean isValid() {
if (getPlayerEntity() == null && getOfflinePlayer() == null) return true;
return false;
}

public Player getPlayerEntity() {
return Bukkit.getPlayer(player_name);
}
Expand Down

0 comments on commit 165fc99

Please sign in to comment.