Factions/src/com/massivecraft/factions/commands/FCommandSethome.java

48 lines
1.1 KiB
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions.commands;
2011-03-23 17:39:56 +01:00
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Role;
2011-03-23 17:39:56 +01:00
public class FCommandSethome extends FBaseCommand {
public FCommandSethome() {
aliases.add("sethome");
helpDescription = "Set the faction home";
}
@Override
2011-03-23 17:39:56 +01:00
public void perform() {
if ( ! assertHasFaction()) {
return;
}
if( isLocked() ) {
sendLockMessage();
return;
}
2011-03-23 17:39:56 +01:00
if ( ! assertMinRole(Role.MODERATOR)) {
return;
}
if ( ! Conf.homesEnabled) {
me.sendMessage("Sorry, Faction homes are disabled on this server.");
return;
}
if (Conf.homesMustBeInClaimedTerritory && !me.isInOwnTerritory()) {
me.sendMessage("Sorry, your faction home can only be set inside your own claimed territory.");
return;
}
2011-03-23 17:39:56 +01:00
Faction myFaction = me.getFaction();
myFaction.setHome(player.getLocation());
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" set the home for your faction. You can now use:");
myFaction.sendMessage(new FCommandHome().getUseageTemplate());
2011-03-23 17:39:56 +01:00
}
}