Ejemplo n.º 1
0
 public void writeAuditLog(String account, String action, Double amount, String economy) {
   String statement = "";
   if (hc.s().gB("sql-connection.use-mysql")) {
     statement =
         "Insert Into hyperconomy_audit_log (TIME, ACCOUNT, ACTION, AMOUNT, ECONOMY) Values (NOW(),'"
             + account
             + "','"
             + action
             + "','"
             + amount
             + "','"
             + economy
             + "')";
   } else {
     statement =
         "Insert Into hyperconomy_audit_log (TIME, ACCOUNT, ACTION, AMOUNT, ECONOMY) Values (datetime('NOW', 'localtime'),'"
             + account
             + "','"
             + action
             + "','"
             + amount
             + "','"
             + economy
             + "')";
   }
   hc.getSQLWrite().executeSQL(statement);
 }
Ejemplo n.º 2
0
  Esell(Player player, String[] args) {
    HyperConomy hc = HyperConomy.hc;
    LanguageFile L = hc.getLanguageFile();
    ShopFactory s = hc.getShopFactory();
    DataHandler dh = hc.getDataFunctions();
    InventoryManipulation im = hc.getInventoryManipulation();
    try {
      if (player.getGameMode() == GameMode.CREATIVE
          && hc.s().gB("block-selling-in-creative-mode")) {
        player.sendMessage(L.get("CANT_SELL_CREATIVE"));
        return;
      }
      if (s.inAnyShop(player)) {
        HyperPlayer hp = dh.getHyperPlayer(player);
        if (hp.hasSellPermission(s.getShop(player))) {
          String name = args[0];
          if (args[0].equalsIgnoreCase("max")) {
            if (!im.hasenchants(player.getItemInHand())) {
              player.sendMessage(L.get("HAS_NO_ENCHANTMENTS"));
            }
            ArrayList<String> enchants = im.getEnchantments(player.getItemInHand());
            for (String e : enchants) {
              if (s.getShop(player).has(e)) {
                PlayerTransaction pt = new PlayerTransaction(TransactionType.SELL);
                pt.setHyperObject(dh.getHyperObject(e, hp.getEconomy()));
                TransactionResponse response = hp.processTransaction(pt);
                response.sendMessages();
              } else {
                player.sendMessage(L.get("CANT_BE_TRADED"));
              }
            }

          } else {
            if (hc.getDataFunctions().enchantTest(name)) {
              if (s.getShop(player).has(name)) {
                PlayerTransaction pt = new PlayerTransaction(TransactionType.SELL);
                pt.setHyperObject(dh.getHyperObject(name, hp.getEconomy()));
                TransactionResponse response = hp.processTransaction(pt);
                response.sendMessages();
              } else {
                player.sendMessage(L.get("CANT_BE_TRADED"));
              }
            } else {
              player.sendMessage(L.get("ENCHANTMENT_NOT_IN_DATABASE"));
            }
          }
        } else {
          player.sendMessage(L.get("NO_TRADE_PERMISSION"));
        }
      } else {
        player.sendMessage(L.get("MUST_BE_IN_SHOP"));
      }
    } catch (Exception e) {
      player.sendMessage(L.get("ESELL_INVALID"));
    }
  }
Ejemplo n.º 3
0
 public void writeSQLLog(
     String playername,
     String action,
     String object,
     Double amount,
     Double money,
     Double tax,
     String store,
     String type) {
   String statement = "";
   if (hc.s().gB("sql-connection.use-mysql")) {
     statement =
         "Insert Into hyperconomy_log (TIME, CUSTOMER, ACTION, OBJECT, AMOUNT, MONEY, TAX, STORE, TYPE)"
             + " Values (NOW(),'"
             + playername
             + "','"
             + action
             + "','"
             + object
             + "','"
             + amount
             + "','"
             + hc.getCalculation().twoDecimals(money)
             + "','"
             + hc.getCalculation().twoDecimals(tax)
             + "','"
             + store
             + "','"
             + type
             + "')";
   } else {
     statement =
         "Insert Into hyperconomy_log (TIME, CUSTOMER, ACTION, OBJECT, AMOUNT, MONEY, TAX, STORE, TYPE)"
             + " Values (datetime('NOW', 'localtime'),'"
             + playername
             + "','"
             + action
             + "','"
             + object
             + "','"
             + amount
             + "','"
             + hc.getCalculation().twoDecimals(money)
             + "','"
             + hc.getCalculation().twoDecimals(tax)
             + "','"
             + store
             + "','"
             + type
             + "')";
   }
   hc.getSQLWrite().executeSQL(statement);
 }