예제 #1
0
  @Override
  public void perform() {
    Board.unclaimAll(Factions.i.getWarZone().getId());
    msg("<i>Zwolniles CALY teren pola walki.");

    if (Conf.logLandUnclaims) P.p.log(fme.getName() + " zwolnil caly teren pola walki.");
  }
예제 #2
0
  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;
  }
예제 #3
0
  public void updateOwnerList(FPlayer player) {
    SpoutPlayer sPlayer = SpoutManager.getPlayer(player.getPlayer());
    if (!sPlayer.isSpoutCraftEnabled()
        || (Conf.spoutTerritoryDisplaySize <= 0 && !Conf.spoutTerritoryNoticeShow)) return;

    FLocation here = player.getLastStoodAt();
    Faction factionHere = Board.getFactionAt(here);

    doOwnerList(player, sPlayer, here, factionHere);

    return;
  }
예제 #4
0
 @Override
 public boolean isExplosionsEnabled(Location loc) {
   Faction faction = Board.getFactionAt(new FLocation(loc));
   if (ChatColor.stripColor(faction.getTag()).equalsIgnoreCase("safezone")
       || ChatColor.stripColor(faction.getTag()).equalsIgnoreCase("warzone")) {
     // ObsidianDestroyer.debug("Factions18x.isExplosionsEnabled: false");
     return false;
   }
   // ObsidianDestroyer.debug("Factions18x.isExplosionsEnabled: " +
   // faction.getFlag(FFlag.EXPLOSIONS));
   return faction.getFlag(FFlag.EXPLOSIONS);
 }
예제 #5
0
 @Override
 public boolean isFactionOffline(Location loc) {
   Faction faction = Board.getFactionAt(new FLocation(loc));
   if (faction.isNone()) {
     return false;
   } else if ((ChatColor.stripColor(faction.getTag()).equalsIgnoreCase("wilderness")
       || ChatColor.stripColor(faction.getTag()).equalsIgnoreCase("safezone")
       || ChatColor.stripColor(faction.getTag()).equalsIgnoreCase("warzone"))) {
     // ObsidianDestroyer.debug("Factions18x.isFactionOffline: false");
     return false;
   }
   // ObsidianDestroyer.debug("Factions18x.isFactionOffline: " +
   // faction.hasOfflineExplosionProtection());
   return faction.hasOfflineExplosionProtection();
 }
예제 #6
0
 @Override
 public boolean isPvpEnabledAt(Location location) {
   FLocation flocation = new FLocation(location);
   Faction faction = Board.getFactionAt(flocation);
   return faction.getFlag(FFlag.PVP);
 }
  @SuppressWarnings("deprecation")
  public static String getSafeZone(Player p) {
    if (tekkitrestrict.config.getBoolean("UseSafeZones")) {
      if (!TRPermHandler.hasPermission(p, "safezone", "bypass", "")) {
        if (tekkitrestrict.getInstance().getServer().getPluginManager().isPluginEnabled("Towny")
            && depends.contains("towny")) {
          /*
           * com.palmergames.bukkit.towny.Towny tapp =
           * (com.palmergames.bukkit
           * .towny.Towny)tekkitrestrict.getInstance
           * ().getServer().getPluginManager().getPlugin("Towny");
           * com.palmergames.bukkit.towny.object.PlayerCache c =
           * tapp.getCache(p);
           * if(!tapp.getTownyUniverse().isWilderness(p.getWorld
           * ().getHighestBlockAt(p.getLocation()))){ return "towny";
           * }
           */
          Block cb = p.getWorld().getHighestBlockAt(p.getLocation());
          boolean hasperm =
              com.palmergames.bukkit.towny.utils.PlayerCacheUtil.getCachePermission(
                  p,
                  p.getLocation(),
                  cb.getTypeId(),
                  com.palmergames.bukkit.towny.object.TownyPermission.ActionType.DESTROY);
          TownBlockStatus tbs =
              com.palmergames.bukkit.towny.utils.PlayerCacheUtil.getTownBlockStatus(
                  p, WorldCoord.parseWorldCoord(p.getLocation()));
          // boolean ls = tbs != TownBlockStatus.UNCLAIMED_ZONE && tbs != TownBlockStatus.WARZONE &&
          // tbs != TownBlockStatus.UNKOWN;
          if (!hasperm) {
            // tekkitrestrict.log.info("towny");
            return "towny+";
          }
        }
        // tekkitrestrict.log.info("deb");
        if (tekkitrestrict.getInstance().getServer().getPluginManager().isPluginEnabled("Factions")
            && depends.contains("factions")) {
          // if(!com.massivecraft.factions.listeners.FactionsPlayerListener.canPlayerUseBlock(p,
          // p.getWorld().getHighestBlockAt(p.getLocation()), true)){
          // Location cccc =
          // p.getWorld().getHighestBlockAt(p.getLocation()).getLocation();

          com.massivecraft.factions.FLocation ccc =
              new com.massivecraft.factions.FLocation(p.getPlayer());
          com.massivecraft.factions.Faction f = com.massivecraft.factions.Board.getFactionAt(ccc);
          String name = p.getPlayer().getName();

          com.massivecraft.factions.FPlayer me = com.massivecraft.factions.FPlayers.i.get(name);
          if (!com.massivecraft.factions.Conf.playersWhoBypassAllProtection.contains(name)) {
            /*if (me.getFaction() != null && f != null && !me.hasAdminMode()) {
            	if ((me.getFaction().getTag() != f.getTag())
            			&& !f.isNone()) {
            		// tekkitrestrict.log.info("factions");

            	}
            }*/
            if (!FPerm.BUILD.has(me, ccc)) {
              return "factions+" + f.getTag();
            }
          }
        }

        if (tekkitrestrict
                .getInstance()
                .getServer()
                .getPluginManager()
                .isPluginEnabled("PreciousStones")
            && depends.contains("preciousstones")) {
          net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones ps =
              (net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones)
                  tekkitrestrict
                      .getInstance()
                      .getServer()
                      .getPluginManager()
                      .getPlugin("PreciousStones");
          Block fblock = p.getWorld().getBlockAt(p.getLocation());

          Field field =
              ps.getForceFieldManager()
                  .getEnabledSourceField(fblock.getLocation(), FieldFlag.CUBOID);
          // tekkitrestrict.log.info("a");
          if (field != null) {
            // tekkitrestrict.log.info("b");
            boolean allowed = ps.getForceFieldManager().isApplyToAllowed(field, p.getName());
            if (!allowed || field.hasFlag(FieldFlag.APPLY_TO_ALL)) {
              // if (field.getSettings().canGrief(fblock.getTypeId()))
              // return;
              // tekkitrestrict.log.info("c");
              return "preciousstones";
            }
          }
        }

        if (tekkitrestrict
                .getInstance()
                .getServer()
                .getPluginManager()
                .isPluginEnabled("GriefPrevention")
            && depends.contains("griefprevention")) {
          me.ryanhamshire.GriefPrevention.GriefPrevention pl =
              (me.ryanhamshire.GriefPrevention.GriefPrevention)
                  tekkitrestrict
                      .getInstance()
                      .getServer()
                      .getPluginManager()
                      .getPlugin("GriefPrevention");
          Claim claim = pl.dataStore.getClaimAt(p.getLocation(), false, null);
          if (claim != null) {
            String noAccessReason = claim.allowAccess(p);
            if (noAccessReason != null) {
              return "griefprevention";
            }
          }
        }

        return getXYZSafeZone(p.getLocation(), p.getWorld().getName());
      } else {
        return "";
      }
    }
    return "";
  }
예제 #8
0
  private void doLabels(FPlayer player, SpoutPlayer sPlayer, boolean notify) {
    FLocation here = player.getLastStoodAt();
    Faction factionHere = Board.getFactionAt(here);
    String tag = factionHere.getColorTo(player).toString() + factionHere.getTag();

    // ----------------------
    // Main territory display
    // ----------------------
    if (Conf.spoutTerritoryDisplayPosition > 0 && Conf.spoutTerritoryDisplaySize > 0) {
      GenericLabel label;
      if (territoryLabels.containsKey(player.getName()))
        label = territoryLabels.get(player.getName());
      else {
        label = new GenericLabel();
        label
            .setWidth(1)
            .setHeight(1); // prevent Spout's questionable new "no default size" warning
        label.setScale(Conf.spoutTerritoryDisplaySize);

        sPlayer.getMainScreen().attachWidget(P.p, label);
        territoryLabels.put(player.getName(), label);
      }

      String msg = tag;

      if (Conf.spoutTerritoryDisplayShowDescription && !factionHere.getDescription().isEmpty())
        msg += " - " + factionHere.getDescription();

      label.setText(msg);
      alignLabel(label, msg);
      label.setDirty(true);
    }

    // -----------------------
    // Fading territory notice
    // -----------------------
    if (notify && Conf.spoutTerritoryNoticeShow && Conf.spoutTerritoryNoticeSize > 0) {
      NoticeLabel label;
      if (territoryChangeLabels.containsKey(player.getName()))
        label = territoryChangeLabels.get(player.getName());
      else {
        label = new NoticeLabel(Conf.spoutTerritoryNoticeLeaveAfterSeconds);
        label
            .setWidth(1)
            .setHeight(1); // prevent Spout's questionable new "no default size" warning
        label.setScale(Conf.spoutTerritoryNoticeSize);
        label.setY(Conf.spoutTerritoryNoticeTop);
        sPlayer.getMainScreen().attachWidget(P.p, label);
        territoryChangeLabels.put(player.getName(), label);
      }

      String msg = tag;

      if (Conf.spoutTerritoryNoticeShowDescription && !factionHere.getDescription().isEmpty())
        msg += " - " + factionHere.getDescription();

      label.setText(msg);
      alignLabel(label, msg, 2);
      label.resetNotice();
      label.setDirty(true);
    }

    // and owner list, of course
    doOwnerList(player, sPlayer, here, factionHere);
  }
예제 #9
0
  @Override
  public void perform() {
    // TODO: Hide this command on help also.
    if (!Conf.homesEnabled) {
      this.fme.msg("<b>Sorry, Faction homes are disabled on this server.");
      return;
    }

    if (!Conf.homesTeleportCommandEnabled) {
      this.fme.msg(
          "<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
      return;
    }

    if (!this.myFaction.hasHome()) {
      this.fme.msg(
          "<b>Your faction does not have a home. "
              + (this.fme.getRole().isLessThan(Rel.OFFICER)
                  ? "<i> Ask your leader to:"
                  : "<i>You should:"));
      this.fme.sendMessage(this.p.cmdBase.cmdSethome.getUseageTemplate());
      return;
    }

    if (!Conf.homesTeleportAllowedFromEnemyTerritory && this.fme.isInEnemyTerritory()) {
      this.fme.msg(
          "<b>You cannot teleport to your faction home while in the territory of an enemy faction.");
      return;
    }

    if (!Conf.homesTeleportAllowedFromDifferentWorld
        && this.me.getWorld().getUID() != this.myFaction.getHome().getWorld().getUID()) {
      this.fme.msg("<b>You cannot teleport to your faction home while in a different world.");
      return;
    }

    final Faction faction = Board.getFactionAt(new FLocation(this.me.getLocation()));
    final Location loc = this.me.getLocation().clone();

    // if player is not in a safe zone or their own faction territory, only allow teleport if no
    // enemies are nearby
    if (Conf.homesTeleportAllowedEnemyDistance > 0
        && faction.getFlag(FFlag.PVP)
        && (!this.fme.isInOwnTerritory()
            || this.fme.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory)) {
      final World w = loc.getWorld();
      final double x = loc.getX();
      final double y = loc.getY();
      final double z = loc.getZ();

      for (final Player p : this.me.getServer().getOnlinePlayers()) {
        if (p == null || !p.isOnline() || p.isDead() || p == this.me || p.getWorld() != w) {
          continue;
        }

        final FPlayer fp = FPlayers.i.get(p);
        if (this.fme.getRelationTo(fp) != Rel.ENEMY) {
          continue;
        }

        final Location l = p.getLocation();
        final double dx = Math.abs(x - l.getX());
        final double dy = Math.abs(y - l.getY());
        final double dz = Math.abs(z - l.getZ());
        final double max = Conf.homesTeleportAllowedEnemyDistance;

        // box-shaped distance check
        if (dx > max || dy > max || dz > max) {
          continue;
        }

        this.fme.msg(
            "<b>You cannot teleport to your faction home while an enemy is within "
                + Conf.homesTeleportAllowedEnemyDistance
                + " blocks of you.");
        return;
      }
    }
    Location home = this.myFaction.getHome();

    if (home.clone().getBlock().getType() != Material.AIR
        || home.clone().add(0, 1, 0).getBlock().getType() != Material.AIR) {
      home.clone().getBlock().setType(Material.AIR);
      home.clone().add(0, 1, 0).getBlock().setType(Material.AIR);
      home.clone().add(0, 2, 0).getBlock().setType(Material.STONE);
    }

    // if Essentials teleport handling is enabled and available, pass the teleport off to it (for
    // delay and cooldown)
    if (EssentialsFeatures.handleTeleport(this.me, this.myFaction.getHome())) return;

    // if economy is enabled, they're not on the bypass list, and this command has a cost set, make
    // 'em pay
    if (!this.payForCommand(
        Conf.econCostHome,
        "to teleport to your faction home",
        "for teleporting to your faction home")) return;

    // Create a smoke effect
    if (Conf.homesTeleportCommandSmokeEffectEnabled) {
      final List<Location> smokeLocations = new ArrayList<Location>();
      smokeLocations.add(loc);
      smokeLocations.add(loc.add(0, 1, 0));
      smokeLocations.add(this.myFaction.getHome());
      smokeLocations.add(this.myFaction.getHome().clone().add(0, 1, 0));
      SmokeUtil.spawnCloudRandom(smokeLocations, 3f);
    }

    this.me.teleport(this.myFaction.getHome());
  }
예제 #10
0
  @Override
  public void perform() {
    // TODO: Hide this command on help also.
    if (!Conf.homesEnabled) {
      fme.msg("<b>Sorry, Faction homes are disabled on this server.");
      return;
    }

    if (!Conf.homesTeleportCommandEnabled) {
      fme.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
      return;
    }

    if (!myFaction.hasHome()) {
      fme.msg(
          "<b>You faction does not have a home. "
              + (fme.getRole().value < Role.MODERATOR.value
                  ? "<i> Ask your leader to:"
                  : "<i>You should:"));
      fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate());
      return;
    }

    if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) {
      fme.msg(
          "<b>You cannot teleport to your faction home while in the territory of an enemy faction.");
      return;
    }

    if (!Conf.homesTeleportAllowedFromDifferentWorld
        && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
      fme.msg("<b>You cannot teleport to your faction home while in a different world.");
      return;
    }

    Faction faction = Board.getFactionAt(new FLocation(me.getLocation()));

    // if player is not in a safe zone or their own faction territory, only
    // allow teleport if no enemies are nearby
    if (Conf.homesTeleportAllowedEnemyDistance > 0
        && !faction.isSafeZone()
        && (!fme.isInOwnTerritory()
            || (fme.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) {
      Location loc = me.getLocation();
      World w = loc.getWorld();
      double x = loc.getX();
      double y = loc.getY();
      double z = loc.getZ();

      for (Player p : me.getServer().getOnlinePlayers()) {
        if (p == null || !p.isOnline() || p.isDead() || p == fme || p.getWorld() != w) continue;

        FPlayer fp = FPlayers.i.get(p);
        if (fme.getRelationTo(fp) != Relation.ENEMY) continue;

        Location l = p.getLocation();
        double dx = Math.abs(x - l.getX());
        double dy = Math.abs(y - l.getY());
        double dz = Math.abs(z - l.getZ());
        double max = Conf.homesTeleportAllowedEnemyDistance;

        // box-shaped distance check
        if (dx > max || dy > max || dz > max) continue;

        fme.msg(
            "<b>You cannot teleport to your faction home while an enemy is within "
                + Conf.homesTeleportAllowedEnemyDistance
                + " blocks of you.");
        return;
      }
    }

    // if Essentials teleport handling is enabled and available, pass the
    // teleport off to it (for delay and cooldown)
    if (EssentialsFeatures.handleTeleport(me, myFaction.getHome())) return;

    // if economy is enabled, they're not on the bypass list, and this
    // command has a cost set, make 'em pay
    if (!payForCommand(
        Conf.econCostHome,
        "to teleport to your faction home",
        "for teleporting to your faction home")) return;

    // Create a smoke effect
    if (Conf.homesTeleportCommandSmokeEffectEnabled) {
      List<Location> smokeLocations = new ArrayList<Location>();
      smokeLocations.add(me.getLocation());
      smokeLocations.add(me.getLocation().clone().add(0, 1, 0));
      smokeLocations.add(myFaction.getHome());
      smokeLocations.add(myFaction.getHome().clone().add(0, 1, 0));
      SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness);
    }

    me.teleport(myFaction.getHome());
  }
예제 #11
0
  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;
  }
예제 #12
0
  @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.");
        }
      }
    }
  }
예제 #13
0
 @Override
 public boolean isFactionAtPower(Location loc) {
   Faction faction = Board.getFactionAt(new FLocation(loc));
   return faction.getPower() >= faction.getLandRounded();
 }