Esempio n. 1
0
  @Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_ADDCUBE) {
      PacketSendUtility.sendMessage(
          admin, LanguageHandler.translate(CustomMessageId.COMMAND_NOT_ENOUGH_RIGHTS));
      return;
    }

    if (params.length != 1) {
      PacketSendUtility.sendMessage(
          admin, LanguageHandler.translate(CustomMessageId.COMMAND_ADDCUBE_SYNTAX));
      return;
    }

    Player receiver = null;

    receiver = World.getInstance().findPlayer(Util.convertName(params[0]));

    if (receiver == null) {
      PacketSendUtility.sendMessage(
          admin,
          LanguageHandler.translate(
              CustomMessageId.PLAYER_NOT_ONLINE, Util.convertName(params[0])));
      return;
    }

    if (receiver != null) {
      if (receiver.getCubeSize() < 9) {
        CubeExpandService.expand(receiver);
        PacketSendUtility.sendMessage(
            admin,
            LanguageHandler.translate(
                CustomMessageId.COMMAND_ADDCUBE_ADMIN_SUCCESS, receiver.getName()));
        PacketSendUtility.sendMessage(
            receiver,
            LanguageHandler.translate(
                CustomMessageId.COMMAND_ADDCUBE_PLAYER_SUCCESS, admin.getName()));
      } else {
        PacketSendUtility.sendMessage(
            admin,
            LanguageHandler.translate(CustomMessageId.COMMAND_ADDCUBE_FAILURE, receiver.getName()));
        return;
      }
    }
  }
Esempio n. 2
0
  @Override
  protected void runImpl() {
    Player player = getConnection().getActivePlayer();

    if (itemCount < -1 || kinahCount < 0) {
      log.info("[ANTICHEAT] Player trying to abuse CM_MAIL packet: " + player.getName());
      return;
    }

    if (player.isTrading() || kinahCount > 999999999) return;

    MailService.getInstance()
        .sendMail(
            player,
            recipientName,
            title,
            message,
            itemObjId,
            itemCount,
            kinahCount,
            express == 1,
            false);
  }