From ef443cade391cd29bd3dcb60f866e22114599de0 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Wed, 8 Oct 2014 19:31:59 +0200 Subject: [PATCH] Added money given on delete. --- .../src/com/intellectualcrafters/plot/C.java | 2 +- .../intellectualcrafters/plot/PlotMain.java | 4 ++-- .../intellectualcrafters/plot/PlotWorld.java | 5 +++-- .../plot/commands/Delete.java | 19 ++++++++++++------- .../plot/generator/DefaultPlotWorld.java | 5 +++++ 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/C.java b/PlotSquared/src/com/intellectualcrafters/plot/C.java index 94b085059..7c7609b37 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/C.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/C.java @@ -25,7 +25,7 @@ public enum C { /* * Economy Stuff */ - CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"), CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"), REMOVED_BALANCE("&6%s &chas been taken from your balance"), + CANNOT_AFFORD_PLOT("&cYou cannot afford to buy this plot. It costs &6%s"), CANNOT_AFFORD_MERGE("&cYou cannot afford to merge the plots. It costs &6%s"), ADDED_BALANCE("&6%s &chas been added to your balance"), REMOVED_BALANCE("&6%s &chas been taken from your balance"), /* * Setup Stuff */ diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java index 937b3145f..16227e4db 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java @@ -464,8 +464,8 @@ public class PlotMain extends JavaPlugin { } /** - * TODO: Implement better system The whole point of this system is to - * recycle old plots So why not just allow users to claim old plots, and try + * TODO: Implement better system + * The whole point of this system is to recycle old plots So why not just allow users to claim old plots, and try * to hide the fact that the are owned. Reduce amount of expired plots: - On * /plot auto - allow claiming of old plot, clear it so the user doesn't * know - On /plot info, - show that the plot is expired and allowed to be diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java index 4ad8f568e..be3cd7756 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java @@ -1,10 +1,10 @@ package com.intellectualcrafters.plot; +import org.bukkit.Material; + import java.util.ArrayList; import java.util.List; -import org.bukkit.Material; - /** * This is the PlotWorld class (obviously)
* - All existing PlotWorld instances should be kept in PlotMain (worlds @@ -225,4 +225,5 @@ public class PlotWorld { public boolean USE_ECONOMY = false; public double PLOT_PRICE = 100; public double MERGE_PRICE = 100; + public double SELL_PRICE = 75; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java index 685a14596..888e9dac9 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java @@ -9,14 +9,10 @@ package com.intellectualcrafters.plot.commands; -import org.bukkit.entity.Player; - -import com.intellectualcrafters.plot.C; -import com.intellectualcrafters.plot.PlayerFunctions; -import com.intellectualcrafters.plot.Plot; -import com.intellectualcrafters.plot.PlotHelper; -import com.intellectualcrafters.plot.PlotMain; +import com.intellectualcrafters.plot.*; import com.intellectualcrafters.plot.database.DBFunc; +import net.milkbowl.vault.economy.Economy; +import org.bukkit.entity.Player; /** * Created by Citymonstret on 2014-08-01. @@ -42,6 +38,15 @@ public class Delete extends SubCommand { PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); return false; } + PlotWorld pWorld = PlotMain.getWorldSettings(plot.getWorld()); + if(PlotMain.useEconomy && pWorld.USE_ECONOMY) { + double c = pWorld.SELL_PRICE; + if(c > 0d) { + Economy economy = PlotMain.economy; + economy.depositPlayer(plr, c); + sendMessage(plr, C.ADDED_BALANCE, c + ""); + } + } boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id, true); if (result) { PlotHelper.removeSign(plr, plot); diff --git a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java index 72a202882..185aa6bdc 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java @@ -184,6 +184,9 @@ public class DefaultPlotWorld extends PlotWorld { public double PLOT_PRICE; public static double PLOT_PRICE_DEFAULT = 100; + + public double SELL_PRICE; + public static double SELL_PRICE_DEFAULT = 75; public double MERGE_PRICE; public static double MERGE_PRICE_DEFAULT = 100; @@ -230,6 +233,7 @@ public class DefaultPlotWorld extends PlotWorld { new ConfigurationNode("economy.use", USE_ECONOMY, "Enable economy features", Configuration.BOOLEAN, false), new ConfigurationNode("economy.prices.claim", PLOT_PRICE, "Plot claim price", Configuration.DOUBLE, false), new ConfigurationNode("economy.prices.merge", MERGE_PRICE, "Plot merge price", Configuration.DOUBLE, false), + new ConfigurationNode("economy.prices.sell", SELL_PRICE, "Plot Sell Price", Configuration.DOUBLE, false), new ConfigurationNode("chat.enabled", PLOT_CHAT, "Enable plot chat", Configuration.BOOLEAN, false) }; } @@ -262,6 +266,7 @@ public class DefaultPlotWorld extends PlotWorld { this.USE_ECONOMY = config.getBoolean("economy.use"); this.PLOT_PRICE = config.getDouble("economy.prices.claim"); this.MERGE_PRICE = config.getDouble("economy.prices.merge"); + this.SELL_PRICE = config.getDouble("economy.prices.sell"); this.PLOT_CHAT = config.getBoolean("chat.enabled"); } }