/f disband, /f list, and /f who <tag> commands can now be used from the server console; /f list now shows "Factionless" instead of "Wilderness" for factioness players; fix for some potential NPEs
This commit is contained in:
		@@ -70,9 +70,15 @@ public class Faction {
 | 
			
		||||
		return prefix+this.tag;
 | 
			
		||||
	}
 | 
			
		||||
	public String getTag(Faction otherFaction) {
 | 
			
		||||
		if (otherFaction == null)
 | 
			
		||||
			return getTag();
 | 
			
		||||
		else
 | 
			
		||||
			return this.getTag(otherFaction.getRelationColor(this).toString());
 | 
			
		||||
	}
 | 
			
		||||
	public String getTag(FPlayer otherFplayer) {
 | 
			
		||||
		if (otherFplayer == null)
 | 
			
		||||
			return getTag();
 | 
			
		||||
		else
 | 
			
		||||
			return this.getTag(otherFplayer.getRelationColor(this).toString());
 | 
			
		||||
	}
 | 
			
		||||
	public void setTag(String str) {
 | 
			
		||||
@@ -182,6 +188,9 @@ public class Faction {
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Relation getRelation(FPlayer fplayer) {
 | 
			
		||||
		if (fplayer == null)
 | 
			
		||||
			return Relation.NEUTRAL;
 | 
			
		||||
		else
 | 
			
		||||
			return getRelation(fplayer.getFaction());
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -189,11 +189,11 @@ public class FBaseCommand {
 | 
			
		||||
			return faction;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (defaultToMine) {
 | 
			
		||||
		if (defaultToMine && sender instanceof Player) {
 | 
			
		||||
			return me.getFaction();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		me.sendMessage(Conf.colorSystem+"No faction or player \""+factionName+"\" was found");
 | 
			
		||||
		sendMessage(Conf.colorSystem+"No faction or player \""+factionName+"\" was found");
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,8 @@ public class FCommandDisband extends FBaseCommand {
 | 
			
		||||
	public FCommandDisband() {
 | 
			
		||||
		aliases.add("disband");
 | 
			
		||||
		
 | 
			
		||||
		senderMustBePlayer = false;
 | 
			
		||||
		
 | 
			
		||||
		requiredParameters.add("faction tag");
 | 
			
		||||
		
 | 
			
		||||
		helpDescription = "Disband a faction";
 | 
			
		||||
@@ -25,10 +27,10 @@ public class FCommandDisband extends FBaseCommand {
 | 
			
		||||
			Faction faction = Faction.findByTag(parameters.get(0));
 | 
			
		||||
			
 | 
			
		||||
			if( faction != null && faction.getId() > 0 ) {
 | 
			
		||||
				me.sendMessage("Faction " + faction.getTag() + " got disbanded");
 | 
			
		||||
				sendMessage("Faction " + faction.getTag() + " got disbanded");
 | 
			
		||||
				Faction.delete( faction.getId() );
 | 
			
		||||
			} else {
 | 
			
		||||
				me.sendMessage("Faction " + parameters.get(0) + "not found");
 | 
			
		||||
				sendMessage("Faction " + parameters.get(0) + "not found");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,8 @@ public class FCommandList extends FBaseCommand {
 | 
			
		||||
		aliases.add("list");
 | 
			
		||||
		aliases.add("ls");
 | 
			
		||||
		
 | 
			
		||||
		senderMustBePlayer = false;
 | 
			
		||||
		
 | 
			
		||||
		optionalParameters.add("page");
 | 
			
		||||
		
 | 
			
		||||
		helpDescription = "Show a list of the factions";
 | 
			
		||||
@@ -84,7 +86,7 @@ public class FCommandList extends FBaseCommand {
 | 
			
		||||
		for (int pos = page * 9; pos < maxPos; pos++) {
 | 
			
		||||
			Faction faction = FactionList.get(pos);
 | 
			
		||||
			if (faction.getId() == 0) {
 | 
			
		||||
				sendMessage(faction.getTag(me)+Conf.colorSystem+" "+faction.getFPlayersWhereOnline(true).size() + " online");
 | 
			
		||||
				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());
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package org.mcteam.factions.commands;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.command.CommandSender;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.mcteam.factions.Conf;
 | 
			
		||||
import org.mcteam.factions.FPlayer;
 | 
			
		||||
import org.mcteam.factions.Faction;
 | 
			
		||||
@@ -17,6 +18,8 @@ public class FCommandShow extends FBaseCommand {
 | 
			
		||||
		aliases.add("show");
 | 
			
		||||
		aliases.add("who");
 | 
			
		||||
		
 | 
			
		||||
		senderMustBePlayer = false;
 | 
			
		||||
		
 | 
			
		||||
		optionalParameters.add("faction tag");
 | 
			
		||||
		
 | 
			
		||||
		helpDescription = "Show faction information";
 | 
			
		||||
@@ -32,10 +35,17 @@ public class FCommandShow extends FBaseCommand {
 | 
			
		||||
		Faction faction;
 | 
			
		||||
		if (parameters.size() > 0) {
 | 
			
		||||
			faction = findFaction(parameters.get(0), true);
 | 
			
		||||
		} else if (!(sender instanceof Player)) {
 | 
			
		||||
			sendMessage("From the command line, you must specify a faction tag (f who <faction tag>).");
 | 
			
		||||
			return;
 | 
			
		||||
		} else {
 | 
			
		||||
			faction = me.getFaction();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (faction == null) {
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		Collection<FPlayer> admins = faction.getFPlayersWhereRole(Role.ADMIN);
 | 
			
		||||
		Collection<FPlayer> mods = faction.getFPlayersWhereRole(Role.MODERATOR);
 | 
			
		||||
		Collection<FPlayer> normals = faction.getFPlayersWhereRole(Role.NORMAL);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user