Introduced Brigadier Command System. More Formatting Coming in next commit.
This commit is contained in:
@@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
@@ -13,23 +13,15 @@ public class CmdPermanent extends FCommand {
|
||||
public CmdPermanent() {
|
||||
super();
|
||||
this.aliases.add("permanent");
|
||||
|
||||
this.requiredArgs.add("faction tag");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.SET_PERMANENT.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SET_PERMANENT)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
Faction faction = this.argAsFaction(0);
|
||||
public void perform(CommandContext context) {
|
||||
Faction faction = context.argAsFaction(0);
|
||||
if (faction == null) {
|
||||
return;
|
||||
}
|
||||
@@ -43,11 +35,11 @@ public class CmdPermanent extends FCommand {
|
||||
faction.setPermanent(true);
|
||||
}
|
||||
|
||||
P.p.log((fme == null ? "A server admin" : fme.getName()) + " " + change + " the faction \"" + faction.getTag() + "\".");
|
||||
FactionsPlugin.getInstance().log((context.fPlayer == null ? "A server admin" : context.fPlayer.getName()) + " " + change + " the faction \"" + faction.getTag() + "\".");
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
|
||||
String blame = (context.fPlayer == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true));
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.msg(TL.COMMAND_PERMANENT_YOURS, blame, change);
|
||||
} else {
|
||||
@@ -61,3 +53,4 @@ public class CmdPermanent extends FCommand {
|
||||
return TL.COMMAND_PERMANENT_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user