2019-07-28 11:04:39 +02:00
|
|
|
package com.massivecraft.factions.cmd.logout;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
2020-01-02 02:59:31 +01:00
|
|
|
import com.massivecraft.factions.cmd.Aliases;
|
2019-09-14 21:13:01 +02:00
|
|
|
import com.massivecraft.factions.cmd.CommandContext;
|
|
|
|
import com.massivecraft.factions.cmd.CommandRequirements;
|
2019-07-28 11:04:39 +02:00
|
|
|
import com.massivecraft.factions.cmd.FCommand;
|
|
|
|
import com.massivecraft.factions.struct.Permission;
|
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
|
|
|
|
|
|
|
public class CmdLogout extends FCommand {
|
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
public CmdLogout() {
|
|
|
|
super();
|
2020-01-02 02:59:31 +01:00
|
|
|
this.aliases.addAll(Aliases.logout);
|
2019-09-15 11:19:06 +02:00
|
|
|
|
|
|
|
this.requirements = new CommandRequirements.Builder(Permission.LOGOUT)
|
|
|
|
.playerOnly()
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform(CommandContext context) {
|
|
|
|
LogoutHandler handler = LogoutHandler.getByName(context.player.getName());
|
|
|
|
|
|
|
|
if (handler.isLogoutActive(context.player)) {
|
|
|
|
context.msg(TL.COMMAND_LOGOUT_ACTIVE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
handler.applyLogoutCooldown(context.player);
|
|
|
|
context.msg(TL.COMMAND_LOGOUT_LOGGING, Conf.logoutCooldown);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_LOGOUT_DESCRIPTION;
|
|
|
|
}
|
2019-07-28 11:04:39 +02:00
|
|
|
}
|