Package com.massivecraft.factions.entity

Examples of com.massivecraft.factions.entity.Faction


    if (that == null)
    {
      return "A server admin";
    }
   
    Faction thatFaction = getFaction(that);
    if (thatFaction == null) return "ERROR"; // ERROR

    Faction myFaction = getFaction(me);
//    if (myFaction == null) return thatFaction.getTag(); // no relation, but can show basic name or tag

    if (that instanceof Faction)
    {
      if (me instanceof UPlayer && myFaction == thatFaction)
View Full Code Here


  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);
    if (thatFaction == null) return Rel.NEUTRAL; // ERROR
   
    // The faction with the lowest wish "wins"
    if (thatFaction.getRelationWish(myFaction).isLessThan(myFaction.getRelationWish(thatFaction)))
    {
      ret = thatFaction.getRelationWish(myFaction);
    }
    else
    {
      ret = myFaction.getRelationWish(thatFaction);
    }

    if (myFaction.equals(thatFaction))
    {
      ret = Rel.MEMBER;
      // Do officer and leader check
      //P.p.log("getRelationOfThatToMe the factions are the same for "+that.getClass().getSimpleName()+" and observer "+me.getClass().getSimpleName());
      if (that instanceof UPlayer)
      {
        ret = ((UPlayer)that).getRole();
        //P.p.log("getRelationOfThatToMe it was a player and role is "+ret);
      }
    }
    else if (!ignorePeaceful && (thatFaction.getFlag(FFlag.PEACEFUL) || myFaction.getFlag(FFlag.PEACEFUL)))
    {
      ret = Rel.TRUCE;
    }

    return ret;
View Full Code Here

    return null;
  }

  public static ChatColor getColorOfThatToMe(RelationParticipator that, RelationParticipator me)
  {
    Faction thatFaction = getFaction(that);
    if (thatFaction != null && thatFaction != getFaction(me))
    {
      if (thatFaction.getFlag(FFlag.FRIENDLYFIRE) == true)
      {
        return MConf.get().colorFriendlyFire;
      }
     
      if (thatFaction.getFlag(FFlag.PVP) == false)
      {
        return MConf.get().colorNoPVP;
      }
    }
    return getRelationOfThatToMe(that, me).getColor();
View Full Code Here

  public void perform()
  {
    Double amount = this.arg(0, ARDouble.get());
    if (amount == null) return;
   
    Faction from = this.arg(1, ARFaction.get(sender), usenderFaction);
    if (from == null) return;
   
    UPlayer to = usender;
   
    boolean success = Econ.transferMoney(usender, from, to, amount);

    if (success && MConf.get().logMoneyTransactions)
    {
      Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(from, amount), from.describeTo(null))));
    }
  }
View Full Code Here

    FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newName);
    createEvent.run();
    if (createEvent.isCancelled()) return;
   
    // Apply
    Faction faction = coll.create(factionId);
    faction.setName(newName);
   
    usender.setRole(Rel.LEADER);
    usender.setFaction(faction);
   
    FactionsEventMembershipChange joinEvent = new FactionsEventMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE);
    joinEvent.run();
    // NOTE: join event cannot be cancelled or you'll have an empty faction
   
    // Inform
    for (UPlayer follower : UPlayerColls.get().get(usender).getAllOnline())
    {
      follower.msg("%s<i> created a new faction %s", usender.describeTo(follower, true), faction.getName(follower));
    }
   
    msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());

    if (MConf.get().logFactionCreate)
View Full Code Here

  public void perform()
  {
    Double amount = this.arg(0, ARDouble.get());
    if (amount == null) return;
   
    Faction faction = this.arg(1, ARFaction.get(sender), usenderFaction);
    if (faction == null) return;
   
    boolean success = Econ.transferMoney(usender, usender, faction, amount);
   
    if (success && MConf.get().logMoneyTransactions)
    {
      Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(usender, amount), faction.describeTo(null))));
    }
  }
View Full Code Here

  }
 
  @Override
  public void perform()
  {
    Faction faction = this.arg(0, ARFaction.get(sender), usenderFaction);
    if (faction == null) return;
     
    if (faction != usenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
   
    Econ.sendBalanceInfo(usender, faction);
View Full Code Here

  @Override
  public void perform()
  {
    // Args
    PS chunk = PS.valueOf(me).getChunk(true);
    Faction newFaction = FactionColls.get().get(me).getNone();

    // Apply
    if (usender.tryClaim(newFaction, chunk, true, true)) return;
  }
View Full Code Here

 
  @Override
  public void perform()
  {
    // Args
    Faction faction = usenderFaction;
    Faction newFaction = FactionColls.get().get(faction).getNone();
   
    // FPerm
    if (!FPerm.TERRITORY.has(usender, faction, true)) return;

    // Apply
View Full Code Here

  @Override
  public void perform()
  {
    // Args
    Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
    if (faction == null) return;
   
    // Data precalculation
    UConf uconf = UConf.get(faction);
    //boolean none = faction.isNone();
    boolean normal = faction.isNormal();
   
    // INFO: Title
    msg(Txt.titleize(Txt.upperCaseFirst(faction.getUniverse()) + " Faction " + faction.getName(usender)));
   
    // INFO: Description
    msg("<a>Description: <i>%s", faction.getDescription())
   
    if (normal)
    {
      // INFO: Age
      long ageMillis = faction.getCreatedAtMillis() - System.currentTimeMillis();
      LinkedHashMap<TimeUnit, Long> ageUnitcounts = TimeDiffUtil.limit(TimeDiffUtil.unitcounts(ageMillis, TimeUnit.getAllButMillis()), 3);
      String ageString = TimeDiffUtil.formatedVerboose(ageUnitcounts, "<i>");
      msg("<a>Age: <i>%s", ageString);
     
      // INFO: Open
      msg("<a>Open: <i>"+(faction.isOpen() ? "<lime>Yes<i>, anyone can join" : "<rose>No<i>, only invited people can join"));
 
      // INFO: Power
      double powerBoost = faction.getPowerBoost();
      String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")";
      msg("<a>Land / Power / Maxpower: <i> %d/%d/%d %s", faction.getLandCount(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost);
     
      // show the land value
      if (Econ.isEnabled(faction))
      {
        long landCount = faction.getLandCount();
       
        for (FactionsEventChunkChangeType type : FactionsEventChunkChangeType.values())
        {
          Double money = uconf.econChunkCost.get(type);
          if (money == null) continue;
          if (money == 0D) continue;
          money *= landCount;
         
          String word = null;
          if (money > 0)
          {
            word = "cost";
          }
          else
          {
            word = "reward";
            money *= -1;
          }
         
          msg("<a>Total land %s %s: <i>%s", type.toString().toLowerCase(), word, Money.format(faction, money));
        }
       
        // Show bank contents
        if (UConf.get(faction).bankEnabled)
        {
          msg("<a>Bank contains: <i>"+Money.format(faction, Money.get(faction)));
        }
      }
     
      // Display important flags
      // TODO: Find the non default flags, and display them instead.
      if (faction.getFlag(FFlag.PERMANENT))
      {
        msg("<a>This faction is permanent - remaining even with no followers.");
      }
     
      if (faction.getFlag(FFlag.PEACEFUL))
      {
        msg("<a>This faction is peaceful - in truce with everyone.");
      }
    }
   
    String sepparator = Txt.parse("<i>")+", ";
   
    // List the relations to other factions
    Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(usender, true);
   
    if (faction.getFlag(FFlag.PEACEFUL))
    {
      sendMessage(Txt.parse("<a>In Truce with:<i> *everyone*"));
    }
    else
    {
      sendMessage(Txt.parse("<a>In Truce with: ") + Txt.implode(relationNames.get(Rel.TRUCE), sepparator));
    }
   
    sendMessage(Txt.parse("<a>Allies: ") + Txt.implode(relationNames.get(Rel.ALLY), sepparator));
    sendMessage(Txt.parse("<a>Enemies: ") + Txt.implode(relationNames.get(Rel.ENEMY), sepparator));
   
    // List the followers...
    List<String> followerNamesOnline = new ArrayList<String>();
    List<String> followerNamesOffline = new ArrayList<String>();
   
    List<UPlayer> followers = faction.getUPlayers();
    Collections.sort(followers, PlayerRoleComparator.get());
   
    for (UPlayer follower : followers)
    {
      if (follower.isOnline() && Mixin.canSee(sender, follower.getId()))
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.