@Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_PRISON) {
      PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command!");
      return;
    }

    if (params.length == 0 || params.length > 2) {
      PacketSendUtility.sendMessage(admin, "syntax //rprison <player>");
      return;
    }

    try {
      Player playerFromPrison = World.getInstance().findPlayer(Util.convertName(params[0]));

      if (playerFromPrison != null) {
        PunishmentService.setIsInPrison(playerFromPrison, false, 0);
        PacketSendUtility.sendMessage(
            admin, "Player " + playerFromPrison.getName() + " removed from prison.");
      }
    } catch (NoSuchElementException nsee) {
      PacketSendUtility.sendMessage(admin, "Usage: //rprison <player>");
    } catch (Exception e) {
      PacketSendUtility.sendMessage(admin, "Usage: //rprison <player>");
    }
  }
 @Override
 protected void handleDialogStart(Player player) {
   if (player.getInventory().getItemCountByItemId(186000236) > 0) {
     super.handleDialogStart(player);
   } else {
     PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(getObjectId(), 27));
     PacketSendUtility.sendMessage(
         player, "You need item [item: 186000236] to ask reinforcements");
   }
 }
Exemplo n.º 3
0
  @Override
  public void execute(Player admin, String... params) {
    if (params == null || params.length < 1) {
      PacketSendUtility.sendMessage(admin, "Syntax: //ungag <player>");
      return;
    }

    String name = Util.convertName(params[0]);
    Player player = World.getInstance().findPlayer(name);
    if (player == null) {
      PacketSendUtility.sendMessage(admin, "Player " + name + " was not found!");
      PacketSendUtility.sendMessage(admin, "Syntax: //ungag <player>");
      return;
    }

    player.setGagged(false);
    Future<?> task = player.getController().getTask(TaskId.GAG);
    if (task != null) player.getController().cancelTask(TaskId.GAG);
    PacketSendUtility.sendMessage(player, "You have been ungagged");

    PacketSendUtility.sendMessage(admin, "Player " + name + " ungagged");
  }
Exemplo n.º 4
0
  @Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_KINAH) {
      PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command.");
      return;
    }

    if (params == null || params.length < 1 || params.length > 2) {
      PacketSendUtility.sendMessage(admin, "syntax //kinah [player] <quantity>");
      return;
    }

    long kinahCount;
    Player receiver;

    if (params.length == 1) {
      receiver = admin;
      try {
        kinahCount = Integer.parseInt(params[0]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "Kinah value must be an integer.");
        return;
      }
    } else {
      receiver = World.getInstance().findPlayer(Util.convertName(params[0]));

      if (receiver == null) {
        PacketSendUtility.sendMessage(admin, "Could not find a player by that name.");
        return;
      }

      try {
        kinahCount = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "Kinah value must be an integer.");
        return;
      }
    }

    ItemService.increaseKinah(receiver, kinahCount);
    PacketSendUtility.sendMessage(admin, "Kinah given successfully.");
    PacketSendUtility.sendMessage(receiver, "An admin gives you some kinah.");
  }
Exemplo n.º 5
0
  @Override
  public void execute(Player player, String... params) {
    if ((params.length < 0) || (params.length < 1)) {
      onFail(player, null);
      return;
    }
    int itemId = 0;
    long itemCount = 1;
    Player receiver;

    try {
      String item = params[0];
      // Some item links have space before Id
      if (item.equals("[item:")) {
        item = params[1];
        Pattern id = Pattern.compile("(\\d{9})");
        Matcher result = id.matcher(item);
        if (result.find()) itemId = Integer.parseInt(result.group(1));

        if (params.length == 3) itemCount = Long.parseLong(params[2]);
      } else {
        Pattern id = Pattern.compile("\\[item:(\\d{9})");
        Matcher result = id.matcher(item);

        if (result.find()) itemId = Integer.parseInt(result.group(1));
        else itemId = Integer.parseInt(params[0]);

        if (params.length == 2) itemCount = Long.parseLong(params[1]);
      }
      receiver = player;
    } catch (NumberFormatException e) {
      receiver = World.getInstance().findPlayer(Util.convertName(params[0]));
      if (receiver == null) {
        PacketSendUtility.sendMessage(player, "Could not find a player by that name.");
        return;
      }

      try {
        String item = params[1];
        // Some item links have space before Id
        if (item.equals("[item:")) {
          item = params[2];
          Pattern id = Pattern.compile("(\\d{9})");
          Matcher result = id.matcher(item);
          if (result.find()) itemId = Integer.parseInt(result.group(1));

          if (params.length == 4) itemCount = Long.parseLong(params[3]);
        } else {
          Pattern id = Pattern.compile("\\[item:(\\d{9})");
          Matcher result = id.matcher(item);

          if (result.find()) itemId = Integer.parseInt(result.group(1));
          else itemId = Integer.parseInt(params[1]);

          if (params.length == 3) itemCount = Long.parseLong(params[2]);
        }
      } catch (NumberFormatException ex) {
        PacketSendUtility.sendMessage(player, "You must give number to itemid.");
        return;
      } catch (Exception ex2) {
        PacketSendUtility.sendMessage(player, "Occurs an error.");
        return;
      }
    }

    if (DataManager.ITEM_DATA.getItemTemplate(itemId) == null) {
      PacketSendUtility.sendMessage(player, "Item id is incorrect: " + itemId);
      return;
    }

    if (!AdminService.getInstance().canOperate(player, receiver, itemId, "command //add")) return;

    long count = ItemService.addItem(receiver, itemId, itemCount);

    if (count == 0) {
      if (player != receiver) {
        PacketSendUtility.sendMessage(
            player,
            "You successfully gave "
                + itemCount
                + " x [item:"
                + itemId
                + "] to "
                + receiver.getName()
                + ".");
        PacketSendUtility.sendMessage(
            receiver,
            "You successfully received "
                + itemCount
                + " x [item:"
                + itemId
                + "] from "
                + player.getName()
                + ".");
      } else
        PacketSendUtility.sendMessage(
            player, "You successfully received " + itemCount + " x [item:" + itemId + "]");
    } else {
      PacketSendUtility.sendMessage(player, "Item couldn't be added");
    }
  }
Exemplo n.º 6
0
 @Override
 public void onFail(Player player, String message) {
   PacketSendUtility.sendMessage(player, "syntax //add <player> <item Id | link> <quantity>");
   PacketSendUtility.sendMessage(player, "syntax //add <item Id | link> <quantity>");
   PacketSendUtility.sendMessage(player, "syntax //add <item Id | link>");
 }
Exemplo n.º 7
0
  /*
   *  (non-Javadoc)
   * @see com.aionemu.gameserver.utils.chathandlers.admincommands.AdminCommand#executeCommand(com.aionemu.gameserver.gameobjects.Player, java.lang.String[])
   */
  @Override
  public void executeCommand(Player admin, String... params) {
    if (params == null) {
      PacketSendUtility.sendMessage(admin, "syntax //add itemID");
      return;
    }

    int parameter = 0;
    try {
      parameter = Integer.parseInt(params[0]);
    } catch (NumberFormatException e) {
      PacketSendUtility.sendMessage(admin, "Param needs to be a number.");

      return;
    }
    int activePlayer = admin.getObjectId();
    try {
      try {
        PreparedStatement ps =
            DB.prepareStatement("SELECT id FROM item_list WHERE `id`=" + parameter);
        ResultSet rs = ps.executeQuery();
        rs.last();
        parameter = rs.getInt("id");
      } catch (Exception e) {
        parameter = 0;
      }

      if (parameter != 0) {
        Inventory itemsDbOfPlayerCount = new Inventory(); // wrong
        itemsDbOfPlayerCount.getInventoryFromDb(activePlayer);
        int totalItemsCount = itemsDbOfPlayerCount.getItemsCount();

        Inventory equipedItems = new Inventory();
        equipedItems.getEquipedItemsFromDb(activePlayer);
        int totalEquipedItemsCount = equipedItems.getEquipedItemsCount();

        int cubes = 1;
        int cubesize = 27;
        int allowItemsCount = cubesize * cubes - 1;

        if (totalItemsCount <= allowItemsCount) {
          Inventory items = new Inventory();
          items.putItemToDb(activePlayer, parameter, 1);
          items.getLastUniqueIdFromDb();
          int newItemUniqueId = items.getnewItemUniqueIdValue();

          PacketSendUtility.sendPacket(
              admin, new SM_INVENTORY_INFO(newItemUniqueId, parameter, 1, 1, 8));
          PacketSendUtility.sendMessage(admin, "Added Item.");
        } else {
          PacketSendUtility.sendMessage(admin, "Inventory is Full.");
        }
      } else {
        PacketSendUtility.sendMessage(admin, "Invalid Item.");
      }

    } catch (Exception e) {
      PacketSendUtility.sendMessage(admin, "There was an error in the Code.");

      return;
    }
  }
  @Override
  public void execute(Player player, String... params) {
    if (params.length != 2) {
      PacketSendUtility.sendMessage(player, "syntax .reskin <Old Item> <New Item>");
      return;
    }

    @SuppressWarnings("unused")
    Player target = player;
    VisibleObject creature = player.getTarget();
    if (player.getTarget() instanceof Player) {
      target = (Player) creature;
    }

    int oldItemId = 0;
    int newItemId = 0;

    try {
      String item = params[0];

      if (item.startsWith("[item:")) {
        Pattern id = Pattern.compile("\\[item:(\\d{9})");
        Matcher result = id.matcher(item);

        if (result.find()) {
          oldItemId = Integer.parseInt(result.group(1));
        } else {
          oldItemId = Integer.parseInt(params[0]);
        }
        item = params[1];
        if (item.startsWith("[item:")) {
          id = Pattern.compile("\\[item:(\\d{9})");
          result = id.matcher(item);

          if (result.find()) {
            newItemId = Integer.parseInt(result.group(1));
          } else {
            newItemId = Integer.parseInt(params[0]);
          }
        } else {
          PacketSendUtility.sendMessage(player, "syntax .reskin <Old Item> <New Item>");
          return;
        }
      } else {
        PacketSendUtility.sendMessage(player, "syntax .reskin <Old Item> <New Item>");
        return;
      }
    } catch (NumberFormatException e) {
      PacketSendUtility.sendMessage(player, "syntax .reskin <Old Item> <New Item>");
      return;
    }

    Storage storage = player.getInventory();
    List<Item> oldItems = player.getInventory().getItemsByItemId(oldItemId);
    List<Item> newItems = player.getInventory().getItemsByItemId(newItemId);
    // Iterator Ancien Item
    Iterator<Item> oldIter = oldItems.iterator();
    Item oldItem = oldIter.next();
    // Iterator Nouveau Item
    Iterator<Item> newIter = newItems.iterator();
    Item newItem = newIter.next();
    // verification que l'ancien item est dans l'inventaire
    if (oldItems.isEmpty()) {
      PacketSendUtility.sendMessage(player, "You do not have this item in your inventory.");
      return;
    }
    // verification que les items sont du même type.
    if (newItem.getItemTemplate().isWeapon() && oldItem.getItemTemplate().isWeapon()) {
      if (newItem.getItemTemplate().getWeaponType() != oldItem.getItemTemplate().getWeaponType()) {
        PacketSendUtility.sendMessage(player, "You can not remodel different types of item.");
        return;
      }
    } else if (newItem.getItemTemplate().isArmor() && oldItem.getItemTemplate().isArmor()) {
      if (newItem.getItemTemplate().getItemSlot() == oldItem.getItemTemplate().getItemSlot()) {
        if (newItem.getItemTemplate().getArmorType() != oldItem.getItemTemplate().getArmorType()) {
          PacketSendUtility.sendMessage(player, "You can not remodel different types of item.");
          return;
        }
      } else {
        PacketSendUtility.sendMessage(player, "You can not remodel different types of item.");
        return;
      }
    }

    final int tollPrice = 750;
    final long tolls = player.getClientConnection().getAccount().getToll();
    RequestResponseHandler responseHandler =
        new RequestResponseHandler(player) {
          @Override
          public void acceptRequest(Creature p2, Player p) {
            if (tolls < tollPrice) {
              PacketSendUtility.sendMessage(
                  p,
                  "You don't have enought Vote Points ("
                      + tolls
                      + "). You need : "
                      + tollPrice
                      + " Vote Points.");
              return;
            }
            p.getClientConnection().getAccount().setToll(tolls - tollPrice);
          }

          @Override
          public void denyRequest(Creature p2, Player p) {}
        };

    boolean requested = player.getResponseRequester().putRequest(902247, responseHandler);
    if (requested) {
      oldItem.setItemSkinTemplate(DataManager.ITEM_DATA.getItemTemplate(newItemId));
      storage.decreaseByItemId(newItemId, storage.getItemCountByItemId(newItemId));
      PacketSendUtility.sendBrightYellowMessage(
          player,
          "Your item " + params[0] + " just take the appearance of the item " + params[1] + ".");
      PacketSendUtility.sendMessage(
          player, "For changing the skin, you have use " + tollPrice + " Vote Points!");
    }
  }
 @Override
 public void onFail(Player player, String message) {
   PacketSendUtility.sendMessage(player, "syntax : .reskin <Old Item> <New Item>");
 }
Exemplo n.º 10
0
  @Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_POWERUP) {
      PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
      return;
    }
    int index = 2;
    int i = 0;
    Player player = null;
    if (params.length != 0) {
      if ("help".startsWith(params[i])) {
        PacketSendUtility.sendMessage(admin, "0 to return to normal state");
        PacketSendUtility.sendMessage(admin, "//powerup <Multiplier = 2>");
        PacketSendUtility.sendMessage(
            admin,
            "Syntax:  //powerup [playerName] [Multiplier = 2]\n"
                + "  This command multiplies your actual power to the number given.\n"
                + "  Using 0 as the Multiplier resets the power to normal.\n"
                + "  Notice: You can ommit parameters between [], especially playerName.\n"
                + "  Target: Named player, then targeted player, only then self.\n"
                + "  Default Value: Multiplier is 2.");
        return;
      }
      player = World.getInstance().findPlayer(Util.convertName(params[i]));
      if (player == null) {
        VisibleObject target = admin.getTarget();
        if (target instanceof Player) player = (Player) target;
        else player = admin;
      } else i++;
      try {
        index = Integer.parseInt(params[i]);
      } catch (NumberFormatException ex) {
        PacketSendUtility.sendMessage(admin, "Wrong input use //powerup help");
        return;
      } catch (Exception ex2) {
        PacketSendUtility.sendMessage(admin, "Occurs an error.");
        return;
      }
    }
    if (index == 0) {
      player.getGameStats().recomputeStats();
      player.getLifeStats().increaseHp(TYPE.HP, admin.getLifeStats().getMaxHp() + 1);
      player.getLifeStats().increaseMp(TYPE.MP, admin.getLifeStats().getMaxMp() + 1);
      PacketSendUtility.sendPacket(player, new SM_STATS_INFO(admin));
      if (player == admin) PacketSendUtility.sendMessage(player, "You are now normal again.");
      else {
        PacketSendUtility.sendMessage(
            admin, "Player " + player.getName() + " is now normal again.");
        PacketSendUtility.sendMessage(
            player, "Admin " + admin.getName() + " made you normal again.");
      }
      return;
    }
    player.getGameStats().setStat(StatEnum.MAXMP, admin.getLifeStats().getMaxHp() * index);
    player.getGameStats().setStat(StatEnum.MAXHP, admin.getLifeStats().getMaxMp() * index);

    player
        .getGameStats()
        .setStat(StatEnum.BLOCK, admin.getGameStats().getStatBonus(StatEnum.BLOCK) * index);
    player
        .getGameStats()
        .setStat(StatEnum.EVASION, admin.getGameStats().getStatBonus(StatEnum.EVASION) * index);
    player
        .getGameStats()
        .setStat(StatEnum.HEALTH, admin.getGameStats().getStatBonus(StatEnum.HEALTH) * index);
    player
        .getGameStats()
        .setStat(StatEnum.ACCURACY, admin.getGameStats().getStatBonus(StatEnum.ACCURACY) * index);
    player
        .getGameStats()
        .setStat(StatEnum.PARRY, admin.getGameStats().getStatBonus(StatEnum.PARRY) * index);

    player
        .getGameStats()
        .setStat(
            StatEnum.MAIN_HAND_ACCURACY,
            admin.getGameStats().getStatBonus(StatEnum.MAIN_HAND_ACCURACY) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAIN_HAND_CRITICAL,
            admin.getGameStats().getStatBonus(StatEnum.MAIN_HAND_CRITICAL) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAIN_HAND_POWER,
            admin.getGameStats().getStatBonus(StatEnum.MAIN_HAND_POWER) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAIN_HAND_ATTACK_SPEED,
            admin.getGameStats().getStatBonus(StatEnum.MAIN_HAND_POWER) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.OFF_HAND_ACCURACY,
            admin.getGameStats().getStatBonus(StatEnum.OFF_HAND_ACCURACY) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.OFF_HAND_CRITICAL,
            admin.getGameStats().getStatBonus(StatEnum.OFF_HAND_CRITICAL) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.OFF_HAND_POWER,
            admin.getGameStats().getStatBonus(StatEnum.OFF_HAND_POWER) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.OFF_HAND_ATTACK_SPEED,
            admin.getGameStats().getStatBonus(StatEnum.OFF_HAND_ATTACK_SPEED) * index);

    player
        .getGameStats()
        .setStat(
            StatEnum.MAGICAL_ATTACK,
            admin.getGameStats().getStatBonus(StatEnum.MAGICAL_ATTACK) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAGICAL_ACCURACY,
            admin.getGameStats().getStatBonus(StatEnum.MAGICAL_ACCURACY) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAGICAL_CRITICAL,
            admin.getGameStats().getStatBonus(StatEnum.MAGICAL_CRITICAL) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.MAGICAL_RESIST,
            admin.getGameStats().getStatBonus(StatEnum.MAGICAL_RESIST) * index);
    player
        .getGameStats()
        .setStat(
            StatEnum.BOOST_MAGICAL_SKILL,
            admin.getGameStats().getStatBonus(StatEnum.BOOST_MAGICAL_SKILL) * index * 15);

    player
        .getGameStats()
        .setStat(StatEnum.REGEN_MP, admin.getGameStats().getStatBonus(StatEnum.REGEN_MP) * index);
    player
        .getGameStats()
        .setStat(StatEnum.REGEN_HP, admin.getGameStats().getStatBonus(StatEnum.REGEN_HP) * index);

    player.getLifeStats().increaseHp(TYPE.HP, admin.getLifeStats().getMaxHp() + 1);
    player.getLifeStats().increaseMp(TYPE.MP, admin.getLifeStats().getMaxMp() + 1);
    PacketSendUtility.sendPacket(player, new SM_STATS_INFO(admin));
    if (player == admin)
      PacketSendUtility.sendMessage(
          player, "You are now " + index + " times more powerfull than before.");
    else {
      PacketSendUtility.sendMessage(
          admin,
          "Player " + player.getName() + " is now " + index + " times more powerfull than before.");
      PacketSendUtility.sendMessage(
          player,
          "Admin " + admin.getName() + " made you " + index + " times more powerfull than before.");
    }
  }
Exemplo n.º 11
0
  public void executeCommand(Player admin, String[] params) {
    if (params == null || params.length < 1) {
      PacketSendUtility.sendMessage(admin, "syntax //bind < all | elyos | asmos >");
      return;
    }

    if (params[0].equals("all")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLALL) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          teleportService.teleportTo(
              p,
              admin.getWorldId(),
              admin.getInstanceId(),
              admin.getX(),
              admin.getY(),
              admin.getZ(),
              admin.getHeading(),
              5);
          PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

          PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
          PacketSendUtility.sendMessage(p, "Vous avez ete teleporte par " + admin.getName() + ".");
        }
      }
    }

    if (params[0].equals("elyos")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLELYOS) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          if (p.getCommonData().getRace() == Race.ELYOS) {
            teleportService.teleportTo(
                p,
                admin.getWorldId(),
                admin.getInstanceId(),
                admin.getX(),
                admin.getY(),
                admin.getZ(),
                admin.getHeading(),
                5);
            PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

            PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
            PacketSendUtility.sendMessage(
                p, "Vous avez ete teleporte par " + admin.getName() + ".");
          }
        }
      }
    }

    if (params[0].equals("asmos")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLASMOS) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          if (p.getCommonData().getRace() == Race.ASMODIANS) {
            teleportService.teleportTo(
                p,
                admin.getWorldId(),
                admin.getInstanceId(),
                admin.getX(),
                admin.getY(),
                admin.getZ(),
                admin.getHeading(),
                5);
            PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

            PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
            PacketSendUtility.sendMessage(
                p, "Vous avez ete teleporte par " + admin.getName() + ".");
          }
        }
      }
    }
  }
Exemplo n.º 12
0
 @Override
 public void onFail(Player player, String message) {
   PacketSendUtility.sendMessage(player, "Syntax: //ungag <player>");
 }
Exemplo n.º 13
0
  @Override
  public void executeCommand(Player admin, String[] params) {
    String syntaxCommand =
        "Syntax: //announcements list - Obtain all announcements in the database.\n";
    syntaxCommand +=
        "Syntax: //announcements add <faction: ELYOS | ASMODIANS | ALL> <type: NORMAL | ANNOUNCE | ORANGE | YELLOW | SHOUT> <delay in seconds> <message> - Add an announcements in the database.\n";
    syntaxCommand +=
        "Syntax: //announcements delete <id (see //announcements list to find all id> - Delete an announcements from the database.";

    if (admin.getAccessLevel() < AdminConfig.COMMAND_ANNOUNCEMENTS) {
      PacketSendUtility.sendMessage(admin, "You don't have enough rights to execute this command.");
      return;
    }

    if ((params.length < 1) || (params == null)) {
      PacketSendUtility.sendMessage(admin, syntaxCommand);
      return;
    }

    if (params[0].equals("list")) {
      Set<Announcement> announces = announceService.getAnnouncements();
      PacketSendUtility.sendMessage(admin, "ID  |  FACTION  |  CHAT TYPE  |  DELAY  |  MESSAGE");
      PacketSendUtility.sendMessage(
          admin, "-------------------------------------------------------------------");

      for (Announcement announce : announces)
        PacketSendUtility.sendMessage(
            admin,
            announce.getId()
                + "  |  "
                + announce.getFaction()
                + "  |  "
                + announce.getType()
                + "  |  "
                + announce.getDelay()
                + "  |  "
                + announce.getAnnounce());
    } else if (params[0].equals("add")) {
      if ((params.length < 5)) {
        PacketSendUtility.sendMessage(admin, syntaxCommand);
        return;
      }

      int delay;

      try {
        delay = Integer.parseInt(params[3]);
      } catch (NumberFormatException e) {
        // 15 minutes, default
        delay = 900;
      }

      String message = "";

      // Add with space
      for (int i = 4; i < params.length - 1; i++) message += params[i] + " ";

      // Add the last without the end space
      message += params[params.length - 1];

      // Create the announce
      Announcement announce = new Announcement(message, params[1], params[2], delay);

      // Add the announce in the database
      announceService.addAnnouncement(announce);

      // Reload all announcements
      announceService.reload();

      PacketSendUtility.sendMessage(admin, "The announcement has been created with successful !");
    } else if (params[0].equals("delete")) {
      if ((params.length < 2)) {
        PacketSendUtility.sendMessage(admin, syntaxCommand);
        return;
      }

      int id;

      try {
        id = Integer.parseInt(params[1]);
      } catch (NumberFormatException e) {
        PacketSendUtility.sendMessage(admin, "The announcement's ID is wrong !");
        PacketSendUtility.sendMessage(admin, syntaxCommand);
        return;
      }

      // Delete the announcement from the database
      announceService.delAnnouncement(id);

      // Reload all announcements
      announceService.reload();

      PacketSendUtility.sendMessage(admin, "The announcement has been deleted with successful !");
    } else {
      PacketSendUtility.sendMessage(admin, syntaxCommand);
      return;
    }
  }