Factions teleport help

Discussion in 'Plugin Development' started by CullanP, Jul 14, 2014.

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

    CullanP

    Hi everyone, I'm trying to use the factions 1.6.8 API to create a method that will block using /back to go into any territory other then their own when teleporting, but I haven't got the clue how to fetch the coords of the territory they're teleporting into.
     
  2. CullanP
    I'd assume you are talking about Essentials' back command, in which case you would need to hook to Essentials too, using something along the lines of
    Code:
    private Essentials essentials;
     
    public void onEnable() {
        setupEssentials();
    }
     
    private void setupEssentials() {
        Plugin essentialsPlugin = Bukkit.getPluginManager().getPlugin("Essentials");
     
        if (essentialsPlugin.isEnabled() && (essentialsPlugin instanceof Essentials)) {
                this.essentials = (Essentials) essentialsPlugin;
        }
    }
    Then get the User object by using
    Code:
    User user = essentials.getUser(thePlayer);
    Then use the User#getLastLocation() method to get the location they would /back to.
    Code:
    Location back = user.getLastLocation();
     
    if(back != null) {
        // Check if 'back' is inside anyone's territory
    }
     
  3. Offline

    fireblast709

    CullanP create a new FLocation, and use Board.getFactionAt()
     
    CullanP likes this.
  4. Offline

    CullanP

    Thank you all for the help! I have managed to block it :)
     
Thread Status:
Not open for further replies.

Share This Page