Package com.massivecraft.factions.entity

Examples of com.massivecraft.factions.entity.Faction


  @Override
  public void innerPerform()
  {
    // Args
    Faction faction = this.arg(0, ARFaction.get(usender));
    if (faction == null) return;
   
    Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isFactionIdGranted(faction.getId()));
    if (newValue == null) return;
   
    // FPerm
    if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
   
    // Apply
    ta = ta.withFactionId(faction.getId(), newValue);
    BoardColls.get().setTerritoryAccessAt(chunk, ta);
   
    // Inform
    this.sendAccessInfo();
  }
View Full Code Here


 
  @Override
  public void perform()
  {
    // Args
    Faction faction = this.arg(0, ARFaction.get(usenderFaction), usenderFaction);
    if (faction == null) return;
   
    PS newHome = PS.valueOf(me.getLocation());
   
    // Validate
    if ( ! UConf.get(faction).homesEnabled)
    {
      usender.msg("<b>Sorry, Faction homes are disabled on this server.");
      return;
    }
   
    // FPerm
    if ( ! FPerm.SETHOME.has(usender, faction, true)) return;
   
    // Verify
    if (!usender.isUsingAdminMode() && !faction.isValidHome(newHome))
    {
      usender.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");
      return;
    }
   
    // Event
    FactionsEventHomeChange event = new FactionsEventHomeChange(sender, faction, newHome);
    event.run();
    if (event.isCancelled()) return;
    newHome = event.getNewHome();

    // Apply
    faction.setHome(newHome);
   
    // Inform
    faction.msg("%s<i> set the home for your faction. You can now use:", usender.describeTo(usenderFaction, true));
    faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
    if (faction != usenderFaction)
    {
      usender.msg("<b>You have set the home for the "+faction.getName(usender)+"<i> faction.");
    }
  }
View Full Code Here

 
  @Override
  public void perform()
  { 
    // Args
    Faction faction = this.arg(0, ARFaction.get(usender), usenderFaction);
    if (faction == null) return;
   
    // FPerm
    if ( ! FPerm.DISBAND.has(usender, faction, true)) return;

    // Verify
    if (faction.getFlag(FFlag.PERMANENT))
    {
      msg("<i>This faction is designated as permanent, so you cannot disband it.");
      return;
    }

    // Event
    FactionsEventDisband event = new FactionsEventDisband(me, faction);
    event.run();
    if (event.isCancelled()) return;

    // Merged Apply and Inform
   
    // Run event for each player in the faction
    for (UPlayer uplayer : faction.getUPlayers())
    {
      FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, uplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND);
      membershipChangeEvent.run();
    }

    // Inform all players
    for (UPlayer uplayer : UPlayerColls.get().get(usender).getAllOnline())
    {
      String who = usender.describeTo(uplayer);
      if (uplayer.getFaction() == faction)
      {
        uplayer.msg("<h>%s<i> disbanded your faction.", who);
      }
      else
      {
        uplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getName(uplayer));
      }
    }
   
    if (MConf.get().logFactionDisband)
    {
      Factions.get().log(Txt.parse("<i>The faction <h>%s <i>(<h>%s<i>) was disbanded by <h>%s<i>.", faction.getName(), faction.getId(), usender.getDisplayName()));
    }   
   
    faction.detach();
  }
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));
    if (from == null) return;
   
    UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
    if (to == null) return;
   
    boolean success = Econ.transferMoney(usender, from, to, amount);

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

    if (UConf.isDisabled(player)) return;
   
    UPlayer uplayer = UPlayer.get(player);
   
    // ... and powerloss can happen here ...
    Faction faction = BoardColls.get().getFactionAt(PS.valueOf(player));
   
    if (!faction.getFlag(FFlag.POWERLOSS))
    {
      uplayer.msg("<i>You didn't lose any power since the territory you died in works that way.");
      return;
    }
   
View Full Code Here

 
  @Override
  public void perform()
  {
    // Args
    Faction faction = this.arg(0, ARFaction.get(sender));
    if (faction == null) return;

    UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender), usender);
    if (uplayer == null) return;
    Faction uplayerFaction = uplayer.getFaction();
   
    boolean samePlayer = uplayer == usender;
   
    // Validate
    if (!samePlayer  && ! Perm.JOIN_OTHERS.has(sender, false))
    {
      msg("<b>You do not have permission to move other players into a faction.");
      return;
    }

    if (faction == uplayerFaction)
    {
      msg("<i>%s <i>%s already a member of %s<i>.", uplayer.describeTo(usender, true), (samePlayer ? "are" : "is"), faction.getName(usender));
      return;
    }

    if (UConf.get(faction).factionMemberLimit > 0 && faction.getUPlayers().size() >= UConf.get(faction).factionMemberLimit)
    {
      msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), UConf.get(faction).factionMemberLimit, uplayer.describeTo(usender, false));
      return;
    }

    if (uplayerFaction.isNormal())
    {
      msg("<b>%s must leave %s current faction first.", uplayer.describeTo(usender, true), (samePlayer ? "your" : "their"));
      return;
    }
View Full Code Here

    }
    if (eattacker.equals(edefender)) return true;
   
    // ... gather defender PS and faction information ...
    PS defenderPs = PS.valueOf(defender);
    Faction defenderPsFaction = BoardColls.get().getFactionAt(defenderPs);
   
    // ... PVP flag may cause a damage block ...
    if (defenderPsFaction.getFlag(FFlag.PVP) == false)
    {
      if (eattacker instanceof Player)
      {
        if (notify)
        {
          UPlayer attacker = UPlayer.get(eattacker);
          attacker.msg("<i>PVP is disabled in %s.", defenderPsFaction.describeTo(attacker));
        }
        return false;
      }
      return defenderPsFaction.getFlag(FFlag.MONSTERS);
    }

    // ... and if the attacker is a player ...
    if (!(eattacker instanceof Player)) return true;
    Player attacker = (Player)eattacker;
    UPlayer fattacker = UPlayer.get(attacker);
   
    // ... does this player bypass all protection? ...
    if (MConf.get().playersWhoBypassAllProtection.contains(attacker.getName())) return true;

    // ... gather attacker PS and faction information ...
    PS attackerPs = PS.valueOf(attacker);
    Faction attackerPsFaction = BoardColls.get().getFactionAt(attackerPs);

    // ... PVP flag may cause a damage block ...
    // (just checking the defender as above isn't enough. What about the attacker? It could be in a no-pvp area)
    // NOTE: This check is probably not that important but we could keep it anyways.
    if (attackerPsFaction.getFlag(FFlag.PVP) == false)
    {
      if (notify) fattacker.msg("<i>PVP is disabled in %s.", attackerPsFaction.describeTo(fattacker));
      return false;
    }

    // ... are PVP rules completely ignored in this world? ...
    if (MConf.get().worldsIgnorePvP.contains(defenderPs.getWorld())) return true;

    Faction defendFaction = fdefender.getFaction();
    Faction attackFaction = fattacker.getFaction();
    UConf uconf = UConf.get(attackFaction);

    if (attackFaction.isNone() && uconf.disablePVPForFactionlessPlayers)
    {
      if (notify) fattacker.msg("<i>You can't hurt other players until you join a faction.");
      return false;
    }
    else if (defendFaction.isNone())
View Full Code Here

      return;
    }
   
    // ... if there is a faction at the players location ...
    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

    // Check Disabled
    if (UConf.isDisabled(event.getLocation())) return;
   
    // ... at a place where monsters are forbidden ...
    PS ps = PS.valueOf(event.getLocation());
    Faction faction = BoardColls.get().getFactionAt(ps);
    if (faction.getFlag(FFlag.MONSTERS)) return;
   
    // ... block the spawn.
    event.setCancelled(true);
  }
View Full Code Here

    // Check Disabled
    if (UConf.isDisabled(target)) return;
   
    // ... at a place where monsters are forbidden ...
    PS ps = PS.valueOf(target);
    Faction faction = BoardColls.get().getFactionAt(ps);
    if (faction.getFlag(FFlag.MONSTERS)) return;
   
    // ... then if ghast target nothing ...
    if (event.getEntityType() == EntityType.GHAST)
    {
      event.setTarget(null);
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.