Ejemplo n.º 1
0
  public void count_cmd() throws CivException {
    Player player = getPlayer();

    HashMap<String, Integer> amounts = new HashMap<String, Integer>();
    int total = CommonCustomMob.customMobs.size();
    for (CommonCustomMob mob : CommonCustomMob.customMobs.values()) {
      Integer count = amounts.get(mob.getClass().getSimpleName());
      if (count == null) {
        count = 0;
      }

      amounts.put(mob.getClass().getSimpleName(), count + 1);
    }

    CivMessage.sendHeading(player, "Custom Mob Counts");
    CivMessage.send(
        player,
        CivColor.LightGray
            + "Red mobs are over their count limit for this area and should no longer spawn.");
    for (String mob : amounts.keySet()) {
      int count = amounts.get(mob);

      LinkedList<Entity> entities =
          EntityProximity.getNearbyEntities(
              null, player.getLocation(), MobSpawnerTimer.MOB_AREA, EntityCreature.class);
      if (entities.size() > MobSpawnerTimer.MOB_AREA_LIMIT) {
        CivMessage.send(player, CivColor.Red + mob + ": " + CivColor.Rose + count);
      } else {
        CivMessage.send(player, CivColor.Green + mob + ": " + CivColor.LightGreen + count);
      }
    }
    CivMessage.send(player, CivColor.Green + "Total Mobs:" + CivColor.LightGreen + total);
  }
Ejemplo n.º 2
0
  public void killall_cmd() throws CivException {
    Player player = getPlayer();
    String name = getNamedString(1, "Enter a mob name");

    LinkedList<CommonCustomMob> removeUs = new LinkedList<CommonCustomMob>();
    for (CommonCustomMob mob : CommonCustomMob.customMobs.values()) {
      if (mob.getType().toString().equalsIgnoreCase(name)) {
        removeUs.add(mob);
      }
    }

    int count = 0;
    for (CommonCustomMob mob : removeUs) {
      CommonCustomMob.customMobs.remove(mob.entity.getUniqueID());
      mob.entity.getBukkitEntity().remove();
      count++;
    }
    CivMessage.sendSuccess(player, "Removed " + count + " mobs of type " + name);
  }