diff --git a/src/com/massivecraft/factions/cmd/CmdCreate.java b/src/com/massivecraft/factions/cmd/CmdCreate.java index 57e8aacb..6f362a3a 100644 --- a/src/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdCreate.java @@ -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("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); diff --git a/src/com/massivecraft/factions/cmd/CmdDisband.java b/src/com/massivecraft/factions/cmd/CmdDisband.java index 5255dfbb..b6c18a94 100644 --- a/src/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdDisband.java @@ -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("%s 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 diff --git a/src/com/massivecraft/factions/integration/SpoutFeatures.java b/src/com/massivecraft/factions/integration/SpoutFeatures.java index 1584b2c6..eee1cc08 100644 --- a/src/com/massivecraft/factions/integration/SpoutFeatures.java +++ b/src/com/massivecraft/factions/integration/SpoutFeatures.java @@ -41,7 +41,7 @@ public class SpoutFeatures { listenersHooked = true; mainListener = new SpoutMainListener(); - P.p.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, mainListener, Event.Priority.Normal, P.p); + P.p.registerEvent(Event.Type.CUSTOM_EVENT, mainListener, Event.Priority.Normal); } } else diff --git a/src/com/massivecraft/factions/zcore/persist/EntityCollection.java b/src/com/massivecraft/factions/zcore/persist/EntityCollection.java index 2d1cb387..fcfe55e0 100644 --- a/src/com/massivecraft/factions/zcore/persist/EntityCollection.java +++ b/src/com/massivecraft/factions/zcore/persist/EntityCollection.java @@ -217,8 +217,13 @@ public abstract class EntityCollection public String getNextId() { - this.nextId += 1; - return "" + (nextId - 1); + String next = Integer.toString(this.nextId); + do + { + this.nextId += 1; + } while ( ! isIdFree(Integer.toString(this.nextId)) ); + + return next; } public boolean isIdFree(String id)