Some bugs fixed.
This commit is contained in:
		
							parent
							
								
									a5c8e2de49
								
							
						
					
					
						commit
						3cc7766fa7
					
				@ -51,6 +51,7 @@ permissions:
 | 
			
		||||
      factions.disband: true
 | 
			
		||||
      factions.help: true
 | 
			
		||||
      factions.home: true
 | 
			
		||||
      factions.invite: true
 | 
			
		||||
      factions.join: true
 | 
			
		||||
      factions.kick: true
 | 
			
		||||
      factions.leave: true
 | 
			
		||||
@ -107,6 +108,8 @@ permissions:
 | 
			
		||||
    description: display a help page
 | 
			
		||||
  factions.home:
 | 
			
		||||
    description: teleport to the faction home
 | 
			
		||||
  factions.invite:
 | 
			
		||||
    description: invite a player to your faction
 | 
			
		||||
  factions.join:
 | 
			
		||||
    description: join a faction
 | 
			
		||||
  factions.kick:
 | 
			
		||||
@ -154,7 +157,7 @@ permissions:
 | 
			
		||||
  factions.sethome:
 | 
			
		||||
    description: set the faction home
 | 
			
		||||
  factions.sethome.any:
 | 
			
		||||
    description: set any faction home
 | 
			
		||||
    description: set faction home for another faction
 | 
			
		||||
  factions.show:
 | 
			
		||||
    description: show faction information
 | 
			
		||||
  factions.tag:
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
	
 | 
			
		||||
	// FIELD: factionId
 | 
			
		||||
	private String factionId;
 | 
			
		||||
	public Faction getFaction() { return Factions.i.get(this.factionId); }
 | 
			
		||||
	public Faction getFaction() { if(this.factionId == null) {return null;} return Factions.i.get(this.factionId); }
 | 
			
		||||
	public String getFactionId() { return this.factionId; }
 | 
			
		||||
	public boolean hasFaction() { return ! factionId.equals("0"); }
 | 
			
		||||
	public void setFaction(Faction faction)
 | 
			
		||||
@ -123,7 +123,7 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
	// GSON need this noarg constructor.
 | 
			
		||||
	public FPlayer()
 | 
			
		||||
	{
 | 
			
		||||
		this.resetFactionData();
 | 
			
		||||
		this.resetFactionData(false);
 | 
			
		||||
		this.power = this.getPowerMax();
 | 
			
		||||
		this.lastPowerUpdateTime = System.currentTimeMillis();
 | 
			
		||||
		this.lastLoginTime = System.currentTimeMillis();
 | 
			
		||||
@ -140,14 +140,16 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void resetFactionData()
 | 
			
		||||
	public void resetFactionData(boolean doSpotUpdate)
 | 
			
		||||
	{
 | 
			
		||||
		// clean up any territory ownership in old faction, if there is one
 | 
			
		||||
		Faction currentFaction = this.getFaction();
 | 
			
		||||
		
 | 
			
		||||
		if (currentFaction != null && currentFaction.isNormal())
 | 
			
		||||
		if (Factions.i.exists(this.getFactionId()))
 | 
			
		||||
		{
 | 
			
		||||
			currentFaction.clearClaimOwnership(this.getId());
 | 
			
		||||
			Faction currentFaction = this.getFaction();
 | 
			
		||||
			if (currentFaction.isNormal())
 | 
			
		||||
			{
 | 
			
		||||
				currentFaction.clearClaimOwnership(this.getId());
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		this.factionId = "0"; // The default neutral faction
 | 
			
		||||
@ -156,7 +158,15 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
		this.title = "";
 | 
			
		||||
		this.autoClaimEnabled = false;
 | 
			
		||||
 | 
			
		||||
		SpoutFeatures.updateAppearances(this.getPlayer());
 | 
			
		||||
		if (doSpotUpdate)
 | 
			
		||||
		{
 | 
			
		||||
			SpoutFeatures.updateAppearances(this.getPlayer());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void resetFactionData()
 | 
			
		||||
	{
 | 
			
		||||
		this.resetFactionData(true);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
@ -548,13 +558,13 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
		
 | 
			
		||||
		if (!perm && this.getRole() == Role.ADMIN && myFaction.getFPlayers().size() > 1)
 | 
			
		||||
		{
 | 
			
		||||
			sendMessage("You must give the admin role to someone else first.");
 | 
			
		||||
			sendMessageParsed("<b>You must give the admin role to someone else first.");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!Conf.CanLeaveWithNegativePower && this.getPower() < 0)
 | 
			
		||||
		{
 | 
			
		||||
			sendMessage("You cannot leave until your power is positive.");
 | 
			
		||||
			sendMessageParsed("<b>You cannot leave until your power is positive.");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -566,23 +576,23 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
			if (cost > 0.0) {
 | 
			
		||||
				String costString = Econ.moneyString(cost);
 | 
			
		||||
				if (!Econ.deductMoney(this.getName(), cost)) {
 | 
			
		||||
					sendMessage("It costs "+costString+" to leave your faction, which you can't currently afford.");
 | 
			
		||||
					sendMessageParsed("<b>It costs <h>%s<b> to leave your faction, which you can't currently afford.", costString);
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
				sendMessage("You have paid "+costString+" to leave your faction.");
 | 
			
		||||
				sendMessageParsed("<i>You have paid <h>%s<i> to leave your faction.", costString);
 | 
			
		||||
			}
 | 
			
		||||
			// wait... we pay you to leave?
 | 
			
		||||
			else if (cost < 0.0)
 | 
			
		||||
			{
 | 
			
		||||
				String costString = Econ.moneyString(-cost);
 | 
			
		||||
				Econ.addMoney(this.getName(), -cost);
 | 
			
		||||
				sendMessage("You have been paid "+costString+" for leaving your faction.");
 | 
			
		||||
				sendMessageParsed("<i>You have been paid <h>%s<i> for leaving your faction.", costString);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (myFaction.isNormal())
 | 
			
		||||
		{
 | 
			
		||||
			myFaction.sendMessage(P.p.txt.parse(this.getNameAndRelevant(myFaction) + "<i> left your faction."));
 | 
			
		||||
			myFaction.sendMessageParsed("%s<i> left your faction.", this.getNameAndRelevant(myFaction));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		this.resetFactionData();
 | 
			
		||||
@ -592,10 +602,10 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
			// Remove this faction
 | 
			
		||||
			for (FPlayer fplayer : FPlayers.i.getOnline())
 | 
			
		||||
			{
 | 
			
		||||
				fplayer.sendMessage(P.p.txt.parse("The faction "+myFaction.getTag(fplayer)+"<i> was disbanded."));
 | 
			
		||||
				fplayer.sendMessageParsed("<i>The faction %s<i> was disbanded.", myFaction.getTag(fplayer));
 | 
			
		||||
			}
 | 
			
		||||
			//Faction.delete(myFaction.getId());
 | 
			
		||||
			this.detach();
 | 
			
		||||
			myFaction.detach();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
@ -612,59 +622,59 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
		if (Conf.worldGuardChecking && Worldguard.checkForRegionsInChunk(loc))
 | 
			
		||||
		{
 | 
			
		||||
			// Checks for WorldGuard regions in the chunk attempting to be claimed
 | 
			
		||||
			sendMessage("This land is protected");
 | 
			
		||||
			sendMessageParsed("<b>This land is protected");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (myFaction == otherFaction)
 | 
			
		||||
		{
 | 
			
		||||
			if (notifyFailure)
 | 
			
		||||
				sendMessage("You already own this land.");
 | 
			
		||||
				sendMessageParsed("<i>You already own this land.");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (this.getRole().value < Role.MODERATOR.value)
 | 
			
		||||
		{
 | 
			
		||||
			sendMessage("You must be "+Role.MODERATOR+" to claim land.");
 | 
			
		||||
			sendMessageParsed("<i>You must be "+Role.MODERATOR+" to claim land.");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (myFaction.getFPlayers().size() < Conf.claimsRequireMinFactionMembers && ! this.isAdminBypassing())
 | 
			
		||||
		{
 | 
			
		||||
			sendMessage("Your faction must have at least "+Conf.claimsRequireMinFactionMembers+" members to claim land.");
 | 
			
		||||
			sendMessageParsed("<b>Your faction must have at least <h>%s<b> members to claim land.", Conf.claimsRequireMinFactionMembers);
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (Conf.worldsNoClaiming.contains(flocation.getWorldName()))
 | 
			
		||||
		{
 | 
			
		||||
			sendMessage("Sorry, this world has land claiming disabled.");
 | 
			
		||||
			sendMessageParsed("<b>Sorry, this world has land claiming disabled.");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (otherFaction.isSafeZone())
 | 
			
		||||
		{
 | 
			
		||||
			if (notifyFailure)
 | 
			
		||||
				sendMessage("You can not claim a Safe Zone.");
 | 
			
		||||
				sendMessageParsed("<b>You can not claim a Safe Zone.");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		else if (otherFaction.isWarZone())
 | 
			
		||||
		{
 | 
			
		||||
			if (notifyFailure)
 | 
			
		||||
				sendMessage("You can not claim a War Zone.");
 | 
			
		||||
				sendMessageParsed("<b>You can not claim a War Zone.");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		int ownedLand = myFaction.getLandRounded();
 | 
			
		||||
		if (ownedLand >= myFaction.getPowerRounded())
 | 
			
		||||
		{
 | 
			
		||||
			sendMessage("You can't claim more land! You need more power!");
 | 
			
		||||
			sendMessageParsed("<b>You can't claim more land! You need more power!");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (otherFaction.getRelation(this) == Relation.ALLY)
 | 
			
		||||
		{
 | 
			
		||||
			if (notifyFailure)
 | 
			
		||||
				sendMessage("You can't claim the land of your allies.");
 | 
			
		||||
				sendMessageParsed("<b>You can't claim the land of your allies.");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -678,9 +688,9 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
		)
 | 
			
		||||
		{
 | 
			
		||||
			if (Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction)
 | 
			
		||||
				sendMessage("You can only claim additional land which is connected to your first claim or controlled by another faction!");
 | 
			
		||||
				sendMessageParsed("<b>You can only claim additional land which is connected to your first claim or controlled by another faction!");
 | 
			
		||||
			else
 | 
			
		||||
				sendMessage("You can only claim additional land which is connected to your first claim!");
 | 
			
		||||
				sendMessageParsed("<b>You can only claim additional land which is connected to your first claim!");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -688,26 +698,26 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
		{
 | 
			
		||||
			if (myFaction.isPeaceful())
 | 
			
		||||
			{
 | 
			
		||||
				sendMessage(P.p.txt.parse(this.getRelationColor(otherFaction)+otherFaction.getTag()+"<i> owns this land. Your faction is peaceful, so you cannot claim land from other factions."));
 | 
			
		||||
				sendMessageParsed("%s<i> owns this land. Your faction is peaceful, so you cannot claim land from other factions.", otherFaction.getTag(this));
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			if (otherFaction.isPeaceful())
 | 
			
		||||
			{
 | 
			
		||||
				sendMessage(P.p.txt.parse(this.getRelationColor(otherFaction)+otherFaction.getTag()+"<i> owns this land, and is a peaceful faction. You cannot claim land from them."));
 | 
			
		||||
				sendMessageParsed("%s<i> owns this land, and is a peaceful faction. You cannot claim land from them.", otherFaction.getTag(this));
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if ( ! otherFaction.hasLandInflation())
 | 
			
		||||
			{
 | 
			
		||||
				 // TODO more messages WARN current faction most importantly
 | 
			
		||||
				sendMessage(P.p.txt.parse(this.getRelationColor(otherFaction)+otherFaction.getTag()+"<i> owns this land and is strong enough to keep it."));
 | 
			
		||||
				sendMessageParsed("%s<i> owns this land and is strong enough to keep it.", otherFaction.getTag(this));
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if ( ! Board.isBorderLocation(flocation))
 | 
			
		||||
			{
 | 
			
		||||
				sendMessage("You must start claiming land at the border of the territory.");
 | 
			
		||||
				sendMessageParsed("<b>You must start claiming land at the border of the territory.");
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@ -722,21 +732,22 @@ public class FPlayer extends PlayerEntity
 | 
			
		||||
			{
 | 
			
		||||
				Faction faction = this.getFaction();
 | 
			
		||||
				
 | 
			
		||||
				if(!faction.removeMoney(cost))
 | 
			
		||||
				if( ! faction.removeMoney(cost))
 | 
			
		||||
				{
 | 
			
		||||
					sendMessage("It costs "+costString+" to claim this land, which your faction can't currently afford.");
 | 
			
		||||
					sendMessageParsed("<b>It costs <h>%s<b> to claim this land, which your faction can't currently afford.", costString);
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					sendMessage(faction.getTag()+" has paid "+costString+" to claim some land.");
 | 
			
		||||
					// TODO: Only I can see this right?
 | 
			
		||||
					sendMessageParsed("%s<i> has paid <h>%s<i> to claim some land.", faction.getTag(this), costString);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				if (!Econ.deductMoney(this.getId(), cost))
 | 
			
		||||
				if ( ! Econ.deductMoney(this.getId(), cost))
 | 
			
		||||
				{
 | 
			
		||||
					sendMessage("Claiming this land will cost "+costString+", which you can't currently afford.");
 | 
			
		||||
					sendMessageParsed("<b>Claiming this land will cost <h>%s<b>, which you can't currently afford.", costString);
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
				sendMessage("You have paid "+costString+" to claim this land.");
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,7 @@ public class P extends MPlugin
 | 
			
		||||
	public final FactionsBlockListener blockListener;
 | 
			
		||||
	
 | 
			
		||||
	// Persistance related
 | 
			
		||||
	private boolean locked = true;
 | 
			
		||||
	private boolean locked = false;
 | 
			
		||||
	public boolean getLocked() {return this.locked;}
 | 
			
		||||
	public void setLocked(boolean val) {this.locked = val; this.setAutoSave(val);}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
@ -48,7 +48,7 @@ public class CmdBalance extends FCommand
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
		sendMessageParsed("<a>%s balance: %s", faction.getTag(), Econ.moneyString(faction.getMoney()));
 | 
			
		||||
		sendMessageParsed("<a>%s balance: %s", faction.getTag(fme), Econ.moneyString(faction.getMoney()));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -34,11 +34,12 @@ public class CmdChat extends FCommand
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		String modeString = this.argAsString(0).toLowerCase();
 | 
			
		||||
		String modeString = this.argAsString(0);
 | 
			
		||||
		ChatMode modeTarget = fme.getChatMode().getNext();
 | 
			
		||||
		
 | 
			
		||||
		if (modeString != null)
 | 
			
		||||
		{
 | 
			
		||||
			modeString.toLowerCase();
 | 
			
		||||
			if(modeString.startsWith("p"))
 | 
			
		||||
			{
 | 
			
		||||
				modeTarget = ChatMode.PUBLIC;
 | 
			
		||||
@ -51,8 +52,11 @@ public class CmdChat extends FCommand
 | 
			
		||||
			{
 | 
			
		||||
				modeTarget = ChatMode.FACTION;
 | 
			
		||||
			}
 | 
			
		||||
			sendMessageParsed("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'");
 | 
			
		||||
			return;
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				sendMessageParsed("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'");
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		fme.setChatMode(modeTarget);
 | 
			
		||||
 | 
			
		||||
@ -37,13 +37,13 @@ public class CmdCreate extends FCommand
 | 
			
		||||
		
 | 
			
		||||
		if (fme.hasFaction())
 | 
			
		||||
		{
 | 
			
		||||
			sendMessage("You must leave your current faction first.");
 | 
			
		||||
			sendMessageParsed("<b>You must leave your current faction first.");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (Factions.i.isTagTaken(tag))
 | 
			
		||||
		{
 | 
			
		||||
			sendMessage("That tag is already in use.");
 | 
			
		||||
			sendMessageParsed("<b>That tag is already in use.");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
@ -70,7 +70,7 @@ public class CmdCreate extends FCommand
 | 
			
		||||
			follower.sendMessageParsed("%s<i> created a new faction %s", fme.getNameAndRelevant(follower), faction.getTag(follower));
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		sendMessage("You should now: " + new CmdDescription().getUseageTemplate());
 | 
			
		||||
		sendMessageParsed("<i>You should now: %s", p.cmdBase.cmdDescription.getUseageTemplate());
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -49,15 +49,15 @@ public class CmdDeposit extends FCommand
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				faction.addMoney(amount);
 | 
			
		||||
				sendMessage("You have deposited "+amountString+" into "+faction.getTag()+"'s bank.");
 | 
			
		||||
				sendMessage(faction.getTag()+" now has "+Econ.moneyString(faction.getMoney()));
 | 
			
		||||
				sendMessageParsed("<i>You have deposited <h>%s<i> into <h>%s's<i> bank.", amountString, faction.getTag());
 | 
			
		||||
				sendMessageParsed("%s<i> now has <h>%s", faction.getTag(fme), Econ.moneyString(faction.getMoney()));
 | 
			
		||||
				P.p.log(fme.getName() + " deposited "+amountString+" into "+faction.getTag()+"'s bank.");
 | 
			
		||||
				
 | 
			
		||||
				for (FPlayer fplayer : FPlayers.i.getOnline())
 | 
			
		||||
				{
 | 
			
		||||
					if (fplayer.getFaction() == faction)
 | 
			
		||||
					{
 | 
			
		||||
						fplayer.sendMessageParsed("%s has deposited %s", fme.getNameAndRelevant(fplayer), amountString);
 | 
			
		||||
						fplayer.sendMessageParsed("%s<i> has deposited <h>%s", fme.getNameAndRelevant(fplayer), amountString);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -39,8 +39,8 @@ public class CmdDescription extends FCommand
 | 
			
		||||
		// Broadcast the description to everyone
 | 
			
		||||
		for (FPlayer fplayer : FPlayers.i.getOnline())
 | 
			
		||||
		{
 | 
			
		||||
			fplayer.sendMessageParsed("The faction "+fplayer.getRelationColor(fme)+myFaction.getTag()+"<i> changed their description to:");
 | 
			
		||||
			fplayer.sendMessageParsed("<i>"+myFaction.getDescription());
 | 
			
		||||
			fplayer.sendMessageParsed("<i>The faction "+fplayer.getRelationColor(fme)+myFaction.getTag()+"<i> changed their description to:");
 | 
			
		||||
			fplayer.sendMessageParsed("<h>"+myFaction.getDescription());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,8 @@ public class CmdHelp extends FCommand
 | 
			
		||||
	@Override
 | 
			
		||||
	public void perform()
 | 
			
		||||
	{
 | 
			
		||||
		if (helpPages == null) updateHelp();
 | 
			
		||||
		
 | 
			
		||||
		int page = this.argAsInt(0, 1);
 | 
			
		||||
		
 | 
			
		||||
		sendMessage(p.txt.titleize("Factions Help ("+page+"/"+helpPages.size()+")"));
 | 
			
		||||
@ -51,140 +53,135 @@ public class CmdHelp extends FCommand
 | 
			
		||||
	// Build the help pages
 | 
			
		||||
	//----------------------------------------------//
 | 
			
		||||
	
 | 
			
		||||
	public static ArrayList<ArrayList<String>> helpPages;
 | 
			
		||||
	public ArrayList<ArrayList<String>> helpPages;
 | 
			
		||||
	
 | 
			
		||||
	public static void updateHelp()
 | 
			
		||||
	public void updateHelp()
 | 
			
		||||
	{
 | 
			
		||||
		helpPages = new ArrayList<ArrayList<String>>();
 | 
			
		||||
		ArrayList<String> pageLines;
 | 
			
		||||
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add( new CmdHelp().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdList().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdShow().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdPower().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdJoin().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdLeave().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdChat().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdHome().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( "Learn how to create a faction on the next page." );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdHelp.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdList.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdShow.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdPower.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdJoin.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdLeave.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdChat.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdHome.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.txt.parse("<i>Learn how to create a faction on the next page.") );
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
		
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add( new CmdCreate().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdDescription().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdTag().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( "You might want to close it and use invitations:" );
 | 
			
		||||
		pageLines.add( new CmdOpen().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdInvite().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdDeinvite().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( "And don't forget to set your home:" );
 | 
			
		||||
		pageLines.add( new CmdSethome().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdCreate.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdDescription.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdTag.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.txt.parse("<i>You might want to close it and use invitations:" ));
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdOpen.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdInvite.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdDeinvite.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.txt.parse("<i>And don't forget to set your home:" ));
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdSethome.getUseageTemplate() );
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
		
 | 
			
		||||
		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" );
 | 
			
		||||
			pageLines.add( "things, so it will need to have money deposited into it." );
 | 
			
		||||
			pageLines.add( p.txt.parse("<i>Your faction has a bank which is used to pay for certain" ));
 | 
			
		||||
			pageLines.add( p.txt.parse("<i>things, so it will need to have money deposited into it." ));
 | 
			
		||||
			pageLines.add( "" );
 | 
			
		||||
			pageLines.add( new CmdBalance().getUseageTemplate() );
 | 
			
		||||
			pageLines.add( new CmdDeposit().getUseageTemplate() );
 | 
			
		||||
			pageLines.add( new CmdWithdraw().getUseageTemplate() );
 | 
			
		||||
			pageLines.add( new CmdPay().getUseageTemplate() );
 | 
			
		||||
			pageLines.add( p.cmdBase.cmdBalance.getUseageTemplate() );
 | 
			
		||||
			pageLines.add( p.cmdBase.cmdDeposit.getUseageTemplate() );
 | 
			
		||||
			pageLines.add( p.cmdBase.cmdWithdraw.getUseageTemplate() );
 | 
			
		||||
			pageLines.add( p.cmdBase.cmdPay.getUseageTemplate() );
 | 
			
		||||
			pageLines.add( "" );
 | 
			
		||||
			helpPages.add(pageLines);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add( new CmdClaim().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdAutoClaim().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdUnclaim().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdUnclaimall().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdKick().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdMod().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdAdmin().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdTitle().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( "Player titles are just for fun. No rules connected to them." );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdClaim.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdAutoClaim.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdKick.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdMod.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdAdmin.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdTitle.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.txt.parse("<i>Player titles are just for fun. No rules connected to them." ));
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
		
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add( new CmdMap().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdBoom().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdMap.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdBoom.getUseageTemplate() );
 | 
			
		||||
		pageLines.add("");
 | 
			
		||||
		pageLines.add( new CmdOwner().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdOwnerList().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdOwner.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdOwnerList.getUseageTemplate() );
 | 
			
		||||
		pageLines.add("");
 | 
			
		||||
		pageLines.add("Claimed land with ownership set is further protected so");
 | 
			
		||||
		pageLines.add("that only the owner(s), faction admin, and possibly the");
 | 
			
		||||
		pageLines.add("faction moderators have full access.");
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Claimed land with ownership set is further protected so"));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>that only the owner(s), faction admin, and possibly the"));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>faction moderators have full access."));
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
		
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add( new CmdDisband().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdDisband.getUseageTemplate() );
 | 
			
		||||
		pageLines.add("");
 | 
			
		||||
		pageLines.add( new CmdRelationAlly().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdRelationNeutral().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdRelationEnemy().getUseageTemplate() );
 | 
			
		||||
		pageLines.add("Set the relation you WISH to have with another faction.");
 | 
			
		||||
		pageLines.add("Your default relation with other factions will be neutral.");
 | 
			
		||||
		pageLines.add("If BOTH factions choose \"ally\" you will be allies.");
 | 
			
		||||
		pageLines.add("If ONE faction chooses \"enemy\" you will be enemies.");
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdRelationAlly.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdRelationNeutral.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdRelationEnemy.getUseageTemplate() );
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Set the relation you WISH to have with another faction."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Your default relation with other factions will be neutral."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>If BOTH factions choose \"ally\" you will be allies."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>If ONE faction chooses \"enemy\" you will be enemies."));
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
		
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add("You can never hurt members or allies.");
 | 
			
		||||
		pageLines.add("You can not hurt neutrals in their own territory.");
 | 
			
		||||
		pageLines.add("You can always hurt enemies and players without faction.");
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>You can never hurt members or allies."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>You can not hurt neutrals in their own territory."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>You can always hurt enemies and players without faction."));
 | 
			
		||||
		pageLines.add("");
 | 
			
		||||
		pageLines.add("Damage from enemies is reduced in your own territory.");
 | 
			
		||||
		pageLines.add("When you die you lose power. It is restored over time.");
 | 
			
		||||
		pageLines.add("The power of a faction is the sum of all member power.");
 | 
			
		||||
		pageLines.add("The power of a faction determines how much land it can hold.");
 | 
			
		||||
		pageLines.add("You can claim land from factions with too little power.");
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Damage from enemies is reduced in your own territory."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>When you die you lose power. It is restored over time."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>The power of a faction is the sum of all member power."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>The power of a faction determines how much land it can hold."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>You can claim land from factions with too little power."));
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
		
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add("Only faction members can build and destroy in their own");
 | 
			
		||||
		pageLines.add("territory. Usage of the following items is also restricted:");
 | 
			
		||||
		pageLines.add("Door, Chest, Furnace, Dispenser, Diode.");
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Only faction members can build and destroy in their own"));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>territory. Usage of the following items is also restricted:"));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Door, Chest, Furnace, Dispenser, Diode."));
 | 
			
		||||
		pageLines.add("");
 | 
			
		||||
		pageLines.add("Make sure to put pressure plates in front of doors for your");
 | 
			
		||||
		pageLines.add("guest visitors. Otherwise they can't get through. You can");
 | 
			
		||||
		pageLines.add("also use this to create member only areas.");
 | 
			
		||||
		pageLines.add("As dispensers are protected, you can create traps without");
 | 
			
		||||
		pageLines.add("worrying about those arrows getting stolen.");
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Make sure to put pressure plates in front of doors for your"));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>guest visitors. Otherwise they can't get through. You can"));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>also use this to create member only areas."));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>As dispensers are protected, you can create traps without"));
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>worrying about those arrows getting stolen."));
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
		
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add("Finally some commands for the server admins:");
 | 
			
		||||
		pageLines.add( new CmdBypass().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdSafeclaim().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdAutoSafeclaim().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdSafeunclaimall().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdWarclaim().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdAutoWarclaim().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdWarunclaimall().getUseageTemplate() );
 | 
			
		||||
		pageLines.add("Note: " + new CmdUnclaim().getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well.");
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdBypass.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdSafeclaim.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdAutoSafeclaim.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdSafeunclaimall.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdWarclaim.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdAutoWarclaim.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdWarunclaimall.getUseageTemplate() );
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."));
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
		
 | 
			
		||||
		pageLines = new ArrayList<String>();
 | 
			
		||||
		pageLines.add("More commands for server admins:");
 | 
			
		||||
		pageLines.add( new CmdPeaceful().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdPermanent().getUseageTemplate() );
 | 
			
		||||
		pageLines.add("Peaceful factions are protected from PvP and land capture.");
 | 
			
		||||
		pageLines.add( new CmdLock().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdReload().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdSaveAll().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdVersion().getUseageTemplate() );
 | 
			
		||||
		pageLines.add( new CmdConfig().getUseageTemplate() );
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>More commands for server admins:"));
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdPeaceful.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdPermanent.getUseageTemplate() );
 | 
			
		||||
		pageLines.add(p.txt.parse("<i>Peaceful factions are protected from PvP and land capture."));
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdLock.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdReload.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdSaveAll.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdVersion.getUseageTemplate() );
 | 
			
		||||
		pageLines.add( p.cmdBase.cmdConfig.getUseageTemplate() );
 | 
			
		||||
		helpPages.add(pageLines);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		updateHelp();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -40,32 +40,32 @@ public class CmdHome extends FCommand
 | 
			
		||||
		// TODO: Hide this command on help also.
 | 
			
		||||
		if ( ! Conf.homesEnabled)
 | 
			
		||||
		{
 | 
			
		||||
			fme.sendMessage("Sorry, Faction homes are disabled on this server.");
 | 
			
		||||
			fme.sendMessageParsed("<b>Sorry, Faction homes are disabled on this server.");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if ( ! Conf.homesTeleportCommandEnabled)
 | 
			
		||||
		{
 | 
			
		||||
			fme.sendMessage("Sorry, the ability to teleport to Faction homes is disabled on this server.");
 | 
			
		||||
			fme.sendMessageParsed("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		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 CmdSethome().getUseageTemplate());
 | 
			
		||||
			fme.sendMessageParsed("<b>You faction does not have a home. " + (fme.getRole().value < Role.MODERATOR.value ? "<i> Ask your leader to:" : "<i>You should:"));
 | 
			
		||||
			fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate());
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if ( ! Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory())
 | 
			
		||||
		{
 | 
			
		||||
			fme.sendMessage("You cannot teleport to your faction home while in the territory of an enemy faction.");
 | 
			
		||||
			fme.sendMessageParsed("<b>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())
 | 
			
		||||
		{
 | 
			
		||||
			fme.sendMessage("You cannot teleport to your faction home while in a different world.");
 | 
			
		||||
			fme.sendMessageParsed("<b>You cannot teleport to your faction home while in a different world.");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
@ -114,7 +114,7 @@ public class CmdHome extends FCommand
 | 
			
		||||
				if (dx > max || dy > max || dz > max)
 | 
			
		||||
					continue;
 | 
			
		||||
 | 
			
		||||
				fme.sendMessage("You cannot teleport to your faction home while an enemy is within " + Conf.homesTeleportAllowedEnemyDistance + " blocks of you.");
 | 
			
		||||
				fme.sendMessageParsed("<b>You cannot teleport to your faction home while an enemy is within " + Conf.homesTeleportAllowedEnemyDistance + " blocks of you.");
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -55,7 +55,7 @@ public class CmdJoin extends FCommand
 | 
			
		||||
		
 | 
			
		||||
		if( ! faction.getOpen() && ! faction.isInvited(fme))
 | 
			
		||||
		{
 | 
			
		||||
			sendMessageParsed("<i>This guild requires invitation.");
 | 
			
		||||
			sendMessageParsed("<i>This faction requires invitation.");
 | 
			
		||||
			faction.sendMessageParsed("%s<i> tried to join your faction.", fme.getNameAndRelevant(faction));
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -67,7 +67,7 @@ public class CmdList extends FCommand
 | 
			
		||||
		});
 | 
			
		||||
		
 | 
			
		||||
		ArrayList<String> lines = new ArrayList<String>();
 | 
			
		||||
		lines.add(p.txt.parse("Factionless <i> %d online", Factions.i.getNone().getFPlayersWhereOnline(true).size()));
 | 
			
		||||
		lines.add(p.txt.parse("<i>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",
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,7 @@ public class CmdOpen extends FCommand
 | 
			
		||||
		String open = myFaction.getOpen() ? "open" : "closed";
 | 
			
		||||
		
 | 
			
		||||
		// Inform
 | 
			
		||||
		myFaction.sendMessageParsed("%s<i> changed the faction to ", fme.getNameAndRelevant(myFaction));
 | 
			
		||||
		myFaction.sendMessageParsed("%s<i> changed the faction to <h>%s<i>.", fme.getNameAndRelevant(myFaction), open);
 | 
			
		||||
		for (Faction faction : Factions.i.get())
 | 
			
		||||
		{
 | 
			
		||||
			if (faction == myFaction)
 | 
			
		||||
 | 
			
		||||
@ -72,7 +72,7 @@ public class CmdReload extends FCommand
 | 
			
		||||
		
 | 
			
		||||
		long timeReload = (System.currentTimeMillis()-timeInitStart);
 | 
			
		||||
		
 | 
			
		||||
		sendMessageParsed("reloaded %s from disk, took %dms", fileName, timeReload);
 | 
			
		||||
		sendMessageParsed("<i>Reloaded <h>%s <i>from disk, took <h>%dms<i>.", fileName, timeReload);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -37,4 +37,4 @@ public class CmdSaveAll extends FCommand
 | 
			
		||||
		sendMessageParsed("<i>Factions saved to disk!");
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -66,8 +66,8 @@ public class CmdSethome extends FCommand
 | 
			
		||||
 | 
			
		||||
		faction.setHome(me.getLocation());
 | 
			
		||||
		
 | 
			
		||||
		faction.sendMessage(fme.getNameAndRelevant(myFaction)+"<i> set the home for your faction. You can now use:");
 | 
			
		||||
		faction.sendMessage(new CmdHome().getUseageTemplate());
 | 
			
		||||
		faction.sendMessageParsed("%s<i> set the home for your faction. You can now use:", fme.getNameAndRelevant(myFaction));
 | 
			
		||||
		faction.sendMessage(p.cmdBase.cmdHome.getUseageTemplate());
 | 
			
		||||
		if (faction != myFaction)
 | 
			
		||||
		{
 | 
			
		||||
			fme.sendMessageParsed("<b>You have set the home for the "+faction.getTag(fme)+"<i> faction.");
 | 
			
		||||
 | 
			
		||||
@ -72,55 +72,55 @@ public class FCmdRoot extends FCommand
 | 
			
		||||
		
 | 
			
		||||
		//this.subCommands.add(p.cmdHelp);
 | 
			
		||||
		
 | 
			
		||||
		this.subCommands.add(this.cmdAdmin);
 | 
			
		||||
		this.subCommands.add(this.cmdAutoClaim);
 | 
			
		||||
		this.subCommands.add(this.cmdAutoSafeclaim);
 | 
			
		||||
		this.subCommands.add(this.cmdAutoWarclaim);
 | 
			
		||||
		this.subCommands.add(this.cmdBalance);
 | 
			
		||||
		this.subCommands.add(this.cmdBoom);
 | 
			
		||||
		this.subCommands.add(this.cmdBypass);
 | 
			
		||||
		this.subCommands.add(this.cmdChat);
 | 
			
		||||
		this.subCommands.add(this.cmdClaim);
 | 
			
		||||
		this.subCommands.add(this.cmdConfig);
 | 
			
		||||
		this.subCommands.add(this.cmdCreate);
 | 
			
		||||
		this.subCommands.add(this.cmdDeinvite);
 | 
			
		||||
		this.subCommands.add(this.cmdDeposit);
 | 
			
		||||
		this.subCommands.add(this.cmdDescription);
 | 
			
		||||
		this.subCommands.add(this.cmdDisband);
 | 
			
		||||
		this.subCommands.add(this.cmdHelp);
 | 
			
		||||
		this.subCommands.add(this.cmdHome);
 | 
			
		||||
		this.subCommands.add(this.cmdInvite);
 | 
			
		||||
		this.subCommands.add(this.cmdJoin);
 | 
			
		||||
		this.subCommands.add(this.cmdKick);
 | 
			
		||||
		this.subCommands.add(this.cmdLeave);
 | 
			
		||||
		this.subCommands.add(this.cmdList);
 | 
			
		||||
		this.subCommands.add(this.cmdLock);
 | 
			
		||||
		this.subCommands.add(this.cmdMap);
 | 
			
		||||
		this.subCommands.add(this.cmdMod);
 | 
			
		||||
		this.subCommands.add(this.cmdOpen);
 | 
			
		||||
		this.subCommands.add(this.cmdOwner);
 | 
			
		||||
		this.subCommands.add(this.cmdOwnerList);
 | 
			
		||||
		this.subCommands.add(this.cmdPay);
 | 
			
		||||
		this.subCommands.add(this.cmdPeaceful);
 | 
			
		||||
		this.subCommands.add(this.cmdPermanent);
 | 
			
		||||
		this.subCommands.add(this.cmdPower);
 | 
			
		||||
		this.subCommands.add(this.cmdRelationAlly);
 | 
			
		||||
		this.subCommands.add(this.cmdRelationEnemy);
 | 
			
		||||
		this.subCommands.add(this.cmdRelationNeutral);
 | 
			
		||||
		this.subCommands.add(this.cmdReload);
 | 
			
		||||
		this.subCommands.add(this.cmdSafeclaim);
 | 
			
		||||
		this.subCommands.add(this.cmdSafeunclaimall);
 | 
			
		||||
		this.subCommands.add(this.cmdSaveAll);
 | 
			
		||||
		this.subCommands.add(this.cmdSethome);
 | 
			
		||||
		this.subCommands.add(this.cmdShow);
 | 
			
		||||
		this.subCommands.add(this.cmdTag);
 | 
			
		||||
		this.subCommands.add(this.cmdTitle);
 | 
			
		||||
		this.subCommands.add(this.cmdUnclaim);
 | 
			
		||||
		this.subCommands.add(this.cmdUnclaimall);
 | 
			
		||||
		this.subCommands.add(this.cmdVersion);
 | 
			
		||||
		this.subCommands.add(this.cmdWarclaim);
 | 
			
		||||
		this.subCommands.add(this.cmdWarunclaimall);
 | 
			
		||||
		this.subCommands.add(this.cmdWithdraw);
 | 
			
		||||
		this.addSubCommand(this.cmdAdmin);
 | 
			
		||||
		this.addSubCommand(this.cmdAutoClaim);
 | 
			
		||||
		this.addSubCommand(this.cmdAutoSafeclaim);
 | 
			
		||||
		this.addSubCommand(this.cmdAutoWarclaim);
 | 
			
		||||
		this.addSubCommand(this.cmdBalance);
 | 
			
		||||
		this.addSubCommand(this.cmdBoom);
 | 
			
		||||
		this.addSubCommand(this.cmdBypass);
 | 
			
		||||
		this.addSubCommand(this.cmdChat);
 | 
			
		||||
		this.addSubCommand(this.cmdClaim);
 | 
			
		||||
		this.addSubCommand(this.cmdConfig);
 | 
			
		||||
		this.addSubCommand(this.cmdCreate);
 | 
			
		||||
		this.addSubCommand(this.cmdDeinvite);
 | 
			
		||||
		this.addSubCommand(this.cmdDeposit);
 | 
			
		||||
		this.addSubCommand(this.cmdDescription);
 | 
			
		||||
		this.addSubCommand(this.cmdDisband);
 | 
			
		||||
		this.addSubCommand(this.cmdHelp);
 | 
			
		||||
		this.addSubCommand(this.cmdHome);
 | 
			
		||||
		this.addSubCommand(this.cmdInvite);
 | 
			
		||||
		this.addSubCommand(this.cmdJoin);
 | 
			
		||||
		this.addSubCommand(this.cmdKick);
 | 
			
		||||
		this.addSubCommand(this.cmdLeave);
 | 
			
		||||
		this.addSubCommand(this.cmdList);
 | 
			
		||||
		this.addSubCommand(this.cmdLock);
 | 
			
		||||
		this.addSubCommand(this.cmdMap);
 | 
			
		||||
		this.addSubCommand(this.cmdMod);
 | 
			
		||||
		this.addSubCommand(this.cmdOpen);
 | 
			
		||||
		this.addSubCommand(this.cmdOwner);
 | 
			
		||||
		this.addSubCommand(this.cmdOwnerList);
 | 
			
		||||
		this.addSubCommand(this.cmdPay);
 | 
			
		||||
		this.addSubCommand(this.cmdPeaceful);
 | 
			
		||||
		this.addSubCommand(this.cmdPermanent);
 | 
			
		||||
		this.addSubCommand(this.cmdPower);
 | 
			
		||||
		this.addSubCommand(this.cmdRelationAlly);
 | 
			
		||||
		this.addSubCommand(this.cmdRelationEnemy);
 | 
			
		||||
		this.addSubCommand(this.cmdRelationNeutral);
 | 
			
		||||
		this.addSubCommand(this.cmdReload);
 | 
			
		||||
		this.addSubCommand(this.cmdSafeclaim);
 | 
			
		||||
		this.addSubCommand(this.cmdSafeunclaimall);
 | 
			
		||||
		this.addSubCommand(this.cmdSaveAll);
 | 
			
		||||
		this.addSubCommand(this.cmdSethome);
 | 
			
		||||
		this.addSubCommand(this.cmdShow);
 | 
			
		||||
		this.addSubCommand(this.cmdTag);
 | 
			
		||||
		this.addSubCommand(this.cmdTitle);
 | 
			
		||||
		this.addSubCommand(this.cmdUnclaim);
 | 
			
		||||
		this.addSubCommand(this.cmdUnclaimall);
 | 
			
		||||
		this.addSubCommand(this.cmdVersion);
 | 
			
		||||
		this.addSubCommand(this.cmdWarclaim);
 | 
			
		||||
		this.addSubCommand(this.cmdWarunclaimall);
 | 
			
		||||
		this.addSubCommand(this.cmdWithdraw);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
 | 
			
		||||
@ -31,6 +31,7 @@ public abstract class FRelationCommand extends FCommand
 | 
			
		||||
	public void perform()
 | 
			
		||||
	{
 | 
			
		||||
		Faction them = this.argAsFaction(0);
 | 
			
		||||
		if (them == null) return;
 | 
			
		||||
		
 | 
			
		||||
		if ( ! them.isNormal())
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,6 @@ import org.bukkit.event.Event;
 | 
			
		||||
import org.bukkit.plugin.Plugin;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.factions.listeners.FactionsServerListener;
 | 
			
		||||
import com.massivecraft.factions.cmd.CmdHelp;
 | 
			
		||||
 | 
			
		||||
import com.earth2me.essentials.api.Economy;
 | 
			
		||||
import com.nijikokun.register.payment.Methods;
 | 
			
		||||
@ -15,36 +14,47 @@ import com.massivecraft.factions.Conf;
 | 
			
		||||
import com.massivecraft.factions.P;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
public class Econ {
 | 
			
		||||
public class Econ
 | 
			
		||||
{
 | 
			
		||||
	private static boolean registerUse = false;
 | 
			
		||||
	private static boolean iConomyUse = false;
 | 
			
		||||
	private static boolean essEcoUse = false;
 | 
			
		||||
 | 
			
		||||
	public static void monitorPlugins() {
 | 
			
		||||
	// TODO: WHY put this here instead of at the same place as the other listeners?
 | 
			
		||||
	public static void monitorPlugins()
 | 
			
		||||
	{
 | 
			
		||||
		P.p.getServer().getPluginManager().registerEvent(Event.Type.PLUGIN_ENABLE, new FactionsServerListener(P.p), Event.Priority.Monitor, P.p);
 | 
			
		||||
		P.p.getServer().getPluginManager().registerEvent(Event.Type.PLUGIN_DISABLE, new FactionsServerListener(P.p), Event.Priority.Monitor, P.p);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void setup(P factions) {
 | 
			
		||||
		if (enabled()) {
 | 
			
		||||
	public static void setup(P factions)
 | 
			
		||||
	{
 | 
			
		||||
		if (enabled())
 | 
			
		||||
		{
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!registerHooked()) {
 | 
			
		||||
		if (!registerHooked())
 | 
			
		||||
		{
 | 
			
		||||
			Plugin plug = factions.getServer().getPluginManager().getPlugin("Register");
 | 
			
		||||
			if (plug != null && plug.getClass().getName().equals("com.nijikokun.register.Register") && plug.isEnabled()) {
 | 
			
		||||
			if (plug != null && plug.getClass().getName().equals("com.nijikokun.register.Register") && plug.isEnabled())
 | 
			
		||||
			{
 | 
			
		||||
				registerSet(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (!iConomyHooked()) {
 | 
			
		||||
		if (!iConomyHooked())
 | 
			
		||||
		{
 | 
			
		||||
			Plugin plug = factions.getServer().getPluginManager().getPlugin("iConomy");
 | 
			
		||||
			if (plug != null && plug.getClass().getName().equals("com.iConomy.iConomy") && plug.isEnabled()) {
 | 
			
		||||
			if (plug != null && plug.getClass().getName().equals("com.iConomy.iConomy") && plug.isEnabled())
 | 
			
		||||
			{
 | 
			
		||||
				iConomySet(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (!essentialsEcoHooked()) {
 | 
			
		||||
		if (!essentialsEcoHooked())
 | 
			
		||||
		{
 | 
			
		||||
			Plugin plug = factions.getServer().getPluginManager().getPlugin("Essentials");
 | 
			
		||||
			if (plug != null && plug.isEnabled()) {
 | 
			
		||||
			if (plug != null && plug.isEnabled())
 | 
			
		||||
			{
 | 
			
		||||
				essentialsEcoSet(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@ -59,7 +69,7 @@ public class Econ {
 | 
			
		||||
		else {
 | 
			
		||||
			P.p.log("Un-hooked from Register.");
 | 
			
		||||
		}
 | 
			
		||||
		CmdHelp.updateHelp();
 | 
			
		||||
		P.p.cmdBase.cmdHelp.updateHelp();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void iConomySet(boolean enable)
 | 
			
		||||
@ -71,7 +81,7 @@ public class Econ {
 | 
			
		||||
		else {
 | 
			
		||||
			P.p.log("Un-hooked from iConomy.");
 | 
			
		||||
		}
 | 
			
		||||
		CmdHelp.updateHelp();
 | 
			
		||||
		P.p.cmdBase.cmdHelp.updateHelp();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void essentialsEcoSet(boolean enable)
 | 
			
		||||
@ -85,7 +95,7 @@ public class Econ {
 | 
			
		||||
		{
 | 
			
		||||
			P.p.log("Un-hooked from EssentialsEco.");
 | 
			
		||||
		}
 | 
			
		||||
		CmdHelp.updateHelp();
 | 
			
		||||
		P.p.cmdBase.cmdHelp.updateHelp();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static boolean registerHooked()
 | 
			
		||||
 | 
			
		||||
@ -44,6 +44,12 @@ public class FactionsChatEarlyListener extends PlayerListener
 | 
			
		||||
		
 | 
			
		||||
		if (event.isCancelled()) return;
 | 
			
		||||
		
 | 
			
		||||
		if (p.handleCommand(event.getPlayer(), event.getMessage()))
 | 
			
		||||
		{
 | 
			
		||||
			event.setCancelled(true);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		Player talkingPlayer = event.getPlayer();
 | 
			
		||||
		String msg = event.getMessage();
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
@ -4,8 +4,10 @@ import java.util.*;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
 | 
			
		||||
public class AsciiCompass {
 | 
			
		||||
	public enum Point {
 | 
			
		||||
public class AsciiCompass
 | 
			
		||||
{
 | 
			
		||||
	public enum Point
 | 
			
		||||
	{
 | 
			
		||||
		N('N'),
 | 
			
		||||
		NE('/'),
 | 
			
		||||
		E('E'),
 | 
			
		||||
@ -17,21 +19,25 @@ public class AsciiCompass {
 | 
			
		||||
		
 | 
			
		||||
		public final char asciiChar;
 | 
			
		||||
		
 | 
			
		||||
		private Point(final char asciiChar) {
 | 
			
		||||
		private Point(final char asciiChar)
 | 
			
		||||
		{
 | 
			
		||||
	        this.asciiChar = asciiChar;
 | 
			
		||||
	    }
 | 
			
		||||
		
 | 
			
		||||
		@Override
 | 
			
		||||
		public String toString() {
 | 
			
		||||
		public String toString()
 | 
			
		||||
		{
 | 
			
		||||
			return String.valueOf(this.asciiChar);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public String toString(boolean isActive, ChatColor colorActive, String colorDefault) {
 | 
			
		||||
		public String toString(boolean isActive, ChatColor colorActive, String colorDefault)
 | 
			
		||||
		{
 | 
			
		||||
			return (isActive ? colorActive : colorDefault)+String.valueOf(this.asciiChar);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static AsciiCompass.Point getCompassPointForDirection(double inDegrees) {
 | 
			
		||||
	public static AsciiCompass.Point getCompassPointForDirection(double inDegrees)
 | 
			
		||||
	{
 | 
			
		||||
		double degrees = (inDegrees - 90) % 360 ;
 | 
			
		||||
		if (degrees < 0)
 | 
			
		||||
			degrees += 360;
 | 
			
		||||
@ -58,7 +64,8 @@ public class AsciiCompass {
 | 
			
		||||
			return null;
 | 
			
		||||
    }
 | 
			
		||||
	
 | 
			
		||||
	public static ArrayList<String> getAsciiCompass(Point point, ChatColor colorActive, String colorDefault) {
 | 
			
		||||
	public static ArrayList<String> getAsciiCompass(Point point, ChatColor colorActive, String colorDefault)
 | 
			
		||||
	{
 | 
			
		||||
		ArrayList<String> ret = new ArrayList<String>();
 | 
			
		||||
		String row;
 | 
			
		||||
		
 | 
			
		||||
@ -83,7 +90,8 @@ public class AsciiCompass {
 | 
			
		||||
		return ret;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static ArrayList<String> getAsciiCompass(double inDegrees, ChatColor colorActive, String colorDefault) {
 | 
			
		||||
	public static ArrayList<String> getAsciiCompass(double inDegrees, ChatColor colorActive, String colorDefault)
 | 
			
		||||
	{
 | 
			
		||||
		return getAsciiCompass(getCompassPointForDirection(inDegrees), colorActive, colorDefault);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,12 @@ public abstract class MCommand<T extends MPlugin>
 | 
			
		||||
	
 | 
			
		||||
	// The sub-commands to this command
 | 
			
		||||
	public List<MCommand<?>> subCommands;
 | 
			
		||||
	public void addSubCommand(MCommand<?> subCommand)
 | 
			
		||||
	{
 | 
			
		||||
		subCommand.commandChain.addAll(this.commandChain);
 | 
			
		||||
		subCommand.commandChain.add(this);
 | 
			
		||||
		this.subCommands.add(subCommand);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// The different names this commands will react to  
 | 
			
		||||
	public List<String> aliases;
 | 
			
		||||
@ -58,7 +64,7 @@ public abstract class MCommand<T extends MPlugin>
 | 
			
		||||
	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
 | 
			
		||||
	public List<MCommand<?>> commandChain = new ArrayList<MCommand<?>>(); // The command chain used to execute this command
 | 
			
		||||
	
 | 
			
		||||
	public MCommand(T p)
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
@ -211,7 +211,7 @@ public abstract class MPlugin extends JavaPlugin
 | 
			
		||||
			
 | 
			
		||||
			for (String alias : command.aliases)
 | 
			
		||||
			{
 | 
			
		||||
				if (commandString.startsWith(alias) || commandString.equals(alias+" "))
 | 
			
		||||
				if (commandString.startsWith(alias+" ") || commandString.equals(alias))
 | 
			
		||||
				{
 | 
			
		||||
					List<String> args = new ArrayList<String>(Arrays.asList(commandString.split("\\s+")));
 | 
			
		||||
					args.remove(0);
 | 
			
		||||
 | 
			
		||||
@ -51,5 +51,4 @@ public class MPluginSecretPlayerListener extends PlayerListener
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -90,6 +90,7 @@ public abstract class EntityCollection<E extends Entity>
 | 
			
		||||
	
 | 
			
		||||
	public boolean exists(String id)
 | 
			
		||||
	{
 | 
			
		||||
		if (id == null) return false;
 | 
			
		||||
		return id2entity.get(id) != null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
@ -110,7 +111,9 @@ public abstract class EntityCollection<E extends Entity>
 | 
			
		||||
		try
 | 
			
		||||
		{
 | 
			
		||||
			e = this.entityClass.newInstance();
 | 
			
		||||
		} catch (Exception ignored) {}
 | 
			
		||||
		} catch (Exception ignored) {
 | 
			
		||||
			ignored.printStackTrace();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		e.setId(id);
 | 
			
		||||
		this.entities.add(e);
 | 
			
		||||
 | 
			
		||||
@ -26,14 +26,6 @@ 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();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user