Package com.massivecraft.factions

Examples of com.massivecraft.factions.Rel


  }
 
  public void setRole(Rel role)
  {
    // Clean input
    Rel target = role;
   
    // Detect Nochange
    if (MUtil.equals(this.role, target)) return;
   
    // Apply
View Full Code Here


  {
    // 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());
View Full Code Here

 
  // FINER
 
  public Rel getRelationWish(String factionId)
  {
    Rel ret = this.getRelationWishes().get(factionId);
    if (ret == null) ret = Rel.NEUTRAL;
    return ret;
  }
View Full Code Here

    {
      ret.put(rel, new ArrayList<String>());
    }
    for (Faction faction : FactionColls.get().get(this).getAll())
    {
      Rel relation = faction.getRelationTo(this);
      if (onlyNonNeutral && relation == Rel.NEUTRAL) continue;
      ret.get(relation).add(faction.getName(rp));
    }
    return ret;
  }
View Full Code Here

    }
   
    // Do the sender have the right to change perms for this faction?
    if ( ! FPerm.PERMS.has(usender, faction, true)) return;
   
    Rel rel = this.arg(2, ARRel.get());
    if (rel == null) return;
   
    if (!this.argIsSet(3))
    {
      msg("<b>Should <h>%s <b>have the <h>%s <b>permission or not?\nYou must <h>add \"yes\" or \"no\" <b>at the end.", Txt.getNicedEnum(rel), Txt.getNicedEnum(perm));
View Full Code Here

    return getRelationOfThatToMe(that, me, false);
  }

  public static Rel getRelationOfThatToMe(RelationParticipator that, RelationParticipator me, boolean ignorePeaceful)
  {
    Rel ret = null;
   
    Faction myFaction = getFaction(me);
    if (myFaction == null) return Rel.NEUTRAL; // ERROR

    Faction thatFaction = getFaction(that);
View Full Code Here

        if (notify) fattacker.msg("<i>You can't hurt players who are not currently in a faction.");
        return false;
      }
    }

    Rel relation = defendFaction.getRelationTo(attackFaction);

    // Check the relation
    if (fdefender.hasFaction() && relation.isFriend() && defenderPsFaction.getFlag(FFlag.FRIENDLYFIRE) == false)
    {
      if (notify) fattacker.msg("<i>You can't hurt %s<i>.", relation.getDescPlayerMany());
      return false;
    }

    // You can not hurt neutrals in their own territory.
    boolean ownTerritory = fdefender.isInOwnTerritory();
View Full Code Here

    PS ps = PS.valueOf(player).getChunk(true);
    Faction factionAtPs = BoardColls.get().getFactionAt(ps);
    if (factionAtPs.isNone()) return;
   
    // ... the command may be denied in the territory of this relation type ...
    Rel rel = factionAtPs.getRelationTo(uplayer);
   
    List<String> deniedCommands = UConf.get(player).denyCommandsTerritoryRelation.get(rel);
    if (deniedCommands == null) return;
    if (!containsCommand(command, deniedCommands)) return;
   
View Full Code Here

TOP

Related Classes of com.massivecraft.factions.Rel

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.