🏷️ item_name, from_name, payment_reason added to payment item

Took 37 minutes
This commit is contained in:
Kiran Hart 2023-03-11 16:45:16 -05:00
parent dca19078c5
commit d30642daaa
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
20 changed files with 248 additions and 27 deletions

View File

@ -223,7 +223,8 @@ public class AuctionHouse extends TweetyPlugin {
new _14_PartialQtyBuyMigration(),
new _15_AuctionPlayerMigration(),
new _16_StatisticVersionTwoMigration(),
new _17_PaymentsMigration()
new _17_PaymentsMigration(),
new _18_PaymentsItemMigration()
);
dataMigrationManager.runMigrations();

View File

@ -21,6 +21,7 @@ package ca.tweetzy.auctionhouse.api;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.auction.AuctionPayment;
import ca.tweetzy.auctionhouse.auction.MinItemPrice;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.compatibility.ServerVersion;
@ -684,9 +685,9 @@ public class AuctionAPI {
}
}
public void depositBalance(OfflinePlayer player, double amount) {
public void depositBalance(OfflinePlayer player, double amount, ItemStack item, OfflinePlayer paidFrom) {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean()) {
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(player.getUniqueId(), amount), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(player.getUniqueId(), amount, item, paidFrom.getName(), PaymentReason.ITEM_SOLD), null);
return;
}

View File

@ -20,10 +20,12 @@ package ca.tweetzy.auctionhouse.auction;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.core.hooks.EconomyManager;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.UUID;
@ -33,11 +35,16 @@ public final class AuctionPayment {
private final UUID id;
private final UUID to;
private final ItemStack item;
private final String fromName;
private final PaymentReason reason;
private final double amount;
private final long time;
public AuctionPayment(UUID to, double amount) {
this(UUID.randomUUID(), to, amount, System.currentTimeMillis());
public AuctionPayment(UUID to, double amount, ItemStack item, String fromName, PaymentReason reason) {
this(UUID.randomUUID(), to, item, fromName, reason, amount, System.currentTimeMillis());
}

View File

@ -0,0 +1,44 @@
/*
* Auction House
* Copyright 2023 Kiran Hart
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ca.tweetzy.auctionhouse.auction.enums;
import ca.tweetzy.auctionhouse.AuctionHouse;
public enum PaymentReason {
LISTING_FAILED,
ITEM_SOLD,
ADMIN_REMOVED,
BID_RETURNED;
public String getTranslation() {
switch (this) {
case LISTING_FAILED:
return AuctionHouse.getInstance().getLocale().getMessage("payments.listing failed").getMessage();
case ITEM_SOLD:
return AuctionHouse.getInstance().getLocale().getMessage("payments.item sold").getMessage();
case ADMIN_REMOVED:
return AuctionHouse.getInstance().getLocale().getMessage("payments.admin removed").getMessage();
case BID_RETURNED:
return AuctionHouse.getInstance().getLocale().getMessage("payments.bid returned").getMessage();
}
return this.name();
}
}

View File

@ -618,7 +618,7 @@ public class DataManager extends DataManagerAbstract {
public void insertAuctionPayment(AuctionPayment auctionPayment, Callback<AuctionPayment> callback) {
this.thread.execute(() -> this.databaseConnector.connect(connection -> {
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + getTablePrefix() + "payments (uuid, payment_for, amount, time) VALUES (?, ?, ?, ?)")) {
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + getTablePrefix() + "payments (uuid, payment_for, amount, time, item, from_name, reason) VALUES (?, ?, ?, ?, ?, ?, ?)")) {
PreparedStatement fetch = connection.prepareStatement("SELECT * FROM " + this.getTablePrefix() + "payments WHERE uuid = ?");
fetch.setString(1, auctionPayment.getId().toString());
@ -626,6 +626,10 @@ public class DataManager extends DataManagerAbstract {
statement.setString(2, auctionPayment.getTo().toString());
statement.setDouble(3, auctionPayment.getAmount());
statement.setLong(4, auctionPayment.getTime());
statement.setString(5, AuctionAPI.encodeItem(auctionPayment.getItem()));
statement.setString(6, auctionPayment.getFromName());
statement.setString(7, auctionPayment.getReason().name());
statement.executeUpdate();
// insert into storage
@ -661,6 +665,9 @@ public class DataManager extends DataManagerAbstract {
return new AuctionPayment(
UUID.fromString(resultSet.getString("uuid")),
UUID.fromString(resultSet.getString("payment_for")),
(resultSet.getString("item") == null || resultSet.getString("item").trim().isEmpty()) ? null : AuctionAPI.decodeItem(resultSet.getString("item")),
(resultSet.getString("from_name") == null || resultSet.getString("from_name").trim().isEmpty()) ? null : resultSet.getString("from_name"),
(resultSet.getString("reason") == null || resultSet.getString("reason").trim().isEmpty()) ? PaymentReason.ITEM_SOLD : PaymentReason.valueOf(resultSet.getString("reason")),
resultSet.getDouble("amount"),
resultSet.getLong("time")
);

View File

@ -0,0 +1,48 @@
/*
* Auction House
* Copyright 2018-2022 Kiran Hart
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ca.tweetzy.auctionhouse.database.migrations;
import ca.tweetzy.core.database.DataMigration;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
/**
* The current file has been created by Kiran Hart
* Date Created: September 08 2022
* Time Created: 9:13 a.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class _18_PaymentsItemMigration extends DataMigration {
public _18_PaymentsItemMigration() {
super(18);
}
@Override
public void migrate(Connection connection, String tablePrefix) throws SQLException {
try (Statement statement = connection.createStatement()) {
statement.execute("ALTER TABLE " + tablePrefix + "payments ADD item TEXT NULL");
statement.execute("ALTER TABLE " + tablePrefix + "payments ADD from_name VARCHAR(48) NULL");
statement.execute("ALTER TABLE " + tablePrefix + "payments ADD reason VARCHAR(48) NULL");
}
}
}

View File

@ -24,6 +24,7 @@ import ca.tweetzy.auctionhouse.auction.AuctionPayment;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmCancel;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.managers.SoundManager;
@ -98,7 +99,13 @@ public class GUIActiveAuctions extends AbstractPlaceholderGui {
final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(item.getHighestBidder());
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), item.getCurrentPrice()), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
oldBidder.getUniqueId(),
item.getCurrentPrice(),
item.getItem(),
AuctionHouse.getInstance().getLocale().getMessage("prefix").getMessage(),
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, item.getCurrentPrice());

View File

@ -26,10 +26,7 @@ import ca.tweetzy.auctionhouse.api.hook.PlaceholderAPIHook;
import ca.tweetzy.auctionhouse.auction.AuctionPayment;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AuctionItemCategory;
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
import ca.tweetzy.auctionhouse.auction.enums.AuctionSortType;
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
import ca.tweetzy.auctionhouse.auction.enums.*;
import ca.tweetzy.auctionhouse.guis.admin.GUIAdminItem;
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmBid;
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmPurchase;
@ -338,7 +335,13 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
if (!auctionItem.getHighestBidder().equals(auctionItem.getOwner())) {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), oldBidAmount), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
oldBidder.getUniqueId(),
oldBidAmount,
auctionItem.getItem(),
AuctionHouse.getInstance().getLocale().getMessage("prefix").getMessage(),
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, oldBidAmount);
if (oldBidder.isOnline())

View File

@ -24,6 +24,7 @@ import ca.tweetzy.auctionhouse.api.events.AuctionBidEvent;
import ca.tweetzy.auctionhouse.auction.AuctionPayment;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.guis.confirmation.GUIConfirmBid;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
import ca.tweetzy.auctionhouse.helpers.input.TitleInput;
@ -154,7 +155,13 @@ public class GUIBid extends AbstractPlaceholderGui {
if (!auctionItem.getHighestBidder().equals(auctionItem.getOwner())) {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), oldBidAmount), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
oldBidder.getUniqueId(),
oldBidAmount,
auctionItem.getItem(),
AuctionHouse.getInstance().getLocale().getMessage("prefix").getMessage(),
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, oldBidAmount);
if (oldBidder.isOnline())

View File

@ -28,6 +28,7 @@ import ca.tweetzy.auctionhouse.managers.SoundManager;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.flight.utils.Replacer;
import org.bukkit.event.inventory.ClickType;
import java.util.Collections;
@ -109,7 +110,12 @@ public class GUIPaymentCollection extends AbstractPlaceholderGui {
setButton(slot++, QuickItem
.of(Settings.GUI_PAYMENT_COLLECTION_PAYMENT_ITEM.getString())
.name(PlaceholderAPIHook.PAPIReplacer.tryReplace(this.player, Settings.GUI_PAYMENT_COLLECTION_PAYMENT_NAME.getString().replace("%payment_amount%", AuctionAPI.getInstance().formatNumber(auctionPayment.getAmount()))))
.lore(PlaceholderAPIHook.PAPIReplacer.tryReplace(this.player, Settings.GUI_PAYMENT_COLLECTION_PAYMENT_LORE.getStringList()))
.lore(Replacer.replaceVariables(
PlaceholderAPIHook.PAPIReplacer.tryReplace(this.player, Settings.GUI_PAYMENT_COLLECTION_PAYMENT_LORE.getStringList()),
"item_name", auctionPayment.getItem() == null ? "&cN/A" : AuctionAPI.getInstance().getItemName(auctionPayment.getItem()),
"from_name",auctionPayment.getFromName(),
"payment_reason", auctionPayment.getReason().getTranslation()
))
.make(), ClickType.LEFT, e -> {
if (this.lastClicked == null) {

View File

@ -26,6 +26,7 @@ import ca.tweetzy.auctionhouse.auction.AuctionPayment;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AdminAction;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.helpers.ConfigurationItemHelper;
@ -80,7 +81,13 @@ public class GUIAdminItem extends AbstractPlaceholderGui {
final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(this.auctionItem.getHighestBidder());
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice()), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
oldBidder.getUniqueId(),
auctionItem.getCurrentPrice(),
auctionItem.getItem(),
e.player.getName(),
PaymentReason.ADMIN_REMOVED
), null);
else
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
@ -105,7 +112,13 @@ public class GUIAdminItem extends AbstractPlaceholderGui {
final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(this.auctionItem.getHighestBidder());
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice()), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
oldBidder.getUniqueId(),
auctionItem.getCurrentPrice(),
auctionItem.getItem(),
e.player.getName(),
PaymentReason.ADMIN_REMOVED
), null);
else
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
@ -129,7 +142,13 @@ public class GUIAdminItem extends AbstractPlaceholderGui {
final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(this.auctionItem.getHighestBidder());
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice()), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
oldBidder.getUniqueId(),
auctionItem.getCurrentPrice(),
auctionItem.getItem(),
e.player.getName(),
PaymentReason.ADMIN_REMOVED
), null);
else
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());

View File

@ -24,6 +24,7 @@ import ca.tweetzy.auctionhouse.api.events.AuctionBidEvent;
import ca.tweetzy.auctionhouse.auction.AuctionPayment;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
import ca.tweetzy.auctionhouse.settings.Settings;
@ -148,7 +149,13 @@ public class GUIConfirmBid extends AbstractPlaceholderGui {
if (!auctionItem.getHighestBidder().equals(auctionItem.getOwner())) {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), oldBidAmount), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
oldBidder.getUniqueId(),
oldBidAmount,
auctionItem.getItem(),
AuctionHouse.getInstance().getLocale().getMessage("prefix").getMessage(),
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, oldBidAmount);

View File

@ -24,6 +24,7 @@ import ca.tweetzy.auctionhouse.auction.AuctionPayment;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIActiveAuctions;
import ca.tweetzy.auctionhouse.settings.Settings;
@ -74,7 +75,14 @@ public class GUIConfirmCancel extends AbstractPlaceholderGui {
final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(located.getHighestBidder());
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(auctionItem.getOwner(), located.getCurrentPrice()), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
auctionItem.getOwner(),
located.getCurrentPrice(),
auctionItem.getItem(),
AuctionHouse.getInstance().getLocale().getMessage("prefix").getMessage(),
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, located.getCurrentPrice());

View File

@ -26,6 +26,7 @@ import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.AuctionSaleType;
import ca.tweetzy.auctionhouse.auction.enums.AuctionStackType;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.exception.ItemNotFoundException;
import ca.tweetzy.auctionhouse.guis.AbstractPlaceholderGui;
import ca.tweetzy.auctionhouse.guis.GUIAuctionHouse;
@ -184,7 +185,13 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui {
final OfflinePlayer oldBidder = Bukkit.getOfflinePlayer(located.getHighestBidder());
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(oldBidder.getUniqueId(), auctionItem.getCurrentPrice()), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
oldBidder.getUniqueId(),
auctionItem.getCurrentPrice(),
auctionItem.getItem(),
AuctionHouse.getInstance().getLocale().getMessage("prefix").getMessage(),
PaymentReason.BID_RETURNED
), null);
else
EconomyManager.deposit(oldBidder, auctionItem.getCurrentPrice());
@ -246,7 +253,7 @@ public class GUIConfirmPurchase extends AbstractPlaceholderGui {
double tax = Settings.TAX_ENABLED.getBoolean() ? (Settings.TAX_SALES_TAX_BUY_NOW_PERCENTAGE.getDouble() / 100) * amount : 0D;
AuctionAPI.getInstance().withdrawBalance(from, Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? amount + tax : amount) : Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? amount + tax : amount);
AuctionAPI.getInstance().depositBalance(Bukkit.getOfflinePlayer(this.auctionItem.getOwner()), Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? amount : amount - tax) : Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? amount : amount - tax);
AuctionAPI.getInstance().depositBalance(Bukkit.getOfflinePlayer(this.auctionItem.getOwner()), Settings.ROUND_ALL_PRICES.getBoolean() ? Math.round(Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? amount : amount - tax) : Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? amount : amount - tax, auctionItem.getItem(), from);
}
private void sendMessages(GuiClickEvent e, AuctionedItem located, boolean overwritePrice, double price, int qtyOverride) {

View File

@ -26,6 +26,7 @@ import ca.tweetzy.auctionhouse.api.hook.McMMOHook;
import ca.tweetzy.auctionhouse.auction.AuctionPayment;
import ca.tweetzy.auctionhouse.auction.AuctionPlayer;
import ca.tweetzy.auctionhouse.auction.AuctionedItem;
import ca.tweetzy.auctionhouse.auction.enums.PaymentReason;
import ca.tweetzy.auctionhouse.managers.SoundManager;
import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.hooks.EconomyManager;
@ -173,7 +174,13 @@ public final class AuctionCreator {
// If the item could not be added for whatever reason and the tax listing fee is enabled, refund them
if (Settings.TAX_ENABLED.getBoolean() && Settings.TAX_CHARGE_LISTING_FEE.getBoolean()) {
if (Settings.STORE_PAYMENTS_FOR_MANUAL_COLLECTION.getBoolean())
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(seller.getUniqueId(), listingFee), null);
AuctionHouse.getInstance().getDataManager().insertAuctionPayment(new AuctionPayment(
seller.getUniqueId(),
listingFee,
auctionItem.getItem(),
AuctionHouse.getInstance().getLocale().getMessage("prefix").getMessage(),
PaymentReason.LISTING_FAILED
), null);
else
EconomyManager.deposit(seller, listingFee);
AuctionHouse.getInstance().getLocale().getMessage("pricing.moneyadd").processPlaceholder("player_balance", AuctionAPI.getInstance().formatNumber(EconomyManager.getBalance(seller))).processPlaceholder("price", AuctionAPI.getInstance().formatNumber(listingFee)).sendPrefixedMessage(seller);

View File

@ -60,6 +60,38 @@ import java.util.List;
*/
public class PlayerListeners implements Listener {
// @EventHandler
// public void onUserDeath(final PlayerDeathEvent event) {
// final Player player = event.getEntity().getPlayer();
// if (player == null) return;
// if (event.getDrops().isEmpty()) return;
//
// // get the death location
// final Location deathLocation = player.getLocation();
//
// // get the block at the location
// final Block blockAtDeath = deathLocation.getBlock();
//
// // if the block at death location is not a chest, then set as chest
// if (blockAtDeath.getType() != Material.CHEST)
// blockAtDeath.setType(Material.CHEST);
//
// final Chest chest = (Chest) blockAtDeath.getState();
//
// for (ItemStack itemToFill : player.getInventory().getContents()) {
// if (itemToFill == null) continue;
//
// // check if full otherwise just drop to ground
// if (chest.getInventory().firstEmpty() == -1)
// chest.getWorld().dropItemNaturally(deathLocation, itemToFill);
// else
// chest.getInventory().addItem(itemToFill);
// }
//
// // clear drops (to prevent dropping to ground after placed in chest)
// event.getDrops().clear();
// }
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
final Player player = event.getEntity();

View File

@ -189,6 +189,11 @@ public class LocaleSettings {
languageNodes.put("admin action.delete", "Deleted");
languageNodes.put("admin action.copy", "Copied");
languageNodes.put("payments.listing failed", "&cItem could not listed, fee returned");
languageNodes.put("payments.item sold", "&aThis item was sold/won by someone");
languageNodes.put("payments.admin removed", "&cItem was removed by an admin");
languageNodes.put("payments.bid returned", "&bOutbid, your original bid was returned");
languageNodes.put("commands.invalid_syntax", "&7The valid syntax is: &6%syntax%&7.");
languageNodes.put("commands.no_permission", "&dYou do not have permission to do that.");
languageNodes.put("commands.sell.args.suggestion one", "100");

View File

@ -692,7 +692,12 @@ public class Settings {
public static final ConfigSetting GUI_PAYMENT_COLLECTION_PAYMENT_ITEM = new ConfigSetting(config, "gui.payment collection.payment.item", "PAPER");
public static final ConfigSetting GUI_PAYMENT_COLLECTION_PAYMENT_NAME = new ConfigSetting(config, "gui.payment collection.payment.name", "&a&l$%payment_amount%");
public static final ConfigSetting GUI_PAYMENT_COLLECTION_PAYMENT_LORE = new ConfigSetting(config, "gui.payment collection.payment.lore", Collections.singletonList(
public static final ConfigSetting GUI_PAYMENT_COLLECTION_PAYMENT_LORE = new ConfigSetting(config, "gui.payment collection.payment.lore", Arrays.asList(
"&7Item&f: &e%item_name%",
"&7From&f: &e%from_name%",
"&7Reason&f:",
"&e%payment_reason%",
"",
"&7Click here to claim this payment"
));

View File

@ -143,7 +143,7 @@ public class TickAuctionsTask extends BukkitRunnable {
if (!Settings.BIDDING_TAKES_MONEY.getBoolean())
AuctionAPI.getInstance().withdrawBalance(auctionWinner, Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice + tax : finalPrice);
AuctionAPI.getInstance().depositBalance(Bukkit.getOfflinePlayer(auctionItem.getOwner()), Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice : finalPrice - tax);
AuctionAPI.getInstance().depositBalance(Bukkit.getOfflinePlayer(auctionItem.getOwner()), Settings.TAX_CHARGE_SALES_TAX_TO_BUYER.getBoolean() ? finalPrice : finalPrice - tax, auctionItem.getItem(), auctionWinner);
// alert seller and buyer
if (Bukkit.getOfflinePlayer(auctionItem.getOwner()).isOnline()) {