diff --git a/src/main/java/com/alttd/playershops/commands/subcommands/CheckStockCommand.java b/src/main/java/com/alttd/playershops/commands/subcommands/CheckStockCommand.java index 8c8adcf..b74676a 100644 --- a/src/main/java/com/alttd/playershops/commands/subcommands/CheckStockCommand.java +++ b/src/main/java/com/alttd/playershops/commands/subcommands/CheckStockCommand.java @@ -8,6 +8,7 @@ import com.alttd.playershops.shop.PlayerShop; import com.alttd.playershops.utils.ShopUtil; import com.alttd.playershops.utils.Util; import com.destroystokyo.paper.ParticleBuilder; +import net.kyori.adventure.chat.ChatType; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; @@ -48,11 +49,11 @@ public class CheckStockCommand implements Subcommand { public boolean doStockCheck(final CommandSender sender, final String[] args) { if (!(sender instanceof Player player)) { - sender.sendMessage(Util.parseMiniMessage("Only players can use this command.")); + sender.sendRichMessage("Only players can use this command."); return false; } if (args.length != 1 && args.length != 2) { - player.sendMessage(Util.parseMiniMessage("Invalid command syntax, use /checkstock [minimum stock]")); + player.sendRichMessage("Invalid command syntax, use /checkstock [minimum stock]"); return false; } @@ -60,12 +61,12 @@ public class CheckStockCommand implements Subcommand { try { radius = Integer.parseInt(args[0]); } catch (NumberFormatException e) { - player.sendMessage(Util.parseMiniMessage("radius has to be a valid number, use /checkstock [minimum stock]")); + player.sendRichMessage("radius has to be a valid number, use /checkstock [minimum stock]"); return false; } if (radius > 100 || radius <= 0) { - player.sendMessage(Util.parseMiniMessage("Please keep the radius between 1 and 100")); + player.sendRichMessage("Please keep the radius between 1 and 100"); return false; } @@ -73,7 +74,7 @@ public class CheckStockCommand implements Subcommand { try { minimumStock = Integer.parseInt(args[1]); } catch (NumberFormatException e) { - player.sendMessage(Util.parseMiniMessage("minimum stock has to be a valid number, use /checkstock [minimum stock]")); + player.sendRichMessage("minimum stock has to be a valid number, use /checkstock [minimum stock]"); return false; } } @@ -175,11 +176,11 @@ public class CheckStockCommand implements Subcommand { } if (component == null) if (minimumStock == -1) - player.sendMessage(Util.parseMiniMessage("No shops that you have permission to view found in specified radius.")); + player.sendRichMessage("No shops that you have permission to view found in specified radius."); else - player.sendMessage(Util.parseMiniMessage( + player.sendRichMessage( "No shops with less than stock found.", - TagResolver.resolver(Placeholder.parsed("minimum_stock", minimumStock + "")))); + TagResolver.resolver(Placeholder.parsed("minimum_stock", minimumStock + ""))); else player.sendMessage(component); } diff --git a/src/main/java/com/alttd/playershops/commands/subcommands/TransferShopsCommand.java b/src/main/java/com/alttd/playershops/commands/subcommands/TransferShopsCommand.java index 6bbef4c..2b96a27 100644 --- a/src/main/java/com/alttd/playershops/commands/subcommands/TransferShopsCommand.java +++ b/src/main/java/com/alttd/playershops/commands/subcommands/TransferShopsCommand.java @@ -33,31 +33,31 @@ public class TransferShopsCommand implements Subcommand { @Override public boolean execute(CommandSender sender, String subCommand, String[] args) { if (!(sender instanceof Player player)) { - sender.sendMiniMessage("Only players can use this command.", null); + sender.sendRichMessage("Only players can use this command."); return false; } if (args.length != 1 && args.length != 2) { - player.sendMiniMessage("Invalid command syntax, use /transfershops ", null); + player.sendRichMessage("Invalid command syntax, use /transfershops "); return false; } OfflinePlayer oldOfflinePlayer = Bukkit.getOfflinePlayer(args[0]); if (!oldOfflinePlayer.hasPlayedBefore()) { - player.sendMiniMessage("" + args[0] + " has not joined this server before.", null); + player.sendRichMessage("" + args[0] + " has not joined this server before."); return false; } Player newShopOwner = Bukkit.getPlayer(args[1]); if (newShopOwner == null) { - player.sendMiniMessage("" + args[1] + " is not online and has to be online for this process.", null); + player.sendRichMessage("" + args[1] + " is not online and has to be online for this process."); return false; } UUID oldUUID = oldOfflinePlayer.getUniqueId(); List playerShops = PlayerShops.getInstance().getShopHandler().getShops(oldUUID); - sender.sendMiniMessage("Starting the transfer process now, this might lag the server.", null); + sender.sendRichMessage("Starting the transfer process now, this might lag the server."); for (PlayerShop playerShop : playerShops) { playerShop.setOwner(newShopOwner); } - newShopOwner.sendMiniMessage(playerShops.size() + " have been transferred to you.", null); - sender.sendMiniMessage(playerShops.size() + " have been transferred to " + args[1] + ".", null); + newShopOwner.sendRichMessage(playerShops.size() + " have been transferred to you."); + sender.sendRichMessage(playerShops.size() + " have been transferred to " + args[1] + "."); return true; } diff --git a/src/main/java/com/alttd/playershops/gui/ListShopsGui.java b/src/main/java/com/alttd/playershops/gui/ListShopsGui.java index ca56fc7..f8f1a03 100644 --- a/src/main/java/com/alttd/playershops/gui/ListShopsGui.java +++ b/src/main/java/com/alttd/playershops/gui/ListShopsGui.java @@ -95,7 +95,7 @@ public class ListShopsGui extends AbstractGui { Placeholder.parsed("balance", String.valueOf(d)), Placeholder.parsed("count", String.valueOf(count)) ); - player.sendMiniMessage(count > 0 ? "You have collected from shops." : "No shops to be collected from.", placeholders); + player.sendRichMessage(count > 0 ? "You have collected from shops." : "No shops to be collected from.", placeholders); return; } diff --git a/src/main/java/com/alttd/playershops/gui/ShopManagementGui.java b/src/main/java/com/alttd/playershops/gui/ShopManagementGui.java index 2bc5067..349ea11 100644 --- a/src/main/java/com/alttd/playershops/gui/ShopManagementGui.java +++ b/src/main/java/com/alttd/playershops/gui/ShopManagementGui.java @@ -98,7 +98,7 @@ public class ShopManagementGui extends AbstractGui { Placeholder.parsed("balance", String.valueOf(d)), Placeholder.parsed("count", String.valueOf(count)) ); - player.sendMiniMessage("You have collected from shops.", placeholders); + player.sendRichMessage("You have collected from shops.", placeholders); return; } @@ -111,13 +111,13 @@ public class ShopManagementGui extends AbstractGui { if (EconomyUtils.getFunds(getPlayer()) > 0) { openChangePrompt(ConversationType.ADD_BALANCE); } else { - getPlayer().sendMiniMessage("You do not have money to add to this shop", null); + getPlayer().sendRichMessage("You do not have money to add to this shop"); } } else if (slot == GuiIcon.MANAGE_SHOP_BALANCE_REMOVE.getSlot() && GuiIcon.MANAGE_SHOP_BALANCE_REMOVE.getItemStack().equals(item)) { if (shop.getBalance() > 0) { openChangePrompt(ConversationType.WITHDRAW_BALANCE); } else { - getPlayer().sendMiniMessage("You can't widraw money from this shop", null); + getPlayer().sendRichMessage("You can't withdraw money from this shop"); } } else if (slot == GuiIcon.MANAGE_SHOP_SALES.getSlot() && GuiIcon.MANAGE_SHOP_SALES.getItemStack().equals(item)) { ListTransactionsGui listTransactionsGui = new ListTransactionsGui(uuid, shop); diff --git a/src/main/java/com/alttd/playershops/listener/PlayerListener.java b/src/main/java/com/alttd/playershops/listener/PlayerListener.java index 841c3db..b41ce5c 100644 --- a/src/main/java/com/alttd/playershops/listener/PlayerListener.java +++ b/src/main/java/com/alttd/playershops/listener/PlayerListener.java @@ -104,14 +104,14 @@ public class PlayerListener extends EventListener { // Player player = event.getPlayer(); if(shop != null) { event.setCancelled(true); - player.sendMiniMessage(MessageConfig.SHOP_ALREADY_EXISTS, null); + player.sendRichMessage(MessageConfig.SHOP_ALREADY_EXISTS); return; } UUID playerUUID = player.getUniqueId(); if (!player.hasPermission("playershops.shop.create")) { event.setCancelled(true); - player.sendMiniMessage(MessageConfig.NO_SHOP_CREATE_PERMISSION, null); + player.sendRichMessage(MessageConfig.NO_SHOP_CREATE_PERMISSION); return; } @@ -120,13 +120,13 @@ public class PlayerListener extends EventListener { if (numberOfShops >= shopLimit) { event.setCancelled(true); - player.sendMiniMessage(MessageConfig.SHOP_LIMIT_REACHED, Placeholder.parsed("limit", String.valueOf(shopLimit))); + player.sendRichMessage(MessageConfig.SHOP_LIMIT_REACHED, Placeholder.parsed("limit", String.valueOf(shopLimit))); return; } if (!EconomyUtils.hasSufficientFunds(player, Config.shopCreationBalance + Config.shopCreationCost)) { event.setCancelled(true); - player.sendMiniMessage(MessageConfig.INSUFFICIENT_FUNDS, null); + player.sendRichMessage(MessageConfig.INSUFFICIENT_FUNDS); return; } diff --git a/src/main/java/com/alttd/playershops/listener/ShopListener.java b/src/main/java/com/alttd/playershops/listener/ShopListener.java index bea0b30..1f5b3dc 100644 --- a/src/main/java/com/alttd/playershops/listener/ShopListener.java +++ b/src/main/java/com/alttd/playershops/listener/ShopListener.java @@ -5,8 +5,6 @@ import com.alttd.playershops.config.MessageConfig; import com.alttd.playershops.handler.ShopHandler; import com.alttd.playershops.shop.PlayerShop; import com.alttd.playershops.utils.EconomyUtils; -import com.destroystokyo.paper.MaterialSetTag; -import me.ryanhamshire.GriefPrevention.events.ClaimExpirationEvent; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Tag; @@ -16,8 +14,6 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.Sign; import org.bukkit.block.data.BlockData; -import org.bukkit.block.data.Directional; -import org.bukkit.block.data.Rotatable; import org.bukkit.block.data.type.WallSign; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -35,8 +31,6 @@ import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import java.util.Iterator; -import java.util.List; -import java.util.UUID; /** * Dedicated class to listen to events related to shops. @@ -139,7 +133,7 @@ public class ShopListener extends EventListener { } if (player.isConversing()) { // TODO enhance method to check if the conversation is about this shop - player.sendMiniMessage(MessageConfig.BREAK_SHOP_WHILE_CONVERSING, null); + player.sendRichMessage(MessageConfig.BREAK_SHOP_WHILE_CONVERSING); event.setCancelled(true); return; } diff --git a/src/main/java/com/alttd/playershops/listener/TransactionListener.java b/src/main/java/com/alttd/playershops/listener/TransactionListener.java index 7f96711..6a8f984 100644 --- a/src/main/java/com/alttd/playershops/listener/TransactionListener.java +++ b/src/main/java/com/alttd/playershops/listener/TransactionListener.java @@ -64,7 +64,7 @@ public class TransactionListener extends EventListener { String shopType = playerShop.getType().toString(); if (!player.hasPermission("playershops.shop.use." + shopType)) { - player.sendMiniMessage(MessageConfig.NO_PERMISSION_FOR_SHOP_TYPE, Placeholder.unparsed("shop_type", shopType)); + player.sendRichMessage(MessageConfig.NO_PERMISSION_FOR_SHOP_TYPE, Placeholder.unparsed("shop_type", shopType)); event.setCancelled(true); return; } @@ -134,7 +134,7 @@ public class TransactionListener extends EventListener { TagResolver placeholders = TagResolver.resolver(type, stock); - player.sendMiniMessage(MessageConfig.SHOP_STOCK_INFO, placeholders); + player.sendRichMessage(MessageConfig.SHOP_STOCK_INFO, placeholders); } private void giveInfo(PlayerShop playerShop, Player player) { @@ -156,7 +156,7 @@ public class TransactionListener extends EventListener { Placeholder.parsed("price", "" + ShopUtil.round(playerShop.getPrice())) ); - player.sendMiniMessage(MessageConfig.SHOP_INFO, placeholders); + player.sendRichMessage(MessageConfig.SHOP_INFO, placeholders); } private void executeTransaction(Player player, PlayerShop shop) { @@ -185,13 +185,13 @@ public class TransactionListener extends EventListener { // TODO notify shopowner in game if not on cooldown and once per day on discord if linked and enabled shopOwner.sendActionBar(Util.parseMiniMessage(shop.getType().getShopTypeConfig().yourShopNoFunds, placeholders)); } - player.sendMiniMessage(shop.getType().getShopTypeConfig().shopNoStock, placeholders); + player.sendRichMessage(shop.getType().getShopTypeConfig().shopNoStock, placeholders); } case INSUFFICIENT_FUNDS_PLAYER -> { - player.sendMiniMessage(shop.getType().getShopTypeConfig().playerNoFunds, placeholders); + player.sendRichMessage(shop.getType().getShopTypeConfig().playerNoFunds, placeholders); } case INSUFFICIENT_ITEMS_PLAYER -> { - player.sendMiniMessage(shop.getType().getShopTypeConfig().playerNoItems, placeholders); + player.sendRichMessage(shop.getType().getShopTypeConfig().playerNoItems, placeholders); } case INVENTORY_FULL_SHOP -> { Player shopOwner = Bukkit.getPlayer(shop.getOwnerUUID()); @@ -199,10 +199,10 @@ public class TransactionListener extends EventListener { shopOwner.sendActionBar(Util.parseMiniMessage(shop.getType().getShopTypeConfig().yourShopNoStock, placeholders)); // TODO notify shopowner in game if not on cooldown and once per day on discord if linked and enabled } - player.sendMiniMessage(shop.getType().getShopTypeConfig().shopInventoryFull, placeholders); + player.sendRichMessage(shop.getType().getShopTypeConfig().shopInventoryFull, placeholders); } case INVENTORY_FULL_PLAYER -> { - player.sendMiniMessage(shop.getType().getShopTypeConfig().playerInventoryFull, placeholders); + player.sendRichMessage(shop.getType().getShopTypeConfig().playerInventoryFull, placeholders); } } return;