Introduced Brigadier Command System. More Formatting Coming in next commit.
This commit is contained in:
@@ -1,49 +1,45 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
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 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;
|
||||
this.requirements = new CommandRequirements.Builder(Permission.FOCUS)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if (!P.p.getConfig().getBoolean("ffocus.Enabled")) {
|
||||
fme.msg(TL.GENERIC_DISABLED);
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("ffocus.Enabled")) {
|
||||
context.msg(TL.GENERIC_DISABLED);
|
||||
return;
|
||||
}
|
||||
FPlayer target = argAsFPlayer(0);
|
||||
FPlayer target = context.argAsFPlayer(0);
|
||||
if (target == null) {
|
||||
return;
|
||||
}
|
||||
if (target.getFaction().getId().equalsIgnoreCase(myFaction.getId())) {
|
||||
fme.msg(TL.COMMAND_FOCUS_SAMEFACTION);
|
||||
if (target.getFaction().getId().equalsIgnoreCase(context.faction.getId())) {
|
||||
context.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());
|
||||
if ((context.faction.getFocused() != null) && (context.faction.getFocused().equalsIgnoreCase(target.getName()))) {
|
||||
context.faction.setFocused(null);
|
||||
context.faction.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());
|
||||
context.faction.msg(TL.COMMAND_FOCUS_FOCUSING, target.getName());
|
||||
context.faction.setFocused(target.getName());
|
||||
FTeamWrapper.updatePrefixes(target.getFaction());
|
||||
}
|
||||
|
||||
@@ -51,4 +47,3 @@ public class CmdFocus
|
||||
return TL.COMMAND_FOCUS_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user