Added Focus/Config Fixes
This commit is contained in:
53
src/main/java/com/massivecraft/factions/cmd/CmdFocus.java
Normal file
53
src/main/java/com/massivecraft/factions/cmd/CmdFocus.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.SavageFactions;
|
||||
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() {
|
||||
if (!SavageFactions.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_FOCUSSING, target.getName());
|
||||
myFaction.setFocused(target.getName());
|
||||
FTeamWrapper.updatePrefixes(target.getFaction());
|
||||
}
|
||||
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_FOCUS_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public class FCmdRoot extends FCommand {
|
||||
public CmdDeinvite cmdDeinvite = new CmdDeinvite();
|
||||
public CmdDescription cmdDescription = new CmdDescription();
|
||||
public CmdDisband cmdDisband = new CmdDisband();
|
||||
public CmdFocus cmdFocus = new CmdFocus();
|
||||
public CmdHelp cmdHelp = new CmdHelp();
|
||||
public CmdHome cmdHome = new CmdHome();
|
||||
public CmdInvite cmdInvite = new CmdInvite();
|
||||
@@ -223,6 +224,9 @@ public class FCmdRoot extends FCommand {
|
||||
} else {
|
||||
SavageFactions.plugin.log("CoreProtect not found, disabling Inspect");
|
||||
}
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("ffocus.Enabled")) {
|
||||
addSubCommand(this.cmdFocus);
|
||||
}
|
||||
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight", false)) {
|
||||
this.addSubCommand(this.cmdFly);
|
||||
|
||||
Reference in New Issue
Block a user