Added help messages for buy/sell commands
This commit is contained in:
parent
219c9024bd
commit
10b4b52297
|
|
@ -22,15 +22,13 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
public class BuyGUI extends GUIMerchant {
|
||||
|
||||
private static final MiniMessage miniMessage = MiniMessage.miniMessage();
|
||||
private static final ItemStack confirm;
|
||||
private long lastClicked = 0;
|
||||
|
||||
static {
|
||||
ItemStack itemStack = new ItemStack(Material.EMERALD_BLOCK);
|
||||
|
|
@ -82,6 +80,13 @@ public class BuyGUI extends GUIMerchant {
|
|||
}
|
||||
|
||||
private void buy2(Player player, Purchase purchase, EconUser econUser, VillagerType villagerType, int oldPoints, Price price) {
|
||||
long newTime = new Date().getTime();
|
||||
if ((newTime - 120) > lastClicked)
|
||||
lastClicked = newTime;
|
||||
else {
|
||||
player.sendMiniMessage(Config.CLICKING_TOO_FAST, null);
|
||||
return;
|
||||
}
|
||||
Economy econ = VillagerUI.getInstance().getEconomy();
|
||||
double balance = econ.getBalance(player);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,20 +21,18 @@ import org.bukkit.Material;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.MerchantInventory;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
public class SellGUI extends GUIMerchant {
|
||||
|
||||
private static final MiniMessage miniMessage = MiniMessage.miniMessage();
|
||||
private static final ItemStack confirm;
|
||||
|
||||
private long lastClicked = 0;
|
||||
|
||||
static {
|
||||
ItemStack itemStack = new ItemStack(Material.EMERALD_BLOCK);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
|
@ -87,6 +85,13 @@ public class SellGUI extends GUIMerchant {
|
|||
}
|
||||
|
||||
private void sell2(Player player, Purchase purchase, EconUser econUser, VillagerType villagerType, int oldPoints, Price price, boolean bulk) {
|
||||
long newTime = new Date().getTime();
|
||||
if ((newTime - 120) > lastClicked)
|
||||
lastClicked = newTime;
|
||||
else {
|
||||
player.sendMiniMessage(Config.CLICKING_TOO_FAST, null);
|
||||
return;
|
||||
}
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
if (!inventory.containsAtLeast(new ItemStack(purchase.material()), purchase.amount())) {
|
||||
player.sendMiniMessage(Config.NOT_ENOUGH_ITEMS, List.of(
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ public final class Config extends AbstractConfig {
|
|||
public static String HELP_MESSAGE_WRAPPER = "<gold>VillagerShopUI help:\n<commands></gold>";
|
||||
public static String HELP_MESSAGE = "<green>Show this menu: <gold>/villagerui help</gold></green>";
|
||||
public static String POINTS_MESSAGE = "<green>Show points: <gold>/villagerui points [villagerType]</green>";
|
||||
public static String BUY_MESSAGE = "<green>Check where/if you can buy an item: <gold>/villagerui buy <item_name></green>";
|
||||
public static String SELL_MESSAGE = "<green>Check where/if you can sell an item: <gold>/villagerui sell <item_name></green>";
|
||||
public static String RELOAD_MESSAGE = "<green>Reload configs: <gold>/villagerui reload</gold></green>";
|
||||
public static String CREATE_VILLAGER_MESSAGE = "<green>Create a new trading villager: <gold>/villagerui createvillager <type> <biome> <x> <y> <z> <yaw> <pitch> <world></gold></green>";
|
||||
public static String REMOVE_VILLAGER_MESSAGE = "<green>Removes all existing trading villagers in a 2 block radius: <gold>/villagerui removevillager</gold></green>";
|
||||
|
|
@ -65,6 +67,8 @@ public final class Config extends AbstractConfig {
|
|||
HELP_MESSAGE_WRAPPER = config.getString("help.help-wrapper", HELP_MESSAGE_WRAPPER);
|
||||
HELP_MESSAGE = config.getString("help.help", HELP_MESSAGE);
|
||||
POINTS_MESSAGE = config.getString("help.points", POINTS_MESSAGE);
|
||||
BUY_MESSAGE = config.getString("help.buy", BUY_MESSAGE);
|
||||
SELL_MESSAGE = config.getString("help.sell", SELL_MESSAGE);
|
||||
RELOAD_MESSAGE = config.getString("help.reload", RELOAD_MESSAGE);
|
||||
CREATE_VILLAGER_MESSAGE = config.getString("help.create-villager", CREATE_VILLAGER_MESSAGE);
|
||||
REMOVE_VILLAGER_MESSAGE = config.getString("help.remove-villager", REMOVE_VILLAGER_MESSAGE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user