Commits
This commit is contained in:
parent
6cfc36b50a
commit
3b523062e8
@ -84,6 +84,10 @@ public interface Faction extends EconomyParticipator {
|
||||
|
||||
void ban(FPlayer target, FPlayer banner);
|
||||
|
||||
int getPoints();
|
||||
|
||||
void setPoints(int points);
|
||||
|
||||
int getStrikes();
|
||||
|
||||
void setStrikes(int strikes);
|
||||
|
@ -0,0 +1,8 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
public class CmdPoints extends FCommand {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdPointsAdd extends FCommand {
|
||||
|
||||
public CmdPointsAdd() {
|
||||
super();
|
||||
this.aliases.add("add");
|
||||
|
||||
this.requiredArgs.add("faction");
|
||||
this.requiredArgs.add("# of points");
|
||||
|
||||
|
||||
this.errorOnToManyArgs = false;
|
||||
//this.optionalArgs
|
||||
|
||||
this.permission = Permission.ADDPOINTS.node;
|
||||
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
Faction faction = Factions.getInstance().getByTag(args.get(0));
|
||||
|
||||
if (faction == null) {
|
||||
fme.msg(TL.COMMAND_POINTS_FAILURE.toString().replace("{faction}", args.get(0)));
|
||||
}
|
||||
|
||||
assert faction != null;
|
||||
faction.setPoints(faction.getPoints() + argAsInt(1));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_ADDPOINTS_DESCRIPTION;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
public class CmdPointsRemove {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
public class CmdPointsSet {
|
||||
}
|
@ -100,6 +100,7 @@ public enum Permission {
|
||||
SETWARP("setwarp"),
|
||||
TOP("top"),
|
||||
VIEWCHEST("viewchest"),
|
||||
ADDPOINTS("addpoints"),
|
||||
VAULT("vault"),
|
||||
GETVAULT("getvault"),
|
||||
SETMAXVAULTS("setmaxvaults"),
|
||||
|
@ -71,6 +71,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
Map<String, Object> bannerSerialized;
|
||||
private long lastDeath;
|
||||
private int strikes = 0;
|
||||
private int points = 0;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// Construct
|
||||
@ -121,6 +122,14 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
resetPerms(); // Reset on new Faction so it has default values.
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(int points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public int getStrikes() {
|
||||
return strikes;
|
||||
}
|
||||
@ -715,20 +724,20 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
// Put the map in there for each relation.
|
||||
for (Relation relation : Relation.values()) {
|
||||
if (relation != Relation.MEMBER) {
|
||||
if (!Conf.defaultFactionPermissions.containsKey(relation.nicename))
|
||||
if (!Conf.defaultFactionPermissions.containsKey(relation.nicename.toUpperCase()))
|
||||
permissions.put(relation, new HashMap<>(defaultMap));
|
||||
else
|
||||
permissions.put(relation, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(relation.nicename)));
|
||||
permissions.put(relation, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(relation.nicename.toUpperCase())));
|
||||
}
|
||||
}
|
||||
|
||||
// And each role.
|
||||
for (Role role : Role.values()) {
|
||||
if (role != Role.LEADER) {
|
||||
if (!Conf.defaultFactionPermissions.containsKey(role.nicename))
|
||||
if (!Conf.defaultFactionPermissions.containsKey(role.nicename.toUpperCase()))
|
||||
permissions.put(role, new HashMap<>(defaultMap));
|
||||
else
|
||||
permissions.put(role, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(role.nicename)));
|
||||
permissions.put(role, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(role.nicename.toUpperCase())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -542,6 +542,8 @@ public enum TL {
|
||||
COMMAND_PERM_SET("&c&l[!]&7 Set permission&c %1$s &7to &c%2$s &7for relation&c %3$s"),
|
||||
COMMAND_PERM_TOP("RCT MEM OFF ALLY TRUCE NEUT ENEMY"),
|
||||
|
||||
COMMAND_POINTS_FAILURE(""),
|
||||
|
||||
COMMAND_PERMANENT_DESCRIPTION("Toggles a permanent faction option"),
|
||||
COMMAND_PERMANENT_GRANT("&c&l[!]&7 added permanent status to"),
|
||||
COMMAND_PERMANENT_REVOKE("&c&l[!]&7 removed permanent status from"),
|
||||
|
Loading…
Reference in New Issue
Block a user