コード例 #1
0
 public void removeDepositFromVault(UUID uuid, double deposit) {
   String path =
       new StringBuilder(51)
           .append("vaults.")
           .append(uuid.toString())
           .append('.')
           .append("deposit")
           .toString();
   double original = data.getYamlConfig().getDouble(path, 0);
   double newDeposit = original - deposit;
   if (newDeposit <= 0) {
     data.set(path, null);
   } else {
     data.set(path, newDeposit);
   }
 }
コード例 #2
0
 public void addDeposit(Lot lot, Player p, double deposit) {
   String depositPath =
       new StringBuilder(86)
           .append("lots.")
           .append(lot.getUuid())
           .append(".deposit.")
           .append(p.getUniqueId())
           .toString();
   data.set(depositPath, data.getYamlConfig().getDouble(depositPath, 0) + deposit);
 }
コード例 #3
0
 public void removeDepositFromVault(UUID uuid) {
   String path =
       new StringBuilder(51)
           .append("vaults.")
           .append(uuid.toString())
           .append('.')
           .append("deposit")
           .toString();
   data.set(path, null);
 }
コード例 #4
0
 public void setLastBid(Player p, Lot lot, long lastBid) {
   String lastBidPath =
       new StringBuilder(90)
           .append("lots.")
           .append(lot.getUuid())
           .append(".bid.lastBid.")
           .append(p.getUniqueId())
           .toString();
   data.set(lastBidPath, lastBid);
 }
コード例 #5
0
 public void addDepositToVault(UUID uuid, double deposit) {
   String path =
       new StringBuilder(51)
           .append("vaults.")
           .append(uuid.toString())
           .append('.')
           .append("deposit")
           .toString();
   double original = data.getYamlConfig().getDouble(path, 0);
   data.set(path, original + deposit);
 }
コード例 #6
0
  public void hammer(Lot lot) {

    UUID buyerUuid = lot.getLastBidPlayerUuid();
    Player buyer = CompatUtils.getPlayer(buyerUuid);
    if (null == buyer || buyer.getInventory().firstEmpty() == -1) {
      String path =
          new StringBuilder(80)
              .append("vaults.")
              .append(buyerUuid.toString())
              .append('.')
              .append(lot.getUuid())
              .toString();
      data.set(path, lot.getItem());
    } else {
      unoccupyVault(buyerUuid);
      buyer.getInventory().addItem(lot.getItem());
    }

    if (buyer != null) buyer.sendMessage(localeManager.getLocalizedString("ui.hammerBuyer"));

    Map<UUID, Double> deposit = getDeposit(lot);
    deposit.remove(buyerUuid);

    for (Entry<UUID, Double> e : deposit.entrySet()) {

      Player p = CompatUtils.getPlayer(e.getKey());

      if (null != p) {
        p.sendMessage(localeManager.getLocalizedString("ui.hammerOthers"));
        Main.economy.depositPlayer(p, e.getValue());
      } else {
        addDepositToVault(e.getKey(), e.getValue());
      }

      unoccupyVault(e.getKey());
    }

    removeLot(lot);
  }
コード例 #7
0
 private void removeFromBackend(Lot lot) {
   data.set("lots." + lot.getUuid().toString(), null);
 }