Factions API Implementation problem.

Discussion in 'Plugin Development' started by vasil7112, Oct 28, 2013.

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

    vasil7112

    Hey there developers,

    I was having some problems implementing factions API to my plugin. A user reported the following bug to me. So as result i had to fix it. I checked the MassiveCraft Factions API to see how to implement it. So i did follow the implementation description but i had a small problem. The implementation says only how to depend on the plugin, but i want to <SoftDepend> on it. I don't want to force my users to use Factions, but i want to make sure that if they are using Factions, they won't face that bug. So, is there any way to check if factions is enabled and then check if the player is on a faction territory not of his own?

    While implementing WorldEdit, i could simply do this:

    Code:java
    1. private void setupWorldGuard() {
    2. Plugin wg = this.getServer().getPluginManager().getPlugin("WorldGuard");
    3. if(wg == null) {
    4. getLogger().info("WorldGuard was not found. Did you know that by using it, players won't be able to place tents on protected areas?");
    5. }else{
    6. worldguardPlugin = (WorldGuardPlugin)wg;
    7. }
    8. }

    Code:java
    1. if(PortableTent.worldguardPlugin !=null){
    2. if(!PortableTent.worldguardPlugin.canBuild(player, new Location(player.getWorld(), ploc.getBlockX() + a, ploc.getBlockY() + b - 1, ploc.getBlockZ() + i))){
    3. return false;
    4. }
    5. }


    But since this option seems not to work on this plugin, should i make a factions.class, check if the factions plugin exist(this.getServer().getPluginManager().getPlugin("Factions") != null), and if it exist, run the code from factions.class ?

    Kind regards
     
Thread Status:
Not open for further replies.

Share This Page