Hooking Into Towny

Discussion in 'Plugin Development' started by Taien, Feb 8, 2013.

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

    Taien

    I'm attempting to make TreasureHunt capable of detecting whether a potential chest location is within a towny block. I'm looking for confirmation that this is all I have to do to do that (once I've acquired the Towny plugin during onEnable, of course):

    Code:
    if (TreasureHunt.towny != null)
    {
        if (TownyUniverse.getTownBlock(target.getLocation()).getType() != TownBlockType.WILDS) continue;
    }
    Anyone know if this is right? I'm going to end up testing it but I have some other things to do first so just looking for confirmation.

    P.S. the 'continue' is due to the chest search being run in a for loop, essentially searching for another location if the town block isn't wilds. basically I'm asking if I have to acquire the TownyUniverse anywhere.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
Thread Status:
Not open for further replies.

Share This Page