This commit is contained in:
Olof Larsson 2011-10-09 20:10:19 +02:00
parent a0c8fd8d7d
commit 3cdd5764d3
61 changed files with 556 additions and 544 deletions

View File

@ -21,55 +21,32 @@ permissions:
factions.*: factions.*:
description: Grants all Factions permissions description: Grants all Factions permissions
children: children:
factions.participate: true factions.*:
factions.create: true description: Grants all Factions permissions
factions.viewAnyPower: true children:
factions.viewAnyFactionBalance: true
factions.peacefulExplosionToggle: true
factions.adminBypass: true factions.managesafezone:
factions.config: true
factions.disband: true
factions.lock: true
factions.manageSafeZone: true
factions.manageWarZone: true
factions.ownershipBypass: true
factions.reload: true
factions.saveall: true
factions.setPeaceful: true
factions.setPermanent: true
factions.commandDisable.none: true
factions.participate:
description: participate in a faction
default: true
factions.create:
description: create a new faction
default: true
factions.viewAnyFactionBalance:
description: view the faction bank balance for any faction
default: true
factions.peacefulExplosionToggle:
description: disable explosions in your territory as a peaceful faction admin or moderator
default: true
factions.manageSafeZone:
description: claim land as a safe zone and build/destroy within safe zones description: claim land as a safe zone and build/destroy within safe zones
default: op default: op
factions.manageWarZone: factions.managewarzone:
description: claim land as a war zone and build/destroy within war zones description: claim land as a war zone and build/destroy within war zones
default: op default: op
factions.ownershipBypass: factions.ownershipbypass:
description: bypass ownership restrictions within own faction's territory description: bypass ownership restrictions within own faction's territory
default: op default: op
factions.command.admin: factions.command.admin:
description: hand over your admin rights description: hand over your admin rights
default: true default: true
factions.command.autoClaim: factions.command.autoclaim:
description: auto-claim land as you walk around description: auto-claim land as you walk around
default: true default: true
factions.command.balance: factions.command.balance:
description: show current faction balance description: show current faction balance
default: true default: true
factions.command.balance.any:
description: show on other factions balance
default: true
factions.command.withdraw: factions.command.withdraw:
description: withdraw money from your faction bank description: withdraw money from your faction bank
default: true default: true
@ -88,6 +65,9 @@ permissions:
factions.command.config: factions.command.config:
description: change a conf.json setting description: change a conf.json setting
default: op default: op
factions.create:
description: create a new faction
default: true
factions.command.deinvite: factions.command.deinvite:
description: remove a pending invitation description: remove a pending invitation
default: true default: true
@ -133,7 +113,7 @@ permissions:
factions.command.mod: factions.command.mod:
description: give or revoke moderator rights description: give or revoke moderator rights
default: true default: true
factions.command.noBoom: factions.command.noboom:
description: toggle explosions (peaceful factions only) description: toggle explosions (peaceful factions only)
default: true default: true
factions.command.open: factions.command.open:
@ -145,10 +125,10 @@ permissions:
factions.command.ownerlist: factions.command.ownerlist:
description: list owner(s) of this claimed land description: list owner(s) of this claimed land
default: true default: true
factions.command.setPeaceful: factions.command.setpeaceful:
description: designate a faction as peaceful description: designate a faction as peaceful
default: op default: op
factions.command.setPermanent: factions.command.setpermanent:
description: designate a faction as permanent description: designate a faction as permanent
default: op default: op
factions.command.power: factions.command.power:
@ -187,5 +167,6 @@ permissions:
factions.command.unclaim: factions.command.unclaim:
description: unclaim the land where you are standing description: unclaim the land where you are standing
default: true default: true
factions.command.unclaimall:
description: unclaim all of your factions land
default: true

View File

@ -1,17 +1,13 @@
package com.massivecraft.factions; package com.massivecraft.factions;
import java.io.*;
import java.lang.reflect.Type;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.logging.Level;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.*; import com.massivecraft.factions.util.*;
@ -185,6 +181,11 @@ public class Faction extends Entity
return this.getId().equals("-2"); return this.getId().equals("-2");
} }
public boolean isPlayerFreeType()
{
return this.isSafeZone() || this.isWarZone();
}
// ------------------------------- // -------------------------------
// Relation and relation colors TODO // Relation and relation colors TODO
@ -302,7 +303,7 @@ public class Faction extends Entity
public ArrayList<FPlayer> getFPlayers() public ArrayList<FPlayer> getFPlayers()
{ {
ArrayList<FPlayer> ret = new ArrayList<FPlayer>(); ArrayList<FPlayer> ret = new ArrayList<FPlayer>();
if (id < 0) return ret; if (this.isPlayerFreeType()) return ret;
for (FPlayer fplayer : FPlayers.i.get()) for (FPlayer fplayer : FPlayers.i.get())
{ {
@ -318,7 +319,7 @@ public class Faction extends Entity
public ArrayList<FPlayer> getFPlayersWhereOnline(boolean online) public ArrayList<FPlayer> getFPlayersWhereOnline(boolean online)
{ {
ArrayList<FPlayer> ret = new ArrayList<FPlayer>(); ArrayList<FPlayer> ret = new ArrayList<FPlayer>();
if (id < 0) return ret; if (this.isPlayerFreeType()) return ret;
for (FPlayer fplayer : FPlayers.i.get()) for (FPlayer fplayer : FPlayers.i.get())
{ {
@ -333,7 +334,7 @@ public class Faction extends Entity
public FPlayer getFPlayerAdmin() public FPlayer getFPlayerAdmin()
{ {
if (id <= 0) return null; if ( ! this.isNormal()) return null;
for (FPlayer fplayer : FPlayers.i.get()) for (FPlayer fplayer : FPlayers.i.get())
{ {
@ -347,7 +348,7 @@ public class Faction extends Entity
public ArrayList<FPlayer> getFPlayersWhereRole(Role role) { public ArrayList<FPlayer> getFPlayersWhereRole(Role role) {
ArrayList<FPlayer> ret = new ArrayList<FPlayer>(); ArrayList<FPlayer> ret = new ArrayList<FPlayer>();
if (id <= 0) return ret; if ( ! this.isNormal()) return ret;
for (FPlayer fplayer : FPlayers.i.get()) { for (FPlayer fplayer : FPlayers.i.get()) {
if (fplayer.getFaction() == this && fplayer.getRole() == role) { if (fplayer.getFaction() == this && fplayer.getRole() == role) {
@ -361,7 +362,7 @@ public class Faction extends Entity
public ArrayList<Player> getOnlinePlayers() public ArrayList<Player> getOnlinePlayers()
{ {
ArrayList<Player> ret = new ArrayList<Player>(); ArrayList<Player> ret = new ArrayList<Player>();
if (id < 0) return ret; if (this.isPlayerFreeType()) return ret;
for (Player player: P.p.getServer().getOnlinePlayers()) for (Player player: P.p.getServer().getOnlinePlayers())
{ {
@ -379,7 +380,7 @@ public class Faction extends Entity
public boolean hasPlayersOnline() public boolean hasPlayersOnline()
{ {
// only real factions can have players online, not safe zone / war zone // only real factions can have players online, not safe zone / war zone
if (id < 0) return false; if (this.isPlayerFreeType()) return false;
for (Player player: P.p.getServer().getOnlinePlayers()) for (Player player: P.p.getServer().getOnlinePlayers())
{ {

View File

@ -1,22 +1,12 @@
package com.massivecraft.factions; package com.massivecraft.factions;
import java.io.File;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
@ -32,16 +22,11 @@ import com.massivecraft.factions.listeners.FactionsChatEarlyListener;
import com.massivecraft.factions.listeners.FactionsEntityListener; import com.massivecraft.factions.listeners.FactionsEntityListener;
import com.massivecraft.factions.listeners.FactionsPlayerListener; import com.massivecraft.factions.listeners.FactionsPlayerListener;
import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter;
import com.massivecraft.factions.util.MyLocationTypeAdapter;
import com.massivecraft.factions.zcore.MPlugin; import com.massivecraft.factions.zcore.MPlugin;
import com.nijiko.permissions.PermissionHandler; import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.earth2me.essentials.chat.EssentialsChat; import com.earth2me.essentials.chat.EssentialsChat;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.integration.EssentialsFeatures; import com.massivecraft.factions.integration.EssentialsFeatures;
public class P extends MPlugin public class P extends MPlugin
@ -55,7 +40,7 @@ public class P extends MPlugin
public final FactionsEntityListener entityListener; public final FactionsEntityListener entityListener;
public final FactionsBlockListener blockListener; public final FactionsBlockListener blockListener;
public CmdBase cmdBase; public FCmdRoot cmdBase;
public P() public P()
{ {
@ -82,7 +67,7 @@ public class P extends MPlugin
Board.load(); Board.load();
// Add Base Commands // Add Base Commands
this.cmdBase = new CmdBase(); this.cmdBase = new FCmdRoot();
this.getBaseCommands().add(cmdBase); this.getBaseCommands().add(cmdBase);
//setupPermissions(); //setupPermissions();
@ -96,59 +81,6 @@ public class P extends MPlugin
Worldguard.init(this); Worldguard.init(this);
} }
//Type mapFLocToStringSetType = new TypeToken<Map<FLocation, Set<String>>>(){}.getType();
// Add the commands
/*commands.add(new FCommandHelp());
commands.add(new FCommandAdmin());
commands.add(new FCommandAutoClaim());
commands.add(new FCommandAutoSafeclaim());
commands.add(new FCommandAutoWarclaim());
commands.add(new FCommandBalance());
commands.add(new FCommandBypass());
commands.add(new FCommandChat());
commands.add(new FCommandClaim());
commands.add(new FCommandConfig());
commands.add(new FCommandCreate());
commands.add(new FCommandDeinvite());
commands.add(new FCommandDeposit());
commands.add(new FCommandDescription());
commands.add(new FCommandDisband());
commands.add(new FCommandHome());
commands.add(new FCommandInvite());
commands.add(new FCommandJoin());
commands.add(new FCommandKick());
commands.add(new FCommandLeave());
commands.add(new FCommandList());
commands.add(new FCommandLock());
commands.add(new FCommandMap());
commands.add(new FCommandMod());
commands.add(new FCommandNoBoom());
commands.add(new FCommandOpen());
commands.add(new FCommandOwner());
commands.add(new FCommandOwnerList());
commands.add(new FCommandPay());
commands.add(new FCommandPower());
commands.add(new FCommandPeaceful());
commands.add(new FCommandPermanent());
commands.add(new FCommandRelationAlly());
commands.add(new FCommandRelationEnemy());
commands.add(new FCommandRelationNeutral());
commands.add(new FCommandReload());
commands.add(new FCommandSafeclaim());
commands.add(new FCommandSafeunclaimall());
commands.add(new FCommandSaveAll());
commands.add(new FCommandSethome());
commands.add(new FCommandShow());
commands.add(new FCommandTag());
commands.add(new FCommandTitle());
commands.add(new FCommandUnclaim());
commands.add(new FCommandUnclaimall());
commands.add(new FCommandVersion());
commands.add(new FCommandWarclaim());
commands.add(new FCommandWarunclaimall());
commands.add(new FCommandWithdraw());*/
// Register events // Register events
PluginManager pm = this.getServer().getPluginManager(); PluginManager pm = this.getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Event.Priority.Highest, this); pm.registerEvent(Event.Type.PLAYER_CHAT, this.playerListener, Event.Priority.Highest, this);
@ -177,11 +109,6 @@ public class P extends MPlugin
pm.registerEvent(Event.Type.BLOCK_PISTON_EXTEND, this.blockListener, Event.Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_PISTON_EXTEND, this.blockListener, Event.Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PISTON_RETRACT, this.blockListener, Event.Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_PISTON_RETRACT, this.blockListener, Event.Priority.Normal, this);
// Register recurring tasks
/*long saveTicks = 20 * 60 * 30; // Approximately every 30 min
if (saveTask == null)
saveTask = this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(), saveTicks, saveTicks);
*/
postEnable(); postEnable();
} }
@ -239,7 +166,8 @@ public class P extends MPlugin
private void unhookEssentialsChat() private void unhookEssentialsChat()
{ {
if (essChat != null) { if (essChat != null)
{
EssentialsFeatures.unhookChat(); EssentialsFeatures.unhookChat();
} }
} }
@ -262,6 +190,8 @@ public class P extends MPlugin
// Simply put, should this chat event be left for Factions to handle? For now, that means players with Faction Chat // Simply put, should this chat event be left for Factions to handle? For now, that means players with Faction Chat
// enabled or use of the Factions f command without a slash; combination of isPlayerFactionChatting() and isFactionsCommand() // enabled or use of the Factions f command without a slash; combination of isPlayerFactionChatting() and isFactionsCommand()
public boolean shouldLetFactionsHandleThisChat(PlayerChatEvent event) public boolean shouldLetFactionsHandleThisChat(PlayerChatEvent event)
{ {
if (event == null) return false; if (event == null) return false;
@ -280,10 +210,13 @@ public class P extends MPlugin
} }
// Is this chat message actually a Factions command, and thus should be left alone by other plugins? // Is this chat message actually a Factions command, and thus should be left alone by other plugins?
// TODO: GET THIS BACK AND WORKING
public boolean isFactionsCommand(String check) public boolean isFactionsCommand(String check)
{ {
if (check == null || check.isEmpty()) return false; if (check == null || check.isEmpty()) return false;
return (Conf.allowNoSlashCommand && (check.startsWith(p.getBaseCommand()+" ") || check.equals(p.getBaseCommand()))); return this.handleCommand(null, check, true);
} }
// Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat // Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat

View File

@ -5,9 +5,9 @@ import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandAdmin extends FCommand public class CmdAdmin extends FCommand
{ {
public FCommandAdmin() public CmdAdmin()
{ {
super(); super();
this.aliases.add("admin"); this.aliases.add("admin");

View File

@ -4,9 +4,9 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandAutoClaim extends FCommand public class CmdAutoClaim extends FCommand
{ {
public FCommandAutoClaim() public CmdAutoClaim()
{ {
super(); super();
this.aliases.add("autoclaim"); this.aliases.add("autoclaim");

View File

@ -5,10 +5,10 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandAutoSafeclaim extends FCommand public class CmdAutoSafeclaim extends FCommand
{ {
public FCommandAutoSafeclaim() public CmdAutoSafeclaim()
{ {
super(); super();
this.aliases.add("autosafe"); this.aliases.add("autosafe");

View File

@ -6,10 +6,10 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandAutoWarclaim extends FCommand public class CmdAutoWarclaim extends FCommand
{ {
public FCommandAutoWarclaim() public CmdAutoWarclaim()
{ {
super(); super();
this.aliases.add("autosafe"); this.aliases.add("autosafe");

View File

@ -5,9 +5,9 @@ import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
public class FCommandBalance extends FCommand public class CmdBalance extends FCommand
{ {
public FCommandBalance() public CmdBalance()
{ {
super(); super();
this.aliases.add("balance"); this.aliases.add("balance");
@ -35,7 +35,7 @@ public class FCommandBalance 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.VIEW_ANY_FACTION_BALANCE.has(sender)) if ( faction != myFaction && ! Permission.COMMAND_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,42 +0,0 @@
package com.massivecraft.factions.commands;
import com.massivecraft.factions.Conf;
public class CmdBase extends FCommand
{
//public CmdAccept cmdAccept = new CmdAccept();
public CmdBase()
{
super();
this.aliases.addAll(Conf.baseCommandAliases);
this.allowNoSlashAccess = Conf.allowNoSlashCommand;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
this.setHelpShort("The faction base command");
this.helpLong.add(p.txt.tags("<i>This command contains all faction stuff."));
/*this.subCommands.add(p.cmdHelp);
this.subCommands.add(new CmdIntend());
this.subCommands.add(new CmdInfect());
this.subCommands.add(cmdAccept);
this.subCommands.add(new CmdList());
this.subCommands.add(new CmdSetfood());
this.subCommands.add(new CmdSetinfection());
this.subCommands.add(new CmdTurn());
this.subCommands.add(new CmdCure());
this.subCommands.add(new CmdVersion());*/
}
@Override
public void perform()
{
//this.commandChain.add(this);
//p.cmdHelp.execute(this.sender, this.args, this.commandChain);
}
}

View File

@ -3,9 +3,9 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandNoBoom extends FCommand public class CmdBoom extends FCommand
{ {
public FCommandNoBoom() public CmdBoom()
{ {
super(); super();
this.aliases.add("noboom"); this.aliases.add("noboom");

View File

@ -3,9 +3,9 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandBypass extends FCommand public class CmdBypass extends FCommand
{ {
public FCommandBypass() public CmdBypass()
{ {
super(); super();
this.aliases.add("bypass"); this.aliases.add("bypass");

View File

@ -4,10 +4,10 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandChat extends FCommand public class CmdChat extends FCommand
{ {
public FCommandChat() public CmdChat()
{ {
super(); super();
this.aliases.add("c"); this.aliases.add("c");

View File

@ -2,10 +2,10 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandClaim extends FCommand public class CmdClaim extends FCommand
{ {
public FCommandClaim() public CmdClaim()
{ {
super(); super();
this.aliases.add("claim"); this.aliases.add("claim");

View File

@ -8,7 +8,6 @@ import java.util.HashMap;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
@ -16,11 +15,11 @@ import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandConfig extends FCommand public class CmdConfig extends FCommand
{ {
private static HashMap<String, String> properFieldNames = new HashMap<String, String>(); private static HashMap<String, String> properFieldNames = new HashMap<String, String>();
public FCommandConfig() public CmdConfig()
{ {
super(); super();
this.aliases.add("config"); this.aliases.add("config");
@ -86,20 +85,16 @@ public class FCommandConfig extends FCommand
// boolean // boolean
if (target.getType() == boolean.class) if (target.getType() == boolean.class)
{ {
if (aliasTrue.contains(value.toLowerCase())) boolean targetValue = this.strAsBool(value);
target.setBoolean(null, targetValue);
if (targetValue)
{ {
target.setBoolean(null, true);
success = "\""+fieldName+"\" option set to true (enabled)."; success = "\""+fieldName+"\" option set to true (enabled).";
} }
else if (aliasFalse.contains(value.toLowerCase()))
{
target.setBoolean(null, false);
success = "\""+fieldName+"\" option set to false (disabled).";
}
else else
{ {
sendMessage("Cannot set \""+fieldName+"\": boolean value required (true or false)."); success = "\""+fieldName+"\" option set to false (disabled).";
return;
} }
} }

View File

@ -11,9 +11,9 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandCreate extends FCommand public class CmdCreate extends FCommand
{ {
public FCommandCreate() public CmdCreate()
{ {
super(); super();
this.aliases.add("create"); this.aliases.add("create");
@ -21,7 +21,7 @@ public class FCommandCreate extends FCommand
this.requiredArgs.add("faction tag"); this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", ""); //this.optionalArgs.put("", "");
this.permission = Permission.CREATE.node; this.permission = Permission.COMMAND_CREATE.node;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = false; senderMustBeMember = false;
@ -75,7 +75,7 @@ public class FCommandCreate extends FCommand
follower.sendMessageParsed("%s<i> created a new faction %s", fme.getNameAndRelevant(follower), faction.getTag(follower)); follower.sendMessageParsed("%s<i> created a new faction %s", fme.getNameAndRelevant(follower), faction.getTag(follower));
} }
sendMessage("You should now: " + new FCommandDescription().getUseageTemplate()); sendMessage("You should now: " + new CmdDescription().getUseageTemplate());
} }
} }

View File

@ -3,10 +3,10 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandDeinvite extends FCommand public class CmdDeinvite extends FCommand
{ {
public FCommandDeinvite() public CmdDeinvite()
{ {
super(); super();
this.aliases.add("deinvite"); this.aliases.add("deinvite");
@ -38,7 +38,7 @@ public class FCommandDeinvite extends FCommand
if (you.getFaction() == myFaction) if (you.getFaction() == myFaction)
{ {
sendMessageParsed("%s<i> is already a member of %s", you.getName(), myFaction.getTag()); sendMessageParsed("%s<i> is already a member of %s", you.getName(), myFaction.getTag());
sendMessageParsed("<i>You might want to: %s", new FCommandKick().getUseageTemplate(false)); sendMessageParsed("<i>You might want to: %s", new CmdKick().getUseageTemplate(false));
return; return;
} }

View File

@ -9,10 +9,10 @@ import com.massivecraft.factions.P;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
public class FCommandDeposit extends FCommand public class CmdDeposit extends FCommand
{ {
public FCommandDeposit() public CmdDeposit()
{ {
super(); super();
this.aliases.add("deposit"); this.aliases.add("deposit");

View File

@ -6,9 +6,9 @@ import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TextUtil; import com.massivecraft.factions.zcore.util.TextUtil;
public class FCommandDescription extends FCommand public class CmdDescription extends FCommand
{ {
public FCommandDescription() public CmdDescription()
{ {
super(); super();
this.aliases.add("desc"); this.aliases.add("desc");

View File

@ -11,9 +11,9 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandDisband extends FCommand public class CmdDisband extends FCommand
{ {
public FCommandDisband() public CmdDisband()
{ {
super(); super();
this.aliases.add("disband"); this.aliases.add("disband");

View File

@ -8,10 +8,10 @@ import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandHelp extends FCommand public class CmdHelp extends FCommand
{ {
public FCommandHelp() public CmdHelp()
{ {
super(); super();
this.aliases.add("help"); this.aliases.add("help");
@ -58,27 +58,27 @@ public class FCommandHelp extends FCommand
ArrayList<String> pageLines; ArrayList<String> pageLines;
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add( new FCommandHelp().getUseageTemplate() ); pageLines.add( new CmdHelp().getUseageTemplate() );
pageLines.add( new FCommandList().getUseageTemplate() ); pageLines.add( new CmdList().getUseageTemplate() );
pageLines.add( new FCommandShow().getUseageTemplate() ); pageLines.add( new CmdShow().getUseageTemplate() );
pageLines.add( new FCommandPower().getUseageTemplate() ); pageLines.add( new CmdPower().getUseageTemplate() );
pageLines.add( new FCommandJoin().getUseageTemplate() ); pageLines.add( new CmdJoin().getUseageTemplate() );
pageLines.add( new FCommandLeave().getUseageTemplate() ); pageLines.add( new CmdLeave().getUseageTemplate() );
pageLines.add( new FCommandChat().getUseageTemplate() ); pageLines.add( new CmdChat().getUseageTemplate() );
pageLines.add( new FCommandHome().getUseageTemplate() ); pageLines.add( new CmdHome().getUseageTemplate() );
pageLines.add( "Learn how to create a faction on the next page." ); pageLines.add( "Learn how to create a faction on the next page." );
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add( new FCommandCreate().getUseageTemplate() ); pageLines.add( new CmdCreate().getUseageTemplate() );
pageLines.add( new FCommandDescription().getUseageTemplate() ); pageLines.add( new CmdDescription().getUseageTemplate() );
pageLines.add( new FCommandTag().getUseageTemplate() ); pageLines.add( new CmdTag().getUseageTemplate() );
pageLines.add( "You might want to close it and use invitations:" ); pageLines.add( "You might want to close it and use invitations:" );
pageLines.add( new FCommandOpen().getUseageTemplate() ); pageLines.add( new CmdOpen().getUseageTemplate() );
pageLines.add( new FCommandInvite().getUseageTemplate() ); pageLines.add( new CmdInvite().getUseageTemplate() );
pageLines.add( new FCommandDeinvite().getUseageTemplate() ); pageLines.add( new CmdDeinvite().getUseageTemplate() );
pageLines.add( "And don't forget to set your home:" ); pageLines.add( "And don't forget to set your home:" );
pageLines.add( new FCommandSethome().getUseageTemplate() ); pageLines.add( new CmdSethome().getUseageTemplate() );
helpPages.add(pageLines); helpPages.add(pageLines);
if (Econ.enabled() && Conf.bankEnabled) if (Econ.enabled() && Conf.bankEnabled)
@ -88,32 +88,32 @@ public class FCommandHelp extends FCommand
pageLines.add( "Your faction has a bank which is used to pay for certain" ); pageLines.add( "Your faction has a bank which is used to pay for certain" );
pageLines.add( "things, so it will need to have money deposited into it." ); pageLines.add( "things, so it will need to have money deposited into it." );
pageLines.add( "" ); pageLines.add( "" );
pageLines.add( new FCommandBalance().getUseageTemplate() ); pageLines.add( new CmdBalance().getUseageTemplate() );
pageLines.add( new FCommandDeposit().getUseageTemplate() ); pageLines.add( new CmdDeposit().getUseageTemplate() );
pageLines.add( new FCommandWithdraw().getUseageTemplate() ); pageLines.add( new CmdWithdraw().getUseageTemplate() );
pageLines.add( new FCommandPay().getUseageTemplate() ); pageLines.add( new CmdPay().getUseageTemplate() );
pageLines.add( "" ); pageLines.add( "" );
helpPages.add(pageLines); helpPages.add(pageLines);
} }
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add( new FCommandClaim().getUseageTemplate() ); pageLines.add( new CmdClaim().getUseageTemplate() );
pageLines.add( new FCommandAutoClaim().getUseageTemplate() ); pageLines.add( new CmdAutoClaim().getUseageTemplate() );
pageLines.add( new FCommandUnclaim().getUseageTemplate() ); pageLines.add( new CmdUnclaim().getUseageTemplate() );
pageLines.add( new FCommandUnclaimall().getUseageTemplate() ); pageLines.add( new CmdUnclaimall().getUseageTemplate() );
pageLines.add( new FCommandKick().getUseageTemplate() ); pageLines.add( new CmdKick().getUseageTemplate() );
pageLines.add( new FCommandMod().getUseageTemplate() ); pageLines.add( new CmdMod().getUseageTemplate() );
pageLines.add( new FCommandAdmin().getUseageTemplate() ); pageLines.add( new CmdAdmin().getUseageTemplate() );
pageLines.add( new FCommandTitle().getUseageTemplate() ); pageLines.add( new CmdTitle().getUseageTemplate() );
pageLines.add( "Player titles are just for fun. No rules connected to them." ); pageLines.add( "Player titles are just for fun. No rules connected to them." );
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add( new FCommandMap().getUseageTemplate() ); pageLines.add( new CmdMap().getUseageTemplate() );
pageLines.add( new FCommandNoBoom().getUseageTemplate() ); pageLines.add( new CmdBoom().getUseageTemplate() );
pageLines.add(""); pageLines.add("");
pageLines.add( new FCommandOwner().getUseageTemplate() ); pageLines.add( new CmdOwner().getUseageTemplate() );
pageLines.add( new FCommandOwnerList().getUseageTemplate() ); pageLines.add( new CmdOwnerList().getUseageTemplate() );
pageLines.add(""); pageLines.add("");
pageLines.add("Claimed land with ownership set is further protected so"); pageLines.add("Claimed land with ownership set is further protected so");
pageLines.add("that only the owner(s), faction admin, and possibly the"); pageLines.add("that only the owner(s), faction admin, and possibly the");
@ -121,11 +121,11 @@ public class FCommandHelp extends FCommand
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add( new FCommandDisband().getUseageTemplate() ); pageLines.add( new CmdDisband().getUseageTemplate() );
pageLines.add(""); pageLines.add("");
pageLines.add( new FCommandRelationAlly().getUseageTemplate() ); pageLines.add( new CmdRelationAlly().getUseageTemplate() );
pageLines.add( new FCommandRelationNeutral().getUseageTemplate() ); pageLines.add( new CmdRelationNeutral().getUseageTemplate() );
pageLines.add( new FCommandRelationEnemy().getUseageTemplate() ); pageLines.add( new CmdRelationEnemy().getUseageTemplate() );
pageLines.add("Set the relation you WISH to have with another faction."); pageLines.add("Set the relation you WISH to have with another faction.");
pageLines.add("Your default relation with other factions will be neutral."); pageLines.add("Your default relation with other factions will be neutral.");
pageLines.add("If BOTH factions choose \"ally\" you will be allies."); pageLines.add("If BOTH factions choose \"ally\" you will be allies.");
@ -158,26 +158,26 @@ public class FCommandHelp extends FCommand
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add("Finally some commands for the server admins:"); pageLines.add("Finally some commands for the server admins:");
pageLines.add( new FCommandBypass().getUseageTemplate() ); pageLines.add( new CmdBypass().getUseageTemplate() );
pageLines.add( new FCommandSafeclaim().getUseageTemplate() ); pageLines.add( new CmdSafeclaim().getUseageTemplate() );
pageLines.add( new FCommandAutoSafeclaim().getUseageTemplate() ); pageLines.add( new CmdAutoSafeclaim().getUseageTemplate() );
pageLines.add( new FCommandSafeunclaimall().getUseageTemplate() ); pageLines.add( new CmdSafeunclaimall().getUseageTemplate() );
pageLines.add( new FCommandWarclaim().getUseageTemplate() ); pageLines.add( new CmdWarclaim().getUseageTemplate() );
pageLines.add( new FCommandAutoWarclaim().getUseageTemplate() ); pageLines.add( new CmdAutoWarclaim().getUseageTemplate() );
pageLines.add( new FCommandWarunclaimall().getUseageTemplate() ); pageLines.add( new CmdWarunclaimall().getUseageTemplate() );
pageLines.add("Note: " + new FCommandUnclaim().getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."); pageLines.add("Note: " + new CmdUnclaim().getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well.");
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add("More commands for server admins:"); pageLines.add("More commands for server admins:");
pageLines.add( new FCommandPeaceful().getUseageTemplate() ); pageLines.add( new CmdPeaceful().getUseageTemplate() );
pageLines.add( new FCommandPermanent().getUseageTemplate() ); pageLines.add( new CmdPermanent().getUseageTemplate() );
pageLines.add("Peaceful factions are protected from PvP and land capture."); pageLines.add("Peaceful factions are protected from PvP and land capture.");
pageLines.add( new FCommandLock().getUseageTemplate() ); pageLines.add( new CmdLock().getUseageTemplate() );
pageLines.add( new FCommandReload().getUseageTemplate() ); pageLines.add( new CmdReload().getUseageTemplate() );
pageLines.add( new FCommandSaveAll().getUseageTemplate() ); pageLines.add( new CmdSaveAll().getUseageTemplate() );
pageLines.add( new FCommandVersion().getUseageTemplate() ); pageLines.add( new CmdVersion().getUseageTemplate() );
pageLines.add( new FCommandConfig().getUseageTemplate() ); pageLines.add( new CmdConfig().getUseageTemplate() );
helpPages.add(pageLines); helpPages.add(pageLines);
} }

View File

@ -14,10 +14,10 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandHome extends FCommand public class CmdHome extends FCommand
{ {
public FCommandHome() public CmdHome()
{ {
super(); super();
this.aliases.add("home"); this.aliases.add("home");
@ -52,7 +52,7 @@ public class FCommandHome extends FCommand
if ( ! myFaction.hasHome()) if ( ! myFaction.hasHome())
{ {
fme.sendMessage("You faction does not have a home. " + (fme.getRole().value < Role.MODERATOR.value ? " Ask your leader to:" : "You should:")); fme.sendMessage("You faction does not have a home. " + (fme.getRole().value < Role.MODERATOR.value ? " Ask your leader to:" : "You should:"));
fme.sendMessage(new FCommandSethome().getUseageTemplate()); fme.sendMessage(new CmdSethome().getUseageTemplate());
return; return;
} }

View File

@ -4,9 +4,9 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandInvite extends FCommand public class CmdInvite extends FCommand
{ {
public FCommandInvite() public CmdInvite()
{ {
super(); super();
this.aliases.add("invite"); this.aliases.add("invite");
@ -38,7 +38,7 @@ public class FCommandInvite extends FCommand
if (you.getFaction() == myFaction) if (you.getFaction() == myFaction)
{ {
sendMessageParsed("%s<i> is already a member of %s", you.getName(), myFaction.getTag()); sendMessageParsed("%s<i> is already a member of %s", you.getName(), myFaction.getTag());
sendMessageParsed("<i>You might want to: " + new FCommandKick().getUseageTemplate(false)); sendMessageParsed("<i>You might want to: " + new CmdKick().getUseageTemplate(false));
return; return;
} }

View File

@ -4,9 +4,9 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandJoin extends FCommand public class CmdJoin extends FCommand
{ {
public FCommandJoin() public CmdJoin()
{ {
super(); super();
this.aliases.add("join"); this.aliases.add("join");

View File

@ -6,10 +6,10 @@ import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandKick extends FCommand public class CmdKick extends FCommand
{ {
public FCommandKick() public CmdKick()
{ {
super(); super();
this.aliases.add("kick"); this.aliases.add("kick");
@ -40,7 +40,7 @@ public class FCommandKick extends FCommand
if (fme == you) if (fme == you)
{ {
sendMessageParsed("<b>You cannot kick yourself."); sendMessageParsed("<b>You cannot kick yourself.");
sendMessageParsed("<i>You might want to: %s", new FCommandLeave().getUseageTemplate(false)); sendMessageParsed("<i>You might want to: %s", new CmdLeave().getUseageTemplate(false));
return; return;
} }

View File

@ -2,9 +2,9 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandLeave extends FCommand { public class CmdLeave extends FCommand {
public FCommandLeave() public CmdLeave()
{ {
super(); super();
this.aliases.add("leave"); this.aliases.add("leave");

View File

@ -10,10 +10,10 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandList extends FCommand public class CmdList extends FCommand
{ {
public FCommandList() public CmdList()
{ {
super(); super();
this.aliases.add("list"); this.aliases.add("list");

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandLock extends FCommand { public class CmdLock extends FCommand {
// TODO: This solution needs refactoring. // TODO: This solution needs refactoring.
/* /*
@ -11,7 +11,7 @@ public class FCommandLock extends FCommand {
default: op default: op
*/ */
public FCommandLock() public CmdLock()
{ {
super(); super();
this.aliases.add("lock"); this.aliases.add("lock");

View File

@ -6,9 +6,9 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandMap extends FCommand public class CmdMap extends FCommand
{ {
public FCommandMap() public CmdMap()
{ {
super(); super();
this.aliases.add("map"); this.aliases.add("map");

View File

@ -4,10 +4,10 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandMod extends FCommand public class CmdMod extends FCommand
{ {
public FCommandMod() public CmdMod()
{ {
super(); super();
this.aliases.add("mod"); this.aliases.add("mod");

View File

@ -5,9 +5,9 @@ import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandOpen extends FCommand public class CmdOpen extends FCommand
{ {
public FCommandOpen() public CmdOpen()
{ {
super(); super();
this.aliases.add("open"); this.aliases.add("open");

View File

@ -9,10 +9,10 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandOwner extends FCommand public class CmdOwner extends FCommand
{ {
public FCommandOwner() public CmdOwner()
{ {
super(); super();
this.aliases.add("owner"); this.aliases.add("owner");

View File

@ -6,10 +6,10 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandOwnerList extends FCommand public class CmdOwnerList extends FCommand
{ {
public FCommandOwnerList() public CmdOwnerList()
{ {
super(); super();
this.aliases.add("ownerlist"); this.aliases.add("ownerlist");

View File

@ -10,9 +10,9 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandPay extends FCommand public class CmdPay extends FCommand
{ {
public FCommandPay() public CmdPay()
{ {
this.aliases.add("pay"); this.aliases.add("pay");

View File

@ -6,10 +6,10 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandPeaceful extends FCommand public class CmdPeaceful extends FCommand
{ {
public FCommandPeaceful() public CmdPeaceful()
{ {
super(); super();
this.aliases.add("peaceful"); this.aliases.add("peaceful");

View File

@ -6,9 +6,9 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandPermanent extends FCommand public class CmdPermanent extends FCommand
{ {
public FCommandPermanent() public CmdPermanent()
{ {
super(); super();
this.aliases.add("permanent"); this.aliases.add("permanent");

View File

@ -4,10 +4,10 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandPower extends FCommand public class CmdPower extends FCommand
{ {
public FCommandPower() public CmdPower()
{ {
super(); super();
this.aliases.add("power"); this.aliases.add("power");

View File

@ -2,9 +2,9 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
public class FCommandRelationAlly extends FRelationCommand public class CmdRelationAlly extends FRelationCommand
{ {
public FCommandRelationAlly() public CmdRelationAlly()
{ {
aliases.add("ally"); aliases.add("ally");
targetRelation = Relation.ALLY; targetRelation = Relation.ALLY;

View File

@ -2,9 +2,9 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
public class FCommandRelationEnemy extends FRelationCommand public class CmdRelationEnemy extends FRelationCommand
{ {
public FCommandRelationEnemy() public CmdRelationEnemy()
{ {
aliases.add("enemy"); aliases.add("enemy");
targetRelation = Relation.ENEMY; targetRelation = Relation.ENEMY;

View File

@ -2,9 +2,9 @@ package com.massivecraft.factions.commands;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
public class FCommandRelationNeutral extends FRelationCommand public class CmdRelationNeutral extends FRelationCommand
{ {
public FCommandRelationNeutral() public CmdRelationNeutral()
{ {
aliases.add("neutral"); aliases.add("neutral");
targetRelation = Relation.NEUTRAL; targetRelation = Relation.NEUTRAL;

View File

@ -7,10 +7,10 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandReload extends FCommand public class CmdReload extends FCommand
{ {
public FCommandReload() public CmdReload()
{ {
super(); super();
this.aliases.add("reload"); this.aliases.add("reload");

View File

@ -5,10 +5,10 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandSafeclaim extends FCommand public class CmdSafeclaim extends FCommand
{ {
public FCommandSafeclaim() public CmdSafeclaim()
{ {
this.aliases.add("safeclaim"); this.aliases.add("safeclaim");
this.aliases.add("safe"); this.aliases.add("safe");
@ -49,7 +49,7 @@ public class FCommandSafeclaim extends FCommand
Board.setFactionAt(Factions.i.getSafeZone(), locToClaim); Board.setFactionAt(Factions.i.getSafeZone(), locToClaim);
} }
sendMessageParsed("<i>You claimed <h>%d chunks<i> for the <a>safe zone.", (1+radius*2)*(1+radius*2)); sendMessageParsed("<i>You claimed <h>%d chunks<i> for the <a>safe zone<i>.", (1+radius*2)*(1+radius*2));
} }
} }

View File

@ -4,10 +4,10 @@ import com.massivecraft.factions.Board;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandSafeunclaimall extends FCommand public class CmdSafeunclaimall extends FCommand
{ {
public FCommandSafeunclaimall() public CmdSafeunclaimall()
{ {
this.aliases.add("safeunclaimall"); this.aliases.add("safeunclaimall");
this.aliases.add("safedeclaimall"); this.aliases.add("safedeclaimall");

View File

@ -6,10 +6,10 @@ import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandSaveAll extends FCommand public class CmdSaveAll extends FCommand
{ {
public FCommandSaveAll() public CmdSaveAll()
{ {
super(); super();
this.aliases.add("saveall"); this.aliases.add("saveall");

View File

@ -7,9 +7,9 @@ import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandSethome extends FCommand public class CmdSethome extends FCommand
{ {
public FCommandSethome() public CmdSethome()
{ {
this.aliases.add("sethome"); this.aliases.add("sethome");
@ -72,7 +72,7 @@ public class FCommandSethome extends FCommand
faction.setHome(me.getLocation()); faction.setHome(me.getLocation());
faction.sendMessage(fme.getNameAndRelevant(myFaction)+"<i> set the home for your faction. You can now use:"); faction.sendMessage(fme.getNameAndRelevant(myFaction)+"<i> set the home for your faction. You can now use:");
faction.sendMessage(new FCommandHome().getUseageTemplate()); faction.sendMessage(new CmdHome().getUseageTemplate());
if (faction != myFaction) if (faction != myFaction)
{ {
fme.sendMessageParsed("<b>You have set the home for the "+faction.getTag(fme)+"<i> faction."); fme.sendMessageParsed("<b>You have set the home for the "+faction.getTag(fme)+"<i> faction.");

View File

@ -10,10 +10,10 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandShow extends FCommand public class CmdShow extends FCommand
{ {
public FCommandShow() public CmdShow()
{ {
this.aliases.add("show"); this.aliases.add("show");
this.aliases.add("who"); this.aliases.add("who");

View File

@ -9,10 +9,10 @@ import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
public class FCommandTag extends FCommand public class CmdTag extends FCommand
{ {
public FCommandTag() public CmdTag()
{ {
this.aliases.add("tag"); this.aliases.add("tag");

View File

@ -6,9 +6,9 @@ import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TextUtil; import com.massivecraft.factions.zcore.util.TextUtil;
public class FCommandTitle extends FCommand public class CmdTitle extends FCommand
{ {
public FCommandTitle() public CmdTitle()
{ {
this.aliases.add("title"); this.aliases.add("title");

View File

@ -8,9 +8,9 @@ import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandUnclaim extends FCommand public class CmdUnclaim extends FCommand
{ {
public FCommandUnclaim() public CmdUnclaim()
{ {
this.aliases.add("unclaim"); this.aliases.add("unclaim");
this.aliases.add("declaim"); this.aliases.add("declaim");

View File

@ -0,0 +1,90 @@
package com.massivecraft.factions.commands;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission;
public class CmdUnclaimall extends FCommand
{
public CmdUnclaimall()
{
this.aliases.add("unclaimall");
this.aliases.add("declaimall");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.COMMAND_UNCLAIM_ALL.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
String moneyBack = "<i>";
if (Econ.enabled())
{
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
// a real refund
if (refund > 0.0)
{
if(Conf.bankFactionPaysLandCosts)
{
Faction faction = myFaction;
faction.addMoney(refund);
moneyBack = " "+faction.getTag()+" <i>received a refund of <h>"+Econ.moneyString(refund)+"<i>.";
}
else
{
Econ.addMoney(fme.getName(), refund);
moneyBack = " They received a refund of <h>"+Econ.moneyString(refund)+"<i>.";
}
}
// wait, you're charging people to unclaim land? outrageous
else if (refund < 0.0)
{
if(Conf.bankFactionPaysLandCosts)
{
Faction faction = myFaction;
if(!faction.removeMoney(-refund))
{
sendMessageParsed("<b>Unclaiming all faction land will cost <h>"+Econ.moneyString(-refund)+"<b>, which your faction can't currently afford.");
return;
}
moneyBack = " It cost "+faction.getTag()+" "+Econ.moneyString(refund)+".";
}
else
{
if (!Econ.deductMoney(fme.getName(), -refund))
{
sendMessageParsed("<b>Unclaiming all faction land will cost <h>"+Econ.moneyString(-refund)+"<b>, which you can't currently afford.");
return;
}
moneyBack = "<i> It cost them <h>"+Econ.moneyString(refund)+"<i>.";
}
moneyBack = "<i> It cost them <h>"+Econ.moneyString(refund)+"<i>.";
}
// no refund
else
{
moneyBack = "";
}
}
Board.unclaimAll(myFaction.getId());
myFaction.sendMessageParsed("%s<i> unclaimed ALL of your faction's land."+moneyBack, fme.getNameAndRelevant(myFaction));
}
}

View File

@ -4,9 +4,9 @@ import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class FCommandVersion extends FCommand public class CmdVersion extends FCommand
{ {
public FCommandVersion() public CmdVersion()
{ {
this.aliases.add("version"); this.aliases.add("version");

View File

@ -0,0 +1,53 @@
package com.massivecraft.factions.commands;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission;
public class CmdWarclaim extends FCommand
{
public CmdWarclaim()
{
this.aliases.add("warclaim");
this.aliases.add("war");
//this.requiredArgs.add("");
this.optionalArgs.put("radius", "0");
this.permission = Permission.MANAGE_WAR_ZONE.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
this.setHelpShort("Claim land for the warzone");
}
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
// The current location of the player
FLocation playerFlocation = new FLocation(fme);
int radius = this.argAsInt(0, 0);
if (radius < 0) radius = 0;
FLocation from = playerFlocation.getRelative(radius, radius);
FLocation to = playerFlocation.getRelative(-radius, -radius);
for (FLocation locToClaim : FLocation.getArea(from, to))
{
Board.setFactionAt(Factions.i.getWarZone(), locToClaim);
}
sendMessageParsed("<i>You claimed <h>%d chunks<i> for the <a>war zone<i>.", (1+radius*2)*(1+radius*2));
}
}

View File

@ -0,0 +1,42 @@
package com.massivecraft.factions.commands;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission;
public class CmdWarunclaimall extends FCommand
{
public CmdWarunclaimall()
{
this.aliases.add("warunclaimall");
this.aliases.add("wardeclaimall");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.MANAGE_WAR_ZONE.node;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
this.setHelpShort("unclaim all warzone land");
}
@Override
public void perform()
{
if( isLocked() )
{
sendLockMessage();
return;
}
Board.unclaimAll(Factions.i.getWarZone().getId());
sendMessageParsed("<i>You unclaimed ALL war zone land.");
}
}

View File

@ -10,10 +10,10 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
public class FCommandWithdraw extends FCommand public class CmdWithdraw extends FCommand
{ {
public FCommandWithdraw() public CmdWithdraw()
{ {
this.aliases.add("withdraw"); this.aliases.add("withdraw");

View File

@ -0,0 +1,131 @@
package com.massivecraft.factions.commands;
import com.massivecraft.factions.Conf;
public class FCmdRoot extends FCommand
{
public CmdAdmin cmdAdmin = new CmdAdmin();
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
public CmdAutoSafeclaim cmdAutoSafeclaim = new CmdAutoSafeclaim();
public CmdAutoWarclaim cmdAutoWarclaim = new CmdAutoWarclaim();
public CmdBalance cmdBalance = new CmdBalance();
public CmdBoom cmdBoom = new CmdBoom();
public CmdBypass cmdBypass = new CmdBypass();
public CmdChat cmdChat = new CmdChat();
public CmdClaim cmdClaim = new CmdClaim();
public CmdConfig cmdConfig = new CmdConfig();
public CmdCreate cmdCreate = new CmdCreate();
public CmdDeinvite cmdDeinvite = new CmdDeinvite();
public CmdDeposit cmdDeposit = new CmdDeposit();
public CmdDescription cmdDescription = new CmdDescription();
public CmdDisband cmdDisband = new CmdDisband();
public CmdHelp cmdHelp = new CmdHelp();
public CmdHome cmdHome = new CmdHome();
public CmdInvite cmdInvite = new CmdInvite();
public CmdJoin cmdJoin = new CmdJoin();
public CmdKick cmdKick = new CmdKick();
public CmdLeave cmdLeave = new CmdLeave();
public CmdList cmdList = new CmdList();
public CmdLock cmdLock = new CmdLock();
public CmdMap cmdMap = new CmdMap();
public CmdMod cmdMod = new CmdMod();
public CmdOpen cmdOpen = new CmdOpen();
public CmdOwner cmdOwner = new CmdOwner();
public CmdOwnerList cmdOwnerList = new CmdOwnerList();
public CmdPay cmdPay = new CmdPay();
public CmdPeaceful cmdPeaceful = new CmdPeaceful();
public CmdPermanent cmdPermanent = new CmdPermanent();
public CmdPower cmdPower = new CmdPower();
public CmdRelationAlly cmdRelationAlly = new CmdRelationAlly();
public CmdRelationEnemy cmdRelationEnemy = new CmdRelationEnemy();
public CmdRelationNeutral cmdRelationNeutral = new CmdRelationNeutral();
public CmdReload cmdReload = new CmdReload();
public CmdSafeclaim cmdSafeclaim = new CmdSafeclaim();
public CmdSafeunclaimall cmdSafeunclaimall = new CmdSafeunclaimall();
public CmdSaveAll cmdSaveAll = new CmdSaveAll();
public CmdSethome cmdSethome = new CmdSethome();
public CmdShow cmdShow = new CmdShow();
public CmdTag cmdTag = new CmdTag();
public CmdTitle cmdTitle = new CmdTitle();
public CmdUnclaim cmdUnclaim = new CmdUnclaim();
public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall();
public CmdVersion cmdVersion = new CmdVersion();
public CmdWarclaim cmdWarclaim = new CmdWarclaim();
public CmdWarunclaimall cmdWarunclaimall = new CmdWarunclaimall();
public CmdWithdraw cmdWithdraw = new CmdWithdraw();
public FCmdRoot()
{
super();
this.aliases.addAll(Conf.baseCommandAliases);
this.allowNoSlashAccess = Conf.allowNoSlashCommand;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
this.setHelpShort("The faction base command");
this.helpLong.add(p.txt.tags("<i>This command contains all faction stuff."));
//this.subCommands.add(p.cmdHelp);
this.subCommands.add(this.cmdAdmin);
this.subCommands.add(this.cmdAutoClaim);
this.subCommands.add(this.cmdAutoSafeclaim);
this.subCommands.add(this.cmdAutoWarclaim);
this.subCommands.add(this.cmdBalance);
this.subCommands.add(this.cmdBoom);
this.subCommands.add(this.cmdBypass);
this.subCommands.add(this.cmdChat);
this.subCommands.add(this.cmdClaim);
this.subCommands.add(this.cmdConfig);
this.subCommands.add(this.cmdCreate);
this.subCommands.add(this.cmdDeinvite);
this.subCommands.add(this.cmdDeposit);
this.subCommands.add(this.cmdDescription);
this.subCommands.add(this.cmdDisband);
this.subCommands.add(this.cmdHelp);
this.subCommands.add(this.cmdHome);
this.subCommands.add(this.cmdInvite);
this.subCommands.add(this.cmdJoin);
this.subCommands.add(this.cmdKick);
this.subCommands.add(this.cmdLeave);
this.subCommands.add(this.cmdList);
this.subCommands.add(this.cmdLock);
this.subCommands.add(this.cmdMap);
this.subCommands.add(this.cmdMod);
this.subCommands.add(this.cmdOpen);
this.subCommands.add(this.cmdOwner);
this.subCommands.add(this.cmdOwnerList);
this.subCommands.add(this.cmdPay);
this.subCommands.add(this.cmdPeaceful);
this.subCommands.add(this.cmdPermanent);
this.subCommands.add(this.cmdPower);
this.subCommands.add(this.cmdRelationAlly);
this.subCommands.add(this.cmdRelationEnemy);
this.subCommands.add(this.cmdRelationNeutral);
this.subCommands.add(this.cmdReload);
this.subCommands.add(this.cmdSafeclaim);
this.subCommands.add(this.cmdSafeunclaimall);
this.subCommands.add(this.cmdSaveAll);
this.subCommands.add(this.cmdSethome);
this.subCommands.add(this.cmdShow);
this.subCommands.add(this.cmdTag);
this.subCommands.add(this.cmdTitle);
this.subCommands.add(this.cmdUnclaim);
this.subCommands.add(this.cmdUnclaimall);
this.subCommands.add(this.cmdVersion);
this.subCommands.add(this.cmdWarclaim);
this.subCommands.add(this.cmdWarunclaimall);
this.subCommands.add(this.cmdWithdraw);
}
@Override
public void perform()
{
this.commandChain.add(this);
this.cmdHelp.execute(this.sender, this.args, this.commandChain);
}
}

View File

@ -1,75 +0,0 @@
package com.massivecraft.factions.commands;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Role;
public class FCommandUnclaimall extends FCommand {
public FCommandUnclaimall() {
aliases.add("unclaimall");
aliases.add("declaimall");
helpDescription = "Unclaim all of your factions land";
}
@Override
public void perform() {
if ( ! assertHasFaction()) {
return;
}
if( isLocked() ) {
sendLockMessage();
return;
}
if ( ! assertMinRole(Role.MODERATOR)) {
return;
}
String moneyBack = "";
if (Econ.enabled()) {
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
// a real refund
if (refund > 0.0) {
if(Conf.bankFactionPaysLandCosts) {
Faction faction = myFaction;
faction.addMoney(refund);
moneyBack = " "+faction.getTag()+" received a refund of "+Econ.moneyString(refund)+".";
} else {
Econ.addMoney(fme.getName(), refund);
moneyBack = " They received a refund of "+Econ.moneyString(refund)+".";
}
}
// wait, you're charging people to unclaim land? outrageous
else if (refund < 0.0) {
if(Conf.bankFactionPaysLandCosts) {
Faction faction = myFaction;
if(!faction.removeMoney(-refund)) {
sendMessage("Unclaiming all faction land will cost "+Econ.moneyString(-refund)+", which your faction can't currently afford.");
return;
}
moneyBack = " It cost "+faction.getTag()+" "+Econ.moneyString(refund)+".";
} else {
if (!Econ.deductMoney(fme.getName(), -refund)) {
sendMessage("Unclaiming all faction land will cost "+Econ.moneyString(-refund)+", which you can't currently afford.");
return;
}
moneyBack = " It cost them "+Econ.moneyString(refund)+".";
}
moneyBack = " It cost them "+Econ.moneyString(refund)+".";
}
// no refund
else {
moneyBack = "";
}
}
Board.unclaimAll(myFaction.getId());
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed ALL of your faction's land."+moneyBack);
}
}

View File

@ -1,63 +0,0 @@
package com.massivecraft.factions.commands;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
public class FCommandWarclaim extends FCommand {
public FCommandWarclaim() {
aliases.add("warclaim");
aliases.add("war");
optionalParameters.add("radius");
helpDescription = "Claim land for the warzone";
}
@Override
public boolean hasPermission(CommandSender sender) {
return P.hasPermManageWarZone(sender);
}
public void perform() {
if( isLocked() ) {
sendLockMessage();
return;
}
// The current location of the player
FLocation playerFlocation = new FLocation(fme);
// Was a radius set?
if (parameters.size() > 0) {
int radius;
try {
radius = Integer.parseInt(parameters.get(0));
}
catch(NumberFormatException ex) {
sendMessage("Usage: " + getUseageTemplate(false));
sendMessage("The radius value must be an integer.");
return;
}
FLocation from = playerFlocation.getRelative(radius, radius);
FLocation to = playerFlocation.getRelative(-radius, -radius);
for (FLocation locToClaim : FLocation.getArea(from, to)) {
Board.setFactionAt(Faction.getWarZone(), locToClaim);
}
sendMessage("You claimed "+(1+radius*2)*(1+radius*2)+" chunks for the war zone.");
} else {
Board.setFactionAt(Faction.getWarZone(), playerFlocation);
sendMessage("This land is now a war zone.");
}
}
}

View File

@ -1,35 +0,0 @@
package com.massivecraft.factions.commands;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
public class FCommandWarunclaimall extends FCommand {
public FCommandWarunclaimall() {
aliases.add("warunclaimall");
aliases.add("wardeclaimall");
helpDescription = "Unclaim all warzone land";
}
@Override
public boolean hasPermission(CommandSender sender) {
return P.hasPermManageWarZone(sender);
}
@Override
public void perform() {
if( isLocked() ) {
sendLockMessage();
return;
}
Board.unclaimAll(Faction.getWarZone().getId());
sendMessage("You unclaimed ALL war zone land.");
}
}

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.FCommandHelp; import com.massivecraft.factions.commands.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;
@ -59,7 +59,7 @@ public class Econ {
else { else {
P.p.log("Un-hooked from Register."); P.p.log("Un-hooked from Register.");
} }
FCommandHelp.updateHelp(); CmdHelp.updateHelp();
} }
public static void iConomySet(boolean enable) public static void iConomySet(boolean enable)
@ -71,7 +71,7 @@ public class Econ {
else { else {
P.p.log("Un-hooked from iConomy."); P.p.log("Un-hooked from iConomy.");
} }
FCommandHelp.updateHelp(); CmdHelp.updateHelp();
} }
public static void essentialsEcoSet(boolean enable) public static void essentialsEcoSet(boolean enable)
@ -85,7 +85,7 @@ public class Econ {
{ {
P.p.log("Un-hooked from EssentialsEco."); P.p.log("Un-hooked from EssentialsEco.");
} }
FCommandHelp.updateHelp(); CmdHelp.updateHelp();
} }
public static boolean registerHooked() public static boolean registerHooked()

View File

@ -6,31 +6,20 @@ import com.massivecraft.factions.P;
public enum Permission public enum Permission
{ {
PARTICIPATE("participate"), MANAGE_SAFE_ZONE("managesafezone"),
CREATE("create"), MANAGE_WAR_ZONE("managewarzone"),
VIEW_ANY_POWER("viewAnyPower"), OWNERSHIP_BYPASS("ownershipbypass"),
VIEW_ANY_FACTION_BALANCE("viewAnyFactionBalance"),
PEACEFUL_EXPLOTION_TOGGLE("peacefulExplosionToggle"),
CONFIG("config"),
DISBAND("disband"),
LOCK("lock"),
MANAGE_SAFE_ZONE("manageSafeZone"),
MANAGE_WAR_ZONE("manageWarZone"),
OWNERSHIP_BYPASS("ownershipBypass"),
RELOAD("reload"),
SAVE_ALL("saveall"),
SET_PEACEFUL("setPeaceful"),
SET_PERMANENT("setPermanent"),
COMMAND_ADMIN("command.admin"), COMMAND_ADMIN("command.admin"),
COMMAND_AUTOCLAIM("command.autoClaim"), COMMAND_AUTOCLAIM("command.autoclaim"),
COMMAND_BALANCE("command.balance"), COMMAND_BALANCE("command.balance"),
COMMAND_BALANCE_ANY("command.balance.any"),
COMMAND_WITHDRAW("command.withdraw"), COMMAND_WITHDRAW("command.withdraw"),
COMMAND_PAY("command.pay"), COMMAND_PAY("command.pay"),
COMMAND_BYPASS("command.bypass"), COMMAND_BYPASS("command.bypass"),
COMMAND_CHAT("command.chat"), COMMAND_CHAT("command.chat"),
COMMAND_CLAIM("command.claim"), COMMAND_CLAIM("command.claim"),
COMMAND_CONFIG("command.config"), COMMAND_CONFIG("command.config"),
COMMAND_CREATE("command.create"),
COMMAND_DEINVITE("command.deinvite"), COMMAND_DEINVITE("command.deinvite"),
COMMAND_DEPOSIT("command.deposit"), COMMAND_DEPOSIT("command.deposit"),
COMMAND_DESCRIPTION("command.description"), COMMAND_DESCRIPTION("command.description"),
@ -47,12 +36,12 @@ public enum Permission
COMMAND_LOCK("command.lock"), COMMAND_LOCK("command.lock"),
COMMAND_MAP("command.map"), COMMAND_MAP("command.map"),
COMMAND_MOD("command.mod"), COMMAND_MOD("command.mod"),
COMMAND_NO_BOOM("command.noBoom"), COMMAND_NO_BOOM("command.noboom"),
COMMAND_OPEN("command.open"), COMMAND_OPEN("command.open"),
COMMAND_OWNER("command.owner"), COMMAND_OWNER("command.owner"),
COMMAND_OWNERLIST("command.ownerlist"), COMMAND_OWNERLIST("command.ownerlist"),
COMMAND_SET_PEACEFUL("command.setPeaceful"), COMMAND_SET_PEACEFUL("command.setpeaceful"),
COMMAND_SET_PERMANENT("command.setPermanent"), COMMAND_SET_PERMANENT("command.setpermanent"),
COMMAND_POWER("command.power"), COMMAND_POWER("command.power"),
COMMAND_POWER_ANY("command.power.any"), COMMAND_POWER_ANY("command.power.any"),
COMMAND_RELATION("command.relation"), COMMAND_RELATION("command.relation"),
@ -64,6 +53,7 @@ public enum Permission
COMMAND_TAG("command.tag"), COMMAND_TAG("command.tag"),
COMMAND_TITLE("command.title"), COMMAND_TITLE("command.title"),
COMMAND_UNCLAIM("command.unclaim"), COMMAND_UNCLAIM("command.unclaim"),
COMMAND_UNCLAIM_ALL("command.unclaimall"),
COMMAND_VERSION("command.version"), COMMAND_VERSION("command.version"),
; ;

View File

@ -297,7 +297,7 @@ public abstract class MCommand<T extends MPlugin>
// Argument Readers // Argument Readers
// -------------------------------------------- // // -------------------------------------------- //
// Is set? // Is set? ======================
public boolean argIsSet(int idx) public boolean argIsSet(int idx)
{ {
if (this.args.size() < idx+1) if (this.args.size() < idx+1)
@ -307,7 +307,7 @@ public abstract class MCommand<T extends MPlugin>
return true; return true;
} }
// STRING // STRING ======================
public String argAsString(int idx, String def) public String argAsString(int idx, String def)
{ {
if (this.args.size() < idx+1) if (this.args.size() < idx+1)
@ -321,7 +321,7 @@ public abstract class MCommand<T extends MPlugin>
return this.argAsString(idx, null); return this.argAsString(idx, null);
} }
// INT // INT ======================
public int argAsInt(int idx, int def) public int argAsInt(int idx, int def)
{ {
String str = this.argAsString(idx); String str = this.argAsString(idx);
@ -341,7 +341,7 @@ public abstract class MCommand<T extends MPlugin>
return this.argAsInt(idx, -1); return this.argAsInt(idx, -1);
} }
// Double // Double ======================
public double argAsDouble(int idx, double def) public double argAsDouble(int idx, double def)
{ {
String str = this.argAsString(idx); String str = this.argAsString(idx);
@ -361,12 +361,10 @@ public abstract class MCommand<T extends MPlugin>
return this.argAsDouble(idx, -1d); return this.argAsDouble(idx, -1d);
} }
// Boolean // TODO: Go through the str conversion for the other arg-readers as well.
public boolean argAsBool(int idx, boolean def) // Boolean ======================
public Boolean strAsBool(String str)
{ {
String str = this.argAsString(idx);
if (str == null) return def;
str = str.toLowerCase(); str = str.toLowerCase();
if (str.startsWith("y") || str.startsWith("t") || str.startsWith("on") || str.startsWith("+") || str.startsWith("1")) if (str.startsWith("y") || str.startsWith("t") || str.startsWith("on") || str.startsWith("+") || str.startsWith("1"))
{ {
@ -374,12 +372,21 @@ public abstract class MCommand<T extends MPlugin>
} }
return false; return false;
} }
public boolean argAsBool(int idx)
public Boolean argAsBool(int idx, boolean def)
{
String str = this.argAsString(idx);
if (str == null) return def;
return strAsBool(str);
}
public Boolean argAsBool(int idx)
{ {
return this.argAsBool(idx, false); return this.argAsBool(idx, false);
} }
// PLAYER // PLAYER ======================
public Player argAsPlayer(int idx, Player def, boolean msg) public Player argAsPlayer(int idx, Player def, boolean msg)
{ {
Player ret = def; Player ret = def;
@ -396,8 +403,7 @@ public abstract class MCommand<T extends MPlugin>
if (msg && ret == null) if (msg && ret == null)
{ {
// TODO: Fix this injection risk! this.sendMessageParsed("<b>No player \"<p>%s<b>\" could not be found.", name);
this.sendMessage(p.txt.tags("<b>The player \"<p>"+name+"<b>\" could not be found."));
} }
return ret; return ret;
@ -411,7 +417,7 @@ public abstract class MCommand<T extends MPlugin>
return this.argAsPlayer(idx, null); return this.argAsPlayer(idx, null);
} }
// BEST PLAYER MATCH // BEST PLAYER MATCH ======================
public Player argAsBestPlayerMatch(int idx, Player def, boolean msg) public Player argAsBestPlayerMatch(int idx, Player def, boolean msg)
{ {
Player ret = def; Player ret = def;
@ -428,8 +434,7 @@ public abstract class MCommand<T extends MPlugin>
if (msg && ret == null) if (msg && ret == null)
{ {
// TODO: Fix this injection risk! this.sendMessageParsed("<b>No player match found for \"<p>%s<b>\".", name);
this.sendMessage(p.txt.tags("<b>No player match found for \"<p>"+name+"<b>\"."));
} }
return ret; return ret;

View File

@ -193,7 +193,7 @@ public abstract class MPlugin extends JavaPlugin
// COMMAND HANDLING // COMMAND HANDLING
// -------------------------------------------- // // -------------------------------------------- //
public boolean handleCommand(CommandSender sender, String commandString) public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly)
{ {
boolean noSlash = false; boolean noSlash = false;
if (commandString.startsWith("/")) if (commandString.startsWith("/"))
@ -212,6 +212,7 @@ public abstract class MPlugin extends JavaPlugin
{ {
List<String> args = new ArrayList<String>(Arrays.asList(commandString.split("\\s+"))); List<String> args = new ArrayList<String>(Arrays.asList(commandString.split("\\s+")));
args.remove(0); args.remove(0);
if (testOnly) return true;
command.execute(sender, args); command.execute(sender, args);
return true; return true;
} }
@ -220,6 +221,11 @@ public abstract class MPlugin extends JavaPlugin
return false; return false;
} }
public boolean handleCommand(CommandSender sender, String commandString)
{
return this.handleCommand(sender, commandString, false);
}
// -------------------------------------------- // // -------------------------------------------- //
// HOOKS // HOOKS
// -------------------------------------------- // // -------------------------------------------- //