Is there a Factions API? I can't find the awnser in google.

Discussion in 'Plugin Development' started by BeastCraft3, Jan 12, 2015.

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

    BeastCraft3

    Greetings, I'm wondering if there is an factions api and if it is, basic instructions?
     
  2. Offline

    xTigerRebornx

  3. Offline

    Skionz

    @BeastCraft3 I googled it and found the answer almost instantly.
     
  4. Offline

    BeastCraft3

    @Skionz @xTigerRebornx
    Basicly i'm wondering if this is possible in the api.
    I'm going to make a plugin which use world edit and factions api which allow me to claim war and safe zones in Regions.

    it's possible right?
     
  5. Offline

    Skionz

    @BeastCraft3 I doubt it since Factions protects chunks.
     
  6. Offline

    BeastCraft3

    @Skionz
    It doesn't hurt to try. and I've seen other servers claiming zone's without chuncks.
    I just need to find out how to set a war or safe zone. I seriously can't find it anywhere.

    my code so far:
    Code:
    package me.BeastCraft3.FactionsCustom;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import com.massivecraft.factions.entity.Faction;
    import com.massivecraft.factions.entity.FactionColl;
    import com.sk89q.worldedit.bukkit.WorldEditPlugin;
    import com.sk89q.worldedit.bukkit.selections.Selection;
    
    public class Main extends JavaPlugin{
       
        private Selection s;
        Faction faction = null;
       
        public void onEnable() {
           
        }
       
        public void onDisable() {
           
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if(!(sender instanceof Player)) {
                sender.sendMessage("§chmm, Only players are suppose to use this command. Ha noob! ;) From Beast");
                return true;
            }
            Player p = (Player) sender;
            if (cmd.getName().equalsIgnoreCase("claim")) {
                faction = FactionColl.get().getSafezone();
                faction = FactionColl.get().getWarzone();
                if(args.length < 1) {
                    p.sendMessage("§4Error: §ctry /claim (safezone/warzone)");
                } else if(args.length <= 1) {
                    if(args[0].equalsIgnoreCase("safezone")) {
                        s = getWorldEdit().getSelection(p);
                        if (s == null) {
                            sender.sendMessage(ChatColor.RED + "Make a selection!");
                            return true;
                        }
                        //set Safezone
                        sender.sendMessage(ChatColor.GREEN + "Set Safezone!");
                    } else if(args[0].equalsIgnoreCase("warzone")) {
                        s = getWorldEdit().getSelection(p);
                        if (s == null) {
                            sender.sendMessage(ChatColor.RED + "Make a selection!");
                            return true;
                        }
                        //Set warzone
                        sender.sendMessage(ChatColor.GREEN + "Set Warzone!");
                    }
                }
            }
           
           
            return false;
           
        }
       
        public WorldEditPlugin getWorldEdit() {
            Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
            if (p instanceof WorldEditPlugin) return (WorldEditPlugin) p;
            else return null;
    }
    
    }
    
     
  7. Offline

    _Cookie_

    The fact of the matter is, that factions save the chunk in say a format like ChunkX:ChunkZ, and that format goes throughout the plugin with, Walking through chunks to see if they're claimed, Interacting with a chunk that is claimed. Same with war zones and safe zones, it would be coded throughout the plugin, and I don't thin you will be able to change it that easily..

    But go ahead if you want to try, I would like to see someone be able to do this, even though I doubt it can be done..
     
  8. Offline

    BeastCraft3

    Anyone know the factions api and can tell me what I should type to create a safezone?
     
  9. Offline

    Coopah

    @BeastCraft3
    Why exactly do you want to claim a safezone/warzone over a worldguard region?
     
  10. Offline

    BeastCraft3

    @Coopah
    Cause I didn't build my spawn after chuncks....
     
  11. Offline

    SuperOriginal

    @BeastCraft3 Just claim everything warzone, then make a world guard region that holds your spawn, then just add the flags that make the player invincible, prevent mob spawning, ect
     
Thread Status:
Not open for further replies.

Share This Page