mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2025-08-10 22:35:29 +00:00
Added maven support, removed camera subcommand
This commit is contained in:
parent
595db4a51f
commit
3c5eead8c7
147 changed files with 116 additions and 102 deletions
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
|
||||
* and/or monetize any of our intellectual property. IntellectualCrafters is not
|
||||
* affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
||||
*
|
||||
* >> File = Delete.java >> Generated by: Citymonstret at 2014-08-09 01:41
|
||||
*/
|
||||
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
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.PlotWorld;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
|
||||
/**
|
||||
* Created by Citymonstret on 2014-08-01.
|
||||
*/
|
||||
public class Delete extends SubCommand {
|
||||
|
||||
public Delete() {
|
||||
super(Command.DELETE, "Delete a plot", "delete", CommandCategory.ACTIONS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player plr, String... args) {
|
||||
if (!PlayerFunctions.isInPlot(plr)) {
|
||||
PlayerFunctions.sendMessage(plr, "You're not in a plot.");
|
||||
return false;
|
||||
}
|
||||
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
return false;
|
||||
}
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())))
|
||||
&& !PlotMain.hasPermission(plr,"plots.admin")) {
|
||||
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) {
|
||||
plot.clear(plr);
|
||||
DBFunc.delete(plr.getWorld().getName(), plot);
|
||||
}
|
||||
else {
|
||||
PlayerFunctions.sendMessage(plr, "Plot clearing has been denied.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue