2011-05-08 17:44:00 +02:00
|
|
|
package org.mcteam.factions.commands;
|
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.mcteam.factions.Faction;
|
|
|
|
import org.mcteam.factions.Factions;
|
|
|
|
|
|
|
|
public class FCommandDisband extends FBaseCommand {
|
|
|
|
|
|
|
|
public FCommandDisband() {
|
|
|
|
aliases.add("disband");
|
|
|
|
|
2011-06-30 12:56:02 +02:00
|
|
|
senderMustBePlayer = false;
|
|
|
|
|
2011-05-08 17:44:00 +02:00
|
|
|
requiredParameters.add("faction tag");
|
|
|
|
|
|
|
|
helpDescription = "Disband a faction";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasPermission(CommandSender sender) {
|
|
|
|
return Factions.hasPermDisband(sender);
|
|
|
|
}
|
|
|
|
|
2011-06-21 07:38:31 +02:00
|
|
|
@Override
|
2011-05-08 17:44:00 +02:00
|
|
|
public void perform() {
|
|
|
|
if( parameters.size() > 0) {
|
|
|
|
Faction faction = Faction.findByTag(parameters.get(0));
|
|
|
|
|
2011-06-12 00:01:06 +02:00
|
|
|
if( faction != null && faction.getId() > 0 ) {
|
2011-06-30 12:56:02 +02:00
|
|
|
sendMessage("Faction " + faction.getTag() + " got disbanded");
|
2011-05-08 17:44:00 +02:00
|
|
|
Faction.delete( faction.getId() );
|
|
|
|
} else {
|
2011-06-30 12:56:02 +02:00
|
|
|
sendMessage("Faction " + parameters.get(0) + "not found");
|
2011-05-08 17:44:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|