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

View File

@ -13,7 +13,7 @@ import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.plugin.Plugin;
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.SpoutFeatures;
import com.massivecraft.factions.integration.Worldguard;
@ -40,6 +40,12 @@ public class P extends MPlugin
public final FactionsEntityListener entityListener;
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 P()
@ -131,7 +137,7 @@ public class P extends MPlugin
}
@Override
public void postSaveTask()
public void postAutoSave()
{
Board.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.FPlayers;
@ -15,7 +15,8 @@ public class CmdAdmin extends FCommand
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_ADMIN.node;
this.permission = Permission.ADMIN.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdAdmin extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer fyou = this.argAsBestFPlayerMatch(0);
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.FLocation;
@ -14,7 +14,8 @@ public class CmdAutoClaim extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.COMMAND_AUTOCLAIM.node;
this.permission = Permission.AUTOCLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -25,12 +26,6 @@ public class CmdAutoClaim extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
boolean enabled = this.argAsBool(0, ! fme.isAutoClaimEnabled());
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.FLocation;
@ -17,6 +17,7 @@ public class CmdAutoSafeclaim extends FCommand
this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -29,12 +30,6 @@ public class CmdAutoSafeclaim extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
boolean enabled = this.argAsBool(0, ! fme.isAutoSafeClaimEnabled());
fme.setIsAutoSafeClaimEnabled(enabled);

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands;
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
@ -18,6 +18,7 @@ public class CmdAutoWarclaim extends FCommand
this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.MANAGE_WAR_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -30,14 +31,8 @@ public class CmdAutoWarclaim extends FCommand
}
@Override
public void perform() {
if ( isLocked() )
{
sendLockMessage();
return;
}
public void perform()
{
boolean enabled = this.argAsBool(0, ! fme.isAutoWarClaimEnabled());
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.integration.Econ;
@ -16,7 +16,8 @@ public class CmdBalance extends FCommand
//this.requiredArgs.add("player name");
this.optionalArgs.put("factiontag", "yours");
this.permission = Permission.COMMAND_BALANCE.node;
this.permission = Permission.BALANCE.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
@ -35,7 +36,7 @@ public class CmdBalance extends FCommand
Faction faction = this.argAsFaction(0, myFaction);
// 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.");
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.struct.Permission;
@ -13,7 +13,8 @@ public class CmdBoom extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.COMMAND_NO_BOOM.node;
this.permission = Permission.NO_BOOM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -24,12 +25,6 @@ public class CmdBoom extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
if ( ! myFaction.isPeaceful())
{
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.struct.Permission;
@ -13,7 +13,8 @@ public class CmdBypass extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.COMMAND_BYPASS.node;
this.permission = Permission.BYPASS.node;
this.disableOnLock = false;
senderMustBePlayer = true;
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.struct.ChatMode;
@ -16,7 +16,8 @@ public class CmdChat extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("mode", "next");
this.permission = Permission.COMMAND_CHAT.node;
this.permission = Permission.CHAT.node;
this.disableOnLock = false;
senderMustBePlayer = 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;
@ -13,7 +13,8 @@ public class CmdClaim extends FCommand
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_CLAIM.node;
this.permission = Permission.CLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
@ -26,12 +27,6 @@ public class CmdClaim extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
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.ParameterizedType;
@ -29,7 +29,8 @@ public class CmdConfig extends FCommand
this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_CONFIG.node;
this.permission = Permission.CONFIG.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
@ -40,12 +41,6 @@ public class CmdConfig extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
// 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
if (properFieldNames.isEmpty())

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands;
package com.massivecraft.factions.cmd;
import java.util.ArrayList;
@ -21,7 +21,8 @@ public class CmdCreate extends FCommand
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_CREATE.node;
this.permission = Permission.CREATE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -32,12 +33,6 @@ public class CmdCreate extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
String tag = this.argAsString(0);
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.struct.Permission;
@ -15,7 +15,8 @@ public class CmdDeinvite extends FCommand
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_DEINVITE.node;
this.permission = Permission.DEINVITE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdDeinvite extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0);
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.integration.Econ;
@ -20,7 +20,8 @@ public class CmdDeposit extends FCommand
this.requiredArgs.add("amount");
//this.optionalArgs
this.permission = Permission.COMMAND_DEPOSIT.node;
this.permission = Permission.DEPOSIT.node;
this.disableOnLock = true;
senderMustBePlayer = 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.FPlayer;
@ -16,7 +16,8 @@ public class CmdDescription extends FCommand
this.requiredArgs.add("desc");
//this.optionalArgs
this.permission = Permission.COMMAND_DESCRIPTION.node;
this.permission = Permission.DESCRIPTION.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -27,12 +28,6 @@ public class CmdDescription extends FCommand
@Override
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 ( ! 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.integration.Econ;
@ -21,7 +21,8 @@ public class CmdDisband extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "yours");
this.permission = Permission.COMMAND_DISBAND.node;
this.permission = Permission.DISBAND.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
@ -44,7 +45,7 @@ public class CmdDisband extends FCommand
}
else
{
if ( ! Permission.COMMAND_DISBAND_ANY.has(me, true))
if ( ! Permission.DISBAND_ANY.has(me, true))
{
return;
}

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands;
package com.massivecraft.factions.cmd;
import java.util.ArrayList;
@ -21,7 +21,8 @@ public class CmdHelp extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("page", "1");
this.permission = Permission.COMMAND_HELP.node;
this.permission = Permission.HELP.node;
this.disableOnLock = false;
senderMustBePlayer = 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.World;
@ -25,7 +25,8 @@ public class CmdHome extends FCommand
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_HOME.node;
this.permission = Permission.HOME.node;
this.disableOnLock = false;
senderMustBePlayer = 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.FPlayer;
@ -15,7 +15,8 @@ public class CmdInvite extends FCommand
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_INVITE.node;
this.permission = Permission.INVITE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdInvite extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0);
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.Faction;
@ -14,7 +14,8 @@ public class CmdJoin extends FCommand
this.requiredArgs.add("faction name");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_JOIN.node;
this.permission = Permission.JOIN.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -25,12 +26,6 @@ public class CmdJoin extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
Faction faction = this.argAsFaction(0);
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.FPlayer;
@ -17,7 +17,8 @@ public class CmdKick extends FCommand
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_KICK.node;
this.permission = Permission.KICK.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -28,12 +29,6 @@ public class CmdKick extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) return;
@ -47,7 +42,7 @@ public class CmdKick extends FCommand
Faction yourFaction = you.getFaction();
// 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)
{

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands;
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Permission;
@ -12,7 +12,8 @@ public class CmdLeave extends FCommand {
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_LEAVE.node;
this.permission = Permission.LEAVE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
@ -23,12 +24,6 @@ public class CmdLeave extends FCommand {
@Override
public void perform()
{
if ( isLocked() )
{
sendLockMessage();
return;
}
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.Collections;
@ -22,7 +22,8 @@ public class CmdList extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("page", "1");
this.permission = Permission.COMMAND_LIST.node;
this.permission = Permission.LIST.node;
this.disableOnLock = false;
senderMustBePlayer = 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;
@ -19,7 +19,8 @@ public class CmdLock extends FCommand {
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flipp");
this.permission = Permission.COMMAND_LOCK.node;
this.permission = Permission.LOCK.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
@ -30,9 +31,9 @@ public class CmdLock extends FCommand {
@Override
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");
}

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.Conf;
@ -16,7 +16,8 @@ public class CmdMap extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "once");
this.permission = Permission.COMMAND_MAP.node;
this.permission = Permission.MAP.node;
this.disableOnLock = false;
senderMustBePlayer = true;
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.struct.Permission;
@ -15,7 +15,8 @@ public class CmdMod extends FCommand
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_MOD.node;
this.permission = Permission.MOD.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdMod extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0);
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.Faction;
@ -15,7 +15,8 @@ public class CmdOpen extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("yes/no", "flipp");
this.permission = Permission.COMMAND_OPEN.node;
this.permission = Permission.OPEN.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdOpen extends FCommand
@Override
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 ( ! 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.Conf;
@ -20,7 +20,8 @@ public class CmdOwner extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("player name", "you");
this.permission = Permission.COMMAND_OWNER.node;
this.permission = Permission.OWNER.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -33,12 +34,6 @@ public class CmdOwner extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
boolean hasBypass = fme.isAdminBypassing();
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.Conf;
@ -17,7 +17,8 @@ public class CmdOwnerList extends FCommand
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_OWNERLIST.node;
this.permission = Permission.OWNERLIST.node;
this.disableOnLock = false;
senderMustBePlayer = true;
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.integration.Econ;
@ -20,7 +20,8 @@ public class CmdPay extends FCommand
this.requiredArgs.add("amount");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_PAY.node;
this.permission = Permission.PAY.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
@ -29,7 +30,8 @@ public class CmdPay extends FCommand
}
@Override
public void perform() {
public void perform()
{
if ( ! Conf.bankEnabled) return;
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.Faction;
@ -17,7 +17,8 @@ public class CmdPeaceful extends FCommand
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_SET_PEACEFUL.node;
this.permission = Permission.SET_PEACEFUL.node;
this.disableOnLock = true;
senderMustBePlayer = 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.Faction;
@ -16,7 +16,8 @@ public class CmdPermanent extends FCommand
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_SET_PERMANENT.node;
this.permission = Permission.SET_PERMANENT.node;
this.disableOnLock = true;
senderMustBePlayer = 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.FPlayer;
@ -16,7 +16,8 @@ public class CmdPower extends FCommand
//this.requiredArgs.add("faction tag");
this.optionalArgs.put("player name", "you");
this.permission = Permission.COMMAND_POWER.node;
this.permission = Permission.POWER.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
@ -30,7 +31,7 @@ public class CmdPower extends FCommand
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
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 ( ! 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;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands;
package com.massivecraft.factions.cmd;
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;

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.Conf;
@ -18,7 +18,8 @@ public class CmdReload extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("file", "all");
this.permission = Permission.COMMAND_RELOAD.node;
this.permission = Permission.RELOAD.node;
this.disableOnLock = false;
senderMustBePlayer = 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.FLocation;
@ -17,6 +17,7 @@ public class CmdSafeclaim extends FCommand
this.optionalArgs.put("radius", "0");
this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -29,12 +30,6 @@ public class CmdSafeclaim extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
// The current location of the player
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.Factions;
@ -16,6 +16,7 @@ public class CmdSafeunclaimall extends FCommand
this.optionalArgs.put("radius", "0");
this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
@ -28,12 +29,6 @@ public class CmdSafeunclaimall extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
Board.unclaimAll(Factions.i.getSafeZone().getId());
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.Conf;
@ -18,7 +18,8 @@ public class CmdSaveAll extends FCommand
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_SAVE.node;
this.permission = Permission.SAVE.node;
this.disableOnLock = false;
senderMustBePlayer = 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.Conf;
@ -16,7 +16,8 @@ public class CmdSethome extends FCommand
//this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "mine");
this.permission = Permission.COMMAND_SETHOME.node;
this.permission = Permission.SETHOME.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -27,12 +28,6 @@ public class CmdSethome extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
if ( ! Conf.homesEnabled)
{
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?
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
{
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?
if
(
! Permission.COMMAND_BYPASS.has(me)
! Permission.BYPASS.has(me)
&&
Conf.homesMustBeInClaimedTerritory
&&

View File

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

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands;
package com.massivecraft.factions.cmd;
import java.util.ArrayList;
@ -19,7 +19,8 @@ public class CmdTag extends FCommand
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_TAG.node;
this.permission = Permission.TAG.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -30,12 +31,6 @@ public class CmdTag extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
String tag = this.argAsString(0);
// 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.FPlayer;
@ -15,7 +15,8 @@ public class CmdTitle extends FCommand
this.requiredArgs.add("player name");
this.optionalArgs.put("title", "");
this.permission = Permission.COMMAND_TITLE.node;
this.permission = Permission.TITLE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -26,12 +27,6 @@ public class CmdTitle extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
FPlayer you = this.argAsBestFPlayerMatch(0);
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.Conf;
@ -18,7 +18,8 @@ public class CmdUnclaim extends FCommand
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_UNCLAIM.node;
this.permission = Permission.UNCLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -29,12 +30,6 @@ public class CmdUnclaim extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
FLocation flocation = new FLocation(fme);
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.Conf;
@ -16,7 +16,8 @@ public class CmdUnclaimall extends FCommand
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_UNCLAIM_ALL.node;
this.permission = Permission.UNCLAIM_ALL.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -27,12 +28,6 @@ public class CmdUnclaimall extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
String moneyBack = "<i>";
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.struct.Permission;
@ -13,7 +13,8 @@ public class CmdVersion extends FCommand
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_VERSION.node;
this.permission = Permission.VERSION.node;
this.disableOnLock = false;
senderMustBePlayer = 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.FLocation;
@ -17,6 +17,7 @@ public class CmdWarclaim extends FCommand
this.optionalArgs.put("radius", "0");
this.permission = Permission.MANAGE_WAR_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -28,12 +29,6 @@ public class CmdWarclaim extends FCommand
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
// The current location of the player
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.Factions;
@ -16,6 +16,7 @@ public class CmdWarunclaimall extends FCommand
//this.optionalArgs.put("", "");
this.permission = Permission.MANAGE_WAR_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
@ -28,13 +29,6 @@ public class CmdWarunclaimall extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
Board.unclaimAll(Factions.i.getWarZone().getId());
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.integration.Econ;
@ -20,7 +20,8 @@ public class CmdWithdraw extends FCommand
this.requiredArgs.add("amount");
//this.optionalArgs.put("factiontag", "yours");
this.permission = Permission.COMMAND_WITHDRAW.node;
this.permission = Permission.WITHDRAW.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.commands;
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
@ -65,6 +65,8 @@ public class FCmdRoot extends FCommand
senderMustBeModerator = false;
senderMustBeAdmin = false;
this.disableOnLock = false;
this.setHelpShort("The faction base command");
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;
@ -18,17 +18,7 @@ import com.massivecraft.factions.zcore.MCommand;
public abstract class FCommand extends MCommand<P>
{
//TODO: Legacy to handle
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 boolean disableOnLock;
public FPlayer fme;
public Faction myFaction;
@ -39,6 +29,10 @@ public abstract class FCommand extends MCommand<P>
public FCommand()
{
super(P.p);
// Due to safety reasons it defaults to disable on lock.
disableOnLock = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
@ -60,6 +54,17 @@ public abstract class FCommand extends MCommand<P>
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
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;
@ -18,7 +18,8 @@ public abstract class FRelationCommand extends FCommand
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("player name", "you");
this.permission = Permission.COMMAND_RELATION.node;
this.permission = Permission.RELATION.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
@ -29,12 +30,6 @@ public abstract class FRelationCommand extends FCommand
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
Faction them = this.argAsFaction(0);
if ( ! them.isNormal())

View File

@ -4,7 +4,7 @@ import org.bukkit.event.Event;
import org.bukkit.plugin.Plugin;
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.nijikokun.register.payment.Methods;

View File

@ -9,52 +9,52 @@ public enum Permission
MANAGE_SAFE_ZONE("managesafezone"),
MANAGE_WAR_ZONE("managewarzone"),
OWNERSHIP_BYPASS("ownershipbypass"),
COMMAND_ADMIN("command.admin"),
COMMAND_AUTOCLAIM("command.autoclaim"),
COMMAND_BALANCE("command.balance"),
COMMAND_BALANCE_ANY("command.balance.any"),
COMMAND_WITHDRAW("command.withdraw"),
COMMAND_PAY("command.pay"),
COMMAND_BYPASS("command.bypass"),
COMMAND_CHAT("command.chat"),
COMMAND_CLAIM("command.claim"),
COMMAND_CONFIG("command.config"),
COMMAND_CREATE("command.create"),
COMMAND_DEINVITE("command.deinvite"),
COMMAND_DEPOSIT("command.deposit"),
COMMAND_DESCRIPTION("command.description"),
COMMAND_DISBAND("command.disband"),
COMMAND_DISBAND_ANY("command.disband.any"),
COMMAND_HELP("command.help"),
COMMAND_HOME("command.home"),
COMMAND_INVITE("command.invite"),
COMMAND_JOIN("command.join"),
COMMAND_KICK("command.kick"),
COMMAND_KICK_ANY("command.kick.any"),
COMMAND_LEAVE("command.leave"),
COMMAND_LIST("command.list"),
COMMAND_LOCK("command.lock"),
COMMAND_MAP("command.map"),
COMMAND_MOD("command.mod"),
COMMAND_NO_BOOM("command.noboom"),
COMMAND_OPEN("command.open"),
COMMAND_OWNER("command.owner"),
COMMAND_OWNERLIST("command.ownerlist"),
COMMAND_SET_PEACEFUL("command.setpeaceful"),
COMMAND_SET_PERMANENT("command.setpermanent"),
COMMAND_POWER("command.power"),
COMMAND_POWER_ANY("command.power.any"),
COMMAND_RELATION("command.relation"),
COMMAND_RELOAD("command.reload"),
COMMAND_SAVE("command.save"),
COMMAND_SETHOME("command.sethome"),
COMMAND_SETHOME_ANY("command.sethome.any"),
COMMAND_SHOW("command.show"),
COMMAND_TAG("command.tag"),
COMMAND_TITLE("command.title"),
COMMAND_UNCLAIM("command.unclaim"),
COMMAND_UNCLAIM_ALL("command.unclaimall"),
COMMAND_VERSION("command.version"),
ADMIN("admin"),
AUTOCLAIM("autoclaim"),
BALANCE("balance"),
BALANCE_ANY("balance.any"),
WITHDRAW("withdraw"),
PAY("pay"),
BYPASS("bypass"),
CHAT("chat"),
CLAIM("claim"),
CONFIG("config"),
CREATE("create"),
DEINVITE("deinvite"),
DEPOSIT("deposit"),
DESCRIPTION("description"),
DISBAND("disband"),
DISBAND_ANY("disband.any"),
HELP("help"),
HOME("home"),
INVITE("invite"),
JOIN("join"),
KICK("kick"),
KICK_ANY("kick.any"),
LEAVE("leave"),
LIST("list"),
LOCK("lock"),
MAP("map"),
MOD("mod"),
NO_BOOM("noboom"),
OPEN("open"),
OWNER("owner"),
OWNERLIST("ownerlist"),
SET_PEACEFUL("setpeaceful"),
SET_PERMANENT("setpermanent"),
POWER("power"),
POWER_ANY("power.any"),
RELATION("relation"),
RELOAD("reload"),
SAVE("save"),
SETHOME("sethome"),
SETHOME_ANY("sethome.any"),
SHOW("show"),
TAG("tag"),
TITLE("title"),
UNCLAIM("unclaim"),
UNCLAIM_ALL("unclaimall"),
VERSION("version"),
;
public final String node;
@ -73,27 +73,4 @@ public enum Permission
{
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))
{
return;
}
if ( ! validCall(this.sender, this.args)) return;
if ( ! this.isEnabled()) return;
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.
*/
// TODO: There should be a boolean for silence
public boolean validCall(CommandSender sender, List<String> args)
{
@ -158,6 +156,11 @@ public abstract class MCommand<T extends MPlugin>
return true;
}
public boolean isEnabled()
{
return true;
}
public boolean validSenderType(CommandSender sender, boolean informSenderIfNot)
{
if (this.senderMustBePlayer && ! (sender instanceof Player))

View File

@ -34,6 +34,9 @@ public abstract class MPlugin extends JavaPlugin
// Persist related
public Gson gson;
private Integer saveTask = null;
private boolean autoSave = true;
public boolean getAutoSave() {return this.autoSave;}
public void setAutoSave(boolean val) {this.autoSave = val;}
// Listeners
private MPluginSecretPlayerListener mPluginSecretPlayerListener;
@ -229,12 +232,12 @@ public abstract class MPlugin extends JavaPlugin
// -------------------------------------------- //
// 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()
{
p.preSaveTask();
if ( ! p.getAutoSave()) return;
p.preAutoSave();
EM.saveAllToDisc();
p.postSaveTask();
p.postAutoSave();
}
}