Fixed error when no parameter given to f balance.

This commit is contained in:
Harry Jeffery 2011-09-26 17:18:37 +01:00
parent 9f8f125a92
commit d718e8bddc

View File

@ -1,5 +1,7 @@
package com.massivecraft.factions.commands; package com.massivecraft.factions.commands;
import org.bukkit.entity.Player;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Econ; import com.massivecraft.factions.Econ;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
@ -25,10 +27,15 @@ public class FCommandBalance extends FBaseCommand {
return; return;
} }
String factionName = parameters.get(0); Faction faction;
Faction faction = findFaction(factionName, true);
sendMessage(Conf.colorChrome+faction.getTag()+"'s balance: "+ Econ.moneyString(faction.getMoney())); if (parameters.size() > 0) {
faction = findFaction(parameters.get(0), true);
} else {
faction = me.getFaction();
}
sendMessage(Conf.colorChrome+faction.getTag()+" balance: "+ Econ.moneyString(faction.getMoney()));
} }
} }