How To Check If A Player Is In A SafeZone(Factions)

Discussion in 'Plugin Development' started by Vandrake, Oct 7, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Vandrake

    My way to check if a player is in a Safezone(From Factions)
    I thought of making this because I was having trouble discovering how it was made. So for future the future plugin developers who want to find out if a player is in a safezone: Here's a tiny tutorial.​
    Code:
    BoardColls.get().getFactionAt(PS.valueOf(Player.getLocation())).getName()
    
    This will return the name of the faction
    Usually Wilderness, SafeZone and WarZone. Just do a equalsIgnoreCase. The old method no longer works so I edited this
     
  2. Offline

    messageofdeath

    or

    PHP:
    FLocation loc = new FLocation(player.getLocation());
    if(
    Board.getFactionAt(loc).isWarZone() == true) {
     
    }
     
    //or for SafeZone its
    if(Board.getFactionAt(log).isSafeZone() == true) {
     
    }
     
  3. Offline

    Vandrake

    see. I googled for an hour or roughly 1 hour and 20 but still couldnt find this! So I went to factions source code and looked for it. lol xD Now I have 2 ways of checking it. FML...well at least for new people this might be useful
     
  4. Offline

    messageofdeath

    yep I was one that had to go through the code due to no api. Check out the plugin i used it for. Click the GameModeChanger button in my signature. You can look at the source from there by hitting the github.
     
  5. Offline

    TnT

    Moved to the Resources forum.
     
  6. Offline

    Vandrake

    Thank you very much Admin :3 I meant to post it there xD After I posted it here I was like omg o.o How do I move this?XD Thank you very much
     
  7. Offline

    TnT

    You're welcome forum member.
     
    hawkfalcon likes this.
  8. Offline

    Vandrake

    Uhhhh the irony hurts xD Sorry, TNT <<<<<<
     
  9. Offline

    waco001

    Do I need to include the factions.jar in the build path? Srry Im kind of n00bish
     
  10. Offline

    Vandrake

    yes ofcourse
     
  11. Offline

    waco001

    What is the (log) part for? is it a variable?
     
  12. Offline

    messageofdeath

    as quoted in your post the (loc) is for the location of the block.

    Like this line:
    FLocation loc = new FLocation(player.getLocation());
    this is the param
    then you put that location there in the ()
    if(Board.getFactionAt(loc).isWarZone() == true) {
     
  13. Offline

    waco001

    Oh, thank you! This may help me greatly :)
     
Thread Status:
Not open for further replies.

Share This Page