Esempio n. 1
0
  public boolean validateCall() {
    if (this.senderMustBePlayer && !(sender instanceof Player)) {
      sendMessage("This command can only be used by ingame players.");
      return false;
    }

    if (!hasPermission(sender)) {
      sendMessage("You lack the permissions to " + this.helpDescription.toLowerCase() + ".");
      return false;
    }

    // make sure player doesn't have their access to the command revoked
    Iterator<String> iter = aliases.iterator();
    while (iter.hasNext()) {
      if (Factions.isCommandDisabled(sender, iter.next())) {
        sendMessage("You lack the permissions to " + this.helpDescription.toLowerCase() + ".");
        return false;
      }
    }

    if (parameters.size() < requiredParameters.size()) {
      sendMessage("Usage: " + this.getUseageTemplate(false));
      return false;
    }

    return true;
  }
 @Override
 public void perform() {
   Factions.get()
       .getOuterCmdFactions()
       .cmdFactionsRank
       .execute(sender, MUtil.list(this.arg(0), this.rankName, this.arg(1)));
 }
  @Override
  public void perform() {
    Double amount = this.arg(0, ARDouble.get());
    if (amount == null) return;

    UPlayer from = this.arg(1, ARUPlayer.getStartAny(sender));
    if (from == null) return;

    Faction to = this.arg(2, ARFaction.get(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 player \"%s\" to the faction \"%s\"",
                      usender.getName(),
                      Money.format(amount),
                      from.describeTo(null),
                      to.describeTo(null))));
    }
  }
Esempio n. 4
0
  @Override
  public synchronized void loadFromRemoteFixed(String id, Entry<JsonObject, Long> remoteEntry) {
    if (!Factions.get().isDatabaseInitialized()) {
      super.loadFromRemoteFixed(id, remoteEntry);
      return;
    }

    MPlayer mplayer = null;

    // Before
    String beforeId = null;
    if (mplayer == null) mplayer = this.id2entity.get(id);
    if (mplayer != null) beforeId = mplayer.getFactionId();

    // Super
    super.loadFromRemoteFixed(id, remoteEntry);

    // After
    String afterId = null;
    if (mplayer == null) mplayer = this.id2entity.get(id);
    if (mplayer != null) afterId = mplayer.getFactionId();

    // Perform
    if (mplayer != null) mplayer.updateFactionIndexes(beforeId, afterId);
  }
  public boolean canPlayerUseBlock(Player player, Block block) {

    if (Conf.adminBypassPlayers.contains(player.getName())) {
      return true;
    }

    Material material = block.getType();
    FLocation loc = new FLocation(block);
    Faction otherFaction = Board.getFactionAt(loc);

    // no door/chest/whatever protection in wilderness, war zones, or safe zones
    if (!otherFaction.isNormal()) {
      return true;
    }

    // We only care about some material types.
    if (otherFaction.hasPlayersOnline()) {
      if (!Conf.territoryProtectedMaterials.contains(material)) {
        return true;
      }
    } else {
      if (!Conf.territoryProtectedMaterialsWhenOffline.contains(material)) {
        return true;
      }
    }

    FPlayer me = FPlayer.get(player);
    Faction myFaction = me.getFaction();
    Relation rel = myFaction.getRelation(otherFaction);
    boolean ownershipFail =
        Conf.ownedAreasEnabled
            && Conf.ownedAreaProtectMaterials
            && !otherFaction.playerHasOwnershipRights(me, loc);

    // You may use any block unless it is another faction's territory...
    if (rel.isNeutral()
        || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials)
        || (rel.isAlly() && Conf.territoryAllyProtectMaterials)) {
      me.sendMessage(
          "You can't use "
              + TextUtil.getMaterialName(material)
              + " in the territory of "
              + otherFaction.getTag(myFaction));
      return false;
    }
    // Also cancel if player doesn't have ownership rights for this claim
    else if (rel.isMember() && ownershipFail && !Factions.hasPermOwnershipBypass(player)) {
      me.sendMessage(
          "You can't use "
              + TextUtil.getMaterialName(material)
              + " in this territory, it is owned by: "
              + myFaction.getOwnerListString(loc));
      return false;
    }

    return true;
  }
  @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
    EventFactionsDisband event = new EventFactionsDisband(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()) {
      EventFactionsMembershipChange membershipChangeEvent =
          new EventFactionsMembershipChange(
              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();
  }
  @Override
  public Faction get(Object oid) {
    Faction ret = super.get(oid);

    // We should only trigger automatic clean if the whole database system is initialized.
    // A cleaning can only be successful if all data is available.
    // Example Reason: When creating the special factions for the first time "createSpecialFactions"
    // a clean would be triggered otherwise.
    if (ret == null && Factions.get().isDatabaseInitialized()) {
      String message =
          Txt.parse(
              "<b>Non existing factionId <h>%s <b>requested. <i>Cleaning all boards and mplayers.",
              this.fixId(oid));
      Factions.get().log(message);

      BoardColl.get().clean();
      MPlayerColl.get().clean();
    }

    return ret;
  }
Esempio n. 8
0
  @Override
  public void perform() {
    String tag = this.argAsString(0);

    // TODO does not first test cover selfcase?
    if (Factions.i.isTagTaken(tag)
        && !MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) {
      msg("<b>That tag is already taken");
      return;
    }

    ArrayList<String> errors = new ArrayList<String>();
    errors.addAll(Factions.validateTag(tag));
    if (errors.size() > 0) {
      sendMessage(errors);
      return;
    }

    // if economy is enabled, they're not on the bypass list, and this command has a cost set, make
    // sure they can pay
    if (!canAffordCommand(Conf.econCostTag, "to change the faction tag")) return;

    // trigger the faction rename event (cancellable)
    FactionRenameEvent renameEvent = new FactionRenameEvent(fme, tag);
    Bukkit.getServer().getPluginManager().callEvent(renameEvent);
    if (renameEvent.isCancelled()) return;

    // then make 'em pay (if applicable)
    if (!payForCommand(
        Conf.econCostTag, "to change the faction tag", "for changing the faction tag")) return;

    String oldtag = myFaction.getTag();
    myFaction.setTag(tag);

    // Inform
    myFaction.msg(
        "%s<i> changed your faction tag to %s",
        fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
    for (Faction faction : Factions.i.get()) {
      if (faction == myFaction) {
        continue;
      }
      faction.msg(
          "<i>The faction %s<i> changed their name to %s.",
          fme.getColorTo(faction) + oldtag, myFaction.getTag(faction));
    }

    if (Conf.spoutFactionTagsOverNames) {
      SpoutFeatures.updateAppearances(myFaction);
    }
  }
Esempio n. 9
0
  @Override
  public void perform() throws MassiveException {
    // Args
    int page = this.readArg();
    final MPlayer msender = this.msender;

    // NOTE: The faction list is quite slow and mostly thread safe.
    // We run it asynchronously to spare the primary server thread.

    // Pager Create
    final Pager<Faction> pager =
        new Pager<Faction>(
            this,
            "Faction List",
            page,
            new Stringifier<Faction>() {
              @Override
              public String toString(Faction faction, int index) {
                if (faction.isNone()) {
                  return Txt.parse(
                      "<i>Factionless<i> %d online",
                      FactionColl.get().getNone().getMPlayersWhereOnline(true).size());
                } else {
                  return Txt.parse(
                      "%s<i> %d/%d online, %d/%d/%d",
                      faction.getName(msender),
                      faction.getMPlayersWhereOnline(true).size(),
                      faction.getMPlayers().size(),
                      faction.getLandCount(),
                      faction.getPowerRounded(),
                      faction.getPowerMaxRounded());
                }
              }
            });

    Bukkit.getScheduler()
        .runTaskAsynchronously(
            Factions.get(),
            new Runnable() {
              @Override
              public void run() {
                // Pager Items
                final List<Faction> factions =
                    FactionColl.get().getAll(FactionListComparator.get());
                pager.setItems(factions);

                // Pager Message
                pager.message();
              }
            });
  }
Esempio n. 10
0
  public void clean() {
    for (MPlayer mplayer : this.getAll()) {
      String factionId = mplayer.getFactionId();
      if (FactionColl.get().containsId(factionId)) continue;

      mplayer.resetFactionData();

      String message =
          Txt.parse(
              "<i>Reset data for <h>%s <i>. Unknown factionId <h>%s",
              mplayer.getDisplayName(IdUtil.getConsole()), factionId);
      Factions.get().log(message);
    }
  }
Esempio n. 11
0
  @Override
  public synchronized MPlayer removeAtLocalFixed(String id) {
    if (!Factions.get().isDatabaseInitialized()) return super.removeAtLocalFixed(id);

    MPlayer mplayer = this.id2entity.get(id);

    if (mplayer != null) {
      String beforeId = mplayer.getFactionId();
      String afterId = null;
      mplayer.updateFactionIndexes(beforeId, afterId);
    }

    return super.removeAtLocalFixed(id);
  }
Esempio n. 12
0
  @Override
  public void perform() {
    // Args
    UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
    if (uplayer == null) return;

    Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));
    if (newInvited == null) return;

    // Allready member?
    if (uplayer.getFaction() == usenderFaction) {
      msg("%s<i> is already a member of %s", uplayer.getName(), usenderFaction.getName());
      msg(
          "<i>You might want to: "
              + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
      return;
    }

    // FPerm
    if (!FPerm.INVITE.has(usender, usenderFaction, true)) return;

    // Event
    FactionsEventInvitedChange event =
        new FactionsEventInvitedChange(sender, uplayer, usenderFaction, newInvited);
    event.run();
    if (event.isCancelled()) return;
    newInvited = event.isNewInvited();

    // Apply
    usenderFaction.setInvited(uplayer, newInvited);

    // Inform
    if (newInvited) {
      uplayer.msg(
          "%s<i> invited you to %s",
          usender.describeTo(uplayer, true), usenderFaction.describeTo(uplayer));
      usenderFaction.msg(
          "%s<i> invited %s<i> to your faction.",
          usender.describeTo(usenderFaction, true), uplayer.describeTo(usenderFaction));
    } else {
      uplayer.msg(
          "%s<i> revoked your invitation to <h>%s<i>.",
          usender.describeTo(uplayer), usenderFaction.describeTo(uplayer));
      usenderFaction.msg(
          "%s<i> revoked %s's<i> invitation.",
          usender.describeTo(usenderFaction), uplayer.describeTo(usenderFaction));
    }
  }
  @Override
  public void perform() {
    Double amount = this.arg(0, ARDouble.get());
    if (amount == null) return;

    Faction from = this.arg(1, ARFaction.get(sender), myFaction);
    if (from == null) return;

    FPlayer to = fme;

    boolean success = Econ.transferMoney(fme, from, to, amount);

    if (success && MConf.get().logMoneyTransactions) {
      Factions.get()
          .log(
              ChatColor.stripColor(
                  Txt.parse(
                      "%s withdrew %s from the faction bank: %s",
                      fme.getName(), Money.format(from, amount), from.describeTo(null))));
    }
  }
Esempio n. 14
0
  public void considerRemovePlayerMillis() {
    // If the config option is 0 or below that means the server owner want it disabled.
    if (MConf.get().removePlayerMillisDefault <= 0.0) return;

    // For each of the offline players...
    // NOTE: If the player is currently online it's most definitely not inactive.
    // NOTE: This check catches some important special cases like the @console "player".
    final Collection<MPlayer> mplayersOffline = this.getAllOffline();

    Bukkit.getScheduler()
        .runTaskAsynchronously(
            Factions.get(),
            new Runnable() {
              @Override
              public void run() {
                for (MPlayer mplayer : mplayersOffline) {
                  mplayer.considerRemovePlayerMillis(true);
                }
              }
            });
  }
  public void econLandRewardRoutine() {
    if (!Econ.isEnabled()) return;

    double econLandReward = MConf.get().econLandReward;
    if (econLandReward == 0.0) return;

    Factions.get().log("Running econLandRewardRoutine...");
    for (Faction faction : this.getAll()) {
      int landCount = faction.getLandCount();
      if (!faction.getFlag(MFlag.getFlagPeaceful()) && landCount > 0) {
        List<MPlayer> players = faction.getMPlayers();
        int playerCount = players.size();
        double reward = econLandReward * landCount / playerCount;
        for (MPlayer player : players) {
          Econ.modifyMoney(
              player,
              reward,
              "own " + landCount + " faction land divided among " + playerCount + " members");
        }
      }
    }
  }
Esempio n. 16
0
 @Override
 public boolean hasPermission(CommandSender sender) {
   return Factions.hasPermCreate(sender);
 }
Esempio n. 17
0
 public BoardColl(String name) {
   super(name, Board.class, MStore.getDb(ConfServer.dburi), Factions.get(), false, true, true);
 }
Esempio n. 18
0
 public boolean hasPermission(CommandSender sender) {
   return Factions.hasPermParticipate(sender);
 }
 @Override
 public Plugin getPlugin() {
   return Factions.get();
 }
  @Override
  public void onPlayerMove(PlayerMoveEvent event) {
    Player player = event.getPlayer();
    FPlayer me = FPlayer.get(player);

    // Did we change coord?
    FLocation from = me.getLastStoodAt();
    FLocation to = new FLocation(player.getLocation());

    if (from.equals(to)) {
      return;
    }

    // Yes we did change coord (:

    me.setLastStoodAt(to);

    if (me.isMapAutoUpdating()) {
      me.sendMessage(Board.getMap(me.getFaction(), to, player.getLocation().getYaw()));
    } else {
      // Did we change "host"(faction)?
      Faction factionFrom = Board.getFactionAt(from);
      Faction factionTo = Board.getFactionAt(to);
      Faction myFaction = me.getFaction();
      String ownersTo = myFaction.getOwnerListString(to);
      if (factionFrom != factionTo) {
        me.sendFactionHereMessage();
        if (Conf.ownedAreasEnabled
            && Conf.ownedMessageOnBorder
            && myFaction == factionTo
            && !ownersTo.isEmpty()) {
          me.sendMessage(Conf.ownedLandMessage + ownersTo);
        }
      } else if (Conf.ownedAreasEnabled
          && Conf.ownedMessageInsideTerritory
          && factionFrom == factionTo
          && myFaction == factionTo) {
        String ownersFrom = myFaction.getOwnerListString(from);
        if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo)) {
          if (!ownersTo.isEmpty()) {
            me.sendMessage(Conf.ownedLandMessage + ownersTo);
          } else if (!Conf.publicLandMessage.isEmpty()) {
            me.sendMessage(Conf.publicLandMessage);
          }
        }
      }
    }

    if (me.autoClaimEnabled()) {
      Faction myFaction = me.getFaction();
      Faction otherFaction = Board.getFactionAt(to);
      double cost = Econ.calculateClaimCost(myFaction.getLandRounded(), otherFaction.isNormal());

      if (me.getRole().value < Role.MODERATOR.value) {
        me.sendMessage("You must be " + Role.MODERATOR + " to claim land.");
        me.enableAutoClaim(false);
      } else if (Conf.worldsNoClaiming.contains(to.getWorldName())) {
        me.sendMessage("Sorry, this world has land claiming disabled.");
        me.enableAutoClaim(false);
      } else if (myFaction.getLandRounded() >= myFaction.getPowerRounded()) {
        me.sendMessage("You can't claim more land! You need more power!");
        me.enableAutoClaim(false);
      } else if (!Econ.canAfford(player.getName(), cost)) {
        String costString = Econ.moneyString(cost);
        me.sendMessage(
            "Claiming this land will cost " + costString + ", which you can't currently afford.");
        me.enableAutoClaim(false);
      } else me.attemptClaim(false);
    } else if (me.autoSafeZoneEnabled()) {
      if (!Factions.hasPermManageSafeZone((CommandSender) player)) {
        me.enableAutoSafeZone(false);
      } else {
        FLocation playerFlocation = new FLocation(me);

        if (!Board.getFactionAt(playerFlocation).isSafeZone()) {
          Board.setFactionAt(Faction.getSafeZone(), playerFlocation);
          me.sendMessage("This land is now a safe zone.");
        }
      }
    } else if (me.autoWarZoneEnabled()) {
      if (!Factions.hasPermManageWarZone((CommandSender) player)) {
        me.enableAutoWarZone(false);
      } else {
        FLocation playerFlocation = new FLocation(me);

        if (!Board.getFactionAt(playerFlocation).isWarZone()) {
          Board.setFactionAt(Faction.getWarZone(), playerFlocation);
          me.sendMessage("This land is now a war zone.");
        }
      }
    }
  }
  public boolean playerCanUseItemHere(Player player, Block block, Material material) {

    if (Conf.adminBypassPlayers.contains(player.getName())) {
      return true;
    }

    FLocation loc = new FLocation(block);
    Faction otherFaction = Board.getFactionAt(loc);

    if (otherFaction.hasPlayersOnline()) {
      if (!Conf.territoryDenyUseageMaterials.contains(material)) {
        return true; // Item isn't one we're preventing for online factions.
      }
    } else {
      if (!Conf.territoryDenyUseageMaterialsWhenOffline.contains(material)) {
        return true; // Item isn't one we're preventing for offline factions.
      }
    }

    FPlayer me = FPlayer.get(player);

    if (otherFaction.isNone()) {
      if (!Conf.wildernessDenyUseage
          || Factions.hasPermAdminBypass(player)
          || Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) {
        return true; // This is not faction territory. Use whatever you like here.
      }
      me.sendMessage("You can't use " + TextUtil.getMaterialName(material) + " in the wilderness.");
      return false;
    } else if (otherFaction.isSafeZone()) {
      if (!Conf.safeZoneDenyUseage || Factions.hasPermManageSafeZone(player)) {
        return true;
      }
      me.sendMessage("You can't use " + TextUtil.getMaterialName(material) + " in a safe zone.");
      return false;
    } else if (otherFaction.isWarZone()) {
      if (!Conf.warZoneDenyUseage || Factions.hasPermManageWarZone(player)) {
        return true;
      }
      me.sendMessage("You can't use " + TextUtil.getMaterialName(material) + " in a war zone.");
      return false;
    }

    Faction myFaction = me.getFaction();
    Relation rel = myFaction.getRelation(otherFaction);
    boolean ownershipFail =
        Conf.ownedAreasEnabled
            && Conf.ownedAreaDenyUseage
            && !otherFaction.playerHasOwnershipRights(me, loc);

    // Cancel if we are not in our own territory
    if (!rel.isMember() && rel.confDenyUseage()) {
      me.sendMessage(
          "You can't use "
              + TextUtil.getMaterialName(material)
              + " in the territory of "
              + otherFaction.getTag(myFaction));
      return false;
    }
    // Also cancel if player doesn't have ownership rights for this claim
    else if (rel.isMember() && ownershipFail && !Factions.hasPermOwnershipBypass(player)) {
      me.sendMessage(
          "You can't use "
              + TextUtil.getMaterialName(material)
              + " in this territory, it is owned by: "
              + myFaction.getOwnerListString(loc));
      return false;
    }

    return true;
  }
Esempio n. 22
0
 public OldConfColl(String name) {
   super(name, OldConf.class, MStore.getDb(), Factions.get());
 }
  @Override
  public void onPlayerChat(PlayerChatEvent event) {
    if (event.isCancelled()) {
      return;
    }

    Player talkingPlayer = event.getPlayer();
    String msg = event.getMessage();

    // ... it was not a command. This means that it is a chat message!
    FPlayer me = FPlayer.get(talkingPlayer);

    // Are we to insert the Faction tag into the format?
    // If we are not to insert it - we are done.
    if (!Conf.chatTagEnabled || Conf.chatTagHandledByAnotherPlugin) {
      return;
    }

    int InsertIndex = 0;
    String eventFormat = event.getFormat();

    if (!Conf.chatTagReplaceString.isEmpty() && eventFormat.contains(Conf.chatTagReplaceString)) {
      // we're using the "replace" method of inserting the faction tags
      // if they stuck "{FACTION_TITLE}" in there, go ahead and do it too
      if (eventFormat.contains("{FACTION_TITLE}")) {
        eventFormat = eventFormat.replace("{FACTION_TITLE}", me.getTitle());
      }
      InsertIndex = eventFormat.indexOf(Conf.chatTagReplaceString);
      eventFormat = eventFormat.replace(Conf.chatTagReplaceString, "");
      Conf.chatTagPadAfter = false;
      Conf.chatTagPadBefore = false;
    } else if (!Conf.chatTagInsertAfterString.isEmpty()
        && eventFormat.contains(Conf.chatTagInsertAfterString)) {
      // we're using the "insert after string" method
      InsertIndex =
          eventFormat.indexOf(Conf.chatTagInsertAfterString)
              + Conf.chatTagInsertAfterString.length();
    } else if (!Conf.chatTagInsertBeforeString.isEmpty()
        && eventFormat.contains(Conf.chatTagInsertBeforeString)) {
      // we're using the "insert before string" method
      InsertIndex = eventFormat.indexOf(Conf.chatTagInsertBeforeString);
    } else {
      // we'll fall back to using the index place method
      InsertIndex = Conf.chatTagInsertIndex;
      if (InsertIndex > eventFormat.length()) return;
    }

    String formatStart =
        eventFormat.substring(0, InsertIndex)
            + ((Conf.chatTagPadBefore && !me.getChatTag().isEmpty()) ? " " : "");
    String formatEnd =
        ((Conf.chatTagPadAfter && !me.getChatTag().isEmpty()) ? " " : "")
            + eventFormat.substring(InsertIndex);

    String nonColoredMsgFormat = formatStart + me.getChatTag().trim() + formatEnd;

    // Relation Colored?
    if (Conf.chatTagRelationColored) {
      // We must choke the standard message and send out individual messages to all players
      // Why? Because the relations will differ.
      event.setCancelled(true);

      for (Player listeningPlayer : event.getRecipients()) {
        FPlayer you = FPlayer.get(listeningPlayer);
        String yourFormat = formatStart + me.getChatTag(you).trim() + formatEnd;
        try {
          listeningPlayer.sendMessage(
              String.format(yourFormat, talkingPlayer.getDisplayName(), msg));
        } catch (UnknownFormatConversionException ex) {
          Factions.log(
              Level.SEVERE,
              "Critical error in chat message formatting! Complete format string: " + yourFormat);
          Factions.log(Level.SEVERE, "First half of event.getFormat() string: " + formatStart);
          Factions.log(Level.SEVERE, "Second half of event.getFormat() string: " + formatEnd);
          Factions.log(
              Level.SEVERE,
              "NOTE: To fix this quickly, running this command should work: f config chatTagInsertIndex 0");
          Factions.log(
              Level.SEVERE,
              "For a more proper fix, please read the chat configuration notes on the configuration page of the Factions user guide.");
          ex.printStackTrace();
          return;
        }
      }

      // Write to the log... We will write the non colored message.
      String nonColoredMsg =
          ChatColor.stripColor(
              String.format(nonColoredMsgFormat, talkingPlayer.getDisplayName(), msg));
      Logger.getLogger("Minecraft").info(nonColoredMsg);
    } else {
      // No relation color.
      event.setFormat(nonColoredMsgFormat);
    }
  }
 private FactionColl() {
   super(Const.COLLECTION_FACTION, Faction.class, MStore.getDb(), Factions.get());
 }