Add shopCreationCost

This commit is contained in:
Len 2023-06-27 17:23:42 +02:00
parent 795650a373
commit e0a4ed85a5
2 changed files with 5 additions and 7 deletions

View File

@ -28,12 +28,14 @@ public class Config extends AbstractConfiguration {
public static boolean usePermissionShopLimit = false;
public static String shopCreationWord = "[SHOP]";
public static double shopCreationBalance = 2500; // minimum amount of balance to create a shop, this is to cover the cost to manage shops and upkeep
public static double shopCreationCost = 250; // minimum amount of balance to create a shop, this is to cover the cost to manage shops and upkeep
private static void shopSettings() {
String path = "shop-settings.";
shopLimit = config.getInt(path + "default-shop-limit", shopLimit);
usePermissionShopLimit = config.getBoolean(path + "use-permission-based-shop-limit", usePermissionShopLimit);
shopCreationWord = config.getString(path + "creation-word", shopCreationWord);
shopCreationBalance = config.getDouble(path + "creation-balance", shopCreationBalance);
shopCreationCost = config.getDouble(path + "creation-cost", shopCreationCost);
}
}

View File

@ -10,7 +10,6 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
@ -19,16 +18,13 @@ 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.block.sign.Side;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.permissions.PermissionAttachmentInfo;
import java.util.UUID;
@ -129,7 +125,7 @@ public class PlayerListener extends EventListener {
return;
}
if (!EconomyUtils.hasSufficientFunds(player, Config.shopCreationBalance)) {
if (!EconomyUtils.hasSufficientFunds(player, Config.shopCreationBalance + Config.shopCreationCost)) {
event.setCancelled(true);
player.sendMiniMessage(MessageConfig.INSUFFICIENT_FUNDS, null);
return;
@ -137,9 +133,9 @@ public class PlayerListener extends EventListener {
PlayerShop playerShop = new PlayerShop(bRelative.getLocation(), signBlock.getLocation(), player);
playerShop.addBalance(Config.shopCreationBalance);
EconomyUtils.removeFunds(player, Config.shopCreationBalance);
EconomyUtils.removeFunds(player, Config.shopCreationBalance + Config.shopCreationCost);
shopHandler.addShop(playerShop);
PlayerShops.getInstance().getDatabaseHelper().createShop(playerShop);
plugin.getDatabaseHelper().createShop(playerShop);
signBlock.setWaxed(true);
}
}