Compare commits
3 Commits
fa8e43eeb0
...
df388ed93f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df388ed93f | ||
|
|
646d0fae3f | ||
|
|
4fd2c55be6 |
|
|
@ -12,7 +12,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "com.alttd.playershops"
|
||||
version = System.getenv("BUILD_NUMBER") ?: "1.2-SNAPSHOT"
|
||||
version = System.getenv("BUILD_NUMBER") ?: "1.3-SNAPSHOT"
|
||||
description = "Player Shop plugin for Altitude."
|
||||
|
||||
apply<JavaLibraryPlugin>()
|
||||
|
|
@ -34,14 +34,13 @@ tasks {
|
|||
}
|
||||
|
||||
runServer {
|
||||
// runDirectory.set(File("./run1"))
|
||||
val fileName = "./run/galaxy.jar"
|
||||
val fileName = "./run/cosmos.jar"
|
||||
val file = File(fileName)
|
||||
if (!file.parentFile.exists()) {
|
||||
file.parentFile.mkdirs()
|
||||
}
|
||||
if (!file.exists()) {
|
||||
download("https://jenkins.destro.xyz/job/Galaxy/lastSuccessfulBuild/artifact/build/libs/Galaxy-paperclip-1.21-R0.1-SNAPSHOT-reobf.jar", fileName)
|
||||
download("https://jenkins.destro.xyz/job/Cosmos/lastSuccessfulBuild/artifact/cosmos-server/build/libs/cosmos-bundler-1.21.6-R0.1-SNAPSHOT-mojmap.jar", fileName)
|
||||
}
|
||||
serverJar(file)
|
||||
minecraftVersion("1.21")
|
||||
|
|
@ -71,7 +70,7 @@ publishing {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT")
|
||||
compileOnly("com.alttd.cosmos:cosmos-api:1.21.6-R0.1-SNAPSHOT")
|
||||
compileOnly("com.github.milkbowl:VaultAPI:1.7") {
|
||||
exclude("org.bukkit","bukkit")
|
||||
}
|
||||
|
|
|
|||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
|||
|
|
@ -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("<red>Only players can use this command."));
|
||||
sender.sendRichMessage("<red>Only players can use this command.");
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
player.sendMessage(Util.parseMiniMessage("<red>Invalid command syntax, use /checkstock <radius> [minimum stock]"));
|
||||
player.sendRichMessage("<red>Invalid command syntax, use /checkstock <radius> [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("<red>radius has to be a valid number, use /checkstock <radius> [minimum stock]"));
|
||||
player.sendRichMessage("<red>radius has to be a valid number, use /checkstock <radius> [minimum stock]");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (radius > 100 || radius <= 0) {
|
||||
player.sendMessage(Util.parseMiniMessage("<red>Please keep the radius between 1 and 100"));
|
||||
player.sendRichMessage("<red>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("<red>minimum stock has to be a valid number, use /checkstock <radius> [minimum stock]"));
|
||||
player.sendRichMessage("<red>minimum stock has to be a valid number, use /checkstock <radius> [minimum stock]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -175,11 +176,11 @@ public class CheckStockCommand implements Subcommand {
|
|||
}
|
||||
if (component == null)
|
||||
if (minimumStock == -1)
|
||||
player.sendMessage(Util.parseMiniMessage("<yellow>No shops that you have permission to view found in specified radius.<yellow>"));
|
||||
player.sendRichMessage("<yellow>No shops that you have permission to view found in specified radius.<yellow>");
|
||||
else
|
||||
player.sendMessage(Util.parseMiniMessage(
|
||||
player.sendRichMessage(
|
||||
"<yellow>No shops with less than <minimum_stock> stock found.</yellow>",
|
||||
TagResolver.resolver(Placeholder.parsed("minimum_stock", minimumStock + ""))));
|
||||
TagResolver.resolver(Placeholder.parsed("minimum_stock", minimumStock + "")));
|
||||
else
|
||||
player.sendMessage(component);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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("<red>Only players can use this command.", null);
|
||||
sender.sendRichMessage("<red>Only players can use this command.");
|
||||
return false;
|
||||
}
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
player.sendMiniMessage("<red>Invalid command syntax, use /transfershops <uuid> <newplayer>", null);
|
||||
player.sendRichMessage("<red>Invalid command syntax, use /transfershops <uuid> <newplayer>");
|
||||
return false;
|
||||
}
|
||||
OfflinePlayer oldOfflinePlayer = Bukkit.getOfflinePlayer(args[0]);
|
||||
if (!oldOfflinePlayer.hasPlayedBefore()) {
|
||||
player.sendMiniMessage("<red>" + args[0] + " has not joined this server before.", null);
|
||||
player.sendRichMessage("<red>" + args[0] + " has not joined this server before.");
|
||||
return false;
|
||||
}
|
||||
Player newShopOwner = Bukkit.getPlayer(args[1]);
|
||||
if (newShopOwner == null) {
|
||||
player.sendMiniMessage("<red>" + args[1] + " is not online and has to be online for this process.", null);
|
||||
player.sendRichMessage("<red>" + args[1] + " is not online and has to be online for this process.");
|
||||
return false;
|
||||
}
|
||||
UUID oldUUID = oldOfflinePlayer.getUniqueId();
|
||||
List<PlayerShop> playerShops = PlayerShops.getInstance().getShopHandler().getShops(oldUUID);
|
||||
sender.sendMiniMessage("<red>Starting the transfer process now, this might lag the server.", null);
|
||||
sender.sendRichMessage("<red>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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ? "<green>You have collected <balance> from <count> shops." : "<red>No shops to be collected from.", placeholders);
|
||||
player.sendRichMessage(count > 0 ? "<green>You have collected <balance> from <count> shops." : "<red>No shops to be collected from.", placeholders);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class ShopManagementGui extends AbstractGui {
|
|||
Placeholder.parsed("balance", String.valueOf(d)),
|
||||
Placeholder.parsed("count", String.valueOf(count))
|
||||
);
|
||||
player.sendMiniMessage("<green>You have collected <balance> from <count> shops.", placeholders);
|
||||
player.sendRichMessage("<green>You have collected <balance> from <count> shops.", placeholders);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -111,13 +111,13 @@ public class ShopManagementGui extends AbstractGui {
|
|||
if (EconomyUtils.getFunds(getPlayer()) > 0) {
|
||||
openChangePrompt(ConversationType.ADD_BALANCE);
|
||||
} else {
|
||||
getPlayer().sendMiniMessage("<red>You do not have money to add to this shop", null);
|
||||
getPlayer().sendRichMessage("<red>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("<red>You can't widraw money from this shop", null);
|
||||
getPlayer().sendRichMessage("<red>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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user