mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-21 11:45:11 +01:00
update pdc
This commit is contained in:
parent
d643267220
commit
2825787e7e
@ -1,4 +1,4 @@
|
||||
package com.badbones69.crazyauctions.api.guis.types.transactions;
|
||||
package com.badbones69.crazyauctions.api.guis.types.other;
|
||||
|
||||
import com.badbones69.crazyauctions.Methods;
|
||||
import com.badbones69.crazyauctions.api.builders.ItemBuilder;
|
||||
@ -13,6 +13,7 @@ import com.badbones69.crazyauctions.api.GuiManager;
|
||||
import com.badbones69.crazyauctions.currency.VaultSupport;
|
||||
import io.papermc.paper.persistence.PersistentDataContainerView;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -59,17 +60,20 @@ public class BidMenu extends Holder {
|
||||
|
||||
final ItemBuilder builder = new ItemBuilder().setMaterial(Material.LIME_STAINED_GLASS_PANE).setAmount(1);
|
||||
|
||||
this.inventory.setItem(9, builder.addString("+1").addInteger(1).setName("&a+1").build());
|
||||
this.inventory.setItem(10, builder.addString("+10").addInteger(10).setName("&a+10").build());
|
||||
this.inventory.setItem(11, builder.addString("+100").addInteger(100).setName("&a+100").build());
|
||||
this.inventory.setItem(12, builder.addString("+1000").addInteger(1000).setName("&a+1000").build());
|
||||
this.inventory.setItem(14, builder.addString("-1000").addInteger(-1000).setName("&c-1000").build());
|
||||
this.inventory.setItem(15, builder.addString("-100").addInteger(-100).setName("&c-100").build());
|
||||
this.inventory.setItem(16, builder.addString("-10").addInteger(-10).setName("&c-10").build());
|
||||
this.inventory.setItem(17, builder.addString("-1").addInteger(-1).setName("&c-1").build());
|
||||
NamespacedKey auction_button = Keys.auction_button.getNamespacedKey();
|
||||
NamespacedKey auction_price = Keys.auction_price.getNamespacedKey();
|
||||
|
||||
this.inventory.setItem(9, builder.addString("+1", auction_button).addInteger(1, auction_price).setName("&a+1").build());
|
||||
this.inventory.setItem(10, builder.addString("+10", auction_button).addInteger(10, auction_price).setName("&a+10").build());
|
||||
this.inventory.setItem(11, builder.addString("+100", auction_button).addInteger(100, auction_price).setName("&a+100").build());
|
||||
this.inventory.setItem(12, builder.addString("+1000", auction_button).addInteger(1000, auction_price).setName("&a+1000").build());
|
||||
this.inventory.setItem(14, builder.addString("-1000", auction_button).addInteger(-1000, auction_price).setName("&c-1000").build());
|
||||
this.inventory.setItem(15, builder.addString("-100", auction_button).addInteger(-100, auction_price).setName("&c-100").build());
|
||||
this.inventory.setItem(16, builder.addString("-10", auction_button).addInteger(-10, auction_price).setName("&c-10").build());
|
||||
this.inventory.setItem(17, builder.addString("-1", auction_button).addInteger(-1, auction_price).setName("&c-1").build());
|
||||
this.inventory.setItem(13, getBiddingGlass(this.player, this.id));
|
||||
|
||||
this.inventory.setItem(22, new ItemBuilder().addString("bid_item").setMaterial(this.config.getString("Settings.GUISettings.OtherSettings.Bid.Item")).setAmount(1)
|
||||
this.inventory.setItem(22, new ItemBuilder().addString("bid_item", auction_button).setMaterial(this.config.getString("Settings.GUISettings.OtherSettings.Bid.Item")).setAmount(1)
|
||||
.setName(this.config.getString("Settings.GUISettings.OtherSettings.Bid.Name")).setLore(this.config.getStringList("Settings.GUISettings.OtherSettings.Bid.Lore")).build());
|
||||
|
||||
this.inventory.setItem(4, getBiddingItem(this.id));
|
||||
@ -117,11 +121,13 @@ public class BidMenu extends Holder {
|
||||
|
||||
String topBidder = data.getString("Items." + ID + ".TopBidder", "None");
|
||||
|
||||
if (support.getMoney(player) < bid) {
|
||||
Map<String, String> placeholders = new HashMap<>();
|
||||
final long money = support.getMoney(player);
|
||||
|
||||
placeholders.put("%Money_Needed%", (bid - support.getMoney(player)) + "");
|
||||
placeholders.put("%money_needed%", (bid - support.getMoney(player)) + "");
|
||||
if (money < bid) {
|
||||
final Map<String, String> placeholders = new HashMap<>();
|
||||
|
||||
placeholders.put("%Money_Needed%", String.valueOf(bid - money));
|
||||
placeholders.put("%money_needed%", String.valueOf(bid - money));
|
||||
|
||||
player.sendMessage(Messages.NEED_MORE_MONEY.getMessage(player, placeholders));
|
||||
|
||||
@ -145,8 +151,8 @@ public class BidMenu extends Holder {
|
||||
data.set("Items." + ID + ".Price", bid);
|
||||
data.set("Items." + ID + ".TopBidder", player.getUniqueId().toString());
|
||||
|
||||
Map<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("%Bid%", bid + "");
|
||||
final Map<String, String> placeholders = new HashMap<>();
|
||||
placeholders.put("%Bid%", String.valueOf(bid));
|
||||
|
||||
player.sendMessage(Messages.BID_MESSAGE.getMessage(player, placeholders));
|
||||
|
||||
@ -154,7 +160,7 @@ public class BidMenu extends Holder {
|
||||
|
||||
HolderManager.addBidding(player, 0);
|
||||
player.closeInventory();
|
||||
click();
|
||||
menu.click(player);
|
||||
}
|
||||
|
||||
case "+1", "+10", "+100", "+1000" -> {
|
@ -1,4 +1,4 @@
|
||||
package com.badbones69.crazyauctions.api.guis.types.transactions;
|
||||
package com.badbones69.crazyauctions.api.guis.types.other;
|
||||
|
||||
import com.badbones69.crazyauctions.Methods;
|
||||
import com.badbones69.crazyauctions.api.builders.ItemBuilder;
|
||||
@ -79,12 +79,12 @@ public class BuyingMenu extends Holder {
|
||||
final ItemBuilder itemBuilder = new ItemBuilder().setMaterial(id).setName(name).setAmount(1);
|
||||
|
||||
if (this.config.contains("Settings.GUISettings.OtherSettings." + key + ".Lore")) {
|
||||
itemBuilder.setLore(this.config.getStringList("Settings.GUISettings.OtherSettings." + key + ".Lore")).addString(key);
|
||||
itemBuilder.setLore(this.config.getStringList("Settings.GUISettings.OtherSettings." + key + ".Lore")).addString(key, Keys.auction_button.getNamespacedKey());
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case "Confirm" -> {
|
||||
final ItemStack itemStack = itemBuilder.addString("Confirm").build();
|
||||
final ItemStack itemStack = itemBuilder.addString("Confirm", Keys.auction_button.getNamespacedKey()).build();
|
||||
|
||||
this.inventory.setItem(0, itemStack);
|
||||
this.inventory.setItem(1, itemStack);
|
||||
@ -93,7 +93,7 @@ public class BuyingMenu extends Holder {
|
||||
}
|
||||
|
||||
case "Cancel" -> {
|
||||
final ItemStack itemStack = itemBuilder.addString("Cancel").build();
|
||||
final ItemStack itemStack = itemBuilder.addString("Cancel", Keys.auction_button.getNamespacedKey()).build();
|
||||
|
||||
this.inventory.setItem(5, itemStack);
|
||||
this.inventory.setItem(6, itemStack);
|
||||
@ -103,18 +103,18 @@ public class BuyingMenu extends Holder {
|
||||
}
|
||||
}
|
||||
|
||||
ItemBuilder itemBuilder = ItemBuilder.convertItemStack(data.getString("Items." + this.id + ".Item"));
|
||||
ItemBuilder itemBuilder = ItemBuilder.convertItemStack(this.data.getString("Items." + this.id + ".Item"));
|
||||
|
||||
List<String> lore = new ArrayList<>(itemBuilder.getUpdatedLore());
|
||||
|
||||
lore.add(" ");
|
||||
|
||||
String price = Methods.getPrice(this.id, false);
|
||||
String time = Methods.convertToTime(data.getLong("Items." + this.id + ".Time-Till-Expire"));
|
||||
String time = Methods.convertToTime(this.data.getLong("Items." + this.id + ".Time-Till-Expire"));
|
||||
|
||||
OfflinePlayer target = null;
|
||||
|
||||
String id = data.getString("Items." + this.id + ".Seller");
|
||||
String id = this.data.getString("Items." + this.id + ".Seller");
|
||||
|
||||
if (id != null) {
|
||||
target = Methods.getOfflinePlayer(id);
|
||||
@ -175,7 +175,7 @@ public class BuyingMenu extends Holder {
|
||||
String seller = data.getString("Items." + ID + ".Seller");
|
||||
|
||||
if (!data.contains("Items." + ID)) {
|
||||
click();
|
||||
menu.click(player);
|
||||
|
||||
GuiManager.openShop(player, HolderManager.getShopType(player), HolderManager.getShopCategory(player), 1);
|
||||
|
||||
@ -185,7 +185,7 @@ public class BuyingMenu extends Holder {
|
||||
}
|
||||
|
||||
if (Methods.isInvFull(player)) {
|
||||
click();
|
||||
menu.click(player);
|
||||
|
||||
player.closeInventory();
|
||||
player.sendMessage(Messages.INVENTORY_FULL.getMessage(player));
|
||||
@ -196,7 +196,7 @@ public class BuyingMenu extends Holder {
|
||||
final VaultSupport support = this.plugin.getSupport();
|
||||
|
||||
if (support.getMoney(player) < cost) {
|
||||
click();
|
||||
menu.click(player);
|
||||
player.closeInventory();
|
||||
|
||||
Map<String, String> placeholders = new HashMap<>();
|
||||
@ -248,7 +248,7 @@ public class BuyingMenu extends Holder {
|
||||
data.set("Items." + ID, null);
|
||||
Files.data.save();
|
||||
|
||||
click();
|
||||
menu.click(player);
|
||||
|
||||
GuiManager.openShop(player, HolderManager.getShopType(player), HolderManager.getShopCategory(player), 1);
|
||||
}
|
||||
@ -256,7 +256,7 @@ public class BuyingMenu extends Holder {
|
||||
case "Cancel" -> {
|
||||
GuiManager.openShop(player, HolderManager.getShopType(player), HolderManager.getShopCategory(player), 1);
|
||||
|
||||
click();
|
||||
menu.click(player);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user