Halfway through refactoring of commands and permissions
This commit is contained in:
parent
227d54dc5f
commit
10f535e637
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
|
||||
@ -10,6 +11,9 @@ public class Conf
|
||||
// not worth saving between server restarts, I think
|
||||
public static transient Set<String> adminBypassPlayers = Collections.synchronizedSet(new HashSet<String>());
|
||||
|
||||
public static List<String> baseCommandAliases = new ArrayList<String>();
|
||||
public static boolean allowNoSlashCommand = true;
|
||||
|
||||
// Colors
|
||||
public static ChatColor colorMember = ChatColor.GREEN;
|
||||
public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE;
|
||||
@ -68,8 +72,6 @@ public class Conf
|
||||
public static String factionChatFormat = "%s"+ChatColor.WHITE+" %s";
|
||||
public static String allianceChatFormat = "%s"+ChatColor.WHITE+" %s";
|
||||
|
||||
public static boolean allowNoSlashCommand = true;
|
||||
|
||||
public static double autoLeaveAfterDaysOfInactivity = 14.0;
|
||||
|
||||
public static boolean worldGuardChecking = false;
|
||||
@ -239,6 +241,8 @@ public class Conf
|
||||
|
||||
static
|
||||
{
|
||||
baseCommandAliases.add("f");
|
||||
|
||||
territoryEnemyDenyCommands.add("home");
|
||||
territoryEnemyDenyCommands.add("sethome");
|
||||
territoryEnemyDenyCommands.add("spawn");
|
||||
|
@ -1,23 +1,15 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.Worldguard;
|
||||
import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.persist.Entity;
|
||||
import com.massivecraft.factions.zcore.persist.PlayerEntity;
|
||||
|
||||
|
||||
@ -70,12 +62,46 @@ public class FPlayer extends PlayerEntity
|
||||
|
||||
// FIELD: autoClaimEnabled
|
||||
private transient boolean autoClaimEnabled;
|
||||
public boolean isAutoClaimEnabled()
|
||||
{
|
||||
if (this.factionId.equals("0")) return false;
|
||||
return autoClaimEnabled;
|
||||
}
|
||||
public void setIsAutoClaimEnabled(boolean enabled)
|
||||
{
|
||||
this.autoClaimEnabled = enabled;
|
||||
if (enabled)
|
||||
{
|
||||
this.autoSafeZoneEnabled = false;
|
||||
this.autoWarZoneEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// FIELD: autoSafeZoneEnabled
|
||||
private transient boolean autoSafeZoneEnabled;
|
||||
public boolean isAutoSafeClaimEnabled() { return autoSafeZoneEnabled; }
|
||||
public void setIsAutoSafeClaimEnabled(boolean enabled)
|
||||
{
|
||||
this.autoSafeZoneEnabled = enabled;
|
||||
if (enabled)
|
||||
{
|
||||
this.autoClaimEnabled = false;
|
||||
this.autoWarZoneEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// FIELD: autoWarZoneEnabled
|
||||
private transient boolean autoWarZoneEnabled;
|
||||
public boolean isAutoWarClaimEnabled() { return autoWarZoneEnabled; }
|
||||
public void setIsAutoWarClaimEnabled(boolean enabled)
|
||||
{
|
||||
this.autoWarZoneEnabled = enabled;
|
||||
if (enabled)
|
||||
{
|
||||
this.autoClaimEnabled = false;
|
||||
this.autoSafeZoneEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// FIELD: loginPvpDisabled
|
||||
private transient boolean loginPvpDisabled;
|
||||
@ -113,10 +139,11 @@ public class FPlayer extends PlayerEntity
|
||||
public void resetFactionData()
|
||||
{
|
||||
// clean up any territory ownership in old faction, if there is one
|
||||
if (this.factionId > 0 && Factions.i.exists(this.factionId))
|
||||
Faction currentFaction = this.getFaction();
|
||||
|
||||
if (currentFaction != null && currentFaction.isNormal())
|
||||
{
|
||||
// TODO: Get faction function...
|
||||
Factions.i.get(factionId).clearClaimOwnership(this.getId());
|
||||
currentFaction.clearClaimOwnership(this.getId());
|
||||
}
|
||||
|
||||
this.factionId = "0"; // The default neutral faction
|
||||
@ -156,48 +183,7 @@ public class FPlayer extends PlayerEntity
|
||||
return lastLoginTime;
|
||||
}
|
||||
|
||||
public boolean autoClaimEnabled()
|
||||
{
|
||||
if (this.factionId.equals("0")) return false;
|
||||
return autoClaimEnabled;
|
||||
}
|
||||
public void enableAutoClaim(boolean enabled)
|
||||
{
|
||||
this.autoClaimEnabled = enabled;
|
||||
if (enabled)
|
||||
{
|
||||
this.autoSafeZoneEnabled = false;
|
||||
this.autoWarZoneEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean autoSafeZoneEnabled()
|
||||
{
|
||||
return autoSafeZoneEnabled;
|
||||
}
|
||||
public void enableAutoSafeZone(boolean enabled)
|
||||
{
|
||||
this.autoSafeZoneEnabled = enabled;
|
||||
if (enabled)
|
||||
{
|
||||
this.autoClaimEnabled = false;
|
||||
this.autoWarZoneEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean autoWarZoneEnabled()
|
||||
{
|
||||
return autoWarZoneEnabled;
|
||||
}
|
||||
public void enableAutoWarZone(boolean enabled)
|
||||
{
|
||||
this.autoWarZoneEnabled = enabled;
|
||||
if (enabled)
|
||||
{
|
||||
this.autoClaimEnabled = false;
|
||||
this.autoSafeZoneEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setLastLoginTime(long lastLoginTime)
|
||||
{
|
||||
@ -513,8 +499,8 @@ public class FPlayer extends PlayerEntity
|
||||
|
||||
public boolean isInOthersTerritory()
|
||||
{
|
||||
String idHere = Board.getIdAt(new FLocation(this));
|
||||
return idHere > 0 && idHere != this.factionId;
|
||||
Faction factionHere = Board.getFactionAt(new FLocation(this));
|
||||
return factionHere != null && factionHere.isNormal() && factionHere != this.getFaction();
|
||||
}
|
||||
|
||||
public boolean isInAllyTerritory()
|
||||
@ -892,4 +878,9 @@ public class FPlayer extends PlayerEntity
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
public void sendMessageParsed(String str, Object... args)
|
||||
{
|
||||
this.sendMessage(P.p.txt.parse(str, args));
|
||||
}
|
||||
}
|
@ -409,6 +409,16 @@ public class Faction extends Entity
|
||||
//----------------------------------------------//
|
||||
// Messages
|
||||
//----------------------------------------------//
|
||||
public void sendMessageParsed(String message, Object... args)
|
||||
{
|
||||
message = P.p.txt.parse(message, args);
|
||||
|
||||
for (FPlayer fplayer : this.getFPlayersWhereOnline(true))
|
||||
{
|
||||
fplayer.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
for (FPlayer fplayer : this.getFPlayersWhereOnline(true))
|
||||
|
@ -44,9 +44,6 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.integration.EssentialsFeatures;
|
||||
|
||||
/**
|
||||
* The data is saved to disk every 30min and on plugin disable.
|
||||
*/
|
||||
public class P extends MPlugin
|
||||
{
|
||||
// Our single plugin instance
|
||||
@ -58,6 +55,8 @@ public class P extends MPlugin
|
||||
public final FactionsEntityListener entityListener;
|
||||
public final FactionsBlockListener blockListener;
|
||||
|
||||
public CmdBase cmdBase;
|
||||
|
||||
public P()
|
||||
{
|
||||
p = this;
|
||||
@ -82,6 +81,10 @@ public class P extends MPlugin
|
||||
Factions.i.loadFromDisc();
|
||||
Board.load();
|
||||
|
||||
// Add Base Commands
|
||||
this.cmdBase = new CmdBase();
|
||||
this.getBaseCommands().add(cmdBase);
|
||||
|
||||
//setupPermissions();
|
||||
integrateEssentialsChat();
|
||||
setupSpout(this);
|
||||
@ -96,7 +99,7 @@ public class P extends MPlugin
|
||||
//Type mapFLocToStringSetType = new TypeToken<Map<FLocation, Set<String>>>(){}.getType();
|
||||
|
||||
// Add the commands
|
||||
commands.add(new FCommandHelp());
|
||||
/*commands.add(new FCommandHelp());
|
||||
commands.add(new FCommandAdmin());
|
||||
commands.add(new FCommandAutoClaim());
|
||||
commands.add(new FCommandAutoSafeclaim());
|
||||
@ -144,7 +147,7 @@ public class P extends MPlugin
|
||||
commands.add(new FCommandVersion());
|
||||
commands.add(new FCommandWarclaim());
|
||||
commands.add(new FCommandWarunclaimall());
|
||||
commands.add(new FCommandWithdraw());
|
||||
commands.add(new FCommandWithdraw());*/
|
||||
|
||||
// Register events
|
||||
PluginManager pm = this.getServer().getPluginManager();
|
||||
|
42
src/com/massivecraft/factions/commands/CmdBase.java
Normal file
42
src/com/massivecraft/factions/commands/CmdBase.java
Normal file
@ -0,0 +1,42 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -19,9 +19,16 @@ import com.massivecraft.factions.zcore.MCommand;
|
||||
public abstract class FCommand extends MCommand<P>
|
||||
{
|
||||
//TODO: Legacy to handle
|
||||
//public boolean senderIsConsole;
|
||||
//private static boolean lock = false;
|
||||
|
||||
private static boolean lock = false;
|
||||
// TODO: Move these messages to the locked command??
|
||||
// TODO: I lost the check for this code somewhere as well :/
|
||||
public void setIsLocked(boolean isLocked) { lock = isLocked; }
|
||||
public boolean isLocked() { return lock; }
|
||||
public void sendLockMessage()
|
||||
{
|
||||
// TODO: CCOLOR!!!
|
||||
me.sendMessage("Factions is locked. Please try again later");
|
||||
}
|
||||
|
||||
public FPlayer fme;
|
||||
public boolean senderMustBeMember;
|
||||
@ -70,19 +77,47 @@ public abstract class FCommand extends MCommand<P>
|
||||
|
||||
if (this.senderMustBeModerator && ! fplayer.getRole().isAtLeast(Role.MODERATOR))
|
||||
{
|
||||
sender.sendMessage(p.txt.parse("<b>Only faction moderators can %s.", this.helpShort));
|
||||
sender.sendMessage(p.txt.parse("<b>Only faction moderators can %s.", this.getHelpShort()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.senderMustBeAdmin && ! fplayer.getRole().isAtLeast(Role.ADMIN))
|
||||
{
|
||||
sender.sendMessage(p.txt.parse("<b>Only faction admins can %s.", this.helpShort));
|
||||
sender.sendMessage(p.txt.parse("<b>Only faction admins can %s.", this.getHelpShort()));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// Assertions
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean assertHasFaction()
|
||||
{
|
||||
if (me == null) return true;
|
||||
|
||||
if ( ! fme.hasFaction())
|
||||
{
|
||||
sendMessage("You are not member of any faction.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean assertMinRole(Role role)
|
||||
{
|
||||
if (me == null) return true;
|
||||
|
||||
if (fme.getRole().value < role.value)
|
||||
{
|
||||
sendMessageParsed("<b>You <h>must be "+role+"<b> to "+this.getHelpShort()+".");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// Argument Readers
|
||||
// -------------------------------------------- //
|
||||
@ -232,12 +267,12 @@ public abstract class FCommand extends MCommand<P>
|
||||
// if economy is enabled and they're not on the bypass list, make 'em pay; returns true unless person can't afford the cost
|
||||
public boolean payForCommand(double cost)
|
||||
{
|
||||
if ( ! Econ.enabled() || this.me == null || cost == 0.0 || Conf.adminBypassPlayers.contains(me.getName()))
|
||||
if ( ! Econ.enabled() || this.fme == null || cost == 0.0 || Conf.adminBypassPlayers.contains(fme.getName()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
String desc = this.helpShort.toLowerCase();
|
||||
String desc = this.getHelpShort().toLowerCase();
|
||||
|
||||
Faction faction = fme.getFaction();
|
||||
|
||||
@ -260,7 +295,7 @@ public abstract class FCommand extends MCommand<P>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Econ.deductMoney(me.getName(), cost))
|
||||
if (!Econ.deductMoney(fme.getName(), cost))
|
||||
{
|
||||
sendMessage("It costs "+costString+" to "+desc+", which you can't currently afford.");
|
||||
return false;
|
||||
@ -280,7 +315,7 @@ public abstract class FCommand extends MCommand<P>
|
||||
}
|
||||
else
|
||||
{
|
||||
Econ.addMoney(me.getName(), -cost);
|
||||
Econ.addMoney(fme.getName(), -cost);
|
||||
}
|
||||
|
||||
|
||||
@ -288,31 +323,4 @@ public abstract class FCommand extends MCommand<P>
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// TODO: Move these messages to the locked command??
|
||||
// TODO: I lost the check for this code somewhere as well :/
|
||||
public void setIsLocked(boolean isLocked)
|
||||
{
|
||||
if( isLocked )
|
||||
{
|
||||
sendMessage("Factions is now locked");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessage("Factions in now unlocked");
|
||||
}
|
||||
|
||||
lock = isLocked;
|
||||
}
|
||||
|
||||
public boolean isLocked()
|
||||
{
|
||||
return lock;
|
||||
}
|
||||
|
||||
public void sendLockMessage()
|
||||
{
|
||||
me.sendMessage("Factions is locked. Please try again later");
|
||||
}
|
||||
}
|
||||
|
@ -1,64 +1,68 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandAdmin extends FCommand {
|
||||
public class FCommandAdmin extends FCommand
|
||||
{
|
||||
public FCommandAdmin()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("admin");
|
||||
|
||||
public FCommandAdmin() {
|
||||
aliases.add("admin");
|
||||
this.requiredArgs.add("player name");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
requiredParameters.add("player name");
|
||||
this.permission = Permission.COMMAND_ADMIN.node;
|
||||
|
||||
helpDescription = "Hand over your admin rights";
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.ADMIN)) {
|
||||
FPlayer fyou = this.argAsBestFPlayerMatch(0);
|
||||
if (fyou == null) return;
|
||||
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
if (fyou.getFaction() != myFaction)
|
||||
{
|
||||
sendMessageParsed("%s<i> is not a member in your faction.", fyou.getNameAndRelevant(fme));
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
if (fyou == fme)
|
||||
{
|
||||
sendMessageParsed("<b>The target player musn't be yourself.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (you.getFaction() != myFaction) {
|
||||
sendMessage(you.getNameAndRelevant(me)+Conf.colorSystem+" is not a member in your faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == me) {
|
||||
sendMessage("The target player musn't be yourself.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
me.setRole(Role.MODERATOR);
|
||||
you.setRole(Role.ADMIN);
|
||||
fme.setRole(Role.MODERATOR);
|
||||
fyou.setRole(Role.ADMIN);
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.getFaction() == me.getFaction()) {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(me)+Conf.colorSystem+" gave "+you.getNameAndRelevant(me)+Conf.colorSystem+" the leadership of your faction.");
|
||||
} else {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" gave "+you.getNameAndRelevant(fplayer)+Conf.colorSystem+" the leadership of "+myFaction.getTag(fplayer));
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
if (fplayer.getFaction() == myFaction)
|
||||
{
|
||||
fplayer.sendMessageParsed("%s<i> gave %s<i> the leadership of your faction.", fme.getNameAndRelevant(fme), fyou.getNameAndRelevant(fme));
|
||||
}
|
||||
else
|
||||
{
|
||||
fplayer.sendMessageParsed("%s<i> gave %s<i> the leadership of %s", fme.getNameAndRelevant(fplayer), fyou.getNameAndRelevant(fplayer), myFaction.getTag(fplayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,65 +3,64 @@ package com.massivecraft.factions.commands;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandAutoClaim extends FCommand {
|
||||
public class FCommandAutoClaim extends FCommand
|
||||
{
|
||||
public FCommandAutoClaim()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("autoclaim");
|
||||
|
||||
public FCommandAutoClaim() {
|
||||
aliases.add("autoclaim");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flipp");
|
||||
|
||||
optionalParameters.add("on|off");
|
||||
this.permission = Permission.COMMAND_AUTOCLAIM.node;
|
||||
|
||||
helpDescription = "Auto-claim land as you walk around";
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
// default: toggle existing value
|
||||
boolean enable = !me.autoClaimEnabled();
|
||||
boolean enabled = this.argAsBool(0, ! fme.isAutoClaimEnabled());
|
||||
|
||||
// if on|off is specified, use that instead
|
||||
if (parameters.size() > 0)
|
||||
enable = parseBool(parameters.get(0));
|
||||
fme.setIsAutoClaimEnabled(enabled);
|
||||
|
||||
me.enableAutoClaim(enable);
|
||||
|
||||
if (!enable) {
|
||||
sendMessage("Auto-claiming of land disabled.");
|
||||
if ( ! enabled)
|
||||
{
|
||||
sendMessageParsed("<i>Auto-claiming of land disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
FLocation flocation = new FLocation(me);
|
||||
Faction myFaction = fme.getFaction();
|
||||
FLocation flocation = new FLocation(fme);
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
me.enableAutoClaim(false);
|
||||
if (Conf.worldsNoClaiming.contains(flocation.getWorldName()))
|
||||
{
|
||||
sendMessageParsed("<b>Sorry, this world has land claiming disabled.");
|
||||
fme.setIsAutoClaimEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) {
|
||||
sendMessage("Sorry, this world has land claiming disabled.");
|
||||
me.enableAutoClaim(false);
|
||||
if (myFaction.getLandRounded() >= myFaction.getPowerRounded())
|
||||
{
|
||||
sendMessageParsed("<b>You can't claim more land! You need more power!");
|
||||
fme.setIsAutoClaimEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFaction.getLandRounded() >= myFaction.getPowerRounded()) {
|
||||
sendMessage("You can't claim more land! You need more power!");
|
||||
me.enableAutoClaim(false);
|
||||
return;
|
||||
}
|
||||
|
||||
sendMessage("Auto-claiming of land enabled.");
|
||||
me.attemptClaim(false);
|
||||
sendMessageParsed("<i>Auto-claiming of land enabled.");
|
||||
fme.attemptClaim(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,54 +1,58 @@
|
||||
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;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandAutoSafeclaim extends FCommand {
|
||||
public class FCommandAutoSafeclaim extends FCommand
|
||||
{
|
||||
|
||||
public FCommandAutoSafeclaim() {
|
||||
aliases.add("autosafe");
|
||||
public FCommandAutoSafeclaim()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("autosafe");
|
||||
|
||||
optionalParameters.add("on|off");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flipp");
|
||||
|
||||
helpDescription = "Auto-claim land for the safezone";
|
||||
this.permission = Permission.MANAGE_SAFE_ZONE.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
this.setHelpShort("Auto-claim land for the safezone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return P.hasPermManageSafeZone(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean enable = !me.autoSafeZoneEnabled();
|
||||
boolean enabled = this.argAsBool(0, ! fme.isAutoSafeClaimEnabled());
|
||||
|
||||
if (parameters.size() > 0)
|
||||
enable = parseBool(parameters.get(0));
|
||||
fme.setIsAutoSafeClaimEnabled(enabled);
|
||||
|
||||
me.enableAutoSafeZone(enable);
|
||||
|
||||
if (!enable) {
|
||||
sendMessage("Auto-claiming of safe zone disabled.");
|
||||
if ( ! enabled)
|
||||
{
|
||||
sendMessageParsed("<i>Auto-claiming of safe zone disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
sendMessage("Auto-claiming of safe zone enabled.");
|
||||
sendMessageParsed("<i>Auto-claiming of safe zone enabled.");
|
||||
|
||||
FLocation playerFlocation = new FLocation(me);
|
||||
FLocation playerFlocation = new FLocation(fme);
|
||||
|
||||
if (!Board.getFactionAt(playerFlocation).isSafeZone()) {
|
||||
Board.setFactionAt(Faction.getSafeZone(), playerFlocation);
|
||||
sendMessage("This land is now a safe zone.");
|
||||
if (!Board.getFactionAt(playerFlocation).isSafeZone())
|
||||
{
|
||||
Board.setFactionAt(Factions.i.getSafeZone(), playerFlocation);
|
||||
sendMessageParsed("<i>This land is now a safe zone.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,54 +1,61 @@
|
||||
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;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandAutoWarclaim extends FCommand {
|
||||
public class FCommandAutoWarclaim extends FCommand
|
||||
{
|
||||
|
||||
public FCommandAutoWarclaim()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("autosafe");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flipp");
|
||||
|
||||
this.permission = Permission.MANAGE_WAR_ZONE.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
public FCommandAutoWarclaim() {
|
||||
aliases.add("autowar");
|
||||
|
||||
optionalParameters.add("on|off");
|
||||
|
||||
helpDescription = "Auto-claim land for the warzone";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return P.hasPermManageWarZone(sender);
|
||||
this.setHelpShort("Auto-claim land for the warzone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
if ( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean enable = !me.autoWarZoneEnabled();
|
||||
boolean enabled = this.argAsBool(0, ! fme.isAutoWarClaimEnabled());
|
||||
|
||||
if (parameters.size() > 0)
|
||||
enable = parseBool(parameters.get(0));
|
||||
fme.setIsAutoWarClaimEnabled(enabled);
|
||||
|
||||
me.enableAutoWarZone(enable);
|
||||
|
||||
if (!enable) {
|
||||
sendMessage("Auto-claiming of war zone disabled.");
|
||||
if ( ! enabled)
|
||||
{
|
||||
sendMessageParsed("<i>Auto-claiming of war zone disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
sendMessage("Auto-claiming of war zone enabled.");
|
||||
sendMessageParsed("<i>Auto-claiming of war zone enabled.");
|
||||
|
||||
FLocation playerFlocation = new FLocation(me);
|
||||
FLocation playerFlocation = new FLocation(fme);
|
||||
|
||||
if (!Board.getFactionAt(playerFlocation).isWarZone()) {
|
||||
Board.setFactionAt(Faction.getWarZone(), playerFlocation);
|
||||
sendMessage("This land is now a war zone.");
|
||||
if (!Board.getFactionAt(playerFlocation).isWarZone())
|
||||
{
|
||||
Board.setFactionAt(Factions.i.getWarZone(), playerFlocation);
|
||||
sendMessageParsed("<i>This land is now a war zone.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,49 +2,52 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
|
||||
public class FCommandBalance extends FCommand
|
||||
{
|
||||
public FCommandBalance()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("balance");
|
||||
this.aliases.add("money");
|
||||
|
||||
public class FCommandBalance extends FCommand {
|
||||
//this.requiredArgs.add("player name");
|
||||
this.optionalArgs.put("factiontag", "yours");
|
||||
|
||||
public FCommandBalance() {
|
||||
aliases.add("balance");
|
||||
aliases.add("money");
|
||||
this.permission = Permission.COMMAND_BALANCE.node;
|
||||
|
||||
optionalParameters.add("faction tag");
|
||||
|
||||
helpDescription = "Show faction's current balance";
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
public void perform()
|
||||
{
|
||||
if ( ! Conf.bankEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.bankEnabled) {
|
||||
Faction faction = this.argAsFaction(0, fme.getFaction());
|
||||
|
||||
// TODO MAKE HIERARCHIAL COMMAND STRUCTURE HERE
|
||||
if ( faction != fme.getFaction() && ! Permission.VIEW_ANY_FACTION_BALANCE.has(sender))
|
||||
{
|
||||
sendMessageParsed("<b>You do not have sufficient permissions to view the bank balance of other factions.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction faction;
|
||||
|
||||
if (parameters.size() > 0) {
|
||||
if (!P.hasPermViewAnyFactionBalance(sender)) {
|
||||
sendMessage("You do not have sufficient permissions to view the bank balance of other factions.");
|
||||
return;
|
||||
}
|
||||
faction = findFaction(parameters.get(0), true);
|
||||
} else {
|
||||
faction = me.getFaction();
|
||||
}
|
||||
|
||||
if(faction == null) {
|
||||
sendMessage("Faction "+parameters.get(0)+" could not be found.");
|
||||
if (faction == null)
|
||||
{
|
||||
sendMessageParsed("<b>Faction %s<b> could not be found.", args.get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
sendMessage(Conf.colorChrome+faction.getTag()+" balance: "+ Econ.moneyString(faction.getMoney()));
|
||||
sendMessageParsed("<a>%s balance: %s", faction.getTag(), Econ.moneyString(faction.getMoney()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,34 +1,43 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class FCommandBypass extends FCommand {
|
||||
public class FCommandBypass extends FCommand
|
||||
{
|
||||
public FCommandBypass()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("bypass");
|
||||
|
||||
public FCommandBypass() {
|
||||
aliases.add("bypass");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flipp");
|
||||
|
||||
helpDescription = "Enable admin bypass mode; build/destroy anywhere";
|
||||
this.permission = Permission.ADMIN_BYPASS.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return P.hasPermAdminBypass(sender);
|
||||
public void perform()
|
||||
{
|
||||
// TODO: Move this to a transient field in the model??
|
||||
if ( ! Conf.adminBypassPlayers.contains(fme.getName()))
|
||||
{
|
||||
Conf.adminBypassPlayers.add(fme.getName());
|
||||
fme.sendMessageParsed("<i>You have enabled admin bypass mode. You will be able to build or destroy anywhere.");
|
||||
P.p.log(fme.getName() + " has ENABLED admin bypass mode.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! Conf.adminBypassPlayers.contains(me.getName())) {
|
||||
Conf.adminBypassPlayers.add(me.getName());
|
||||
me.sendMessage("You have enabled admin bypass mode. You will be able to build or destroy anywhere.");
|
||||
P.log(me.getName() + " has ENABLED admin bypass mode.");
|
||||
} else {
|
||||
Conf.adminBypassPlayers.remove(me.getName());
|
||||
me.sendMessage("You have disabled admin bypass mode.");
|
||||
P.log(me.getName() + " DISABLED admin bypass mode.");
|
||||
else
|
||||
{
|
||||
Conf.adminBypassPlayers.remove(fme.getName());
|
||||
fme.sendMessageParsed("<i>You have disabled admin bypass mode.");
|
||||
P.p.log(fme.getName() + " DISABLED admin bypass mode.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,56 +2,71 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandChat extends FCommand {
|
||||
public class FCommandChat extends FCommand
|
||||
{
|
||||
|
||||
public FCommandChat() {
|
||||
aliases.add("chat");
|
||||
aliases.add("c");
|
||||
public FCommandChat()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("c");
|
||||
this.aliases.add("chat");
|
||||
|
||||
optionalParameters.add("mode");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("mode", "next");
|
||||
|
||||
helpDescription = "Change chat mode";
|
||||
this.permission = Permission.COMMAND_CHAT.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! Conf.factionOnlyChat ) {
|
||||
sendMessage("Faction-only chat is disabled on this server.");
|
||||
return;
|
||||
}
|
||||
if ( ! assertHasFaction()) {
|
||||
public void perform()
|
||||
{
|
||||
if ( ! Conf.factionOnlyChat )
|
||||
{
|
||||
sendMessageParsed("<b>Faction-only chat is disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.parameters.size() >= 1 ) {
|
||||
String mode = this.parameters.get(0);
|
||||
String modeString = this.argAsString(0).toLowerCase();
|
||||
ChatMode modeTarget = fme.getChatMode().getNext();
|
||||
|
||||
if(mode.startsWith("p")) {
|
||||
me.setChatMode(ChatMode.PUBLIC);
|
||||
sendMessage("Public chat mode.");
|
||||
} else if(mode.startsWith("a")) {
|
||||
me.setChatMode(ChatMode.ALLIANCE);
|
||||
sendMessage("Alliance only chat mode.");
|
||||
} else if(mode.startsWith("f")) {
|
||||
me.setChatMode(ChatMode.FACTION);
|
||||
sendMessage("Faction only chat mode.");
|
||||
} else {
|
||||
sendMessage("Unrecognised chat mode. Please enter either 'a','f' or 'p'");
|
||||
if (modeString != null)
|
||||
{
|
||||
if(modeString.startsWith("p"))
|
||||
{
|
||||
modeTarget = ChatMode.PUBLIC;
|
||||
}
|
||||
else if (modeString.startsWith("a"))
|
||||
{
|
||||
modeTarget = ChatMode.ALLIANCE;
|
||||
}
|
||||
else if(modeString.startsWith("f"))
|
||||
{
|
||||
modeTarget = ChatMode.FACTION;
|
||||
}
|
||||
sendMessageParsed("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'");
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
fme.setChatMode(modeTarget);
|
||||
|
||||
if(me.getChatMode() == ChatMode.PUBLIC) {
|
||||
me.setChatMode(ChatMode.ALLIANCE);
|
||||
sendMessage("Alliance only chat mode.");
|
||||
} else if (me.getChatMode() == ChatMode.ALLIANCE ) {
|
||||
me.setChatMode(ChatMode.FACTION);
|
||||
sendMessage("Faction only chat mode.");
|
||||
} else {
|
||||
me.setChatMode(ChatMode.PUBLIC);
|
||||
sendMessage("Public chat mode.");
|
||||
if(fme.getChatMode() == ChatMode.PUBLIC)
|
||||
{
|
||||
sendMessageParsed("<i>Public chat mode.");
|
||||
}
|
||||
else if (fme.getChatMode() == ChatMode.ALLIANCE )
|
||||
{
|
||||
sendMessageParsed("<i>Alliance only chat mode.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessageParsed("<i>Faction only chat mode.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,38 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
public class FCommandClaim extends FCommand {
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandClaim extends FCommand
|
||||
{
|
||||
|
||||
public FCommandClaim()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("claim");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.COMMAND_CLAIM.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
public FCommandClaim() {
|
||||
aliases.add("claim");
|
||||
|
||||
helpDescription = "Claim the land where you are standing";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
me.attemptClaim(true);
|
||||
fme.attemptClaim(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,122 +14,148 @@ import org.bukkit.entity.Player;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandConfig extends FCommand {
|
||||
|
||||
public class FCommandConfig extends FCommand
|
||||
{
|
||||
private static HashMap<String, String> properFieldNames = new HashMap<String, String>();
|
||||
|
||||
public FCommandConfig() {
|
||||
aliases.add("config");
|
||||
public FCommandConfig()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("config");
|
||||
|
||||
this.requiredArgs.add("setting");
|
||||
this.requiredArgs.add("value");
|
||||
this.requiredArgs.add("");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.COMMAND_CONFIG.node;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
|
||||
requiredParameters.add("setting");
|
||||
requiredParameters.add("value");
|
||||
|
||||
helpDescription = "change a conf.json setting";
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return P.hasPermConfigure(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
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()) {
|
||||
if (properFieldNames.isEmpty())
|
||||
{
|
||||
Field[] fields = Conf.class.getDeclaredFields();
|
||||
for(int i = 0; i < fields.length; i++) {
|
||||
for(int i = 0; i < fields.length; i++)
|
||||
{
|
||||
properFieldNames.put(fields[i].getName().toLowerCase(), fields[i].getName());
|
||||
}
|
||||
}
|
||||
|
||||
String field = parameters.get(0).toLowerCase();
|
||||
if (field.startsWith("\"") && field.endsWith("\"")) {
|
||||
String field = this.argAsString(0).toLowerCase();
|
||||
if (field.startsWith("\"") && field.endsWith("\""))
|
||||
{
|
||||
field = field.substring(1, field.length() - 1);
|
||||
}
|
||||
String fieldName = properFieldNames.get(field);
|
||||
|
||||
if (fieldName == null || fieldName.isEmpty()) {
|
||||
sendMessage("No configuration setting \""+parameters.get(0)+"\" exists.");
|
||||
if (fieldName == null || fieldName.isEmpty())
|
||||
{
|
||||
sendMessageParsed("<b>No configuration setting \"<h>%s<b>\" exists.", field);
|
||||
return;
|
||||
}
|
||||
|
||||
String success = "";
|
||||
|
||||
String value = parameters.get(1);
|
||||
for(int i = 2; i < parameters.size(); i++) {
|
||||
value += ' ' + parameters.get(i);
|
||||
String value = args.get(1);
|
||||
for(int i = 2; i < args.size(); i++)
|
||||
{
|
||||
value += ' ' + args.get(i);
|
||||
}
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
Field target = Conf.class.getField(fieldName);
|
||||
|
||||
// boolean
|
||||
if (target.getType() == boolean.class) {
|
||||
if (aliasTrue.contains(value.toLowerCase())) {
|
||||
if (target.getType() == boolean.class)
|
||||
{
|
||||
if (aliasTrue.contains(value.toLowerCase()))
|
||||
{
|
||||
target.setBoolean(null, true);
|
||||
success = "\""+fieldName+"\" option set to true (enabled).";
|
||||
}
|
||||
else if (aliasFalse.contains(value.toLowerCase())) {
|
||||
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).");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// int
|
||||
else if (target.getType() == int.class) {
|
||||
try {
|
||||
else if (target.getType() == int.class)
|
||||
{
|
||||
try
|
||||
{
|
||||
int intVal = Integer.parseInt(value);
|
||||
target.setInt(null, intVal);
|
||||
success = "\""+fieldName+"\" option set to "+intVal+".";
|
||||
}
|
||||
catch(NumberFormatException ex) {
|
||||
catch(NumberFormatException ex)
|
||||
{
|
||||
sendMessage("Cannot set \""+fieldName+"\": integer (whole number) value required.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// double
|
||||
else if (target.getType() == double.class) {
|
||||
try {
|
||||
else if (target.getType() == double.class)
|
||||
{
|
||||
try
|
||||
{
|
||||
double doubleVal = Double.parseDouble(value);
|
||||
target.setDouble(null, doubleVal);
|
||||
success = "\""+fieldName+"\" option set to "+doubleVal+".";
|
||||
}
|
||||
catch(NumberFormatException ex) {
|
||||
catch(NumberFormatException ex)
|
||||
{
|
||||
sendMessage("Cannot set \""+fieldName+"\": double (numeric) value required.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// String
|
||||
else if (target.getType() == String.class) {
|
||||
else if (target.getType() == String.class)
|
||||
{
|
||||
target.set(null, value);
|
||||
success = "\""+fieldName+"\" option set to \""+value+"\".";
|
||||
}
|
||||
|
||||
// ChatColor
|
||||
else if (target.getType() == ChatColor.class) {
|
||||
else if (target.getType() == ChatColor.class)
|
||||
{
|
||||
ChatColor newColor = null;
|
||||
try {
|
||||
try
|
||||
{
|
||||
newColor = ChatColor.valueOf(value.toUpperCase());
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
|
||||
}
|
||||
if (newColor == null) {
|
||||
if (newColor == null)
|
||||
{
|
||||
sendMessage("Cannot set \""+fieldName+"\": \""+value.toUpperCase()+"\" is not a valid color.");
|
||||
return;
|
||||
}
|
||||
@ -138,25 +164,32 @@ public class FCommandConfig extends FCommand {
|
||||
}
|
||||
|
||||
// Set<?> or other parameterized collection
|
||||
else if (target.getGenericType() instanceof ParameterizedType) {
|
||||
else if (target.getGenericType() instanceof ParameterizedType)
|
||||
{
|
||||
ParameterizedType targSet = (ParameterizedType)target.getGenericType();
|
||||
Type innerType = targSet.getActualTypeArguments()[0];
|
||||
|
||||
// not a Set, somehow, and that should be the only collection we're using in Conf.java
|
||||
if (targSet.getRawType() != Set.class) {
|
||||
if (targSet.getRawType() != Set.class)
|
||||
{
|
||||
sendMessage("\""+fieldName+"\" is not a data collection type which can be modified with this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Set<Material>
|
||||
else if (innerType == Material.class) {
|
||||
else if (innerType == Material.class)
|
||||
{
|
||||
Material newMat = null;
|
||||
try {
|
||||
try
|
||||
{
|
||||
newMat = Material.valueOf(value.toUpperCase());
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
|
||||
}
|
||||
if (newMat == null) {
|
||||
if (newMat == null)
|
||||
{
|
||||
sendMessage("Cannot change \""+fieldName+"\" set: \""+value.toUpperCase()+"\" is not a valid material.");
|
||||
return;
|
||||
}
|
||||
@ -165,13 +198,15 @@ public class FCommandConfig extends FCommand {
|
||||
Set<Material> matSet = (Set<Material>)target.get(null);
|
||||
|
||||
// Material already present, so remove it
|
||||
if (matSet.contains(newMat)) {
|
||||
if (matSet.contains(newMat))
|
||||
{
|
||||
matSet.remove(newMat);
|
||||
target.set(null, matSet);
|
||||
success = "\""+fieldName+"\" set: Material \""+value.toUpperCase()+"\" removed.";
|
||||
}
|
||||
// Material not present yet, add it
|
||||
else {
|
||||
else
|
||||
{
|
||||
matSet.add(newMat);
|
||||
target.set(null, matSet);
|
||||
success = "\""+fieldName+"\" set: Material \""+value.toUpperCase()+"\" added.";
|
||||
@ -179,18 +214,21 @@ public class FCommandConfig extends FCommand {
|
||||
}
|
||||
|
||||
// Set<String>
|
||||
else if (innerType == String.class) {
|
||||
else if (innerType == String.class)
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<String> stringSet = (Set<String>)target.get(null);
|
||||
|
||||
// String already present, so remove it
|
||||
if (stringSet.contains(value)) {
|
||||
if (stringSet.contains(value))
|
||||
{
|
||||
stringSet.remove(value);
|
||||
target.set(null, stringSet);
|
||||
success = "\""+fieldName+"\" set: \""+value+"\" removed.";
|
||||
}
|
||||
// String not present yet, add it
|
||||
else {
|
||||
else
|
||||
{
|
||||
stringSet.add(value);
|
||||
target.set(null, stringSet);
|
||||
success = "\""+fieldName+"\" set: \""+value+"\" added.";
|
||||
@ -198,31 +236,37 @@ public class FCommandConfig extends FCommand {
|
||||
}
|
||||
|
||||
// Set of unknown type
|
||||
else {
|
||||
else
|
||||
{
|
||||
sendMessage("\""+fieldName+"\" is not a data type set which can be modified with this command.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown type
|
||||
else {
|
||||
else
|
||||
{
|
||||
sendMessage("\""+fieldName+"\" is not a data type which can be modified with this command.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (NoSuchFieldException ex) {
|
||||
catch (NoSuchFieldException ex)
|
||||
{
|
||||
sendMessage("Configuration setting \""+fieldName+"\" couldn't be matched, though it should be... please report this error.");
|
||||
return;
|
||||
}
|
||||
catch (IllegalAccessException ex) {
|
||||
catch (IllegalAccessException ex)
|
||||
{
|
||||
sendMessage("Error setting configuration setting \""+fieldName+"\" to \""+value+"\".");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!success.isEmpty()) {
|
||||
if (!success.isEmpty())
|
||||
{
|
||||
sendMessage(success);
|
||||
if (sender instanceof Player) {
|
||||
P.log(success + " Command was run by "+me.getName()+".");
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
P.p.log(success + " Command was run by "+fme.getName()+".");
|
||||
}
|
||||
}
|
||||
// save change to disk
|
||||
|
@ -2,68 +2,77 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
||||
public class FCommandCreate extends FCommand {
|
||||
public class FCommandCreate extends FCommand
|
||||
{
|
||||
public FCommandCreate()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("create");
|
||||
|
||||
public FCommandCreate() {
|
||||
aliases.add("create");
|
||||
this.requiredArgs.add("faction tag");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
requiredParameters.add("faction tag");
|
||||
this.permission = Permission.CREATE.node;
|
||||
|
||||
helpDescription = "Create a new faction";
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return P.hasPermCreate(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String tag = parameters.get(0);
|
||||
String tag = this.argAsString(0);
|
||||
|
||||
if (me.hasFaction()) {
|
||||
if (fme.hasFaction())
|
||||
{
|
||||
sendMessage("You must leave your current faction first.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Faction.isTagTaken(tag)) {
|
||||
if (Factions.i.isTagTaken(tag))
|
||||
{
|
||||
sendMessage("That tag is already in use.");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> tagValidationErrors = Faction.validateTag(tag);
|
||||
if (tagValidationErrors.size() > 0) {
|
||||
ArrayList<String> tagValidationErrors = Factions.validateTag(tag);
|
||||
if (tagValidationErrors.size() > 0)
|
||||
{
|
||||
sendMessage(tagValidationErrors);
|
||||
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.econCostCreate)) {
|
||||
if (!payForCommand(Conf.econCostCreate))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Faction faction = Faction.create();
|
||||
Faction faction = Factions.i.create();
|
||||
faction.setTag(tag);
|
||||
me.setRole(Role.ADMIN);
|
||||
me.setFaction(faction);
|
||||
fme.setRole(Role.ADMIN);
|
||||
fme.setFaction(faction);
|
||||
|
||||
for (FPlayer follower : FPlayer.getAllOnline()) {
|
||||
follower.sendMessage(me.getNameAndRelevant(follower)+Conf.colorSystem+" created a new faction "+faction.getTag(follower));
|
||||
for (FPlayer follower : FPlayers.i.getOnline())
|
||||
{
|
||||
follower.sendMessageParsed("%s<i> created a new faction %s", fme.getNameAndRelevant(follower), faction.getTag(follower));
|
||||
}
|
||||
|
||||
sendMessage("You should now: " + new FCommandDescription().getUseageTemplate());
|
||||
|
@ -1,55 +1,54 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandDeinvite extends FCommand {
|
||||
public class FCommandDeinvite extends FCommand
|
||||
{
|
||||
|
||||
public FCommandDeinvite() {
|
||||
aliases.add("deinvite");
|
||||
aliases.add("deinv");
|
||||
public FCommandDeinvite()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("deinvite");
|
||||
this.aliases.add("deinv");
|
||||
|
||||
requiredParameters.add("player name");
|
||||
this.requiredArgs.add("player name");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
helpDescription = "Remove a pending invitation";
|
||||
this.permission = Permission.COMMAND_DEINVITE.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
FPlayer you = this.argAsBestFPlayerMatch(0);
|
||||
if (you == null) return;
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getFaction() == myFaction) {
|
||||
sendMessage(you.getName()+" is already a member of "+myFaction.getTag());
|
||||
sendMessage("You might want to: " + new FCommandKick().getUseageTemplate(false));
|
||||
if (you.getFaction() == myFaction)
|
||||
{
|
||||
sendMessageParsed("%s<i> is already a member of %s", you.getName(), myFaction.getTag());
|
||||
sendMessageParsed("<i>You might want to: %s", new FCommandKick().getUseageTemplate(false));
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.deinvite(you);
|
||||
|
||||
you.sendMessage(me.getNameAndRelevant(you)+Conf.colorSystem+" revoked your invitation to "+myFaction.getTag(you));
|
||||
myFaction.sendMessage(me.getNameAndRelevant(me)+Conf.colorSystem+" revoked "+you.getNameAndRelevant(me)+"'s"+Conf.colorSystem+" invitation.");
|
||||
you.sendMessageParsed("%s<i> revoked your invitation to %s", fme.getNameAndRelevant(you), myFaction.getTag(you));
|
||||
myFaction.sendMessageParsed("%s<i> revoked %s's<i> invitation.", fme.getNameAndRelevant(fme), you.getNameAndRelevant(fme));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,58 +2,61 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
|
||||
|
||||
public class FCommandDeposit extends FCommand {
|
||||
public class FCommandDeposit extends FCommand
|
||||
{
|
||||
|
||||
public FCommandDeposit() {
|
||||
aliases.add("deposit");
|
||||
public FCommandDeposit()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("deposit");
|
||||
|
||||
helpDescription = "Deposit money into your faction's bank";
|
||||
requiredParameters.add("amount");
|
||||
this.requiredArgs.add("amount");
|
||||
//this.optionalArgs
|
||||
|
||||
this.permission = Permission.COMMAND_DEPOSIT.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
public void perform()
|
||||
{
|
||||
if ( ! Conf.bankEnabled) return;
|
||||
|
||||
if (!Conf.bankEnabled) {
|
||||
return;
|
||||
}
|
||||
Faction faction = fme.getFaction();
|
||||
|
||||
double amount = 0.0;
|
||||
double amount = this.argAsDouble(0, 0);
|
||||
|
||||
Faction faction = me.getFaction();
|
||||
|
||||
if (parameters.size() == 1) {
|
||||
try {
|
||||
amount = Double.parseDouble(parameters.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
// wasn't valid
|
||||
}
|
||||
}
|
||||
|
||||
if( amount > 0.0 ) {
|
||||
if( amount > 0.0 )
|
||||
{
|
||||
String amountString = Econ.moneyString(amount);
|
||||
|
||||
if( !Econ.deductMoney(me.getName(), amount ) ) {
|
||||
sendMessage("You cannot afford to deposit that much.");
|
||||
if( ! Econ.deductMoney(fme.getName(), amount ) )
|
||||
{
|
||||
sendMessageParsed("<b>You cannot afford to deposit that much.");
|
||||
}
|
||||
else
|
||||
{
|
||||
faction.addMoney(amount);
|
||||
sendMessage("You have deposited "+amountString+" into "+faction.getTag()+"'s bank.");
|
||||
sendMessage(faction.getTag()+" now has "+Econ.moneyString(faction.getMoney()));
|
||||
P.log(me.getName() + " deposited "+amountString+" into "+faction.getTag()+"'s bank.");
|
||||
P.p.log(fme.getName() + " deposited "+amountString+" into "+faction.getTag()+"'s bank.");
|
||||
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has deposited "+amountString);
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
if (fplayer.getFaction() == faction)
|
||||
{
|
||||
fplayer.sendMessageParsed("%s has deposited %s", fme.getNameAndRelevant(fplayer), amountString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,45 +2,50 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
|
||||
public class FCommandDescription extends FCommand {
|
||||
public class FCommandDescription extends FCommand
|
||||
{
|
||||
public FCommandDescription()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("desc");
|
||||
|
||||
public FCommandDescription() {
|
||||
aliases.add("desc");
|
||||
this.requiredArgs.add("desc");
|
||||
//this.optionalArgs
|
||||
|
||||
requiredParameters.add("desc");
|
||||
this.permission = Permission.COMMAND_DESCRIPTION.node;
|
||||
|
||||
helpDescription = "Change the faction description";
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
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)) {
|
||||
if ( ! payForCommand(Conf.econCostDesc))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
me.getFaction().setDescription(TextUtil.implode(parameters));
|
||||
fme.getFaction().setDescription(TextUtil.implode(args, " "));
|
||||
|
||||
// Broadcast the description to everyone
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
fplayer.sendMessage("The faction "+fplayer.getRelationColor(me)+me.getFaction().getTag()+Conf.colorSystem+" changed their description to:");
|
||||
fplayer.sendMessage(me.getFaction().getDescription());
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
fplayer.sendMessageParsed("The faction "+fplayer.getRelationColor(fme)+fme.getFaction().getTag()+"<i> changed their description to:");
|
||||
fplayer.sendMessageParsed("<i>"+fme.getFaction().getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,85 +2,88 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
||||
public class FCommandDisband extends FCommand {
|
||||
public class FCommandDisband extends FCommand
|
||||
{
|
||||
public FCommandDisband()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("disband");
|
||||
|
||||
public FCommandDisband() {
|
||||
aliases.add("disband");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction tag", "yours");
|
||||
|
||||
this.permission = Permission.COMMAND_DISBAND.node;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
|
||||
optionalParameters.add("faction tag");
|
||||
|
||||
helpDescription = "Disband a faction";
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
public void perform()
|
||||
{
|
||||
// The faction, default to your own.. but null if console sender.
|
||||
Faction faction = this.argAsFaction(0, fme == null ? null : fme.getFaction());
|
||||
if (faction == null) return;
|
||||
|
||||
Faction faction = null;
|
||||
boolean isMyFaction = fme == null ? false : faction == fme.getFaction();
|
||||
|
||||
if( parameters.size() > 0) {
|
||||
faction = Faction.findByTag(parameters.get(0));
|
||||
|
||||
if( faction == null || !faction.isNormal()) {
|
||||
sendMessage("Faction \"" + parameters.get(0) + "\" not found");
|
||||
return;
|
||||
if (isMyFaction)
|
||||
{
|
||||
if ( ! assertMinRole(Role.ADMIN)) return;
|
||||
}
|
||||
|
||||
if ( ! P.hasPermDisband(sender)) {
|
||||
if (me.getFaction() == faction) {
|
||||
parameters.clear();
|
||||
}
|
||||
else {
|
||||
sendMessage("You do not have sufficient permission to disband other factions.");
|
||||
else
|
||||
{
|
||||
if ( ! Permission.COMMAND_DISBAND_ANY.has(me, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (parameters.isEmpty()) {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
if ( ! assertMinRole(Role.ADMIN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
faction = me.getFaction();
|
||||
|
||||
if (faction.isPermanent() && !P.hasPermDisband(sender)) {
|
||||
sendMessage("Your faction is designated as permanent, so you cannot disband it.");
|
||||
if (faction.isPermanent())
|
||||
{
|
||||
sendMessageParsed("<i>This faction is designated as permanent, so you cannot disband it.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.sendMessage((senderIsConsole ? "A server admin" : me.getNameAndRelevant(fplayer))+Conf.colorSystem+" disbanded your faction.");
|
||||
} else {
|
||||
fplayer.sendMessage((senderIsConsole ? "A server admin" : me.getNameAndRelevant(fplayer))+Conf.colorSystem+" disbanded the faction "+faction.getTag(fplayer)+".");
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
String who = senderIsConsole ? "A server admin" : fme.getNameAndRelevant(fplayer);
|
||||
if (fplayer.getFaction() == faction)
|
||||
{
|
||||
fplayer.sendMessageParsed("<h>%s<i> disbanded your faction.", who);
|
||||
}
|
||||
else
|
||||
{
|
||||
fplayer.sendMessageParsed("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer));
|
||||
}
|
||||
}
|
||||
|
||||
if (Conf.bankEnabled) {
|
||||
if (Conf.bankEnabled)
|
||||
{
|
||||
double amount = faction.getMoney();
|
||||
Econ.addMoney(me.getName(), amount ); //Give all the faction's money to the disbander
|
||||
if (amount > 0.0) {
|
||||
Econ.addMoney(fme.getId(), amount); //Give all the faction's money to the disbander
|
||||
if (amount > 0.0)
|
||||
{
|
||||
String amountString = Econ.moneyString(amount);
|
||||
sendMessage("You have been given the disbanded faction's bank, totaling "+amountString+".");
|
||||
P.log(me.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+".");
|
||||
sendMessageParsed("<i>You have been given the disbanded faction's bank, totaling %s.", amountString);
|
||||
P.p.log(fme.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+".");
|
||||
}
|
||||
}
|
||||
|
||||
Faction.delete( faction.getId() );
|
||||
faction.detach();
|
||||
|
||||
SpoutFeatures.updateAppearances();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,44 +2,45 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class FCommandHelp extends FCommand {
|
||||
public class FCommandHelp extends FCommand
|
||||
{
|
||||
|
||||
public FCommandHelp() {
|
||||
aliases.add("help");
|
||||
aliases.add("h");
|
||||
aliases.add("?");
|
||||
public FCommandHelp()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("help");
|
||||
this.aliases.add("h");
|
||||
this.aliases.add("?");
|
||||
|
||||
optionalParameters.add("page");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("page", "1");
|
||||
|
||||
helpDescription = "Display a help page";
|
||||
this.permission = Permission.COMMAND_HELP.node;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
public void perform()
|
||||
{
|
||||
int page = this.argAsInt(0, 1);
|
||||
|
||||
sendMessage(p.txt.titleize("Factions Help ("+page+"/"+helpPages.size()+")"));
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
int page = 1;
|
||||
if (parameters.size() > 0) {
|
||||
try {
|
||||
page = Integer.parseInt(parameters.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
// wasn't an integer
|
||||
}
|
||||
}
|
||||
sendMessage(TextUtil.titleize("Factions Help ("+page+"/"+helpPages.size()+")"));
|
||||
page -= 1;
|
||||
if (page < 0 || page >= helpPages.size()) {
|
||||
sendMessage("This page does not exist");
|
||||
|
||||
if (page < 0 || page >= helpPages.size())
|
||||
{
|
||||
sendMessageParsed("<b>This page does not exist");
|
||||
return;
|
||||
}
|
||||
sendMessage(helpPages.get(page));
|
||||
@ -51,7 +52,8 @@ public class FCommandHelp extends FCommand {
|
||||
|
||||
public static ArrayList<ArrayList<String>> helpPages;
|
||||
|
||||
public static void updateHelp() {
|
||||
public static void updateHelp()
|
||||
{
|
||||
helpPages = new ArrayList<ArrayList<String>>();
|
||||
ArrayList<String> pageLines;
|
||||
|
||||
@ -79,7 +81,8 @@ public class FCommandHelp extends FCommand {
|
||||
pageLines.add( new FCommandSethome().getUseageTemplate() );
|
||||
helpPages.add(pageLines);
|
||||
|
||||
if (Econ.enabled() && Conf.bankEnabled) {
|
||||
if (Econ.enabled() && Conf.bankEnabled)
|
||||
{
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( "" );
|
||||
pageLines.add( "Your faction has a bank which is used to pay for certain" );
|
||||
@ -162,7 +165,7 @@ public class FCommandHelp extends FCommand {
|
||||
pageLines.add( new FCommandWarclaim().getUseageTemplate() );
|
||||
pageLines.add( new FCommandAutoWarclaim().getUseageTemplate() );
|
||||
pageLines.add( new FCommandWarunclaimall().getUseageTemplate() );
|
||||
pageLines.add("Note: " + Conf.colorCommand + "f unclaim" + Conf.colorSystem + " works on safe/war zones as well.");
|
||||
pageLines.add("Note: " + new FCommandUnclaim().getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well.");
|
||||
helpPages.add(pageLines);
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
@ -178,7 +181,8 @@ public class FCommandHelp extends FCommand {
|
||||
helpPages.add(pageLines);
|
||||
}
|
||||
|
||||
static {
|
||||
static
|
||||
{
|
||||
updateHelp();
|
||||
}
|
||||
}
|
||||
|
@ -8,60 +8,88 @@ import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandHome extends FCommand {
|
||||
public class FCommandHome extends FCommand
|
||||
{
|
||||
|
||||
public FCommandHome() {
|
||||
aliases.add("home");
|
||||
public FCommandHome()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("home");
|
||||
|
||||
helpDescription = "Teleport to the faction home";
|
||||
//this.requiredArgs.add("");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.COMMAND_HOME.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
public void perform()
|
||||
{
|
||||
// TODO: Hide this command on help also.
|
||||
if ( ! Conf.homesEnabled)
|
||||
{
|
||||
fme.sendMessage("Sorry, Faction homes are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Conf.homesEnabled) {
|
||||
me.sendMessage("Sorry, Faction homes are disabled on this server.");
|
||||
if ( ! Conf.homesTeleportCommandEnabled)
|
||||
{
|
||||
fme.sendMessage("Sorry, the ability to teleport to Faction homes is disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Conf.homesTeleportCommandEnabled) {
|
||||
me.sendMessage("Sorry, the ability to teleport to Faction homes is disabled on this server.");
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
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(new FCommandSethome().getUseageTemplate());
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if ( ! myFaction.hasHome()) {
|
||||
me.sendMessage("You faction does not have a home. " + (me.getRole().value < Role.MODERATOR.value ? " Ask your leader to:" : "You should:"));
|
||||
me.sendMessage(new FCommandSethome().getUseageTemplate());
|
||||
if ( ! Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory())
|
||||
{
|
||||
fme.sendMessage("You cannot teleport to your faction home while in the territory of an enemy faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.homesTeleportAllowedFromEnemyTerritory && me.isInEnemyTerritory()) {
|
||||
me.sendMessage("You cannot teleport to your faction home while in the territory of an enemy faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
|
||||
me.sendMessage("You cannot teleport to your faction home while in a different world.");
|
||||
if ( ! Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID())
|
||||
{
|
||||
fme.sendMessage("You cannot teleport to your faction home while in a different world.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction faction = Board.getFactionAt(new FLocation(me.getLocation()));
|
||||
|
||||
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
|
||||
if (
|
||||
if
|
||||
(
|
||||
Conf.homesTeleportAllowedEnemyDistance > 0
|
||||
&& !faction.isSafeZone()
|
||||
&& (!me.isInOwnTerritory() || (me.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))
|
||||
) {
|
||||
&&
|
||||
! faction.isSafeZone()
|
||||
&&
|
||||
(
|
||||
! fme.isInOwnTerritory()
|
||||
||
|
||||
(
|
||||
fme.isInOwnTerritory()
|
||||
&&
|
||||
! Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
Location loc = me.getLocation();
|
||||
World w = loc.getWorld();
|
||||
double x = loc.getX();
|
||||
@ -70,11 +98,11 @@ public class FCommandHome extends FCommand {
|
||||
|
||||
for (Player p : me.getServer().getOnlinePlayers())
|
||||
{
|
||||
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w)
|
||||
if (p == null || !p.isOnline() || p.isDead() || p == fme || p.getWorld() != w)
|
||||
continue;
|
||||
|
||||
FPlayer fp = FPlayer.get(p);
|
||||
if (me.getRelation(fp) != Relation.ENEMY)
|
||||
FPlayer fp = FPlayers.i.get(p);
|
||||
if (fme.getRelation(fp) != Relation.ENEMY)
|
||||
continue;
|
||||
|
||||
Location l = p.getLocation();
|
||||
@ -87,13 +115,14 @@ public class FCommandHome extends FCommand {
|
||||
if (dx > max || dy > max || dz > max)
|
||||
continue;
|
||||
|
||||
me.sendMessage("You cannot teleport to your faction home while an enemy is within " + Conf.homesTeleportAllowedEnemyDistance + " blocks of you.");
|
||||
fme.sendMessage("You cannot teleport to your faction home while an enemy is within " + Conf.homesTeleportAllowedEnemyDistance + " blocks of you.");
|
||||
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.econCostHome)) {
|
||||
if ( ! payForCommand(Conf.econCostHome))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3,58 +3,58 @@ package com.massivecraft.factions.commands;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandInvite extends FCommand {
|
||||
public class FCommandInvite extends FCommand
|
||||
{
|
||||
public FCommandInvite()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("invite");
|
||||
this.aliases.add("inv");
|
||||
|
||||
public FCommandInvite() {
|
||||
aliases.add("invite");
|
||||
aliases.add("inv");
|
||||
this.requiredArgs.add("player name");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
requiredParameters.add("player name");
|
||||
this.permission = Permission.COMMAND_INVITE.node;
|
||||
|
||||
helpDescription = "Invite a player";
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
FPlayer you = this.argAsBestFPlayerMatch(0);
|
||||
if (you == null) return;
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (you.getFaction() == myFaction) {
|
||||
sendMessage(you.getName()+" is already a member of "+myFaction.getTag());
|
||||
sendMessage("You might want to: " + new FCommandKick().getUseageTemplate(false));
|
||||
if (you.getFaction() == myFaction)
|
||||
{
|
||||
sendMessageParsed("%s<i> is already a member of %s", you.getName(), myFaction.getTag());
|
||||
sendMessageParsed("<i>You might want to: " + new FCommandKick().getUseageTemplate(false));
|
||||
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.econCostInvite)) {
|
||||
if ( ! payForCommand(Conf.econCostInvite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.invite(you);
|
||||
|
||||
you.sendMessage(me.getNameAndRelevant(you)+Conf.colorSystem+" invited you to "+myFaction.getTag(you));
|
||||
myFaction.sendMessage(me.getNameAndRelevant(me)+Conf.colorSystem+" invited "+you.getNameAndRelevant(me)+Conf.colorSystem+" to your faction.");
|
||||
you.sendMessageParsed("%s<i> invited you to %s", fme.getNameAndRelevant(you), myFaction.getTag(you));
|
||||
myFaction.sendMessageParsed("%s<i> invited %s<i> to your faction.", fme.getNameAndRelevant(fme), you.getNameAndRelevant(fme));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,69 +2,80 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandJoin extends FCommand {
|
||||
public class FCommandJoin extends FCommand
|
||||
{
|
||||
public FCommandJoin()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("join");
|
||||
|
||||
public FCommandJoin() {
|
||||
aliases.add("join");
|
||||
this.requiredArgs.add("faction name");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
requiredParameters.add("faction name");
|
||||
this.permission = Permission.COMMAND_JOIN.node;
|
||||
|
||||
helpDescription = "Join a faction";
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String factionName = parameters.get(0);
|
||||
Faction faction = this.argAsFaction(0);
|
||||
if (faction == null) return;
|
||||
|
||||
Faction faction = findFaction(factionName);
|
||||
if (faction == null) {
|
||||
if ( ! faction.isNormal())
|
||||
{
|
||||
sendMessageParsed("<b>You may only join normal factions. This is a system faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! faction.isNormal()) {
|
||||
sendMessage("You may only join normal factions. This is a system faction.");
|
||||
if (faction == fme.getFaction())
|
||||
{
|
||||
sendMessageParsed("<b>You are already a member of %s", faction.getTag(fme));
|
||||
return;
|
||||
}
|
||||
|
||||
if (faction == me.getFaction()) {
|
||||
sendMessage("You are already a member of "+faction.getTag(me));
|
||||
if (fme.hasFaction())
|
||||
{
|
||||
sendMessageParsed("<b>You must leave your current faction first.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (me.hasFaction()) {
|
||||
sendMessage("You must leave your current faction first.");
|
||||
if (!Conf.CanLeaveWithNegativePower && fme.getPower() < 0)
|
||||
{
|
||||
sendMessageParsed("<b>You cannot join a faction until your power is positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.CanLeaveWithNegativePower && me.getPower() < 0) {
|
||||
sendMessage("You cannot join a faction until your power is positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
if( ! faction.getOpen() && ! faction.isInvited(me)) {
|
||||
sendMessage("This guild requires invitation.");
|
||||
faction.sendMessage(me.getNameAndRelevant(faction)+Conf.colorSystem+" tried to join your faction.");
|
||||
if( ! faction.getOpen() && ! faction.isInvited(fme))
|
||||
{
|
||||
sendMessageParsed("<i>This guild requires invitation.");
|
||||
faction.sendMessageParsed("%s<i> tried to join your faction.", fme.getNameAndRelevant(faction));
|
||||
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.econCostJoin)) {
|
||||
if (!payForCommand(Conf.econCostJoin))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
me.sendMessage(Conf.colorSystem+"You successfully joined "+faction.getTag(me));
|
||||
faction.sendMessage(me.getNameAndRelevant(faction)+Conf.colorSystem+" joined your faction.");
|
||||
fme.sendMessageParsed("<i>You successfully joined %s", faction.getTag(fme));
|
||||
faction.sendMessageParsed("<i>%s joined your faction.", fme.getNameAndRelevant(faction));
|
||||
|
||||
me.resetFactionData();
|
||||
me.setFaction(faction);
|
||||
faction.deinvite(me);
|
||||
fme.resetFactionData();
|
||||
fme.setFaction(faction);
|
||||
faction.deinvite(fme);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,81 +2,98 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandKick extends FCommand {
|
||||
public class FCommandKick extends FCommand
|
||||
{
|
||||
|
||||
public FCommandKick() {
|
||||
aliases.add("kick");
|
||||
public FCommandKick()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("kick");
|
||||
|
||||
requiredParameters.add("player name");
|
||||
this.requiredArgs.add("player name");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
helpDescription = "Kick a player from the faction";
|
||||
this.permission = Permission.COMMAND_KICK.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
FPlayer you = this.argAsBestFPlayerMatch(0);
|
||||
if (you == null) return;
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (me == you) {
|
||||
sendMessage("You cannot kick yourself.");
|
||||
sendMessage("You might want to: " + new FCommandLeave().getUseageTemplate(false));
|
||||
if (fme == you)
|
||||
{
|
||||
sendMessageParsed("<b>You cannot kick yourself.");
|
||||
sendMessageParsed("<i>You might want to: %s", new FCommandLeave().getUseageTemplate(false));
|
||||
return;
|
||||
}
|
||||
|
||||
Faction yourFaction = you.getFaction();
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
// players with admin-level "disband" permission can bypass these requirements
|
||||
if (!P.hasPermDisband(sender)) {
|
||||
if (yourFaction != myFaction) {
|
||||
sendMessage(you.getNameAndRelevant(me)+Conf.colorSystem+" is not a member of "+myFaction.getTag(me));
|
||||
if ( ! Permission.COMMAND_KICK_ANY.has(sender))
|
||||
{
|
||||
if (yourFaction != myFaction)
|
||||
{
|
||||
sendMessageParsed("%s<b> is not a member of %s", you.getNameAndRelevant(fme), myFaction.getTag(fme));
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getRole().value >= me.getRole().value) { // TODO add more informative messages.
|
||||
sendMessage("Your rank is too low to kick this player.");
|
||||
if (you.getRole().value >= fme.getRole().value)
|
||||
{
|
||||
// TODO add more informative messages.
|
||||
sendMessageParsed("<b>Your rank is too low to kick this player.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.CanLeaveWithNegativePower && you.getPower() < 0) {
|
||||
sendMessage("You cannot kick that member until their power is positive.");
|
||||
if ( ! Conf.CanLeaveWithNegativePower && you.getPower() < 0)
|
||||
{
|
||||
sendMessageParsed("<b>You cannot kick that member until their power is positive.");
|
||||
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.econCostKick)) {
|
||||
if ( ! payForCommand(Conf.econCostKick))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
yourFaction.sendMessage(me.getNameAndRelevant(yourFaction)+Conf.colorSystem+" kicked "+you.getNameAndRelevant(yourFaction)+Conf.colorSystem+" from the faction! :O");
|
||||
you.sendMessage(me.getNameAndRelevant(you)+Conf.colorSystem+" kicked you from "+yourFaction.getTag(you)+Conf.colorSystem+"! :O");
|
||||
if (yourFaction != myFaction) {
|
||||
me.sendMessage(Conf.colorSystem+"You kicked "+you.getNameAndRelevant(myFaction)+Conf.colorSystem+" from the faction "+yourFaction.getTag(me)+Conf.colorSystem+"!");
|
||||
yourFaction.sendMessageParsed("%s<i> kicked %s<i> from the faction! :O", fme.getNameAndRelevant(yourFaction), you.getNameAndRelevant(yourFaction));
|
||||
you.sendMessageParsed("%s<i> kicked you from %s<i>! :O", fme.getNameAndRelevant(you), yourFaction.getTag(you));
|
||||
if (yourFaction != myFaction)
|
||||
{
|
||||
fme.sendMessageParsed("<i>You kicked %s<i> from the faction %s<i>!", you.getNameAndRelevant(myFaction), yourFaction.getTag(fme));
|
||||
}
|
||||
|
||||
yourFaction.deinvite(you);
|
||||
you.resetFactionData();
|
||||
|
||||
if (yourFaction.getFPlayers().isEmpty() && !yourFaction.isPermanent()) {
|
||||
if (yourFaction.getFPlayers().isEmpty() && !yourFaction.isPermanent())
|
||||
{
|
||||
// Remove this faction
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
fplayer.sendMessage("The faction "+yourFaction.getTag(fplayer)+Conf.colorSystem+" was disbanded.");
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
fplayer.sendMessageParsed("The faction %s<i> was disbanded.", yourFaction.getTag(fplayer));
|
||||
}
|
||||
Faction.delete(yourFaction.getId());
|
||||
yourFaction.detach();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,32 +1,35 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandLeave extends FCommand {
|
||||
|
||||
public FCommandLeave() {
|
||||
aliases.add("leave");
|
||||
public FCommandLeave()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("leave");
|
||||
|
||||
helpDescription = "Leave your faction";
|
||||
//this.requiredArgs.add("");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.COMMAND_LEAVE.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if ( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
me.leave(true);
|
||||
fme.leave(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,55 +4,45 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class FCommandList extends FCommand {
|
||||
public class FCommandList extends FCommand
|
||||
{
|
||||
|
||||
public FCommandList() {
|
||||
aliases.add("list");
|
||||
aliases.add("ls");
|
||||
public FCommandList()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("list");
|
||||
this.aliases.add("ls");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("page", "1");
|
||||
|
||||
this.permission = Permission.COMMAND_LIST.node;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
|
||||
optionalParameters.add("page");
|
||||
|
||||
helpDescription = "Show a list of the factions";
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
ArrayList<Faction> FactionList = new ArrayList<Faction>(Faction.getAll());
|
||||
FactionList.remove(Faction.getNone());
|
||||
FactionList.remove(Faction.getSafeZone());
|
||||
FactionList.remove(Faction.getWarZone());
|
||||
|
||||
public void perform()
|
||||
{
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!payForCommand(Conf.econCostList)) {
|
||||
return;
|
||||
}
|
||||
if ( ! payForCommand(Conf.econCostList)) return;
|
||||
|
||||
int page = 1;
|
||||
if (parameters.size() > 0) {
|
||||
try {
|
||||
page = Integer.parseInt(parameters.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
// wasn't an integer
|
||||
}
|
||||
}
|
||||
page -= 1;
|
||||
ArrayList<Faction> factionList = new ArrayList<Faction>(Factions.i.get());
|
||||
factionList.remove(Factions.i.getNone());
|
||||
factionList.remove(Factions.i.getSafeZone());
|
||||
factionList.remove(Factions.i.getWarZone());
|
||||
|
||||
// Sort by total followers first
|
||||
Collections.sort(FactionList, new Comparator<Faction>(){
|
||||
Collections.sort(factionList, new Comparator<Faction>(){
|
||||
@Override
|
||||
public int compare(Faction f1, Faction f2) {
|
||||
if (f1.getFPlayers().size() < f2.getFPlayers().size())
|
||||
@ -64,7 +54,7 @@ public class FCommandList extends FCommand {
|
||||
});
|
||||
|
||||
// Then sort by how many members are online now
|
||||
Collections.sort(FactionList, new Comparator<Faction>(){
|
||||
Collections.sort(factionList, new Comparator<Faction>(){
|
||||
@Override
|
||||
public int compare(Faction f1, Faction f2) {
|
||||
if (f1.getFPlayersWhereOnline(true).size() < f2.getFPlayersWhereOnline(true).size())
|
||||
@ -75,28 +65,21 @@ public class FCommandList extends FCommand {
|
||||
}
|
||||
});
|
||||
|
||||
FactionList.add(0, Faction.getNone());
|
||||
|
||||
int maxPage = (int)Math.floor((double)FactionList.size() / 9D);
|
||||
if (page < 0 || page > maxPage) {
|
||||
sendMessage("The faction list is only " + (maxPage+1) + " page(s) long");
|
||||
return;
|
||||
ArrayList<String> lines = new ArrayList<String>();
|
||||
lines.add(p.txt.parse("Factionless <i> %d online", Factions.i.getNone().getFPlayersWhereOnline(true).size()));
|
||||
for (Faction faction : factionList)
|
||||
{
|
||||
lines.add(p.txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
||||
faction.getTag(fme),
|
||||
faction.getFPlayersWhereOnline(true).size(),
|
||||
faction.getFPlayers().size(),
|
||||
faction.getLandRounded(),
|
||||
faction.getPowerRounded(),
|
||||
faction.getPowerMaxRounded())
|
||||
);
|
||||
}
|
||||
|
||||
String header = "Faction List";
|
||||
if (maxPage > 1) header += " (page " + (page+1) + " of " + (maxPage+1) + ")";
|
||||
sendMessage(TextUtil.titleize(header));
|
||||
|
||||
int maxPos = (page+1) * 9;
|
||||
if (maxPos > FactionList.size()) maxPos = FactionList.size();
|
||||
for (int pos = page * 9; pos < maxPos; pos++) {
|
||||
Faction faction = FactionList.get(pos);
|
||||
if (faction.getId() == 0) {
|
||||
sendMessage("Factionless"+Conf.colorSystem+" "+faction.getFPlayersWhereOnline(true).size() + " online");
|
||||
} else {
|
||||
sendMessage(faction.getTag(me)+Conf.colorSystem+" "+faction.getFPlayersWhereOnline(true).size()+"/"+faction.getFPlayers().size()+" online, "+faction.getLandRounded()+"/"+faction.getPowerRounded()+"/"+faction.getPowerMaxRounded());
|
||||
}
|
||||
}
|
||||
sendMessage(p.txt.getPage(lines, this.argAsInt(0, 1), "Faction List"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,36 +1,44 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class FCommandLock extends FCommand {
|
||||
|
||||
public FCommandLock() {
|
||||
aliases.add("lock");
|
||||
// TODO: This solution needs refactoring.
|
||||
/*
|
||||
factions.lock:
|
||||
description: use the /f lock [on/off] command to temporarily lock the data files from being overwritten
|
||||
default: op
|
||||
*/
|
||||
|
||||
public FCommandLock()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("lock");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "flipp");
|
||||
|
||||
this.permission = Permission.COMMAND_LOCK.node;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
|
||||
optionalParameters.add("on|off");
|
||||
|
||||
helpDescription = "lock all write stuff";
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return P.hasPermLock(sender);
|
||||
}
|
||||
public void perform()
|
||||
{
|
||||
setIsLocked(this.argAsBool(0, ! isLocked()));
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if( parameters.size() > 0 ) {
|
||||
setLock( parseBool( parameters.get(0) ));
|
||||
} else {
|
||||
if( isLocked() ) {
|
||||
sendMessage("Factions is locked");
|
||||
} else {
|
||||
sendMessage("Factions is not locked");
|
||||
if( isLocked() )
|
||||
{
|
||||
sendMessageParsed("<i>Factions is now locked");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessageParsed("<i>Factions in now unlocked");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,61 +1,66 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
|
||||
public class FCommandMap extends FCommand {
|
||||
public class FCommandMap extends FCommand
|
||||
{
|
||||
public FCommandMap()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("map");
|
||||
|
||||
public FCommandMap() {
|
||||
aliases.add("map");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("on/off", "once");
|
||||
|
||||
optionalParameters.add("on|off");
|
||||
this.permission = Permission.COMMAND_MAP.node;
|
||||
|
||||
helpDescription = "Show territory map, set optional auto update";
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (parameters.size() > 0) {
|
||||
String mapAutoUpdating = parameters.get(0);
|
||||
if (parseBool(mapAutoUpdating)) {
|
||||
public void perform()
|
||||
{
|
||||
if (this.argIsSet(0))
|
||||
{
|
||||
if (this.argAsBool(0, ! fme.isMapAutoUpdating()))
|
||||
{
|
||||
// Turn on
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!payForCommand(Conf.econCostMap)) {
|
||||
return;
|
||||
}
|
||||
if ( ! payForCommand(Conf.econCostMap)) return;
|
||||
|
||||
me.setMapAutoUpdating(true);
|
||||
sendMessage("Map auto update ENABLED.");
|
||||
fme.setMapAutoUpdating(true);
|
||||
sendMessageParsed("<i>Map auto update <green>ENABLED.");
|
||||
|
||||
// And show the map once
|
||||
showMap();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Turn off
|
||||
me.setMapAutoUpdating(false);
|
||||
sendMessage("Map auto update DISABLED.");
|
||||
fme.setMapAutoUpdating(false);
|
||||
sendMessageParsed("<i>Map auto update <red>DISABLED.");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!payForCommand(Conf.econCostMap)) {
|
||||
return;
|
||||
}
|
||||
if ( ! payForCommand(Conf.econCostMap)) return;
|
||||
|
||||
showMap();
|
||||
}
|
||||
}
|
||||
|
||||
public void showMap() {
|
||||
sendMessage(Board.getMap(me.getFaction(), new FLocation(me), me.getPlayer().getLocation().getYaw()));
|
||||
public void showMap()
|
||||
{
|
||||
sendMessage(Board.getMap(fme.getFaction(), new FLocation(fme), fme.getPlayer().getLocation().getYaw()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,62 +1,66 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandMod extends FCommand {
|
||||
public class FCommandMod extends FCommand
|
||||
{
|
||||
|
||||
public FCommandMod() {
|
||||
aliases.add("mod");
|
||||
public FCommandMod()
|
||||
{
|
||||
super();
|
||||
this.aliases.add("mod");
|
||||
|
||||
requiredParameters.add("player name");
|
||||
this.requiredArgs.add("player name");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
helpDescription = "Give or revoke moderator rights";
|
||||
this.permission = Permission.COMMAND_MOD.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
public void perform()
|
||||
{
|
||||
if( isLocked() )
|
||||
{
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.ADMIN)) {
|
||||
FPlayer you = this.argAsBestFPlayerMatch(0);
|
||||
if (you == null) return;
|
||||
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
if (you.getFaction() != myFaction)
|
||||
{
|
||||
sendMessageParsed("%s<b> is not a member in your faction.", you.getNameAndRelevant(fme));
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = parameters.get(0);
|
||||
|
||||
FPlayer you = findFPlayer(playerName, false);
|
||||
if (you == null) {
|
||||
if (you == fme)
|
||||
{
|
||||
sendMessageParsed("<b>The target player musn't be yourself.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (you.getFaction() != myFaction) {
|
||||
sendMessage(you.getNameAndRelevant(me)+Conf.colorSystem+" is not a member in your faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == me) {
|
||||
sendMessage("The target player musn't be yourself.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getRole() == Role.MODERATOR) {
|
||||
if (you.getRole() == Role.MODERATOR)
|
||||
{
|
||||
// Revoke
|
||||
you.setRole(Role.NORMAL);
|
||||
myFaction.sendMessage(you.getNameAndRelevant(myFaction)+Conf.colorSystem+" is no longer moderator in your faction.");
|
||||
} else {
|
||||
myFaction.sendMessageParsed("%s<i> is no longer moderator in your faction.", you.getNameAndRelevant(myFaction));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Give
|
||||
you.setRole(Role.MODERATOR);
|
||||
myFaction.sendMessage(you.getNameAndRelevant(myFaction)+Conf.colorSystem+" was promoted to moderator in your faction.");
|
||||
myFaction.sendMessageParsed("%s<i> was promoted to moderator in your faction.", you.getNameAndRelevant(myFaction));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,10 @@ public class FCommandNoBoom extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
if (!myFaction.isPeaceful()) {
|
||||
me.sendMessage("This command is only usable by factions which are specially designated as peaceful.");
|
||||
fme.sendMessage("This command is only usable by factions which are specially designated as peaceful.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class FCommandNoBoom extends FCommand {
|
||||
String enabled = myFaction.noExplosionsInTerritory() ? "disabled" : "enabled";
|
||||
|
||||
// Inform
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" has "+enabled+" explosions in your faction's territory.");
|
||||
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" has "+enabled+" explosions in your faction's territory.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,24 +24,26 @@ public class FCommandOpen extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
if ( ! assertMinRole(Role.MODERATOR))
|
||||
{
|
||||
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)) {
|
||||
if (!payForCommand(Conf.econCostOpen))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
myFaction.setOpen( ! me.getFaction().getOpen());
|
||||
Faction myFaction = fme.getFaction();
|
||||
myFaction.setOpen( ! fme.getFaction().getOpen());
|
||||
|
||||
String open = myFaction.getOpen() ? "open" : "closed";
|
||||
|
||||
// Inform
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed the faction to "+open);
|
||||
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed the faction to "+open);
|
||||
for (Faction faction : Faction.getAll()) {
|
||||
if (faction == me.getFaction()) {
|
||||
if (faction == fme.getFaction()) {
|
||||
continue;
|
||||
}
|
||||
faction.sendMessage(Conf.colorSystem+"The faction "+myFaction.getTag(faction)+Conf.colorSystem+" is now "+open);
|
||||
|
@ -21,7 +21,7 @@ public class FCommandOwner extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
boolean hasBypass = P.hasPermAdminBypass(me);
|
||||
boolean hasBypass = P.hasPermAdminBypass(fme);
|
||||
|
||||
if ( ! hasBypass && ! assertHasFaction()) {
|
||||
return;
|
||||
@ -33,14 +33,14 @@ public class FCommandOwner extends FCommand {
|
||||
}
|
||||
|
||||
if ( ! Conf.ownedAreasEnabled) {
|
||||
me.sendMessage("Sorry, but owned areas are disabled on this server.");
|
||||
fme.sendMessage("Sorry, but owned areas are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) {
|
||||
me.sendMessage("Sorry, but you have reached the server's limit of "+Conf.ownedAreasLimitPerFaction+" owned areas per faction.");
|
||||
fme.sendMessage("Sorry, but you have reached the server's limit of "+Conf.ownedAreasLimitPerFaction+" owned areas per faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -48,17 +48,17 @@ public class FCommandOwner extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
FLocation flocation = new FLocation(me);
|
||||
FLocation flocation = new FLocation(fme);
|
||||
|
||||
if (Board.getIdAt(flocation) != myFaction.getId()) {
|
||||
if (!hasBypass) {
|
||||
me.sendMessage("This land is not claimed by your faction, so you can't set ownership of it.");
|
||||
fme.sendMessage("This land is not claimed by your faction, so you can't set ownership of it.");
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction = Board.getFactionAt(flocation);
|
||||
if (!myFaction.isNormal()) {
|
||||
me.sendMessage("This land is not claimed by a faction. Ownership is not possible.");
|
||||
fme.sendMessage("This land is not claimed by a faction. Ownership is not possible.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -68,7 +68,7 @@ public class FCommandOwner extends FCommand {
|
||||
if (parameters.size() > 0) {
|
||||
target = findFPlayer(parameters.get(0), false);
|
||||
} else {
|
||||
target = me;
|
||||
target = fme;
|
||||
}
|
||||
if (target == null) {
|
||||
return;
|
||||
@ -77,20 +77,20 @@ public class FCommandOwner extends FCommand {
|
||||
String playerName = target.getName();
|
||||
|
||||
if (target.getFaction().getId() != myFaction.getId()) {
|
||||
me.sendMessage(playerName + " is not a member of this faction.");
|
||||
fme.sendMessage(playerName + " is not a member of this faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
// if no player name was passed, and this claim does already have owners set, clear them
|
||||
if (parameters.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation)) {
|
||||
myFaction.clearClaimOwnership(flocation);
|
||||
me.sendMessage("You have cleared ownership for this claimed area.");
|
||||
fme.sendMessage("You have cleared ownership for this claimed area.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFaction.isPlayerInOwnerList(playerName, flocation)) {
|
||||
myFaction.removePlayerAsOwner(playerName, flocation);
|
||||
me.sendMessage("You have removed ownership of this claimed land from "+playerName+".");
|
||||
fme.sendMessage("You have removed ownership of this claimed land from "+playerName+".");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -100,6 +100,6 @@ public class FCommandOwner extends FCommand {
|
||||
}
|
||||
|
||||
myFaction.setPlayerAsOwner(playerName, flocation);
|
||||
me.sendMessage("You have added "+playerName+" to the owner list for this claimed land.");
|
||||
fme.sendMessage("You have added "+playerName+" to the owner list for this claimed land.");
|
||||
}
|
||||
}
|
||||
|
@ -20,29 +20,29 @@ public class FCommandOwnerList extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
boolean hasBypass = P.hasPermAdminBypass(me);
|
||||
boolean hasBypass = P.hasPermAdminBypass(fme);
|
||||
|
||||
if ( ! hasBypass && ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! Conf.ownedAreasEnabled) {
|
||||
me.sendMessage("Owned areas are disabled on this server.");
|
||||
fme.sendMessage("Owned areas are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
FLocation flocation = new FLocation(me);
|
||||
Faction myFaction = fme.getFaction();
|
||||
FLocation flocation = new FLocation(fme);
|
||||
|
||||
if (Board.getIdAt(flocation) != myFaction.getId()) {
|
||||
if (!hasBypass) {
|
||||
me.sendMessage("This land is not claimed by your faction.");
|
||||
fme.sendMessage("This land is not claimed by your faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction = Board.getFactionAt(flocation);
|
||||
if (!myFaction.isNormal()) {
|
||||
me.sendMessage("This land is not claimed by any faction, thus no owners.");
|
||||
fme.sendMessage("This land is not claimed by any faction, thus no owners.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -50,10 +50,10 @@ public class FCommandOwnerList extends FCommand {
|
||||
String owners = myFaction.getOwnerListString(flocation);
|
||||
|
||||
if (owners == null || owners.isEmpty()) {
|
||||
me.sendMessage("No owners are set here; everyone in the faction has access.");
|
||||
fme.sendMessage("No owners are set here; everyone in the faction has access.");
|
||||
return;
|
||||
}
|
||||
|
||||
me.sendMessage("Current owner(s) of this land: "+owners);
|
||||
fme.sendMessage("Current owner(s) of this land: "+owners);
|
||||
}
|
||||
}
|
||||
|
@ -2,77 +2,70 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
||||
public class FCommandPay extends FCommand
|
||||
{
|
||||
|
||||
public FCommandPay()
|
||||
{
|
||||
aliases.add("pay");
|
||||
this.aliases.add("pay");
|
||||
|
||||
helpDescription = "Pay another faction from your bank";
|
||||
requiredParameters.add("faction");
|
||||
requiredParameters.add("amount");
|
||||
this.requiredArgs.add("faction");
|
||||
this.requiredArgs.add("amount");
|
||||
//this.optionalArgs.put("factiontag", "yours");
|
||||
|
||||
this.permission = Permission.COMMAND_PAY.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
if ( ! Conf.bankEnabled) return;
|
||||
|
||||
if ( ! Conf.bankMembersCanWithdraw && ! assertMinRole(Role.MODERATOR))
|
||||
{
|
||||
sendMessageParsed("<b>Only faction moderators or admins are able to pay another faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.bankEnabled) {
|
||||
return;
|
||||
}
|
||||
Faction us = fme.getFaction();
|
||||
Faction them = this.argAsFaction(0);
|
||||
if ( them == null ) return;
|
||||
double amount = this.argAsDouble(1, 0d);
|
||||
|
||||
if ( !Conf.bankMembersCanWithdraw && !assertMinRole(Role.MODERATOR)) {
|
||||
sendMessage("Only faction moderators or admins are able to pay another faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
double amount = 0.0;
|
||||
|
||||
Faction us = me.getFaction();
|
||||
Faction them = null;
|
||||
|
||||
if (parameters.size() == 2) {
|
||||
try {
|
||||
them = Faction.findByTag(parameters.get(0));
|
||||
amount = Double.parseDouble(parameters.get(1));
|
||||
} catch (NumberFormatException e) {
|
||||
// wasn't valid
|
||||
}
|
||||
}
|
||||
|
||||
if(them == null) {
|
||||
sendMessage("Faction "+parameters.get(0)+" could not be found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if( amount > 0.0 ) {
|
||||
if( amount > 0.0 )
|
||||
{
|
||||
String amountString = Econ.moneyString(amount);
|
||||
|
||||
if( amount > us.getMoney() ) {
|
||||
if( amount > us.getMoney() )
|
||||
{
|
||||
amount = us.getMoney();
|
||||
}
|
||||
|
||||
us.removeMoney(amount);
|
||||
them.addMoney(amount);
|
||||
sendMessage("You have paid "+amountString+" from "+us.getTag()+"'s bank to "+them.getTag()+"'s bank.");
|
||||
sendMessage(us.getTag()+" now has "+Econ.moneyString(us.getMoney()));
|
||||
P.log(me.getName() + " paid "+amountString+" from "+us.getTag()+"'s bank to "+them.getTag()+"'s bank.");
|
||||
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.getFaction() == us || fplayer.getFaction() == them) {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has sent "+amountString+" from "+us.getTag()+" to "+them.getTag() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sendMessageParsed("<i>You have paid "+amountString+" from "+us.getTag()+"'s bank to "+them.getTag()+"'s bank.");
|
||||
sendMessageParsed("<i>"+us.getTag()+" now has "+Econ.moneyString(us.getMoney()));
|
||||
P.p.log(fme.getName() + " paid "+amountString+" from "+us.getTag()+"'s bank to "+them.getTag()+"'s bank.");
|
||||
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
if (fplayer.getFaction() == us || fplayer.getFaction() == them)
|
||||
{
|
||||
fplayer.sendMessageParsed(fme.getNameAndRelevant(fplayer)+"<i> has sent "+amountString+" from "+us.getTag()+" to "+them.getTag());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ public class FCommandPeaceful extends FCommand {
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" your faction.");
|
||||
fplayer.sendMessage(fme.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" your faction.");
|
||||
} else {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
||||
fplayer.sendMessage(fme.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,9 @@ public class FCommandPermanent extends FCommand {
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" your faction.");
|
||||
fplayer.sendMessage(fme.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" your faction.");
|
||||
} else {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
||||
fplayer.sendMessage(fme.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ public class FCommandPower extends FCommand {
|
||||
public void perform() {
|
||||
FPlayer target;
|
||||
if (parameters.size() > 0) {
|
||||
if (!P.hasPermViewAnyPower(me)) {
|
||||
me.sendMessage("You do not have the appropriate permission to view another player's power level.");
|
||||
if (!P.hasPermViewAnyPower(fme)) {
|
||||
fme.sendMessage("You do not have the appropriate permission to view another player's power level.");
|
||||
return;
|
||||
}
|
||||
target = findFPlayer(parameters.get(0), false);
|
||||
@ -39,7 +39,7 @@ public class FCommandPower extends FCommand {
|
||||
sendMessage("From the console, you must specify a player (f power <player name>).");
|
||||
return;
|
||||
} else {
|
||||
target = me;
|
||||
target = fme;
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
@ -51,7 +51,7 @@ public class FCommandPower extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
sendMessage(target.getNameAndRelevant(me)+Conf.colorChrome+" - Power / Maxpower: "+Conf.colorSystem+target.getPowerRounded()+" / "+target.getPowerMaxRounded());
|
||||
sendMessage(target.getNameAndRelevant(fme)+Conf.colorChrome+" - Power / Maxpower: "+Conf.colorSystem+target.getPowerRounded()+" / "+target.getPowerMaxRounded());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class FCommandSafeclaim extends FCommand {
|
||||
}
|
||||
|
||||
// The current location of the player
|
||||
FLocation playerFlocation = new FLocation(me);
|
||||
FLocation playerFlocation = new FLocation(fme);
|
||||
|
||||
// Was a radius set?
|
||||
if (parameters.size() > 0) {
|
||||
|
@ -31,28 +31,28 @@ public class FCommandSethome extends FCommand {
|
||||
}
|
||||
|
||||
if ( ! Conf.homesEnabled) {
|
||||
me.sendMessage("Sorry, Faction homes are disabled on this server.");
|
||||
fme.sendMessage("Sorry, Faction homes are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
if (parameters.size() > 0) {
|
||||
if (!P.hasPermAdminBypass(me)) {
|
||||
me.sendMessage("You cannot set the home of another faction without adminBypass permission.");
|
||||
if (!P.hasPermAdminBypass(fme)) {
|
||||
fme.sendMessage("You cannot set the home of another faction without adminBypass permission.");
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction = findFaction(parameters.get(0), true);
|
||||
|
||||
if (myFaction == null) {
|
||||
me.sendMessage("No such faction seems to exist.");
|
||||
fme.sendMessage("No such faction seems to exist.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Conf.homesMustBeInClaimedTerritory && !me.isInOwnTerritory() && !P.hasPermAdminBypass(me)) {
|
||||
me.sendMessage("Sorry, your faction home can only be set inside your own claimed territory.");
|
||||
if (Conf.homesMustBeInClaimedTerritory && !fme.isInOwnTerritory() && !P.hasPermAdminBypass(fme)) {
|
||||
fme.sendMessage("Sorry, your faction home can only be set inside your own claimed territory.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -61,12 +61,12 @@ public class FCommandSethome extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.setHome(me.getLocation());
|
||||
myFaction.setHome(fme.getLocation());
|
||||
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" set the home for your faction. You can now use:");
|
||||
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" set the home for your faction. You can now use:");
|
||||
myFaction.sendMessage(new FCommandHome().getUseageTemplate());
|
||||
if (myFaction != me.getFaction()) {
|
||||
me.sendMessage("You have set the home for the "+myFaction.getTag(me)+Conf.colorSystem+" faction.");
|
||||
if (myFaction != fme.getFaction()) {
|
||||
fme.sendMessage("You have set the home for the "+myFaction.getTag(fme)+Conf.colorSystem+" faction.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class FCommandShow extends FCommand {
|
||||
sendMessage("From the command line, you must specify a faction tag (f who <faction tag>).");
|
||||
return;
|
||||
} else {
|
||||
faction = me.getFaction();
|
||||
faction = fme.getFaction();
|
||||
}
|
||||
|
||||
if (faction == null) {
|
||||
@ -56,7 +56,7 @@ public class FCommandShow extends FCommand {
|
||||
Collection<FPlayer> mods = faction.getFPlayersWhereRole(Role.MODERATOR);
|
||||
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Role.NORMAL);
|
||||
|
||||
sendMessage(TextUtil.titleize(faction.getTag(me)));
|
||||
sendMessage(TextUtil.titleize(faction.getTag(fme)));
|
||||
sendMessage(Conf.colorChrome+"Description: "+Conf.colorSystem+faction.getDescription());
|
||||
if ( ! faction.isNormal()) {
|
||||
return;
|
||||
@ -99,7 +99,7 @@ public class FCommandShow extends FCommand {
|
||||
if (otherFaction == faction) {
|
||||
continue;
|
||||
}
|
||||
listpart = otherFaction.getTag(me)+Conf.colorSystem+", ";
|
||||
listpart = otherFaction.getTag(fme)+Conf.colorSystem+", ";
|
||||
if (otherFaction.getRelation(faction).isAlly()) {
|
||||
allyList += listpart;
|
||||
} else if (otherFaction.getRelation(faction).isEnemy()) {
|
||||
@ -120,7 +120,7 @@ public class FCommandShow extends FCommand {
|
||||
String onlineList = Conf.colorChrome+"Members online: ";
|
||||
String offlineList = Conf.colorChrome+"Members offline: ";
|
||||
for (FPlayer follower : admins) {
|
||||
listpart = follower.getNameAndTitle(me)+Conf.colorSystem+", ";
|
||||
listpart = follower.getNameAndTitle(fme)+Conf.colorSystem+", ";
|
||||
if (follower.isOnline()) {
|
||||
onlineList += listpart;
|
||||
} else {
|
||||
@ -128,7 +128,7 @@ public class FCommandShow extends FCommand {
|
||||
}
|
||||
}
|
||||
for (FPlayer follower : mods) {
|
||||
listpart = follower.getNameAndTitle(me)+Conf.colorSystem+", ";
|
||||
listpart = follower.getNameAndTitle(fme)+Conf.colorSystem+", ";
|
||||
if (follower.isOnline()) {
|
||||
onlineList += listpart;
|
||||
} else {
|
||||
@ -136,7 +136,7 @@ public class FCommandShow extends FCommand {
|
||||
}
|
||||
}
|
||||
for (FPlayer follower : normals) {
|
||||
listpart = follower.getNameAndTitle(me)+Conf.colorSystem+", ";
|
||||
listpart = follower.getNameAndTitle(fme)+Conf.colorSystem+", ";
|
||||
if (follower.isOnline()) {
|
||||
onlineList += listpart;
|
||||
} else {
|
||||
|
@ -37,7 +37,7 @@ public class FCommandTag extends FCommand {
|
||||
String tag = parameters.get(0);
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
if (Faction.isTagTaken(tag) && ! TextUtil.getComparisonString(tag).equals(me.getFaction().getComparisonTag())) {
|
||||
if (Faction.isTagTaken(tag) && ! TextUtil.getComparisonString(tag).equals(fme.getFaction().getComparisonTag())) {
|
||||
sendMessage("That tag is already taken");
|
||||
return;
|
||||
}
|
||||
@ -54,18 +54,18 @@ public class FCommandTag extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
String oldtag = myFaction.getTag();
|
||||
myFaction.setTag(tag);
|
||||
|
||||
// Inform
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed your faction tag to "+Conf.colorMember+myFaction.getTag());
|
||||
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed your faction tag to "+Conf.colorMember+myFaction.getTag());
|
||||
for (Faction faction : Faction.getAll()) {
|
||||
if (faction == me.getFaction()) {
|
||||
if (faction == fme.getFaction()) {
|
||||
continue;
|
||||
}
|
||||
faction.sendMessage(Conf.colorSystem+"The faction "+me.getRelationColor(faction)+oldtag+Conf.colorSystem+" changed their name to "+myFaction.getTag(faction));
|
||||
faction.sendMessage(Conf.colorSystem+"The faction "+fme.getRelationColor(faction)+oldtag+Conf.colorSystem+" changed their name to "+myFaction.getTag(faction));
|
||||
}
|
||||
|
||||
if (Conf.spoutFactionTagsOverNames) {
|
||||
|
@ -38,7 +38,7 @@ public class FCommandTitle extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! canIAdministerYou(me, you)) {
|
||||
if ( ! canIAdministerYou(fme, you)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -50,11 +50,11 @@ public class FCommandTitle extends FCommand {
|
||||
you.setTitle(title);
|
||||
|
||||
// Inform
|
||||
Faction myFaction = me.getFaction();
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed a title: "+you.getNameAndRelevant(myFaction));
|
||||
Faction myFaction = fme.getFaction();
|
||||
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed a title: "+you.getNameAndRelevant(myFaction));
|
||||
|
||||
if (Conf.spoutFactionTitlesOverNames) {
|
||||
SpoutFeatures.updateAppearances(me);
|
||||
SpoutFeatures.updateAppearances(fme);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class FCommandUnclaim extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
FLocation flocation = new FLocation(me);
|
||||
FLocation flocation = new FLocation(fme);
|
||||
Faction otherFaction = Board.getFactionAt(flocation);
|
||||
|
||||
if (otherFaction.isSafeZone()) {
|
||||
@ -47,10 +47,10 @@ public class FCommandUnclaim extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Conf.adminBypassPlayers.contains(me.getName())) {
|
||||
if (Conf.adminBypassPlayers.contains(fme.getName())) {
|
||||
Board.removeAt(flocation);
|
||||
|
||||
otherFaction.sendMessage(me.getNameAndRelevant(otherFaction)+Conf.colorSystem+" unclaimed some of your land.");
|
||||
otherFaction.sendMessage(fme.getNameAndRelevant(otherFaction)+Conf.colorSystem+" unclaimed some of your land.");
|
||||
sendMessage("You unclaimed this land.");
|
||||
return;
|
||||
}
|
||||
@ -63,7 +63,7 @@ public class FCommandUnclaim extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
|
||||
if ( myFaction != otherFaction) {
|
||||
@ -77,25 +77,25 @@ public class FCommandUnclaim extends FCommand {
|
||||
// a real refund
|
||||
if (refund > 0.0) {
|
||||
if(Conf.bankFactionPaysLandCosts) {
|
||||
Faction faction = me.getFaction();
|
||||
Faction faction = fme.getFaction();
|
||||
faction.addMoney(refund);
|
||||
moneyBack = " "+faction.getTag()+" received a refund of "+Econ.moneyString(refund)+".";
|
||||
} else {
|
||||
Econ.addMoney(me.getName(), refund);
|
||||
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 = me.getFaction();
|
||||
Faction faction = fme.getFaction();
|
||||
if(!faction.removeMoney(-refund)) {
|
||||
sendMessage("Unclaiming this 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(me.getName(), -refund)) {
|
||||
if (!Econ.deductMoney(fme.getName(), -refund)) {
|
||||
sendMessage("Unclaiming this land will cost "+Econ.moneyString(-refund)+", which you can't currently afford.");
|
||||
return;
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class FCommandUnclaim extends FCommand {
|
||||
}
|
||||
|
||||
Board.removeAt(flocation);
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed some land."+moneyBack);
|
||||
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed some land."+moneyBack);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class FCommandUnclaimall extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction myFaction = fme.getFaction();
|
||||
|
||||
String moneyBack = "";
|
||||
if (Econ.enabled()) {
|
||||
@ -38,25 +38,25 @@ public class FCommandUnclaimall extends FCommand {
|
||||
// a real refund
|
||||
if (refund > 0.0) {
|
||||
if(Conf.bankFactionPaysLandCosts) {
|
||||
Faction faction = me.getFaction();
|
||||
Faction faction = fme.getFaction();
|
||||
faction.addMoney(refund);
|
||||
moneyBack = " "+faction.getTag()+" received a refund of "+Econ.moneyString(refund)+".";
|
||||
} else {
|
||||
Econ.addMoney(me.getName(), refund);
|
||||
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 = me.getFaction();
|
||||
Faction faction = fme.getFaction();
|
||||
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(me.getName(), -refund)) {
|
||||
if (!Econ.deductMoney(fme.getName(), -refund)) {
|
||||
sendMessage("Unclaiming all faction land will cost "+Econ.moneyString(-refund)+", which you can't currently afford.");
|
||||
return;
|
||||
}
|
||||
@ -71,7 +71,7 @@ public class FCommandUnclaimall extends FCommand {
|
||||
}
|
||||
|
||||
Board.unclaimAll(myFaction.getId());
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed ALL of your faction's land."+moneyBack);
|
||||
myFaction.sendMessage(fme.getNameAndRelevant(myFaction)+Conf.colorSystem+" unclaimed ALL of your faction's land."+moneyBack);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class FCommandWarclaim extends FCommand {
|
||||
}
|
||||
|
||||
// The current location of the player
|
||||
FLocation playerFlocation = new FLocation(me);
|
||||
FLocation playerFlocation = new FLocation(fme);
|
||||
|
||||
// Was a radius set?
|
||||
if (parameters.size() > 0) {
|
||||
|
@ -2,64 +2,70 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
||||
public class FCommandWithdraw extends FCommand {
|
||||
public class FCommandWithdraw extends FCommand
|
||||
{
|
||||
|
||||
public FCommandWithdraw() {
|
||||
aliases.add("withdraw");
|
||||
public FCommandWithdraw()
|
||||
{
|
||||
this.aliases.add("withdraw");
|
||||
|
||||
helpDescription = "Withdraw money from your faction's bank";
|
||||
requiredParameters.add("amount");
|
||||
this.requiredArgs.add("amount");
|
||||
//this.optionalArgs.put("factiontag", "yours");
|
||||
|
||||
this.permission = Permission.COMMAND_WITHDRAW.node;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
public void perform()
|
||||
{
|
||||
if ( ! Conf.bankEnabled) return;
|
||||
|
||||
if ( ! Conf.bankMembersCanWithdraw && ! assertMinRole(Role.MODERATOR))
|
||||
{
|
||||
sendMessageParsed("<b>Only faction moderators or admins are able to withdraw from the bank.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.bankEnabled) {
|
||||
return;
|
||||
}
|
||||
Faction faction = fme.getFaction();
|
||||
|
||||
if ( !Conf.bankMembersCanWithdraw && !assertMinRole(Role.MODERATOR)) {
|
||||
sendMessage("Only faction moderators or admins are able to withdraw from the bank.");
|
||||
return;
|
||||
}
|
||||
double amount = this.argAsDouble(0, 0d);
|
||||
|
||||
double amount = 0.0;
|
||||
|
||||
Faction faction = me.getFaction();
|
||||
|
||||
if (parameters.size() == 1) {
|
||||
try {
|
||||
amount = Double.parseDouble(parameters.get(0));
|
||||
} catch (NumberFormatException e) {
|
||||
// wasn't valid
|
||||
}
|
||||
}
|
||||
|
||||
if( amount > 0.0 ) {
|
||||
if( amount > 0.0 )
|
||||
{
|
||||
String amountString = Econ.moneyString(amount);
|
||||
|
||||
if( amount > faction.getMoney() ) {
|
||||
if( amount > faction.getMoney() )
|
||||
{
|
||||
amount = faction.getMoney();
|
||||
}
|
||||
|
||||
faction.removeMoney(amount);
|
||||
Econ.addMoney(me.getName(), amount);
|
||||
sendMessage("You have withdrawn "+amountString+" from "+faction.getTag()+"'s bank.");
|
||||
sendMessage(faction.getTag()+" now has "+Econ.moneyString(faction.getMoney()));
|
||||
P.log(me.getName() + " withdrew "+amountString+" from "+faction.getTag()+"'s bank.");
|
||||
// TODO: Improve messages.
|
||||
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has withdrawn "+amountString);
|
||||
faction.removeMoney(amount);
|
||||
Econ.addMoney(fme.getName(), amount);
|
||||
sendMessageParsed("<i>You have withdrawn "+amountString+" from "+faction.getTag()+"'s bank.");
|
||||
sendMessageParsed("<i>"+faction.getTag()+" now has "+Econ.moneyString(faction.getMoney()));
|
||||
P.p.log(fme.getName() + " withdrew "+amountString+" from "+faction.getTag()+"'s bank.");
|
||||
|
||||
// TODO: FAction.getOnlineMembers().
|
||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||
{
|
||||
if (fplayer.getFaction() == faction)
|
||||
{
|
||||
fplayer.sendMessageParsed("%s<i> has withdrawn %s", fme.getNameAndRelevant(fplayer), amountString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class FRelationCommand extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
Faction myFaction = fme.getFaction();
|
||||
Faction otherFaction = findFaction(otherFactionName, false);
|
||||
if (otherFaction == null) {
|
||||
return;
|
||||
|
@ -236,7 +236,7 @@ public class FactionsPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
|
||||
if (me.autoClaimEnabled())
|
||||
if (me.isAutoClaimEnabled())
|
||||
{
|
||||
Faction myFaction = me.getFaction();
|
||||
// TODO: Why is this ("cost") here and unused??? Should it be used somewhere Brettflan? :)
|
||||
@ -247,26 +247,26 @@ public class FactionsPlayerListener extends PlayerListener
|
||||
if (me.getRole().value < Role.MODERATOR.value)
|
||||
{
|
||||
me.sendMessage("You must be "+Role.MODERATOR+" to claim land.");
|
||||
me.enableAutoClaim(false);
|
||||
me.setIsAutoClaimEnabled(false);
|
||||
}
|
||||
else if (Conf.worldsNoClaiming.contains(to.getWorldName()))
|
||||
{
|
||||
me.sendMessage("Sorry, this world has land claiming disabled.");
|
||||
me.enableAutoClaim(false);
|
||||
me.setIsAutoClaimEnabled(false);
|
||||
}
|
||||
else if (myFaction.getLandRounded() >= myFaction.getPowerRounded())
|
||||
{
|
||||
me.sendMessage("You can't claim more land! You need more power!");
|
||||
me.enableAutoClaim(false);
|
||||
me.setIsAutoClaimEnabled(false);
|
||||
}
|
||||
else
|
||||
me.attemptClaim(false);
|
||||
}
|
||||
else if (me.autoSafeZoneEnabled())
|
||||
else if (me.isAutoSafeClaimEnabled())
|
||||
{
|
||||
if ( ! Permission.MANAGE_SAFE_ZONE.has(player))
|
||||
{
|
||||
me.enableAutoSafeZone(false);
|
||||
me.setIsAutoSafeClaimEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -279,11 +279,11 @@ public class FactionsPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (me.autoWarZoneEnabled())
|
||||
else if (me.isAutoWarClaimEnabled())
|
||||
{
|
||||
if ( ! Permission.MANAGE_WAR_ZONE.has(player))
|
||||
{
|
||||
me.enableAutoWarZone(false);
|
||||
me.setIsAutoWarClaimEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.factions.struct;
|
||||
|
||||
public enum ChatMode {
|
||||
public enum ChatMode
|
||||
{
|
||||
FACTION(2, "faction chat"),
|
||||
ALLIANCE(1, "alliance chat"),
|
||||
PUBLIC(0, "public chat");
|
||||
@ -8,21 +9,32 @@ public enum ChatMode {
|
||||
public final int value;
|
||||
public final String nicename;
|
||||
|
||||
private ChatMode(final int value, final String nicename) {
|
||||
private ChatMode(final int value, final String nicename)
|
||||
{
|
||||
this.value = value;
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(ChatMode role) {
|
||||
public boolean isAtLeast(ChatMode role)
|
||||
{
|
||||
return this.value >= role.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(ChatMode role) {
|
||||
public boolean isAtMost(ChatMode role)
|
||||
{
|
||||
return this.value <= role.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public String toString()
|
||||
{
|
||||
return this.nicename;
|
||||
}
|
||||
|
||||
public ChatMode getNext()
|
||||
{
|
||||
if (this == PUBLIC) return ALLIANCE;
|
||||
if (this == ALLIANCE)return FACTION;
|
||||
return PUBLIC;
|
||||
}
|
||||
}
|
||||
|
@ -6,27 +6,53 @@ import com.massivecraft.factions.P;
|
||||
|
||||
public enum Permission
|
||||
{
|
||||
PARTICIPATE("factions.participate"),
|
||||
CREATE("factions.create"),
|
||||
VIEW_ANY_POWER("factions.viewAnyPower"),
|
||||
PEACEFUL_EXPLOTION_TOGGLE("factions.peacefulExplosionToggle"),
|
||||
ADMIN_BYPASS("factions.adminBypass"),
|
||||
CONFIG("factions.config"),
|
||||
DISBAN("factions.disband"),
|
||||
LOCK("factions.lock"),
|
||||
MANAGE_SAFE_ZONE("factions.manageSafeZone"),
|
||||
MANAGE_WAR_ZONE("factions.manageWarZone"),
|
||||
OWNERSHIP_BYPASS("factions.ownershipBypass"),
|
||||
RELOAD("factions.reload"),
|
||||
SAVE_ALL("factions.saveall"),
|
||||
SET_PEACEFUL("factions.setPeaceful"),
|
||||
PARTICIPATE("participate"),
|
||||
CREATE("create"),
|
||||
VIEW_ANY_POWER("viewAnyPower"),
|
||||
VIEW_ANY_FACTION_BALANCE("viewAnyFactionBalance"),
|
||||
PEACEFUL_EXPLOTION_TOGGLE("peacefulExplosionToggle"),
|
||||
ADMIN_BYPASS("adminBypass"),
|
||||
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_AUTOCLAIM("command.autoClaim"),
|
||||
COMMAND_BALANCE("command.balance"),
|
||||
COMMAND_WITHDRAW("command.withdraw"),
|
||||
COMMAND_PAY("command.pay"),
|
||||
COMMAND_CHAT("command.chat"),
|
||||
COMMAND_CLAIM("command.claim"),
|
||||
COMMAND_CONFIG("command.config"),
|
||||
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"),
|
||||
;
|
||||
|
||||
public final String node;
|
||||
|
||||
Permission(final String node)
|
||||
{
|
||||
this.node = node;
|
||||
this.node = "factions."+node;
|
||||
}
|
||||
|
||||
public boolean has(CommandSender sender, boolean informSenderIfNot)
|
||||
|
@ -27,8 +27,25 @@ public abstract class MCommand<T extends MPlugin>
|
||||
public List<String> requiredArgs;
|
||||
public LinkedHashMap<String, String> optionalArgs;
|
||||
|
||||
// Help info
|
||||
public String helpShort;
|
||||
// FIELD: Help Short
|
||||
// This field may be left blank and will in such case be loaded from the permissions node instead.
|
||||
// Thus make sure the permissions node description is an action description like "eat hamburgers" or "do admin stuff".
|
||||
private String helpShort;
|
||||
public void setHelpShort(String val) { this.helpShort = val; }
|
||||
public String getHelpShort()
|
||||
{
|
||||
if (this.helpShort == null)
|
||||
{
|
||||
String pdesc = p.perm.getPermissionDescription(this.permission);
|
||||
if (pdesc != null)
|
||||
{
|
||||
return pdesc;
|
||||
}
|
||||
return "*no short help available*";
|
||||
}
|
||||
return this.helpShort;
|
||||
}
|
||||
|
||||
public List<String> helpLong;
|
||||
public CommandVisibility visibility;
|
||||
|
||||
@ -39,6 +56,7 @@ public abstract class MCommand<T extends MPlugin>
|
||||
// Information available on execution of the command
|
||||
public CommandSender sender; // Will always be set
|
||||
public Player me; // Will only be set when the sender is a player
|
||||
public boolean senderIsConsole;
|
||||
public List<String> args; // Will contain the arguments, or and empty list if there are none.
|
||||
public List<MCommand<?>> commandChain; // The command chain used to execute this command
|
||||
|
||||
@ -56,7 +74,7 @@ public abstract class MCommand<T extends MPlugin>
|
||||
this.requiredArgs = new ArrayList<String>();
|
||||
this.optionalArgs = new LinkedHashMap<String, String>();
|
||||
|
||||
this.helpShort = "*Default helpShort*";
|
||||
this.helpShort = null;
|
||||
this.helpLong = new ArrayList<String>();
|
||||
this.visibility = CommandVisibility.VISIBLE;
|
||||
}
|
||||
@ -69,10 +87,12 @@ public abstract class MCommand<T extends MPlugin>
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
this.me = (Player)sender;
|
||||
this.senderIsConsole = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.me = null;
|
||||
this.senderIsConsole = true;
|
||||
}
|
||||
this.args = args;
|
||||
this.commandChain = commandChain;
|
||||
@ -255,38 +275,38 @@ public abstract class MCommand<T extends MPlugin>
|
||||
// Message Sending Helpers
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void sendMessage(String msg, boolean parseColors)
|
||||
public void sendMessageParsed(String str, Object... args)
|
||||
{
|
||||
if (parseColors)
|
||||
{
|
||||
sender.sendMessage(p.txt.tags(msg));
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(msg);
|
||||
sender.sendMessage(p.txt.parse(str, args));
|
||||
}
|
||||
|
||||
public void sendMessage(String msg)
|
||||
{
|
||||
this.sendMessage(msg, false);
|
||||
}
|
||||
|
||||
public void sendMessage(List<String> msgs, boolean parseColors)
|
||||
{
|
||||
for(String msg : msgs)
|
||||
{
|
||||
this.sendMessage(msg, parseColors);
|
||||
}
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
|
||||
public void sendMessage(List<String> msgs)
|
||||
{
|
||||
sendMessage(msgs, false);
|
||||
for(String msg : msgs)
|
||||
{
|
||||
this.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// Argument Readers
|
||||
// -------------------------------------------- //
|
||||
|
||||
// Is set?
|
||||
public boolean argIsSet(int idx)
|
||||
{
|
||||
if (this.args.size() < idx+1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// STRING
|
||||
public String argAsString(int idx, String def)
|
||||
{
|
||||
|
@ -26,6 +26,14 @@ public class PlayerEntity extends Entity
|
||||
// Message Sending Helpers
|
||||
// -------------------------------------------- //
|
||||
|
||||
/*
|
||||
public void sendMessageParsed(String str, Object... args)
|
||||
{
|
||||
this.sendMessage(p.txt.parse(str, args));
|
||||
}
|
||||
Refference issue!!
|
||||
*/
|
||||
|
||||
public void sendMessage(String msg)
|
||||
{
|
||||
Player player = this.getPlayer();
|
||||
|
306
src/plugin.yml
306
src/plugin.yml
@ -39,254 +39,114 @@ permissions:
|
||||
factions.setPermanent: true
|
||||
factions.commandDisable.none: true
|
||||
factions.participate:
|
||||
description: Allows the player to participate in a faction
|
||||
description: participate in a faction
|
||||
default: true
|
||||
factions.create:
|
||||
description: Allows the player to create a new faction
|
||||
description: create a new faction
|
||||
default: true
|
||||
factions.viewAnyPower:
|
||||
description: Allows the player to view the power level of anyone else
|
||||
description: view the power level of anyone else
|
||||
default: true
|
||||
factions.viewAnyFactionBalance:
|
||||
description: Allows the player to view the faction bank balance for any faction
|
||||
description: view the faction bank balance for any faction
|
||||
default: true
|
||||
factions.peacefulExplosionToggle:
|
||||
description: Allows peaceful faction admins and moderators to disable explosions in their territory
|
||||
description: disable explosions in your territory as a peaceful faction admin or moderator
|
||||
default: true
|
||||
factions.adminBypass:
|
||||
description: Allows the player to bypass many normal restrictions, and use the bypass command
|
||||
description: enable admin bypass mode (build/destroy anywhere)
|
||||
default: op
|
||||
factions.config:
|
||||
description: Can use /f config command to change conf.json options
|
||||
default: op
|
||||
factions.disband:
|
||||
description: Can use the /f disband <faction> command to disband any faction
|
||||
default: op
|
||||
factions.lock:
|
||||
description: Can use the /f lock [on/off] command to temporarily lock the data files from being overwritten
|
||||
description: use /f config command to change conf.json options
|
||||
default: op
|
||||
factions.manageSafeZone:
|
||||
description: Allows the player to claim land as a safe zone, and to build/destroy within safe zones
|
||||
description: claim land as a safe zone and build/destroy within safe zones
|
||||
default: op
|
||||
factions.manageWarZone:
|
||||
description: Allows the player to claim land as a war zone, and to build/destroy within war zones
|
||||
description: claim land as a war zone and build/destroy within war zones
|
||||
default: op
|
||||
factions.ownershipBypass:
|
||||
description: Allows the player to bypass ownership restrictions within own faction's territory
|
||||
description: bypass ownership restrictions within own faction's territory
|
||||
default: op
|
||||
factions.reload:
|
||||
description: Can use the /f reload command to reload data file(s) from disk
|
||||
description: use the /f reload command to reload data file(s) from disk
|
||||
default: op
|
||||
factions.saveall:
|
||||
description: Can use the /f saveall command to save all data to disk
|
||||
description: use the /f saveall command to save all data to disk
|
||||
default: op
|
||||
factions.setPeaceful:
|
||||
description: Can designate specific factions as "peaceful" (no PvP, no land stealing, etc.)
|
||||
description: designate specific factions as "peaceful" (no PvP, no land stealing, etc.)
|
||||
default: op
|
||||
factions.setPermanent:
|
||||
description: Can designate specific factions as permanent (not disbanded even with no members)
|
||||
description: designate specific factions as permanent (not disbanded even with no members)
|
||||
default: op
|
||||
factions.commandDisable.none:
|
||||
description: no commands disabled (ignore all other commandDisable permissions)
|
||||
|
||||
factions.command.admin:
|
||||
description: hand over your admin rights
|
||||
default: true
|
||||
factions.command.autoClaim:
|
||||
description: auto-claim land as you walk around
|
||||
default: true
|
||||
factions.command.balance:
|
||||
description: show current faction balance
|
||||
default: true
|
||||
factions.command.withdraw:
|
||||
description: withdraw money from your faction bank
|
||||
default: true
|
||||
factions.command.pay:
|
||||
description: pay another faction from your bank
|
||||
default: true
|
||||
factions.command.chat:
|
||||
description: change chat mode
|
||||
default: true
|
||||
factions.command.claim:
|
||||
description: claim the land where you are standing
|
||||
default: true
|
||||
factions.command.config:
|
||||
description: change a conf.json setting
|
||||
default: op
|
||||
factions.commandDisable.admin:
|
||||
description: admin command disabled
|
||||
default: false
|
||||
factions.commandDisable.autoclaim:
|
||||
description: autoclaim command disabled
|
||||
default: false
|
||||
factions.commandDisable.autosafe:
|
||||
description: autosafe command disabled
|
||||
default: false
|
||||
factions.commandDisable.autowar:
|
||||
description: autowar command disabled
|
||||
default: false
|
||||
factions.commandDisable.balance:
|
||||
description: balance/money command disabled
|
||||
default: false
|
||||
factions.commandDisable.bypass:
|
||||
description: bypass command disabled
|
||||
default: false
|
||||
factions.commandDisable.chat:
|
||||
description: chat command disabled
|
||||
default: false
|
||||
factions.commandDisable.c:
|
||||
description: chat command disabled
|
||||
default: false
|
||||
factions.commandDisable.claim:
|
||||
description: claim command disabled
|
||||
default: false
|
||||
factions.commandDisable.create:
|
||||
description: create command disabled
|
||||
default: false
|
||||
factions.commandDisable.deinvite:
|
||||
description: deinvite command disabled
|
||||
default: false
|
||||
factions.commandDisable.deinv:
|
||||
description: deinvite command disabled
|
||||
default: false
|
||||
factions.commandDisable.deposit:
|
||||
description: deposit command disabled
|
||||
default: false
|
||||
factions.commandDisable.desc:
|
||||
description: desc command disabled
|
||||
default: false
|
||||
factions.commandDisable.disband:
|
||||
description: disband command disabled
|
||||
default: false
|
||||
factions.commandDisable.help:
|
||||
description: help command disabled
|
||||
default: false
|
||||
factions.commandDisable.h:
|
||||
description: help command disabled
|
||||
default: false
|
||||
factions.commandDisable.?:
|
||||
description: help command disabled
|
||||
default: false
|
||||
factions.commandDisable.home:
|
||||
description: home command disabled
|
||||
default: false
|
||||
factions.commandDisable.invite:
|
||||
description: invite command disabled
|
||||
default: false
|
||||
factions.commandDisable.inv:
|
||||
description: invite command disabled
|
||||
default: false
|
||||
factions.commandDisable.join:
|
||||
description: join command disabled
|
||||
default: false
|
||||
factions.commandDisable.kick:
|
||||
description: kick command disabled
|
||||
default: false
|
||||
factions.commandDisable.leave:
|
||||
description: leave command disabled
|
||||
default: false
|
||||
factions.commandDisable.list:
|
||||
description: list command disabled
|
||||
default: false
|
||||
factions.commandDisable.ls:
|
||||
description: list command disabled
|
||||
default: false
|
||||
factions.commandDisable.lock:
|
||||
description: lock command disabled
|
||||
default: false
|
||||
factions.commandDisable.map:
|
||||
description: map command disabled
|
||||
default: false
|
||||
factions.commandDisable.mod:
|
||||
description: mod command disabled
|
||||
default: false
|
||||
factions.commandDisable.money:
|
||||
description: balance/money command disabled
|
||||
default: false
|
||||
factions.commandDisable.noboom:
|
||||
description: noboom command disabled
|
||||
default: false
|
||||
factions.commandDisable.open:
|
||||
description: open command disabled
|
||||
default: false
|
||||
factions.commandDisable.close:
|
||||
description: open command disabled
|
||||
default: false
|
||||
factions.commandDisable.owner:
|
||||
description: owner command disabled
|
||||
default: false
|
||||
factions.commandDisable.ownerlist:
|
||||
description: ownerlist command disabled
|
||||
default: false
|
||||
factions.commandDisable.pay:
|
||||
description: pay command disabled
|
||||
default: false
|
||||
factions.commandDisable.peaceful:
|
||||
description: peaceful command disabled
|
||||
default: false
|
||||
factions.commandDisable.permanent:
|
||||
description: permanent command disabled
|
||||
default: false
|
||||
factions.commandDisable.power:
|
||||
description: power command disabled
|
||||
default: false
|
||||
factions.commandDisable.pow:
|
||||
description: power command disabled
|
||||
default: false
|
||||
factions.commandDisable.ally:
|
||||
description: ally command disabled
|
||||
default: false
|
||||
factions.commandDisable.enemy:
|
||||
description: enemy command disabled
|
||||
default: false
|
||||
factions.commandDisable.neutral:
|
||||
description: neutral command disabled
|
||||
default: false
|
||||
factions.commandDisable.reload:
|
||||
description: reload command disabled
|
||||
default: false
|
||||
factions.commandDisable.safeclaim:
|
||||
description: safeclaim command disabled
|
||||
default: false
|
||||
factions.commandDisable.safe:
|
||||
description: safeclaim command disabled
|
||||
default: false
|
||||
factions.commandDisable.safeunclaimall:
|
||||
description: safeunclaimall command disabled
|
||||
default: false
|
||||
factions.commandDisable.safedeclaimall:
|
||||
description: safeunclaimall command disabled
|
||||
default: false
|
||||
factions.commandDisable.saveall:
|
||||
description: saveall command disabled
|
||||
default: false
|
||||
factions.commandDisable.save:
|
||||
description: saveall command disabled
|
||||
default: false
|
||||
factions.commandDisable.sethome:
|
||||
description: sethome command disabled
|
||||
default: false
|
||||
factions.commandDisable.show:
|
||||
description: show command disabled
|
||||
default: false
|
||||
factions.commandDisable.who:
|
||||
description: show command disabled
|
||||
default: false
|
||||
factions.commandDisable.tag:
|
||||
description: tag command disabled
|
||||
default: false
|
||||
factions.commandDisable.title:
|
||||
description: title command disabled
|
||||
default: false
|
||||
factions.commandDisable.unclaim:
|
||||
description: unclaim command disabled
|
||||
default: false
|
||||
factions.commandDisable.declaim:
|
||||
description: unclaim command disabled
|
||||
default: false
|
||||
factions.commandDisable.unclaimall:
|
||||
description: unclaimall command disabled
|
||||
default: false
|
||||
factions.commandDisable.declaimall:
|
||||
description: unclaimall command disabled
|
||||
default: false
|
||||
factions.commandDisable.version:
|
||||
description: version command disabled
|
||||
default: false
|
||||
factions.commandDisable.warclaim:
|
||||
description: warclaim command disabled
|
||||
default: false
|
||||
factions.commandDisable.war:
|
||||
description: warclaim command disabled
|
||||
default: false
|
||||
factions.commandDisable.warunclaimall:
|
||||
description: warunclaimall command disabled
|
||||
default: false
|
||||
factions.commandDisable.wardeclaimall:
|
||||
description: warunclaimall command disabled
|
||||
default: false
|
||||
factions.commandDisable.withdraw:
|
||||
description: withdraw command disabled
|
||||
default: false
|
||||
factions.commandDisable.worldnoclaim:
|
||||
description: worldnoclaim command disabled
|
||||
default: false
|
||||
factions.commandDisable.worldnopowerloss:
|
||||
description: worldnopowerloss command disabled
|
||||
default: false
|
||||
factions.command.deinvite:
|
||||
description: remove a pending invitation
|
||||
default: true
|
||||
factions.command.deposit:
|
||||
description: deposit money into your faction bank
|
||||
default: true
|
||||
factions.command.description:
|
||||
description: change the faction description
|
||||
default: true
|
||||
factions.command.disband:
|
||||
description: disband a faction
|
||||
default: true
|
||||
factions.command.disband.any:
|
||||
description: disband an other faction
|
||||
default: op
|
||||
factions.command.help:
|
||||
description: display a help page
|
||||
default: true
|
||||
factions.command.home:
|
||||
description: teleport to the faction home
|
||||
default: true
|
||||
factions.command.join:
|
||||
description: join a faction
|
||||
default: true
|
||||
factions.command.kick:
|
||||
description: kick a player from the faction
|
||||
default: true
|
||||
factions.command.kick.any:
|
||||
description: kick anyone from any faction
|
||||
default: op
|
||||
factions.command.leave:
|
||||
description: leave your faction
|
||||
default: true
|
||||
factions.command.list:
|
||||
description: see a list of the factions
|
||||
default: true
|
||||
factions.command.lock:
|
||||
description: lock all write stuff
|
||||
default: op
|
||||
factions.command.map:
|
||||
description: show territory map, set optional auto update
|
||||
default: true
|
||||
factions.command.mod:
|
||||
description: give or revoke moderator rights
|
||||
default: true
|
Loading…
Reference in New Issue
Block a user