mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2025-08-07 04:53:00 +00:00
Fixed errors
This commit is contained in:
parent
ea669b7697
commit
ffbc2f9611
11 changed files with 78 additions and 51 deletions
|
@ -67,6 +67,31 @@ public class MainUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges all plots in the arraylist (with cost)
|
||||
*
|
||||
* @param plr
|
||||
* @param world
|
||||
* @param plotIds
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean mergePlots(final PlotPlayer player, final String world, final ArrayList<PlotId> plotIds) {
|
||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||
if ((EconHandler.manager != null) && plotworld.USE_ECONOMY) {
|
||||
final double cost = plotIds.size() * plotworld.MERGE_PRICE;
|
||||
if (cost > 0d) {
|
||||
if (EconHandler.manager.getMoney(player) < cost) {
|
||||
MainUtil.sendMessage(player, C.CANNOT_AFFORD_MERGE, "" + cost);
|
||||
return false;
|
||||
}
|
||||
EconHandler.manager.withdrawMoney(player, cost);
|
||||
MainUtil.sendMessage(player, C.REMOVED_BALANCE, cost + "");
|
||||
}
|
||||
}
|
||||
return MainUtil.mergePlots(world, plotIds, true);
|
||||
}
|
||||
|
||||
public static boolean unlinkPlot(final Plot plot) {
|
||||
final String world = plot.world;
|
||||
final PlotId pos1 = MainUtil.getBottomPlot(plot).id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue