Saber-Factions/src/main/java/com/massivecraft/factions/cmd/CmdFocus.java

55 lines
1.4 KiB
Java
Raw Normal View History

2018-11-22 08:09:58 +01:00
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
2019-06-29 03:49:46 +02:00
import com.massivecraft.factions.SaberFactions;
2018-11-22 08:09:58 +01:00
import com.massivecraft.factions.scoreboards.FTeamWrapper;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdFocus
extends FCommand {
public CmdFocus() {
aliases.add("focus");
requiredArgs.add("player");
permission = Permission.FOCUS.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
public void perform() {
2019-06-29 03:49:46 +02:00
if (!SaberFactions.plugin.getConfig().getBoolean("ffocus.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
return;
}
FPlayer target = argAsFPlayer(0);
if (target == null) {
return;
}
if (target.getFaction().getId().equalsIgnoreCase(myFaction.getId())) {
fme.msg(TL.COMMAND_FOCUS_SAMEFACTION);
return;
}
if ((myFaction.getFocused() != null) && (myFaction.getFocused().equalsIgnoreCase(target.getName()))) {
myFaction.setFocused(null);
myFaction.msg(TL.COMMAND_FOCUS_NO_LONGER, target.getName());
FTeamWrapper.updatePrefixes(target.getFaction());
return;
}
myFaction.msg(TL.COMMAND_FOCUS_FOCUSING, target.getName());
myFaction.setFocused(target.getName());
FTeamWrapper.updatePrefixes(target.getFaction());
}
public TL getUsageTranslation() {
return TL.COMMAND_FOCUS_DESCRIPTION;
}
2018-11-22 08:09:58 +01:00
}