2011-04-08 15:51:07 +02:00
|
|
|
package org.mcteam.factions.commands;
|
2011-03-23 17:39:56 +01:00
|
|
|
|
2011-04-08 15:51:07 +02:00
|
|
|
import org.mcteam.factions.Conf;
|
|
|
|
import org.mcteam.factions.Faction;
|
|
|
|
import org.mcteam.factions.struct.Role;
|
2011-03-23 17:39:56 +01:00
|
|
|
|
|
|
|
public class FCommandHome extends FBaseCommand {
|
|
|
|
|
|
|
|
public FCommandHome() {
|
|
|
|
aliases.add("home");
|
|
|
|
|
|
|
|
helpDescription = "Teleport to the faction home";
|
|
|
|
}
|
|
|
|
|
|
|
|
public void perform() {
|
|
|
|
if ( ! assertHasFaction()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! Conf.homesEnabled) {
|
|
|
|
me.sendMessage("Sorry, Faction homes are disabled on this server.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Faction myFaction = me.getFaction();
|
|
|
|
|
|
|
|
if ( ! myFaction.hasHome()) {
|
|
|
|
me.sendMessage("You faction does not have a home. " + (me.getRole().value < Role.MODERATOR.value ? " Ask your leader to:" : "You should:"));
|
2011-04-08 16:03:04 +02:00
|
|
|
me.sendMessage(new FCommandSethome().getUseageTemplate());
|
2011-03-23 17:39:56 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-03-31 15:13:02 +02:00
|
|
|
player.teleport(myFaction.getHome());
|
2011-03-23 17:39:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|