* added lock switch to all write actions
* added saveall command to save everything to disk * added reload command to reload everything from disk
This commit is contained in:
@ -28,6 +28,7 @@ public class FBaseCommand {
|
||||
|
||||
public List<String> parameters;
|
||||
|
||||
private static boolean lock = false;
|
||||
|
||||
public FBaseCommand() {
|
||||
aliases = new ArrayList<String>();
|
||||
@ -232,4 +233,22 @@ public class FBaseCommand {
|
||||
|
||||
return aliasTrue.contains(str.toLowerCase());
|
||||
}
|
||||
|
||||
public void setLock(boolean newLock) {
|
||||
if( newLock ) {
|
||||
me.sendMessage("Factions is now locked");
|
||||
} else {
|
||||
me.sendMessage("Factions in now unlocked");
|
||||
}
|
||||
|
||||
lock = newLock;
|
||||
}
|
||||
|
||||
public boolean isLocked() {
|
||||
return lock;
|
||||
}
|
||||
|
||||
public void sendLockMessage() {
|
||||
me.sendMessage("Factions is locked. Please try again later");
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ public class FCommandAdmin extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.ADMIN)) {
|
||||
return;
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ public class FCommandClaim extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
FLocation flocation = new FLocation(me);
|
||||
Faction otherFaction = Board.getFactionAt(flocation);
|
||||
|
@ -26,6 +26,12 @@ public class FCommandCreate extends FBaseCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String tag = parameters.get(0);
|
||||
|
||||
if (me.hasFaction()) {
|
||||
|
@ -21,6 +21,11 @@ public class FCommandDeinvite extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
|
@ -20,6 +20,11 @@ public class FCommandDescription extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
@ -21,6 +21,11 @@ public class FCommandInvite extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
@ -14,6 +14,12 @@ public class FCommandJoin extends FBaseCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String factionName = parameters.get(0);
|
||||
|
||||
Faction faction = findFaction(factionName);
|
||||
|
@ -15,6 +15,12 @@ public class FCommandKick extends FBaseCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
|
@ -20,6 +20,11 @@ public class FCommandLeave extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
me.leave();
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,11 @@ public class FCommandMod extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.ADMIN)) {
|
||||
return;
|
||||
}
|
||||
|
@ -18,6 +18,11 @@ public class FCommandOpen extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
@ -9,6 +9,12 @@ public class FCommandRelationAlly extends FRelationCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
relation(Relation.ALLY, parameters.get(0));
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,12 @@ public class FCommandRelationEnemy extends FRelationCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
relation(Relation.ENEMY, parameters.get(0));
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,12 @@ public class FCommandRelationNeutral extends FRelationCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
relation(Relation.NEUTRAL, parameters.get(0));
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,12 @@ public class FCommandSafeclaim extends FBaseCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
// The current location of the player
|
||||
FLocation playerFlocation = new FLocation(me);
|
||||
|
||||
|
@ -17,6 +17,11 @@ public class FCommandSethome extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
@ -23,6 +23,11 @@ public class FCommandTag extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ public class FCommandTitle extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
parameters.remove(0);
|
||||
String title = TextUtil.implode(parameters);
|
||||
|
@ -17,6 +17,12 @@ public class FCommandUnclaim extends FBaseCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
FLocation flocation = new FLocation(me);
|
||||
Faction otherFaction = Board.getFactionAt(flocation);
|
||||
|
||||
|
@ -19,6 +19,11 @@ public class FCommandUnclaimall extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
@ -21,6 +21,11 @@ public class FRelationCommand extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user