refactoring of delete command

This commit is contained in:
Tobias Ottenweller 2012-05-16 23:00:04 +02:00
parent c5490270de
commit 649777c939

View File

@ -1,10 +1,14 @@
package org.mcteam.ancientgates.commands; package org.mcteam.ancientgates.commands;
import org.bukkit.command.CommandSender;
import org.mcteam.ancientgates.Gate; import org.mcteam.ancientgates.Gate;
import org.mcteam.ancientgates.Plugin;
public class CommandDelete extends BaseCommand {
public CommandDelete() { public class CommandDelete extends BaseCommand
{
public CommandDelete()
{
aliases.add("delete"); aliases.add("delete");
aliases.add("del"); aliases.add("del");
aliases.add("remove"); aliases.add("remove");
@ -14,20 +18,17 @@ public class CommandDelete extends BaseCommand {
senderMustBePlayer = false; senderMustBePlayer = false;
helpDescription = "Delete a gate"; helpDescription = "Delete a gate";
requiredPermission = Plugin.permissionManage;
} }
public void perform() public void perform()
{ {
gate.setOpen(false); gate.setOpen(false);
sendMessage("Gate with id \"" + gate.getId() + "\" was deleted.");
Gate.delete(gate.getId()); Gate.delete(gate.getId());
}
sendMessage("Gate with id \"" + gate.getId() + "\" was deleted.");
@Override
public boolean hasPermission(CommandSender sender)
{
return sender.hasPermission(permissionManage);
} }
} }