|
|
@ -37,8 +37,6 @@ import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.Timestamp; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
@ -322,7 +320,7 @@ public class Guild extends AbstractWorldObject { |
|
|
|
if (ac == null) |
|
|
|
if (ac == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
// errant guilds cant be guild leader.
|
|
|
|
// errant guilds cant be guild leader.
|
|
|
|
if (this.isErrant()) |
|
|
|
if (this.isEmptyGuild()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (!DbManager.GuildQueries.SET_GUILD_LEADER(ac.getObjectUUID(), this.getObjectUUID())) { |
|
|
|
if (!DbManager.GuildQueries.SET_GUILD_LEADER(ac.getObjectUUID(), this.getObjectUUID())) { |
|
|
@ -348,7 +346,7 @@ public class Guild extends AbstractWorldObject { |
|
|
|
if (ac == null) |
|
|
|
if (ac == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
// errant guilds cant be guild leader.
|
|
|
|
// errant guilds cant be guild leader.
|
|
|
|
if (this.isErrant()) |
|
|
|
if (this.isEmptyGuild()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)) |
|
|
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)) |
|
|
@ -401,7 +399,7 @@ public class Guild extends AbstractWorldObject { |
|
|
|
* Utils |
|
|
|
* Utils |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
public boolean isErrant() { |
|
|
|
public boolean isEmptyGuild() { |
|
|
|
return this.getObjectUUID() == Guild.errantGuild.getObjectUUID(); |
|
|
|
return this.getObjectUUID() == Guild.errantGuild.getObjectUUID(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -415,7 +413,7 @@ public class Guild extends AbstractWorldObject { |
|
|
|
public static boolean sameGuildExcludeErrant(Guild a, Guild b) { |
|
|
|
public static boolean sameGuildExcludeErrant(Guild a, Guild b) { |
|
|
|
if (a == null || b == null) |
|
|
|
if (a == null || b == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
if (a.isErrant() || b.isErrant()) |
|
|
|
if (a.isEmptyGuild() || b.isEmptyGuild()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
return a.getObjectUUID() == b.getObjectUUID(); |
|
|
|
return a.getObjectUUID() == b.getObjectUUID(); |
|
|
|
} |
|
|
|
} |
|
|
@ -423,7 +421,7 @@ public class Guild extends AbstractWorldObject { |
|
|
|
public static boolean sameGuildIncludeErrant(Guild a, Guild b) { |
|
|
|
public static boolean sameGuildIncludeErrant(Guild a, Guild b) { |
|
|
|
if (a == null || b == null) |
|
|
|
if (a == null || b == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
if (a.isErrant() || b.isErrant()) |
|
|
|
if (a.isEmptyGuild() || b.isEmptyGuild()) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
return a.getObjectUUID() == b.getObjectUUID(); |
|
|
|
return a.getObjectUUID() == b.getObjectUUID(); |
|
|
|
} |
|
|
|
} |
|
|
@ -445,7 +443,7 @@ public class Guild extends AbstractWorldObject { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if (a.nation == null || b.nation == null) |
|
|
|
if (a.nation == null || b.nation == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
return a.nation.getObjectUUID() == b.nation.getObjectUUID() && !a.nation.isErrant(); |
|
|
|
return a.nation.getObjectUUID() == b.nation.getObjectUUID() && !a.nation.isEmptyGuild(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isGuildLeader(int uuid) { |
|
|
|
public boolean isGuildLeader(int uuid) { |
|
|
@ -465,7 +463,7 @@ public class Guild extends AbstractWorldObject { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void removePlayer(PlayerCharacter pc, GuildHistoryType historyType) { |
|
|
|
public void removePlayer(PlayerCharacter pc, GuildHistoryType historyType) { |
|
|
|
|
|
|
|
|
|
|
|
if (this.isErrant()) { |
|
|
|
if (this.isEmptyGuild()) { |
|
|
|
Logger.warn("Attempted to remove a PlayerCharacter (" + pc.getObjectUUID() + ") from an errant guild."); |
|
|
|
Logger.warn("Attempted to remove a PlayerCharacter (" + pc.getObjectUUID() + ") from an errant guild."); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -830,9 +828,9 @@ public class Guild extends AbstractWorldObject { |
|
|
|
this.guildState = GuildState.Nation; |
|
|
|
this.guildState = GuildState.Nation; |
|
|
|
else if (this.nation.equals(this)) |
|
|
|
else if (this.nation.equals(this)) |
|
|
|
this.guildState = GuildState.Sovereign; |
|
|
|
this.guildState = GuildState.Sovereign; |
|
|
|
else if (!this.nation.isErrant() && this.cityUUID != 0) |
|
|
|
else if (!this.nation.isEmptyGuild() && this.cityUUID != 0) |
|
|
|
this.guildState = GuildState.Province; |
|
|
|
this.guildState = GuildState.Province; |
|
|
|
else if (!this.nation.isErrant()) |
|
|
|
else if (!this.nation.isEmptyGuild()) |
|
|
|
this.guildState = GuildState.Sworn; |
|
|
|
this.guildState = GuildState.Sworn; |
|
|
|
else |
|
|
|
else |
|
|
|
this.guildState = GuildState.Errant; |
|
|
|
this.guildState = GuildState.Errant; |
|
|
@ -1253,7 +1251,7 @@ public class Guild extends AbstractWorldObject { |
|
|
|
if (guild == null) |
|
|
|
if (guild == null) |
|
|
|
return roster; |
|
|
|
return roster; |
|
|
|
|
|
|
|
|
|
|
|
if (guild.isErrant()) |
|
|
|
if (guild.isEmptyGuild()) |
|
|
|
return roster; |
|
|
|
return roster; |
|
|
|
|
|
|
|
|
|
|
|
if (DbManager.getList(GameObjectType.PlayerCharacter) == null) |
|
|
|
if (DbManager.getList(GameObjectType.PlayerCharacter) == null) |
|
|
|