diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 0e6f7e3ef..869d19b8d 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -1519,7 +1519,7 @@ public class PS { } for (String areaId : areasSection.getKeys(false)) { log(C.PREFIX.s() + "&3 - " + areaId); - String[] split = areaId.split("-"); + String[] split = areaId.split("(?--`"); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 0883d79c4..106640c2b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -138,7 +138,7 @@ public class Auto extends SubCommand { } } if ((EconHandler.manager != null) && plotarea.USE_ECONOMY) { - double cost = plotarea.PLOT_PRICE; + double cost = plotarea.PRICES.get("claim"); cost = (size_x * size_z) * cost; if (cost > 0d) { if (EconHandler.manager.getMoney(plr) < cost) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 444f26db5..33b881030 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -109,7 +109,7 @@ public class Claim extends SubCommand { } final PlotArea world = plot.getArea(); if ((EconHandler.manager != null) && world.USE_ECONOMY) { - final double cost = world.PLOT_PRICE; + final double cost = world.PRICES.get("claim"); if (cost > 0d) { if (EconHandler.manager.getMoney(plr) < cost) { return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index 5e2f1472b..647bfbfcc 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -74,7 +74,7 @@ public class Delete extends SubCommand { public void run() { plot.removeRunning(); if ((EconHandler.manager != null) && plotworld.USE_ECONOMY) { - final double value = plotworld.SELL_PRICE * plots.size(); + final double value = plotworld.PRICES.get("sell") * plots.size(); if (value > 0d) { EconHandler.manager.depositMoney(plr, value); sendMessage(plr, C.ADDED_BALANCE, value + ""); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index 3f013d6a0..381fcce4c 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -88,9 +88,10 @@ public class Merge extends SubCommand { } } final PlotArea plotworld = plot.getArea(); - if (EconHandler.manager != null && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d - && EconHandler.manager.getMoney(plr) < plotworld.MERGE_PRICE) { - sendMessage(plr, C.CANNOT_AFFORD_MERGE, plotworld.MERGE_PRICE + ""); + final double price = plotworld.PRICES.get("merge"); + if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d + && EconHandler.manager.getMoney(plr) < price) { + sendMessage(plr, C.CANNOT_AFFORD_MERGE, price + ""); return false; } final int size = plot.getConnectedPlots().size(); @@ -122,9 +123,9 @@ public class Merge extends SubCommand { terrain = "true".equalsIgnoreCase(args[1]); } if (plot.autoMerge(-1, maxSize, uuid, terrain)) { - if (EconHandler.manager != null && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) { - EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE); - sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + ""); + if (EconHandler.manager != null && price > 0d) { + EconHandler.manager.withdrawMoney(plr, price); + sendMessage(plr, C.REMOVED_BALANCE, price + ""); } MainUtil.sendMessage(plr, C.SUCCESS_MERGE); return true; @@ -152,9 +153,9 @@ public class Merge extends SubCommand { terrain = Settings.MERGE_REMOVES_ROADS; } if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) { - if (EconHandler.manager != null && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) { - EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE); - sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + ""); + if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) { + EconHandler.manager.withdrawMoney(plr, price); + sendMessage(plr, C.REMOVED_BALANCE, price + ""); } MainUtil.sendMessage(plr, C.SUCCESS_MERGE); return true; @@ -187,13 +188,13 @@ public class Merge extends SubCommand { sendMessage(accepter, C.MERGE_NOT_VALID); return; } - if (EconHandler.manager != null && plotworld.USE_ECONOMY && plotworld.MERGE_PRICE > 0d) { - if (EconHandler.manager.getMoney(plr) < plotworld.MERGE_PRICE) { - sendMessage(plr, C.CANNOT_AFFORD_MERGE, plotworld.MERGE_PRICE + ""); + if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) { + if (EconHandler.manager.getMoney(plr) < price) { + sendMessage(plr, C.CANNOT_AFFORD_MERGE, price + ""); return; } - EconHandler.manager.withdrawMoney(plr, plotworld.MERGE_PRICE); - sendMessage(plr, C.REMOVED_BALANCE, plotworld.MERGE_PRICE + ""); + EconHandler.manager.withdrawMoney(plr, price); + sendMessage(plr, C.REMOVED_BALANCE, price + ""); } MainUtil.sendMessage(plr, C.SUCCESS_MERGE); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 4c25d4f7f..1d894d6c9 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -1595,7 +1595,7 @@ public class SQLManager implements AbstractDB { ConfigurationSection areaSection = worldSection.getConfigurationSection(worldKey + ".areas"); if (areaSection != null) { for (String areaKey : areaSection.getKeys(false)) { - String[] split = areaKey.split("-"); + String[] split = areaKey.split("(? SCHEMATICS = null; public HashMap DEFAULT_FLAGS; public boolean USE_ECONOMY = false; - public double PLOT_PRICE = 100; - public double MERGE_PRICE = 100; - public double SELL_PRICE = 100; + public HashMap PRICES = new HashMap<>(); public boolean SPAWN_EGGS = false; public boolean SPAWN_CUSTOM = true; public boolean SPAWN_BREEDING = false; @@ -209,9 +207,10 @@ public abstract class PlotArea { SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim"); SCHEMATICS = config.getStringList("schematic.schematics"); USE_ECONOMY = config.getBoolean("economy.use") && EconHandler.manager != null; - PLOT_PRICE = config.getDouble("economy.prices.claim"); - MERGE_PRICE = config.getDouble("economy.prices.merge"); - SELL_PRICE = config.getDouble("economy.prices.sell"); + ConfigurationSection priceSection = config.getConfigurationSection("economy.prices"); + for (String key : priceSection.getKeys(false)) { + PRICES.put(key, priceSection.getDouble(key)); + } PLOT_CHAT = config.getBoolean("chat.enabled"); WORLD_BORDER = config.getBoolean("world.border"); MAX_BUILD_HEIGHT = config.getInt("world.max_height"); @@ -303,9 +302,9 @@ public abstract class PlotArea { options.put("schematic.specify_on_claim", SCHEMATIC_CLAIM_SPECIFY); options.put("schematic.schematics", SCHEMATICS); options.put("economy.use", USE_ECONOMY); - options.put("economy.prices.claim", PLOT_PRICE); - options.put("economy.prices.merge", MERGE_PRICE); - options.put("economy.prices.sell", SELL_PRICE); + options.put("economy.prices.claim", 100); + options.put("economy.prices.merge", 100); + options.put("economy.prices.sell", 100); options.put("chat.enabled", PLOT_CHAT); options.put("flags.default", null); options.put("event.spawn.egg", SPAWN_EGGS); @@ -700,7 +699,7 @@ public abstract class PlotArea { public boolean mergePlots(final PlotPlayer player, final ArrayList plotIds) { if (EconHandler.manager != null && USE_ECONOMY) { - final double cost = plotIds.size() * MERGE_PRICE; + final double cost = plotIds.size() * PRICES.getOrDefault("merge", 0d); if (cost > 0d) { if (EconHandler.manager.getMoney(player) < cost) { MainUtil.sendMessage(player, C.CANNOT_AFFORD_MERGE, "" + cost); diff --git a/target/PlotSquared-Bukkit.jar b/target/PlotSquared-Bukkit.jar index 8b01093f6..c150b91a5 100644 Binary files a/target/PlotSquared-Bukkit.jar and b/target/PlotSquared-Bukkit.jar differ