This commit is contained in:
Driftay 2019-06-30 23:22:28 -04:00
parent 6cfc36b50a
commit 3b523062e8
8 changed files with 90 additions and 4 deletions

View File

@ -84,6 +84,10 @@ public interface Faction extends EconomyParticipator {
void ban(FPlayer target, FPlayer banner); void ban(FPlayer target, FPlayer banner);
int getPoints();
void setPoints(int points);
int getStrikes(); int getStrikes();
void setStrikes(int strikes); void setStrikes(int strikes);

View File

@ -0,0 +1,8 @@
package com.massivecraft.factions.cmd;
public class CmdPoints extends FCommand {
}

View File

@ -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;
}
}

View File

@ -0,0 +1,4 @@
package com.massivecraft.factions.cmd;
public class CmdPointsRemove {
}

View File

@ -0,0 +1,4 @@
package com.massivecraft.factions.cmd;
public class CmdPointsSet {
}

View File

@ -100,6 +100,7 @@ public enum Permission {
SETWARP("setwarp"), SETWARP("setwarp"),
TOP("top"), TOP("top"),
VIEWCHEST("viewchest"), VIEWCHEST("viewchest"),
ADDPOINTS("addpoints"),
VAULT("vault"), VAULT("vault"),
GETVAULT("getvault"), GETVAULT("getvault"),
SETMAXVAULTS("setmaxvaults"), SETMAXVAULTS("setmaxvaults"),

View File

@ -71,6 +71,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
Map<String, Object> bannerSerialized; Map<String, Object> bannerSerialized;
private long lastDeath; private long lastDeath;
private int strikes = 0; private int strikes = 0;
private int points = 0;
// -------------------------------------------- // // -------------------------------------------- //
// Construct // Construct
@ -121,6 +122,14 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
resetPerms(); // Reset on new Faction so it has default values. 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() { public int getStrikes() {
return strikes; return strikes;
} }
@ -715,20 +724,20 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
// Put the map in there for each relation. // Put the map in there for each relation.
for (Relation relation : Relation.values()) { for (Relation relation : Relation.values()) {
if (relation != Relation.MEMBER) { if (relation != Relation.MEMBER) {
if (!Conf.defaultFactionPermissions.containsKey(relation.nicename)) if (!Conf.defaultFactionPermissions.containsKey(relation.nicename.toUpperCase()))
permissions.put(relation, new HashMap<>(defaultMap)); permissions.put(relation, new HashMap<>(defaultMap));
else 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. // And each role.
for (Role role : Role.values()) { for (Role role : Role.values()) {
if (role != Role.LEADER) { if (role != Role.LEADER) {
if (!Conf.defaultFactionPermissions.containsKey(role.nicename)) if (!Conf.defaultFactionPermissions.containsKey(role.nicename.toUpperCase()))
permissions.put(role, new HashMap<>(defaultMap)); permissions.put(role, new HashMap<>(defaultMap));
else else
permissions.put(role, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(role.nicename))); permissions.put(role, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(role.nicename.toUpperCase())));
} }
} }
} }

View File

@ -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_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_PERM_TOP("RCT MEM OFF ALLY TRUCE NEUT ENEMY"),
COMMAND_POINTS_FAILURE(""),
COMMAND_PERMANENT_DESCRIPTION("Toggles a permanent faction option"), COMMAND_PERMANENT_DESCRIPTION("Toggles a permanent faction option"),
COMMAND_PERMANENT_GRANT("&c&l[!]&7 added permanent status to"), COMMAND_PERMANENT_GRANT("&c&l[!]&7 added permanent status to"),
COMMAND_PERMANENT_REVOKE("&c&l[!]&7 removed permanent status from"), COMMAND_PERMANENT_REVOKE("&c&l[!]&7 removed permanent status from"),