Exemplo n.º 1
0
 public static boolean isOnSnitch(Snitch snitch, String playerName) {
   Faction faction = snitch.getGroup();
   if (faction == null) return false;
   return faction.isMember(playerName)
       || faction.isModerator(playerName)
       || faction.isFounder(playerName);
 }
Exemplo n.º 2
0
 public boolean execute(CommandSender sender, String[] args) {
   String groupName = args[0];
   GroupManager groupManager = Citadel.getGroupManager();
   Faction group = groupManager.getGroup(groupName);
   if (group == null) {
     sendMessage(sender, ChatColor.RED, "Group doesn't exist");
     return true;
   }
   if (group.isDisciplined()) {
     sendMessage(sender, ChatColor.RED, Faction.kDisciplineMsg);
     return true;
   }
   String senderName = sender.getName();
   if (!group.isFounder(senderName) && !group.isModerator(senderName)) {
     sendMessage(sender, ChatColor.RED, "Invalid access to modify this group");
     return true;
   }
   if (group.isPersonalGroup()) {
     sendMessage(sender, ChatColor.RED, "You cannot allow players to your default group");
     return true;
   }
   String playerName = args[1];
   if (!group.isMember(playerName)) {
     sendMessage(sender, ChatColor.RED, "%s is not a member of this group", playerName);
     return true;
   }
   groupManager.removeMemberFromGroup(groupName, playerName);
   sendMessage(
       sender,
       ChatColor.GREEN,
       "Disallowed %s from access to %s blocks",
       playerName,
       group.getName());
   return true;
 }
Exemplo n.º 3
0
  public void setSuperEffects(Location loc, int tier) {
    int one = config_.getInt("beacon_super.range");
    int dist[] = {0, one};

    Faction group = groupname(loc);
    if (group == null) {
      return;
    }
    for (Player name : Bukkit.getOnlinePlayers()) {
      int level = 1;
      if (!group.isMember(name.getUniqueId())
          && !group.isModerator(name.getUniqueId())
          && !group.isFounder(name.getUniqueId())) {
        level = 3;
        PotionEffectType Types1[] = {PotionEffectType.WEAKNESS};
        for (PotionEffectType type : Types1) {
          if (type == PotionEffectType.WEAKNESS) level = 1;
          negativeeffecttype(name, loc, 50, level, type);
        }
        continue;
      }
      if (group.isPersonalGroup()) {
        if (group.equals(
            Citadel.getPersonalGroupManager()
                .getPersonalGroup(name.getUniqueId())
                .getGroupName())) {
          PotionEffectType Types[] = {
            PotionEffectType.FAST_DIGGING,
            PotionEffectType.REGENERATION,
            PotionEffectType.INCREASE_DAMAGE,
            PotionEffectType.SPEED
          };
          for (PotionEffectType type : Types) {
            effecttype(name, loc, dist, tier, level, type);
          }
        }
      } else {
        PotionEffectType Types[] = {
          PotionEffectType.FAST_DIGGING,
          PotionEffectType.REGENERATION,
          PotionEffectType.INCREASE_DAMAGE,
          PotionEffectType.SPEED
        };
        for (PotionEffectType type : Types) {
          effecttype(name, loc, dist, tier, level, type);
        }
      }
    }
  }
Exemplo n.º 4
0
  public void setSpeedEffects(Location loc, int tier) {
    int level = 0;
    int one = config_.getInt("beacon_speed.tier_1.range");
    int two = config_.getInt("beacon_speed.tier_2.range");
    int three = config_.getInt("beacon_speed.tier_3.range");
    int four = config_.getInt("beacon_speed.tier_4.range");
    int five = config_.getInt("beacon_speed.tier_5.range");
    int dist[] = {0, one, two, three, four, five}; // Distances for this
    // beacon; In Array
    // form because if
    // someone wants a
    // 6th lvl, it can
    // be done without
    // changing alot of
    // code.
    switch (tier) { // if tier == 4 || 5, level = 1;
      case 4:
      case 5:
        level = 1;
        break;
    }

    Faction group = groupname(loc);
    if (group == null) {
      return;
    }
    for (Player name : Bukkit.getOnlinePlayers()) {

      if (!group.isMember(name.getUniqueId())
          && !group.isModerator(name.getUniqueId())
          && !group.isFounder(name.getUniqueId())) {
        continue;
      } else if (group.isPersonalGroup()) {
        if (group.equals(
            Citadel.getPersonalGroupManager()
                .getPersonalGroup(name.getUniqueId())
                .getGroupName())) {
          effecttype(name, loc, dist, tier, level, PotionEffectType.SPEED);
        }
      } else {
        effecttype(name, loc, dist, tier, level, PotionEffectType.SPEED);
      }
    }
  }
Exemplo n.º 5
0
  public void setStrengthEffects(Location loc, int tier) {
    int level = 0;
    int one = config_.getInt("beacon_strength.tier_1.range");
    int two = config_.getInt("beacon_strength.tier_1.range");
    int three = config_.getInt("beacon_strength.tier_1.range");
    int four = config_.getInt("beacon_strength.tier_1.range");
    int five = config_.getInt("beacon_strength.tier_1.range");
    int dist[] = {0, one, two, three, four, five};

    switch (tier) {
      case 4:
      case 5:
        level = 1;
        break;
    }

    Faction group = groupname(loc);
    if (group == null) {
      return;
    }
    for (Player name : Bukkit.getOnlinePlayers()) {
      if (!group.isMember(name.getUniqueId())
          && !group.isModerator(name.getUniqueId())
          && !group.isFounder(name.getUniqueId())) {
        continue;
      } else if (group.isPersonalGroup()) {
        if (group.equals(
            Citadel.getPersonalGroupManager()
                .getPersonalGroup(name.getUniqueId())
                .getGroupName())) {
          effecttype(name, loc, dist, tier, level, PotionEffectType.INCREASE_DAMAGE);
        }
      } else {
        effecttype(name, loc, dist, tier, level, PotionEffectType.INCREASE_DAMAGE);
      }
    }
  }