Check System Added and Massive Reformat
This commit is contained in:
@@ -7,7 +7,7 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdLogout extends FCommand {
|
||||
|
||||
public CmdLogout(){
|
||||
public CmdLogout() {
|
||||
super();
|
||||
this.aliases.add("logout");
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CmdLogout extends FCommand {
|
||||
public void perform() {
|
||||
LogoutHandler handler = LogoutHandler.getByName(fme.getPlayer().getName());
|
||||
|
||||
if(handler.isLogoutActive(fme.getPlayer())){
|
||||
if (handler.isLogoutActive(fme.getPlayer())) {
|
||||
fme.msg(TL.COMMAND_LOGOUT_ACTIVE);
|
||||
return;
|
||||
}
|
||||
@@ -35,5 +35,7 @@ public class CmdLogout extends FCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() { return TL.COMMAND_LOGOUT_DESCRIPTION; }
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_LOGOUT_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,30 +22,28 @@ public class LogoutHandler {
|
||||
factionDatas.put(name, this);
|
||||
}
|
||||
|
||||
public static LogoutHandler getByName(String name) {
|
||||
LogoutHandler logoutHandler = factionDatas.get(name);
|
||||
return logoutHandler == null ? new LogoutHandler(name) : factionDatas.get(name);
|
||||
}
|
||||
|
||||
public boolean isLogoutActive(Player player) {
|
||||
return logoutCooldown.containsKey(player.getUniqueId()) && System.currentTimeMillis() < logoutCooldown.get(player.getUniqueId());
|
||||
}
|
||||
|
||||
public void cancelLogout(Player player) {
|
||||
if(logoutCooldown.containsKey(player.getUniqueId())) {
|
||||
logoutCooldown.remove(player.getUniqueId());
|
||||
}
|
||||
logoutCooldown.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public void applyLogoutCooldown(Player player) {
|
||||
logoutCooldown.put(player.getUniqueId(), System.currentTimeMillis() + (30 * 1000));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(P.p, () -> {
|
||||
if(isLogoutActive(player)) {
|
||||
if (isLogoutActive(player)) {
|
||||
player.setMetadata("Logout", new FixedMetadataValue(P.p, true));
|
||||
player.kickPlayer(String.valueOf(TL.COMMAND_LOGOUT_KICK_MESSAGE));
|
||||
cancelLogout(player);
|
||||
}
|
||||
}, Conf.logoutCooldown * 20L);
|
||||
}
|
||||
|
||||
public static LogoutHandler getByName(String name) {
|
||||
LogoutHandler logoutHandler = factionDatas.get(name);
|
||||
return logoutHandler == null ? new LogoutHandler(name) : factionDatas.get(name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user