Some Factions API questions.

Discussion in 'Plugin Development' started by hellobrad100, Feb 6, 2015.

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

    hellobrad100

    Hello,

    I have been looking into the factions API and have made something that works, which is great, however it need to only work for enemy or neutral territory.

    Does anyone have any idea how to check the land for Enemy or Neutral territory? I can't seem to be able to find it. I have been looking on the MassiveCraft website, and been making this following their guide on development.

    Here is my code so far, but if any knows how to get Enemy / neutral land, I will be grateful.

    Code:
        @EventHandler
        public void onCmd(PlayerTeleportEvent e)
        {
            Player p = e.getPlayer();
            MPlayer mp = MPlayer.get(p);
            Location l = e.getTo();
            Faction tofac = BoardColl.get().getFactionAt(PS.valueOf(l));
            String fromfac = mp.getFaction().getName();
            String name = tofac.getName();
            if(p.isOp() || p.hasPermission("essentials.kick")) return;
            if(!(name == FactionColl.get().getWarzone().getName()) && !(name == FactionColl.get().getSafezone().getName()) && !(name == FactionColl.get().getNone().getName()))
            {
                if(!name.equals(fromfac))
                {
                    e.setCancelled(true);
                    p.sendMessage("Yolo");   
                }
            }
        }
    Thanks, Brad.
     
Thread Status:
Not open for further replies.

Share This Page