2015-09-08 19:18:00 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.Faction;
|
|
|
|
import com.massivecraft.factions.struct.Permission;
|
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
|
|
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
|
|
|
|
|
|
public class CmdAHome extends FCommand {
|
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
public CmdAHome() {
|
|
|
|
super();
|
|
|
|
this.aliases.add("ahome");
|
|
|
|
|
|
|
|
this.requiredArgs.add("player name");
|
|
|
|
|
|
|
|
this.permission = Permission.AHOME.node;
|
|
|
|
this.disableOnLock = false;
|
2019-06-02 20:28:42 +02:00
|
|
|
this.disableOnSpam = false;
|
2019-03-03 04:51:21 +01:00
|
|
|
|
|
|
|
senderMustBePlayer = false;
|
|
|
|
senderMustBeMember = false;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeAdmin = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
FPlayer target = argAsBestFPlayerMatch(0);
|
|
|
|
if (target == null) {
|
|
|
|
msg(TL.GENERIC_NOPLAYERMATCH, argAsString(0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (target.isOnline()) {
|
|
|
|
Faction faction = target.getFaction();
|
|
|
|
if (faction.hasHome()) {
|
|
|
|
target.getPlayer().teleport(faction.getHome(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
|
|
|
msg(TL.COMMAND_AHOME_SUCCESS, target.getName());
|
|
|
|
target.msg(TL.COMMAND_AHOME_TARGET);
|
|
|
|
} else {
|
|
|
|
msg(TL.COMMAND_AHOME_NOHOME, target.getName());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
msg(TL.COMMAND_AHOME_OFFLINE, target.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_AHOME_DESCRIPTION;
|
|
|
|
}
|
2015-09-08 19:18:00 +02:00
|
|
|
}
|