mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 08:27:45 +00:00
Merge pull request #24 from c0508383/master
Fixed a faction duplication glitch
This commit is contained in:
2 files changed
+3
-14
No files matched your search
@@ -560,7 +560,7 @@ public class PacketHandlerServer{
|
||||
else if(type == EnumPacketServer.FactionSave){
|
||||
Faction faction = new Faction();
|
||||
faction.readNBT(Server.readNBT(buffer));
|
||||
FactionController.getInstance().create(faction);
|
||||
FactionController.getInstance().saveFaction(faction);
|
||||
NoppesUtilServer.sendFactionDataAll(player);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
faction.writeNBT(compound);
|
||||
|
||||
@@ -139,7 +139,7 @@ public class FactionController implements IFactionHandler {
|
||||
}
|
||||
|
||||
public void saveFaction(Faction faction) {
|
||||
|
||||
|
||||
if(faction.id < 0){
|
||||
faction.id = getUnusedId();
|
||||
while(hasName(faction.name))
|
||||
@@ -157,23 +157,12 @@ public class FactionController implements IFactionHandler {
|
||||
}
|
||||
|
||||
public Faction create(Faction faction) {
|
||||
String name = faction.getName();
|
||||
int color = faction.getColor();
|
||||
|
||||
for(faction = new Faction(); this.hasName(name); name = name + "_") {
|
||||
}
|
||||
|
||||
faction.name = name;
|
||||
faction.color = color;
|
||||
this.saveFaction(faction);
|
||||
return faction;
|
||||
}
|
||||
|
||||
public Faction create(String name, int color) {
|
||||
Faction faction;
|
||||
for(faction = new Faction(); this.hasName(name); name = name + "_") {
|
||||
}
|
||||
|
||||
Faction faction = new Faction();
|
||||
faction.name = name;
|
||||
faction.color = color;
|
||||
this.saveFaction(faction);
|
||||
|
||||
Reference in new issue
Block a user