Fix for faction creation sometimes causing an NPE; hopefully a fix for the cause of the null value as well, from an ID clash in the entity collection of factions
Fix for disband command causing an NPE if run from the console Additionally, disband command use is now logged
This commit is contained in:
@ -58,6 +58,13 @@ public class CmdCreate extends FCommand
|
||||
if ( ! payForCommand(Conf.econCostCreate, "to create a new faction", "for creating a new faction")) return;
|
||||
|
||||
Faction faction = Factions.i.create();
|
||||
|
||||
if (faction == null)
|
||||
{
|
||||
msg("<b>There was an internal error while trying to create your faction. Please try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
faction.setTag(tag);
|
||||
fme.setRole(Role.ADMIN);
|
||||
fme.setFaction(faction);
|
||||
|
@ -44,7 +44,7 @@ public class CmdDisband extends FCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! Permission.DISBAND_ANY.has(me, true))
|
||||
if ( ! Permission.DISBAND_ANY.has(sender, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -69,7 +69,8 @@ public class CmdDisband extends FCommand
|
||||
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer));
|
||||
}
|
||||
}
|
||||
|
||||
P.p.log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
|
||||
|
||||
if (Econ.shouldBeUsed())
|
||||
{
|
||||
//Give all the faction's money to the disbander
|
||||
|
Reference in New Issue
Block a user