2014-09-22 13:02:14 +02:00
|
|
|
/*
|
|
|
|
* 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 = Clear.java
|
|
|
|
* >> Generated by: Citymonstret at 2014-08-09 01:41
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.intellectualcrafters.plot.commands;
|
|
|
|
|
2014-09-24 22:21:43 +10:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2014-09-25 23:30:26 +10:00
|
|
|
import com.intellectualcrafters.plot.C;
|
2014-09-22 13:02:14 +02:00
|
|
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
|
|
|
import com.intellectualcrafters.plot.Plot;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by Citymonstret on 2014-08-01.
|
|
|
|
*/
|
|
|
|
public class Clear extends SubCommand {
|
|
|
|
|
2014-10-11 00:33:10 -07:00
|
|
|
public Clear() {
|
|
|
|
super(Command.CLEAR, "Clear a plot", "clear", CommandCategory.ACTIONS);
|
|
|
|
}
|
2014-09-24 22:21:43 +10:00
|
|
|
|
2014-10-11 00:33:10 -07:00
|
|
|
@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 (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(
|
|
|
|
plr.getUniqueId()))
|
|
|
|
&& !plr.hasPermission("plots.admin")) {
|
|
|
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
plot.clear(plr);
|
|
|
|
return true;
|
|
|
|
}
|
2014-09-22 13:02:14 +02:00
|
|
|
}
|