Made Giving F Points Player Supported Too

This commit is contained in:
Driftay 2019-08-06 19:39:20 -04:00
parent ac85687258
commit 6f50c4e680
3 changed files with 26 additions and 6 deletions

View File

@ -1,5 +1,7 @@
package com.massivecraft.factions.cmd.points; package com.massivecraft.factions.cmd.points;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.cmd.FCommand;
@ -12,7 +14,7 @@ public class CmdPointsAdd extends FCommand {
super(); super();
this.aliases.add("add"); this.aliases.add("add");
this.requiredArgs.add("faction"); this.requiredArgs.add("faction/player");
this.requiredArgs.add("# of points"); this.requiredArgs.add("# of points");
@ -35,7 +37,12 @@ public class CmdPointsAdd extends FCommand {
public void perform() { public void perform() {
Faction faction = Factions.getInstance().getByTag(args.get(0)); Faction faction = Factions.getInstance().getByTag(args.get(0));
if (faction == null) { FPlayer fPlayer = this.argAsFPlayer(0);
if (fPlayer != null) {
faction = fPlayer.getFaction();
}
if (faction == null || faction.isWilderness()) {
fme.msg(TL.COMMAND_POINTS_FAILURE.toString().replace("{faction}", args.get(0))); fme.msg(TL.COMMAND_POINTS_FAILURE.toString().replace("{faction}", args.get(0)));
return; return;
} }

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions.cmd.points; package com.massivecraft.factions.cmd.points;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.cmd.FCommand;
@ -12,7 +13,7 @@ public class CmdPointsRemove extends FCommand {
super(); super();
this.aliases.add("remove"); this.aliases.add("remove");
this.requiredArgs.add("faction"); this.requiredArgs.add("faction/player");
this.requiredArgs.add("# of points"); this.requiredArgs.add("# of points");
@ -35,7 +36,13 @@ public class CmdPointsRemove extends FCommand {
public void perform() { public void perform() {
Faction faction = Factions.getInstance().getByTag(args.get(0)); Faction faction = Factions.getInstance().getByTag(args.get(0));
if (faction == null) {
FPlayer fPlayer = this.argAsFPlayer(0);
if (fPlayer != null) {
faction = fPlayer.getFaction();
}
if (faction == null || faction.isWilderness()) {
fme.msg(TL.COMMAND_POINTS_FAILURE.toString().replace("{faction}", args.get(0))); fme.msg(TL.COMMAND_POINTS_FAILURE.toString().replace("{faction}", args.get(0)));
return; return;
} }

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions.cmd.points; package com.massivecraft.factions.cmd.points;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.cmd.FCommand; import com.massivecraft.factions.cmd.FCommand;
@ -12,7 +13,7 @@ public class CmdPointsSet extends FCommand {
super(); super();
this.aliases.add("set"); this.aliases.add("set");
this.requiredArgs.add("faction"); this.requiredArgs.add("faction/player");
this.requiredArgs.add("# of points"); this.requiredArgs.add("# of points");
@ -35,7 +36,12 @@ public class CmdPointsSet extends FCommand {
public void perform() { public void perform() {
Faction faction = Factions.getInstance().getByTag(args.get(0)); Faction faction = Factions.getInstance().getByTag(args.get(0));
if (faction == null) { FPlayer fPlayer = this.argAsFPlayer(0);
if (fPlayer != null) {
faction = fPlayer.getFaction();
}
if (faction == null || faction.isWilderness()) {
fme.msg(TL.COMMAND_POINTS_FAILURE.toString().replace("{faction}", args.get(0))); fme.msg(TL.COMMAND_POINTS_FAILURE.toString().replace("{faction}", args.get(0)));
return; return;
} }