Package com.massivecraft.factions.entity

Examples of com.massivecraft.factions.entity.Faction


   
    // Check Disabled
    if (UConf.isDisabled(entity)) return;
 
    // ... and the faction there has explosions disabled ...
    Faction faction = BoardColls.get().getFactionAt(PS.valueOf(entity));
    if (faction.getFlag(FFlag.EXPLOSIONS)) return;
   
    // ... then cancel.
    event.setCancelled(true);
  }
View Full Code Here


    // Individually check the flag state for each block
    Iterator<Block> iter = event.blockList().iterator();
    while (iter.hasNext())
    {
      Block block = iter.next();
      Faction faction = BoardColls.get().getFactionAt(PS.valueOf(block));
      if (faction.getFlag(FFlag.EXPLOSIONS) == false) iter.remove();
    }
  }
View Full Code Here

    // Check Disabled
    if (UConf.isDisabled(entity)) return;

    // ... and the faction there has explosions disabled ...
    PS ps = PS.valueOf(event.getBlock());
    Faction faction = BoardColls.get().getFactionAt(ps);
    if (faction.getFlag(FFlag.EXPLOSIONS)) return;
   
    // ... stop the block alteration.
    event.setCancelled(true);
  }
View Full Code Here

    // Check Disabled
    if (UConf.isDisabled(entity)) return;
   
    // ... and the faction there has endergrief disabled ...
    PS ps = PS.valueOf(event.getBlock());
    Faction faction = BoardColls.get().getFactionAt(ps);
    if (faction.getFlag(FFlag.ENDERGRIEF)) return;
   
    // ... stop the block alteration.
    event.setCancelled(true);
  }
View Full Code Here

    // Check Disabled
    if (UConf.isDisabled(block)) return;
   
    // If the faction at the block has firespread disabled ...
    PS ps = PS.valueOf(block);
    Faction faction = BoardColls.get().getFactionAt(ps);
     
    if (faction.getFlag(FFlag.FIRESPREAD)) return;
   
    // then cancel the event.
    cancellable.setCancelled(true);
  }
View Full Code Here

    if (!FPerm.BUILD.has(uplayer, ps, false) && FPerm.PAINBUILD.has(uplayer, ps, false))
    {
      if (verboose)
      {
        Faction hostFaction = BoardColls.get().getFactionAt(ps);
        uplayer.msg("<b>It is painful to build in the territory of %s<b>.", hostFaction.describeTo(uplayer));
        player.damage(UConf.get(player).actionDeniedPainAmount);
      }
      return true;
    }
   
View Full Code Here

  @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
  public void blockBuild(BlockPistonExtendEvent event)
  {
    Block block = event.getBlock();

    Faction pistonFaction = BoardColls.get().getFactionAt(PS.valueOf(block));

    // target end-of-the-line empty (air) block which is being pushed into, including if piston itself would extend into air
    Block targetBlock = block.getRelative(event.getDirection(), event.getLength() + 1);

    // members of faction might not have build rights in their own territory, but pistons should still work regardless; so, address that corner case
    Faction targetFaction = BoardColls.get().getFactionAt(PS.valueOf(targetBlock));
    if (targetFaction == pistonFaction) return;

    // if potentially pushing into air/water/lava in another territory, we need to check it out
    if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && ! FPerm.BUILD.has(pistonFaction, targetFaction))
    {
View Full Code Here

    PS retractPs = PS.valueOf(retractBlock);

    // if potentially retracted block is just air/water/lava, no worries
    if (retractBlock.isEmpty() || retractBlock.isLiquid()) return;

    Faction pistonFaction = BoardColls.get().getFactionAt(PS.valueOf(event.getBlock()));

    // members of faction might not have build rights in their own territory, but pistons should still work regardless; so, address that corner case
    Faction targetFaction = BoardColls.get().getFactionAt(retractPs);
    if (targetFaction == pistonFaction) return;

    if (!FPerm.BUILD.has(pistonFaction, targetFaction))
    {
      event.setCancelled(true);
View Full Code Here

 
  @Override
  public void perform()
  {
    // Args
    Faction otherFaction = this.arg(0, ARFaction.get(sender));
    if (otherFaction == null) return;
   
    Rel newRelation = targetRelation;
   
    /*if ( ! them.isNormal())
    {
      msg("<b>Nope! You can't.");
      return;
    }*/
   
    // Verify
   
    if (otherFaction == usenderFaction)
    {
      msg("<b>Nope! You can't declare a relation to yourself :)");
      return;
    }

    if (usenderFaction.getRelationWish(otherFaction) == newRelation)
    {
      msg("<b>You already have that relation wish set with %s.", otherFaction.getName());
      return;
    }
   
    // Event
    FactionsEventRelationChange event = new FactionsEventRelationChange(sender, usenderFaction, otherFaction, newRelation);
    event.run();
    if (event.isCancelled()) return;
    newRelation = event.getNewRelation();

    // try to set the new relation
    usenderFaction.setRelationWish(otherFaction, newRelation);
    Rel currentRelation = usenderFaction.getRelationTo(otherFaction, true);

    // if the relation change was successful
    if (newRelation == currentRelation)
    {
      otherFaction.msg("%s<i> is now %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne());
      usenderFaction.msg("%s<i> is now %s.", otherFaction.describeTo(usenderFaction, true), newRelation.getDescFactionOne());
    }
    // inform the other faction of your request
    else
    {
      otherFaction.msg("%s<i> wishes to be %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
      otherFaction.msg("<i>Type <c>/"+ConfServer.baseCommandAliases.get(0)+" "+newRelation+" "+usenderFaction.getName()+"<i> to accept.");
      usenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(usenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
    }
   
    // TODO: The ally case should work!!
    //   * this might have to be bumped up to make that happen, & allow ALLY,NEUTRAL only
    if ( newRelation != Rel.TRUCE && otherFaction.getFlag(FFlag.PEACEFUL))
    {
      otherFaction.msg("<i>This will have no effect while your faction is peaceful.");
      usenderFaction.msg("<i>This will have no effect while their faction is peaceful.");
    }
   
    if ( newRelation != Rel.TRUCE && usenderFaction.getFlag(FFlag.PEACEFUL))
    {
      otherFaction.msg("<i>This will have no effect while their faction is peaceful.");
      usenderFaction.msg("<i>This will have no effect while your faction is peaceful.");
    }
  }
View Full Code Here

 
    // Args
    Integer radius = this.arg(0, ARInteger.get(), 1);
    if (radius == null) return;
   
    final Faction forFaction = this.arg(1, ARFaction.get(me), usenderFaction);
    if (forFaction == null) return;
   
    // FPerm
    if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
   
    // Validate
    if (radius < 1)
    {
      msg("<b>If you specify a radius, it must be at least 1.");
View Full Code Here

TOP

Related Classes of com.massivecraft.factions.entity.Faction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.