This commit is contained in:
Olof Larsson 2011-10-09 21:57:43 +02:00
parent 3cdd5764d3
commit a5c8e2de49
59 changed files with 361 additions and 482 deletions

View File

@ -1,172 +1,169 @@
name: Factions name: Factions
version: 1.6.0_dev version: 1.6.0_dev
main: com.massivecraft.factions.P main: com.massivecraft.factions.P
softdepend: authors: [Olof Larsson, Brett Flannigan]
- PermissionsEx softdepend: [PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, nChat, ChatManager, AuthMe, iConomy, Register, Spout, WorldEdit, WorldGuard]
- Permissions
- Essentials
- EssentialsChat
- HeroChat
- iChat
- LocalAreaChat
- nChat
- ChatManager
- AuthMe
- iConomy
- Register
- Spout
- WorldEdit
- WorldGuard
permissions: permissions:
factions.*: factions.kit.admin:
description: Grants all Factions permissions description: All faction permissions.
children: children:
factions.*: factions.kit.mod: true
description: Grants all Factions permissions factions.config: true
factions.lock: true
factions.reload: true
factions.save: true
factions.kit.mod:
description: All faction permissions but configuration and persistance.
children: children:
factions.kit.halfmod: true
factions.disband.any: true
factions.managesafezone: factions.setpermanent: true
description: claim land as a safe zone and build/destroy within safe zones factions.setpeaceful: true
default: op factions.sethome.any: true
factions.managewarzone: factions.kit.halfmod:
description: claim land as a war zone and build/destroy within war zones description: Zones, bypassing, and kicking
default: op children:
factions.ownershipbypass: factions.kit.fullplayer: true
description: bypass ownership restrictions within own faction's territory factions.managesafezone: true
default: op factions.managewarzone: true
factions.command.admin: factions.bypass: true
factions.kick.any: true
factions.ownershipbypass: true
factions.kit.fullplayer:
description: Can also create new factions.
children:
factions.kit.halfplayer: true
factions.create: true
factions.kit.halfplayer:
description: Can do all but create factions.
children:
factions.admin: true
factions.autoclaim: true
factions.balance: true
factions.balance.any: true
factions.withdraw: true
factions.pay: true
factions.chat: true
factions.claim: true
factions.deinvite: true
factions.deposit: true
factions.description: true
factions.disband: true
factions.help: true
factions.home: true
factions.join: true
factions.kick: true
factions.leave: true
factions.list: true
factions.map: true
factions.mod: true
factions.noboom: true
factions.open: true
factions.owner: true
factions.ownerlist: true
factions.power: true
factions.power.any: true
factions.relation: true
factions.sethome: true
factions.show: true
factions.tag: true
factions.title: true
factions.version: true
factions.unclaim: true
factions.unclaimall: true
factions.admin:
description: hand over your admin rights description: hand over your admin rights
default: true factions.autoclaim:
factions.command.autoclaim:
description: auto-claim land as you walk around description: auto-claim land as you walk around
default: true factions.balance:
factions.command.balance:
description: show current faction balance description: show current faction balance
default: true factions.balance.any:
factions.command.balance.any:
description: show on other factions balance description: show on other factions balance
default: true factions.withdraw:
factions.command.withdraw:
description: withdraw money from your faction bank description: withdraw money from your faction bank
default: true factions.pay:
factions.command.pay:
description: pay another faction from your bank description: pay another faction from your bank
default: true factions.bypass:
factions.command.bypass:
description: enable admin bypass mode description: enable admin bypass mode
default: op factions.chat:
factions.command.chat:
description: change chat mode description: change chat mode
default: true factions.claim:
factions.command.claim:
description: claim the land where you are standing description: claim the land where you are standing
default: true factions.config:
factions.command.config:
description: change a conf.json setting description: change a conf.json setting
default: op
factions.create: factions.create:
description: create a new faction description: create a new faction
default: true factions.deinvite:
factions.command.deinvite:
description: remove a pending invitation description: remove a pending invitation
default: true factions.deposit:
factions.command.deposit:
description: deposit money into your faction bank description: deposit money into your faction bank
default: true factions.description:
factions.command.description:
description: change the faction description description: change the faction description
default: true factions.disband:
factions.command.disband:
description: disband a faction description: disband a faction
default: true factions.disband.any:
factions.command.disband.any:
description: disband an other faction description: disband an other faction
default: op factions.help:
factions.command.help:
description: display a help page description: display a help page
default: true factions.home:
factions.command.home:
description: teleport to the faction home description: teleport to the faction home
default: true factions.join:
factions.command.join:
description: join a faction description: join a faction
default: true factions.kick:
factions.command.kick:
description: kick a player from the faction description: kick a player from the faction
default: true factions.kick.any:
factions.command.kick.any:
description: kick anyone from any faction description: kick anyone from any faction
default: op factions.leave:
factions.command.leave:
description: leave your faction description: leave your faction
default: true factions.list:
factions.command.list:
description: see a list of the factions description: see a list of the factions
default: true factions.lock:
factions.command.lock:
description: lock all write stuff description: lock all write stuff
default: op factions.managesafezone:
factions.command.map: description: claim land as a safe zone and build/destroy within safe zones
factions.managewarzone:
description: claim land as a war zone and build/destroy within war zones
factions.map:
description: show territory map, set optional auto update description: show territory map, set optional auto update
default: true factions.mod:
factions.command.mod:
description: give or revoke moderator rights description: give or revoke moderator rights
default: true factions.noboom:
factions.command.noboom:
description: toggle explosions (peaceful factions only) description: toggle explosions (peaceful factions only)
default: true factions.open:
factions.command.open:
description: switch if invitation is required to join description: switch if invitation is required to join
default: true factions.owner:
factions.command.owner:
description: set ownership of claimed land description: set ownership of claimed land
default: true factions.ownerlist:
factions.command.ownerlist:
description: list owner(s) of this claimed land description: list owner(s) of this claimed land
default: true factions.ownershipbypass:
factions.command.setpeaceful: description: bypass ownership restrictions within own faction's territory
factions.setpeaceful:
description: designate a faction as peaceful description: designate a faction as peaceful
default: op factions.setpermanent:
factions.command.setpermanent:
description: designate a faction as permanent description: designate a faction as permanent
default: op factions.power:
factions.command.power:
description: show player power info description: show player power info
default: true factions.power.any:
factions.command.power.any:
description: view an other players power level description: view an other players power level
default: true factions.relation:
factions.command.relation:
description: set relation wish to another faction description: set relation wish to another faction
default: true factions.reload:
factions.command.reload:
description: reload data file(s) from disk description: reload data file(s) from disk
default: op factions.save:
factions.command.save:
description: save all data to disk description: save all data to disk
default: op factions.sethome:
factions.command.sethome:
description: set the faction home description: set the faction home
default: true factions.sethome.any:
factions.command.sethome.any:
description: set any faction home description: set any faction home
default: op factions.show:
factions.command.show: description: show faction information
description: chow faction information factions.tag:
default: true
factions.command.tag:
description: change the faction tag description: change the faction tag
default: true factions.title:
factions.command.title:
description: set or remove a players title description: set or remove a players title
default: true factions.version:
factions.command.version:
description: see the version of the plugin description: see the version of the plugin
default: true factions.unclaim:
factions.command.unclaim:
description: unclaim the land where you are standing description: unclaim the land where you are standing
default: true factions.unclaimall:
factions.command.unclaimall:
description: unclaim all of your factions land description: unclaim all of your factions land
default: true

View File

@ -13,7 +13,7 @@ import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import com.massivecraft.factions.commands.*; import com.massivecraft.factions.cmd.*;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.integration.Worldguard; import com.massivecraft.factions.integration.Worldguard;
@ -40,6 +40,12 @@ public class P extends MPlugin
public final FactionsEntityListener entityListener; public final FactionsEntityListener entityListener;
public final FactionsBlockListener blockListener; public final FactionsBlockListener blockListener;
// Persistance related
private boolean locked = true;
public boolean getLocked() {return this.locked;}
public void setLocked(boolean val) {this.locked = val; this.setAutoSave(val);}
// Commands
public FCmdRoot cmdBase; public FCmdRoot cmdBase;
public P() public P()
@ -131,7 +137,7 @@ public class P extends MPlugin
} }
@Override @Override
public void postSaveTask() public void postAutoSave()
{ {
Board.save(); Board.save();
Conf.save(); Conf.save();

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
@ -15,7 +15,8 @@ public class CmdAdmin extends FCommand
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_ADMIN.node; this.permission = Permission.ADMIN.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdAdmin extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer fyou = this.argAsBestFPlayerMatch(0); FPlayer fyou = this.argAsBestFPlayerMatch(0);
if (fyou == null) return; if (fyou == null) return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FLocation;
@ -14,7 +14,8 @@ public class CmdAutoClaim extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flipp"); this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.COMMAND_AUTOCLAIM.node; this.permission = Permission.AUTOCLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -25,12 +26,6 @@ public class CmdAutoClaim extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
boolean enabled = this.argAsBool(0, ! fme.isAutoClaimEnabled()); boolean enabled = this.argAsBool(0, ! fme.isAutoClaimEnabled());
fme.setIsAutoClaimEnabled(enabled); fme.setIsAutoClaimEnabled(enabled);

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FLocation;
@ -17,6 +17,7 @@ public class CmdAutoSafeclaim extends FCommand
this.optionalArgs.put("on/off", "flipp"); this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.MANAGE_SAFE_ZONE.node; this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -29,12 +30,6 @@ public class CmdAutoSafeclaim extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
boolean enabled = this.argAsBool(0, ! fme.isAutoSafeClaimEnabled()); boolean enabled = this.argAsBool(0, ! fme.isAutoSafeClaimEnabled());
fme.setIsAutoSafeClaimEnabled(enabled); fme.setIsAutoSafeClaimEnabled(enabled);

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
@ -18,6 +18,7 @@ public class CmdAutoWarclaim extends FCommand
this.optionalArgs.put("on/off", "flipp"); this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.MANAGE_WAR_ZONE.node; this.permission = Permission.MANAGE_WAR_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -30,14 +31,8 @@ public class CmdAutoWarclaim extends FCommand
} }
@Override @Override
public void perform() { public void perform()
if ( isLocked() )
{ {
sendLockMessage();
return;
}
boolean enabled = this.argAsBool(0, ! fme.isAutoWarClaimEnabled()); boolean enabled = this.argAsBool(0, ! fme.isAutoWarClaimEnabled());
fme.setIsAutoWarClaimEnabled(enabled); fme.setIsAutoWarClaimEnabled(enabled);

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
@ -16,7 +16,8 @@ public class CmdBalance extends FCommand
//this.requiredArgs.add("player name"); //this.requiredArgs.add("player name");
this.optionalArgs.put("factiontag", "yours"); this.optionalArgs.put("factiontag", "yours");
this.permission = Permission.COMMAND_BALANCE.node; this.permission = Permission.BALANCE.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;
@ -35,7 +36,7 @@ public class CmdBalance extends FCommand
Faction faction = this.argAsFaction(0, myFaction); Faction faction = this.argAsFaction(0, myFaction);
// TODO MAKE HIERARCHIAL COMMAND STRUCTURE HERE // TODO MAKE HIERARCHIAL COMMAND STRUCTURE HERE
if ( faction != myFaction && ! Permission.COMMAND_BALANCE_ANY.has(sender)) if ( faction != myFaction && ! Permission.BALANCE_ANY.has(sender))
{ {
sendMessageParsed("<b>You do not have sufficient permissions to view the bank balance of other factions."); sendMessageParsed("<b>You do not have sufficient permissions to view the bank balance of other factions.");
return; return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -13,7 +13,8 @@ public class CmdBoom extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flipp"); this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.COMMAND_NO_BOOM.node; this.permission = Permission.NO_BOOM.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -24,12 +25,6 @@ public class CmdBoom extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
if ( ! myFaction.isPeaceful()) if ( ! myFaction.isPeaceful())
{ {
fme.sendMessageParsed("<b>This command is only usable by factions which are specially designated as peaceful."); fme.sendMessageParsed("<b>This command is only usable by factions which are specially designated as peaceful.");

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -13,7 +13,8 @@ public class CmdBypass extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flipp"); this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.COMMAND_BYPASS.node; this.permission = Permission.BYPASS.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.ChatMode;
@ -16,7 +16,8 @@ public class CmdChat extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("mode", "next"); this.optionalArgs.put("mode", "next");
this.permission = Permission.COMMAND_CHAT.node; this.permission = Permission.CHAT.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -13,7 +13,8 @@ public class CmdClaim extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_CLAIM.node; this.permission = Permission.CLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;
@ -26,12 +27,6 @@ public class CmdClaim extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
fme.attemptClaim(true); fme.attemptClaim(true);
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
@ -29,7 +29,8 @@ public class CmdConfig extends FCommand
this.requiredArgs.add(""); this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_CONFIG.node; this.permission = Permission.CONFIG.node;
this.disableOnLock = true;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -40,12 +41,6 @@ public class CmdConfig extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
// store a lookup map of lowercase field names paired with proper capitalization field names // store a lookup map of lowercase field names paired with proper capitalization field names
// that way, if the person using this command messes up the capitalization, we can fix that // that way, if the person using this command messes up the capitalization, we can fix that
if (properFieldNames.isEmpty()) if (properFieldNames.isEmpty())

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import java.util.ArrayList; import java.util.ArrayList;
@ -21,7 +21,8 @@ public class CmdCreate extends FCommand
this.requiredArgs.add("faction tag"); this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_CREATE.node; this.permission = Permission.CREATE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -32,12 +33,6 @@ public class CmdCreate extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
String tag = this.argAsString(0); String tag = this.argAsString(0);
if (fme.hasFaction()) if (fme.hasFaction())

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -15,7 +15,8 @@ public class CmdDeinvite extends FCommand
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_DEINVITE.node; this.permission = Permission.DEINVITE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdDeinvite extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0); FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) return; if (you == null) return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
@ -20,7 +20,8 @@ public class CmdDeposit extends FCommand
this.requiredArgs.add("amount"); this.requiredArgs.add("amount");
//this.optionalArgs //this.optionalArgs
this.permission = Permission.COMMAND_DEPOSIT.node; this.permission = Permission.DEPOSIT.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
@ -16,7 +16,8 @@ public class CmdDescription extends FCommand
this.requiredArgs.add("desc"); this.requiredArgs.add("desc");
//this.optionalArgs //this.optionalArgs
this.permission = Permission.COMMAND_DESCRIPTION.node; this.permission = Permission.DESCRIPTION.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -27,12 +28,6 @@ public class CmdDescription extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(Conf.econCostDesc)) if ( ! payForCommand(Conf.econCostDesc))
{ {

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
@ -21,7 +21,8 @@ public class CmdDisband extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "yours"); this.optionalArgs.put("faction tag", "yours");
this.permission = Permission.COMMAND_DISBAND.node; this.permission = Permission.DISBAND.node;
this.disableOnLock = true;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -44,7 +45,7 @@ public class CmdDisband extends FCommand
} }
else else
{ {
if ( ! Permission.COMMAND_DISBAND_ANY.has(me, true)) if ( ! Permission.DISBAND_ANY.has(me, true))
{ {
return; return;
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import java.util.ArrayList; import java.util.ArrayList;
@ -21,7 +21,8 @@ public class CmdHelp extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("page", "1"); this.optionalArgs.put("page", "1");
this.permission = Permission.COMMAND_HELP.node; this.permission = Permission.HELP.node;
this.disableOnLock = false;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
@ -25,7 +25,8 @@ public class CmdHome extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_HOME.node; this.permission = Permission.HOME.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
@ -15,7 +15,8 @@ public class CmdInvite extends FCommand
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_INVITE.node; this.permission = Permission.INVITE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdInvite extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0); FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) return; if (you == null) return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
@ -14,7 +14,8 @@ public class CmdJoin extends FCommand
this.requiredArgs.add("faction name"); this.requiredArgs.add("faction name");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_JOIN.node; this.permission = Permission.JOIN.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -25,12 +26,6 @@ public class CmdJoin extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
Faction faction = this.argAsFaction(0); Faction faction = this.argAsFaction(0);
if (faction == null) return; if (faction == null) return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
@ -17,7 +17,8 @@ public class CmdKick extends FCommand
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_KICK.node; this.permission = Permission.KICK.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -28,12 +29,6 @@ public class CmdKick extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0); FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) return; if (you == null) return;
@ -47,7 +42,7 @@ public class CmdKick extends FCommand
Faction yourFaction = you.getFaction(); Faction yourFaction = you.getFaction();
// players with admin-level "disband" permission can bypass these requirements // players with admin-level "disband" permission can bypass these requirements
if ( ! Permission.COMMAND_KICK_ANY.has(sender)) if ( ! Permission.KICK_ANY.has(sender))
{ {
if (yourFaction != myFaction) if (yourFaction != myFaction)
{ {

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -12,7 +12,8 @@ public class CmdLeave extends FCommand {
//this.requiredArgs.add(""); //this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_LEAVE.node; this.permission = Permission.LEAVE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;
@ -23,12 +24,6 @@ public class CmdLeave extends FCommand {
@Override @Override
public void perform() public void perform()
{ {
if ( isLocked() )
{
sendLockMessage();
return;
}
fme.leave(true); fme.leave(true);
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -22,7 +22,8 @@ public class CmdList extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("page", "1"); this.optionalArgs.put("page", "1");
this.permission = Permission.COMMAND_LIST.node; this.permission = Permission.LIST.node;
this.disableOnLock = false;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -19,7 +19,8 @@ public class CmdLock extends FCommand {
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flipp"); this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.COMMAND_LOCK.node; this.permission = Permission.LOCK.node;
this.disableOnLock = false;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -30,9 +31,9 @@ public class CmdLock extends FCommand {
@Override @Override
public void perform() public void perform()
{ {
setIsLocked(this.argAsBool(0, ! isLocked())); p.setLocked(this.argAsBool(0, ! p.getLocked()));
if( isLocked() ) if( p.getLocked())
{ {
sendMessageParsed("<i>Factions is now locked"); sendMessageParsed("<i>Factions is now locked");
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -16,7 +16,8 @@ public class CmdMap extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("on/off", "once"); this.optionalArgs.put("on/off", "once");
this.permission = Permission.COMMAND_MAP.node; this.permission = Permission.MAP.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -15,7 +15,8 @@ public class CmdMod extends FCommand
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_MOD.node; this.permission = Permission.MOD.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdMod extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0); FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) return; if (you == null) return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
@ -15,7 +15,8 @@ public class CmdOpen extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("yes/no", "flipp"); this.optionalArgs.put("yes/no", "flipp");
this.permission = Permission.COMMAND_OPEN.node; this.permission = Permission.OPEN.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdOpen extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(Conf.econCostOpen)) return; if ( ! payForCommand(Conf.econCostOpen)) return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -20,7 +20,8 @@ public class CmdOwner extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("player name", "you"); this.optionalArgs.put("player name", "you");
this.permission = Permission.COMMAND_OWNER.node; this.permission = Permission.OWNER.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -33,12 +34,6 @@ public class CmdOwner extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
boolean hasBypass = fme.isAdminBypassing(); boolean hasBypass = fme.isAdminBypassing();
if ( ! hasBypass && ! assertHasFaction()) { if ( ! hasBypass && ! assertHasFaction()) {

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -17,7 +17,8 @@ public class CmdOwnerList extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_OWNERLIST.node; this.permission = Permission.OWNERLIST.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
@ -20,7 +20,8 @@ public class CmdPay extends FCommand
this.requiredArgs.add("amount"); this.requiredArgs.add("amount");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_PAY.node; this.permission = Permission.PAY.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;
@ -29,7 +30,8 @@ public class CmdPay extends FCommand
} }
@Override @Override
public void perform() { public void perform()
{
if ( ! Conf.bankEnabled) return; if ( ! Conf.bankEnabled) return;
if ( ! Conf.bankMembersCanWithdraw && ! assertMinRole(Role.MODERATOR)) if ( ! Conf.bankMembersCanWithdraw && ! assertMinRole(Role.MODERATOR))

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
@ -17,7 +17,8 @@ public class CmdPeaceful extends FCommand
this.requiredArgs.add("faction tag"); this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_SET_PEACEFUL.node; this.permission = Permission.SET_PEACEFUL.node;
this.disableOnLock = true;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
@ -16,7 +16,8 @@ public class CmdPermanent extends FCommand
this.requiredArgs.add("faction tag"); this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_SET_PERMANENT.node; this.permission = Permission.SET_PERMANENT.node;
this.disableOnLock = true;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
@ -16,7 +16,8 @@ public class CmdPower extends FCommand
//this.requiredArgs.add("faction tag"); //this.requiredArgs.add("faction tag");
this.optionalArgs.put("player name", "you"); this.optionalArgs.put("player name", "you");
this.permission = Permission.COMMAND_POWER.node; this.permission = Permission.POWER.node;
this.disableOnLock = false;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -30,7 +31,7 @@ public class CmdPower extends FCommand
FPlayer target = this.argAsBestFPlayerMatch(0, fme); FPlayer target = this.argAsBestFPlayerMatch(0, fme);
if (target == null) return; if (target == null) return;
if (target != me && ! Permission.COMMAND_POWER_ANY.has(sender, true)) return; if (target != me && ! Permission.POWER_ANY.has(sender, true)) return;
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(Conf.econCostPower)) return; if ( ! payForCommand(Conf.econCostPower)) return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -18,7 +18,8 @@ public class CmdReload extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("file", "all"); this.optionalArgs.put("file", "all");
this.permission = Permission.COMMAND_RELOAD.node; this.permission = Permission.RELOAD.node;
this.disableOnLock = false;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FLocation;
@ -17,6 +17,7 @@ public class CmdSafeclaim extends FCommand
this.optionalArgs.put("radius", "0"); this.optionalArgs.put("radius", "0");
this.permission = Permission.MANAGE_SAFE_ZONE.node; this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -29,12 +30,6 @@ public class CmdSafeclaim extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
// The current location of the player // The current location of the player
FLocation playerFlocation = new FLocation(fme); FLocation playerFlocation = new FLocation(fme);

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
@ -16,6 +16,7 @@ public class CmdSafeunclaimall extends FCommand
this.optionalArgs.put("radius", "0"); this.optionalArgs.put("radius", "0");
this.permission = Permission.MANAGE_SAFE_ZONE.node; this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -28,12 +29,6 @@ public class CmdSafeunclaimall extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
Board.unclaimAll(Factions.i.getSafeZone().getId()); Board.unclaimAll(Factions.i.getSafeZone().getId());
sendMessageParsed("<i>You unclaimed ALL safe zone land."); sendMessageParsed("<i>You unclaimed ALL safe zone land.");
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -18,7 +18,8 @@ public class CmdSaveAll extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_SAVE.node; this.permission = Permission.SAVE.node;
this.disableOnLock = false;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -16,7 +16,8 @@ public class CmdSethome extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "mine"); this.optionalArgs.put("faction tag", "mine");
this.permission = Permission.COMMAND_SETHOME.node; this.permission = Permission.SETHOME.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -27,12 +28,6 @@ public class CmdSethome extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
if ( ! Conf.homesEnabled) if ( ! Conf.homesEnabled)
{ {
fme.sendMessageParsed("<b>Sorry, Faction homes are disabled on this server."); fme.sendMessageParsed("<b>Sorry, Faction homes are disabled on this server.");
@ -45,17 +40,17 @@ public class CmdSethome extends FCommand
// Can the player set the home for this faction? // Can the player set the home for this faction?
if (faction == myFaction) if (faction == myFaction)
{ {
if ( ! Permission.COMMAND_SETHOME_ANY.has(sender) && ! assertMinRole(Role.MODERATOR)) return; if ( ! Permission.SETHOME_ANY.has(sender) && ! assertMinRole(Role.MODERATOR)) return;
} }
else else
{ {
if (Permission.COMMAND_SETHOME_ANY.has(sender, true)) return; if (Permission.SETHOME_ANY.has(sender, true)) return;
} }
// Can the player set the faction home HERE? // Can the player set the faction home HERE?
if if
( (
! Permission.COMMAND_BYPASS.has(me) ! Permission.BYPASS.has(me)
&& &&
Conf.homesMustBeInClaimedTerritory Conf.homesMustBeInClaimedTerritory
&& &&

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import java.util.Collection; import java.util.Collection;
@ -21,7 +21,8 @@ public class CmdShow extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "yours"); this.optionalArgs.put("faction tag", "yours");
this.permission = Permission.COMMAND_SHOW.node; this.permission = Permission.SHOW.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import java.util.ArrayList; import java.util.ArrayList;
@ -19,7 +19,8 @@ public class CmdTag extends FCommand
this.requiredArgs.add("faction tag"); this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_TAG.node; this.permission = Permission.TAG.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -30,12 +31,6 @@ public class CmdTag extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
String tag = this.argAsString(0); String tag = this.argAsString(0);
// TODO does not first test cover selfcase? // TODO does not first test cover selfcase?

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
@ -15,7 +15,8 @@ public class CmdTitle extends FCommand
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
this.optionalArgs.put("title", ""); this.optionalArgs.put("title", "");
this.permission = Permission.COMMAND_TITLE.node; this.permission = Permission.TITLE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdTitle extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0); FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) return; if (you == null) return;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -18,7 +18,8 @@ public class CmdUnclaim extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_UNCLAIM.node; this.permission = Permission.UNCLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -29,12 +30,6 @@ public class CmdUnclaim extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
FLocation flocation = new FLocation(fme); FLocation flocation = new FLocation(fme);
Faction otherFaction = Board.getFactionAt(flocation); Faction otherFaction = Board.getFactionAt(flocation);

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -16,7 +16,8 @@ public class CmdUnclaimall extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_UNCLAIM_ALL.node; this.permission = Permission.UNCLAIM_ALL.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -27,12 +28,6 @@ public class CmdUnclaimall extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
String moneyBack = "<i>"; String moneyBack = "<i>";
if (Econ.enabled()) if (Econ.enabled())
{ {

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -13,7 +13,8 @@ public class CmdVersion extends FCommand
//this.requiredArgs.add(""); //this.requiredArgs.add("");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_VERSION.node; this.permission = Permission.VERSION.node;
this.disableOnLock = false;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FLocation;
@ -17,6 +17,7 @@ public class CmdWarclaim extends FCommand
this.optionalArgs.put("radius", "0"); this.optionalArgs.put("radius", "0");
this.permission = Permission.MANAGE_WAR_ZONE.node; this.permission = Permission.MANAGE_WAR_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -28,12 +29,6 @@ public class CmdWarclaim extends FCommand
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
// The current location of the player // The current location of the player
FLocation playerFlocation = new FLocation(fme); FLocation playerFlocation = new FLocation(fme);

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
@ -16,6 +16,7 @@ public class CmdWarunclaimall extends FCommand
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.MANAGE_WAR_ZONE.node; this.permission = Permission.MANAGE_WAR_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -28,13 +29,6 @@ public class CmdWarunclaimall extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
Board.unclaimAll(Factions.i.getWarZone().getId()); Board.unclaimAll(Factions.i.getWarZone().getId());
sendMessageParsed("<i>You unclaimed ALL war zone land."); sendMessageParsed("<i>You unclaimed ALL war zone land.");
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
@ -20,7 +20,8 @@ public class CmdWithdraw extends FCommand
this.requiredArgs.add("amount"); this.requiredArgs.add("amount");
//this.optionalArgs.put("factiontag", "yours"); //this.optionalArgs.put("factiontag", "yours");
this.permission = Permission.COMMAND_WITHDRAW.node; this.permission = Permission.WITHDRAW.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -65,6 +65,8 @@ public class FCmdRoot extends FCommand
senderMustBeModerator = false; senderMustBeModerator = false;
senderMustBeAdmin = false; senderMustBeAdmin = false;
this.disableOnLock = false;
this.setHelpShort("The faction base command"); this.setHelpShort("The faction base command");
this.helpLong.add(p.txt.tags("<i>This command contains all faction stuff.")); this.helpLong.add(p.txt.tags("<i>This command contains all faction stuff."));

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import java.util.List; import java.util.List;
@ -18,17 +18,7 @@ import com.massivecraft.factions.zcore.MCommand;
public abstract class FCommand extends MCommand<P> public abstract class FCommand extends MCommand<P>
{ {
//TODO: Legacy to handle public boolean disableOnLock;
private static boolean lock = false;
// TODO: Move these messages to the locked command??
// TODO: I lost the check for this code somewhere as well :/
public void setIsLocked(boolean isLocked) { lock = isLocked; }
public boolean isLocked() { return lock; }
public void sendLockMessage()
{
// TODO: CCOLOR!!!
me.sendMessage("Factions is locked. Please try again later");
}
public FPlayer fme; public FPlayer fme;
public Faction myFaction; public Faction myFaction;
@ -39,6 +29,10 @@ public abstract class FCommand extends MCommand<P>
public FCommand() public FCommand()
{ {
super(P.p); super(P.p);
// Due to safety reasons it defaults to disable on lock.
disableOnLock = true;
senderMustBeMember = false; senderMustBeMember = false;
senderMustBeModerator = false; senderMustBeModerator = false;
senderMustBeAdmin = false; senderMustBeAdmin = false;
@ -60,6 +54,17 @@ public abstract class FCommand extends MCommand<P>
super.execute(sender, args, commandChain); super.execute(sender, args, commandChain);
} }
@Override
public boolean isEnabled()
{
if (p.getLocked() && this.disableOnLock)
{
sendMessageParsed("<b>Factions was locked by an admin. Please try again later.");
return false;
}
return true;
}
@Override @Override
public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) public boolean validSenderType(CommandSender sender, boolean informSenderIfNot)
{ {

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.cmd;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -18,7 +18,8 @@ public abstract class FRelationCommand extends FCommand
this.requiredArgs.add("faction tag"); this.requiredArgs.add("faction tag");
//this.optionalArgs.put("player name", "you"); //this.optionalArgs.put("player name", "you");
this.permission = Permission.COMMAND_RELATION.node; this.permission = Permission.RELATION.node;
this.disableOnLock = true;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -29,12 +30,6 @@ public abstract class FRelationCommand extends FCommand
@Override @Override
public void perform() public void perform()
{ {
if( isLocked() )
{
sendLockMessage();
return;
}
Faction them = this.argAsFaction(0); Faction them = this.argAsFaction(0);
if ( ! them.isNormal()) if ( ! them.isNormal())

View File

@ -4,7 +4,7 @@ import org.bukkit.event.Event;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.listeners.FactionsServerListener; import com.massivecraft.factions.listeners.FactionsServerListener;
import com.massivecraft.factions.commands.CmdHelp; import com.massivecraft.factions.cmd.CmdHelp;
import com.earth2me.essentials.api.Economy; import com.earth2me.essentials.api.Economy;
import com.nijikokun.register.payment.Methods; import com.nijikokun.register.payment.Methods;

View File

@ -9,52 +9,52 @@ public enum Permission
MANAGE_SAFE_ZONE("managesafezone"), MANAGE_SAFE_ZONE("managesafezone"),
MANAGE_WAR_ZONE("managewarzone"), MANAGE_WAR_ZONE("managewarzone"),
OWNERSHIP_BYPASS("ownershipbypass"), OWNERSHIP_BYPASS("ownershipbypass"),
COMMAND_ADMIN("command.admin"), ADMIN("admin"),
COMMAND_AUTOCLAIM("command.autoclaim"), AUTOCLAIM("autoclaim"),
COMMAND_BALANCE("command.balance"), BALANCE("balance"),
COMMAND_BALANCE_ANY("command.balance.any"), BALANCE_ANY("balance.any"),
COMMAND_WITHDRAW("command.withdraw"), WITHDRAW("withdraw"),
COMMAND_PAY("command.pay"), PAY("pay"),
COMMAND_BYPASS("command.bypass"), BYPASS("bypass"),
COMMAND_CHAT("command.chat"), CHAT("chat"),
COMMAND_CLAIM("command.claim"), CLAIM("claim"),
COMMAND_CONFIG("command.config"), CONFIG("config"),
COMMAND_CREATE("command.create"), CREATE("create"),
COMMAND_DEINVITE("command.deinvite"), DEINVITE("deinvite"),
COMMAND_DEPOSIT("command.deposit"), DEPOSIT("deposit"),
COMMAND_DESCRIPTION("command.description"), DESCRIPTION("description"),
COMMAND_DISBAND("command.disband"), DISBAND("disband"),
COMMAND_DISBAND_ANY("command.disband.any"), DISBAND_ANY("disband.any"),
COMMAND_HELP("command.help"), HELP("help"),
COMMAND_HOME("command.home"), HOME("home"),
COMMAND_INVITE("command.invite"), INVITE("invite"),
COMMAND_JOIN("command.join"), JOIN("join"),
COMMAND_KICK("command.kick"), KICK("kick"),
COMMAND_KICK_ANY("command.kick.any"), KICK_ANY("kick.any"),
COMMAND_LEAVE("command.leave"), LEAVE("leave"),
COMMAND_LIST("command.list"), LIST("list"),
COMMAND_LOCK("command.lock"), LOCK("lock"),
COMMAND_MAP("command.map"), MAP("map"),
COMMAND_MOD("command.mod"), MOD("mod"),
COMMAND_NO_BOOM("command.noboom"), NO_BOOM("noboom"),
COMMAND_OPEN("command.open"), OPEN("open"),
COMMAND_OWNER("command.owner"), OWNER("owner"),
COMMAND_OWNERLIST("command.ownerlist"), OWNERLIST("ownerlist"),
COMMAND_SET_PEACEFUL("command.setpeaceful"), SET_PEACEFUL("setpeaceful"),
COMMAND_SET_PERMANENT("command.setpermanent"), SET_PERMANENT("setpermanent"),
COMMAND_POWER("command.power"), POWER("power"),
COMMAND_POWER_ANY("command.power.any"), POWER_ANY("power.any"),
COMMAND_RELATION("command.relation"), RELATION("relation"),
COMMAND_RELOAD("command.reload"), RELOAD("reload"),
COMMAND_SAVE("command.save"), SAVE("save"),
COMMAND_SETHOME("command.sethome"), SETHOME("sethome"),
COMMAND_SETHOME_ANY("command.sethome.any"), SETHOME_ANY("sethome.any"),
COMMAND_SHOW("command.show"), SHOW("show"),
COMMAND_TAG("command.tag"), TAG("tag"),
COMMAND_TITLE("command.title"), TITLE("title"),
COMMAND_UNCLAIM("command.unclaim"), UNCLAIM("unclaim"),
COMMAND_UNCLAIM_ALL("command.unclaimall"), UNCLAIM_ALL("unclaimall"),
COMMAND_VERSION("command.version"), VERSION("version"),
; ;
public final String node; public final String node;
@ -73,27 +73,4 @@ public enum Permission
{ {
return has(sender, false); return has(sender, false);
} }
/*public boolean has(CommandSender sender)
{
//return CreativeGates.p.perm.has(sender, this.node);
}
public static boolean isCommandDisabled(CommandSender sender, String command)
{
return (hasPerm(sender, "factions.commandDisable."+command) && !hasPerm(sender, "factions.commandDisable.none"));
}
private static boolean hasPerm(CommandSender sender, String permNode)
{
if (Factions.Permissions == null || ! (sender instanceof Player))
{
return sender.isOp() || sender.hasPermission(permNode);
}
Player player = (Player)sender;
return Factions.Permissions.has(player, permNode);
}*/
} }

View File

@ -112,10 +112,9 @@ public abstract class MCommand<T extends MPlugin>
} }
} }
if ( ! validCall(this.sender, this.args)) if ( ! validCall(this.sender, this.args)) return;
{
return; if ( ! this.isEnabled()) return;
}
perform(); perform();
} }
@ -136,7 +135,6 @@ public abstract class MCommand<T extends MPlugin>
/** /**
* In this method we validate that all prerequisites to perform this command has been met. * In this method we validate that all prerequisites to perform this command has been met.
*/ */
// TODO: There should be a boolean for silence // TODO: There should be a boolean for silence
public boolean validCall(CommandSender sender, List<String> args) public boolean validCall(CommandSender sender, List<String> args)
{ {
@ -158,6 +156,11 @@ public abstract class MCommand<T extends MPlugin>
return true; return true;
} }
public boolean isEnabled()
{
return true;
}
public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) public boolean validSenderType(CommandSender sender, boolean informSenderIfNot)
{ {
if (this.senderMustBePlayer && ! (sender instanceof Player)) if (this.senderMustBePlayer && ! (sender instanceof Player))

View File

@ -34,6 +34,9 @@ public abstract class MPlugin extends JavaPlugin
// Persist related // Persist related
public Gson gson; public Gson gson;
private Integer saveTask = null; private Integer saveTask = null;
private boolean autoSave = true;
public boolean getAutoSave() {return this.autoSave;}
public void setAutoSave(boolean val) {this.autoSave = val;}
// Listeners // Listeners
private MPluginSecretPlayerListener mPluginSecretPlayerListener; private MPluginSecretPlayerListener mPluginSecretPlayerListener;
@ -229,12 +232,12 @@ public abstract class MPlugin extends JavaPlugin
// -------------------------------------------- // // -------------------------------------------- //
// HOOKS // HOOKS
// -------------------------------------------- // // -------------------------------------------- //
public void preSaveTask() public void preAutoSave()
{ {
} }
public void postSaveTask() public void postAutoSave()
{ {
} }

View File

@ -12,8 +12,9 @@ public class SaveTask implements Runnable
public void run() public void run()
{ {
p.preSaveTask(); if ( ! p.getAutoSave()) return;
p.preAutoSave();
EM.saveAllToDisc(); EM.saveAllToDisc();
p.postSaveTask(); p.postAutoSave();
} }
} }