From 825f41e4698e56f820fa66d5c32f668a392a3b89 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 21 Jan 2023 09:28:30 -0500 Subject: [PATCH] rename method to isEmptyGuild() so as not to confuse with GuildState. --- src/engine/devcmd/cmds/MakeBaneCmd.java | 2 +- src/engine/gameManager/BuildingManager.java | 2 +- src/engine/gameManager/GuildManager.java | 4 ++-- src/engine/net/client/ClientMessagePump.java | 2 +- .../handlers/AcceptInviteToGuildHandler.java | 2 +- .../handlers/AllianceChangeMsgHandler.java | 4 ++-- .../handlers/ArcLoginNotifyMsgHandler.java | 2 +- .../handlers/BanishUnbanishHandler.java | 2 +- .../client/handlers/ClaimAssetMsgHandler.java | 2 +- .../handlers/ClaimGuildTreeMsgHandler.java | 6 ++--- .../client/handlers/DisbandGuildHandler.java | 4 ++-- .../client/handlers/InviteToGuildHandler.java | 4 ++-- .../client/handlers/InviteToSubHandler.java | 4 ++-- .../client/handlers/LeaveGuildHandler.java | 2 +- .../client/handlers/MerchantMsgHandler.java | 4 ++-- .../handlers/MineWindowChangeHandler.java | 6 +---- .../client/handlers/PlaceAssetMsgHandler.java | 4 ++-- .../client/handlers/TaxCityMsgHandler.java | 2 +- .../net/client/msg/GuildTreeStatusMsg.java | 2 +- .../client/msg/OpenFriendsCondemnListMsg.java | 4 ++-- src/engine/objects/Bane.java | 8 +++---- src/engine/objects/City.java | 16 +++++++------- src/engine/objects/Experience.java | 4 ++-- src/engine/objects/Guild.java | 22 +++++++++---------- src/engine/objects/Mine.java | 20 ++++++++--------- src/engine/objects/NPC.java | 2 +- src/engine/objects/PlayerCharacter.java | 10 ++++----- src/engine/workthreads/HourlyJobThread.java | 2 +- 28 files changed, 71 insertions(+), 77 deletions(-) diff --git a/src/engine/devcmd/cmds/MakeBaneCmd.java b/src/engine/devcmd/cmds/MakeBaneCmd.java index 3b845d79..85f17c0e 100644 --- a/src/engine/devcmd/cmds/MakeBaneCmd.java +++ b/src/engine/devcmd/cmds/MakeBaneCmd.java @@ -80,7 +80,7 @@ public class MakeBaneCmd extends AbstractDevCmd { - if (player.getGuild().isErrant()) { + if (player.getGuild().isEmptyGuild()) { throwbackError(pc, "Errant's can not place banes"); return; } diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 79511e56..5a2d7fa6 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -328,7 +328,7 @@ public enum BuildingManager { if (building.getOwner().equals(player)) return true; - if (player.getGuild().isErrant()) + if (player.getGuild().isEmptyGuild()) return false; if (building.getGuild().isGuildLeader(player.getObjectUUID())) diff --git a/src/engine/gameManager/GuildManager.java b/src/engine/gameManager/GuildManager.java index c69cf920..75ea7afc 100644 --- a/src/engine/gameManager/GuildManager.java +++ b/src/engine/gameManager/GuildManager.java @@ -61,13 +61,13 @@ public enum GuildManager { if (origin == null) return false; - if (playerCharacter.getGuild().isErrant() == false && GuildStatusController.isGuildLeader(playerCharacter.getGuildStatus())) + if (playerCharacter.getGuild().isEmptyGuild() == false && GuildStatusController.isGuildLeader(playerCharacter.getGuildStatus())) return false; if (playerCharacter.getGuild() != null && playerCharacter.getGuild().isGuildLeader(playerCharacter.getObjectUUID())) return false; - if (playerCharacter.getGuild() != null && !playerCharacter.getGuild().isErrant()){ + if (playerCharacter.getGuild() != null && !playerCharacter.getGuild().isEmptyGuild()){ if (DbManager.GuildQueries.ADD_TO_GUILDHISTORY(playerCharacter.getGuildUUID(), playerCharacter, DateTime.now(), GuildHistoryType.LEAVE)){ GuildHistory guildHistory = new GuildHistory(playerCharacter.getGuildUUID(),playerCharacter.getGuild().getName(),DateTime.now(), GuildHistoryType.LEAVE) ; playerCharacter.getGuildHistory().add(guildHistory); diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 6f493559..f2598353 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1457,7 +1457,7 @@ boolean updateCity = false; return; //make sure mine belongs to guild - if (mine.getOwningGuild().isErrant() || mine.getOwningGuild().getObjectUUID() != sourcePlayer.getGuild().getObjectUUID()) + if (mine.getOwningGuild().isEmptyGuild() || mine.getOwningGuild().getObjectUUID() != sourcePlayer.getGuild().getObjectUUID()) return; //make sure valid resource diff --git a/src/engine/net/client/handlers/AcceptInviteToGuildHandler.java b/src/engine/net/client/handlers/AcceptInviteToGuildHandler.java index ff33c3e9..0b40f7a9 100644 --- a/src/engine/net/client/handlers/AcceptInviteToGuildHandler.java +++ b/src/engine/net/client/handlers/AcceptInviteToGuildHandler.java @@ -80,7 +80,7 @@ public class AcceptInviteToGuildHandler extends AbstractClientMsgHandler { return true; if ( (player.getGuild() != null) && - (player.getGuild().isErrant() == false)) { + (player.getGuild().isEmptyGuild() == false)) { ChatManager.chatGuildError(player, "You already belongs to a guild!"); return true; diff --git a/src/engine/net/client/handlers/AllianceChangeMsgHandler.java b/src/engine/net/client/handlers/AllianceChangeMsgHandler.java index db918d6d..db312f31 100644 --- a/src/engine/net/client/handlers/AllianceChangeMsgHandler.java +++ b/src/engine/net/client/handlers/AllianceChangeMsgHandler.java @@ -46,10 +46,10 @@ public class AllianceChangeMsgHandler extends AbstractClientMsgHandler { Guild toGuild = null; toGuild = Guild.getGuild(msg.getSourceGuildID()); - if (toGuild.isErrant()) + if (toGuild.isEmptyGuild()) return true; - if (player.getGuild().isErrant()) + if (player.getGuild().isEmptyGuild()) return true; diff --git a/src/engine/net/client/handlers/ArcLoginNotifyMsgHandler.java b/src/engine/net/client/handlers/ArcLoginNotifyMsgHandler.java index dd951737..63d4ac49 100644 --- a/src/engine/net/client/handlers/ArcLoginNotifyMsgHandler.java +++ b/src/engine/net/client/handlers/ArcLoginNotifyMsgHandler.java @@ -133,7 +133,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler { DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); } - if (player.getGuild() != null && !player.getGuild().isErrant()) { + if (player.getGuild() != null && !player.getGuild().isEmptyGuild()) { Guild.UpdateClientAlliancesForPlayer(player); } return true; diff --git a/src/engine/net/client/handlers/BanishUnbanishHandler.java b/src/engine/net/client/handlers/BanishUnbanishHandler.java index 7676373c..1bc83365 100644 --- a/src/engine/net/client/handlers/BanishUnbanishHandler.java +++ b/src/engine/net/client/handlers/BanishUnbanishHandler.java @@ -42,7 +42,7 @@ public class BanishUnbanishHandler extends AbstractClientMsgHandler { int target = msg.getTarget(); PlayerCharacter source = origin.getPlayerCharacter(); - if(source == null || source.getGuild().isErrant() || source.getGuild().getObjectUUID() == 0) + if(source == null || source.getGuild().isEmptyGuild() || source.getGuild().getObjectUUID() == 0) return true; if (GuildStatusController.isGuildLeader(source.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(source.getGuildStatus()) == false) diff --git a/src/engine/net/client/handlers/ClaimAssetMsgHandler.java b/src/engine/net/client/handlers/ClaimAssetMsgHandler.java index 50ffb9d6..d1dfda7c 100644 --- a/src/engine/net/client/handlers/ClaimAssetMsgHandler.java +++ b/src/engine/net/client/handlers/ClaimAssetMsgHandler.java @@ -90,7 +90,7 @@ public class ClaimAssetMsgHandler extends AbstractClientMsgHandler { // Errant players cannot claim - if (sourcePlayer.getGuild().isErrant()) + if (sourcePlayer.getGuild().isEmptyGuild()) return true; // Can't claim an object without a blueprint diff --git a/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java b/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java index 639a984c..388a9c8f 100644 --- a/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java +++ b/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java @@ -85,7 +85,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler { // Errant players cannot rename - if (sourcePlayer.getGuild().isErrant()) + if (sourcePlayer.getGuild().isEmptyGuild()) return true; // Can't rename an object without a blueprint @@ -100,7 +100,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler { return true; //dont rename if guild is null - if (building.getGuild().isErrant()) + if (building.getGuild().isEmptyGuild()) return true; if (!ManageCityAssetMsgHandler.playerCanManageNotFriends(sourcePlayer, building)) @@ -131,7 +131,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler { return true; } - if (building.getGuild().isErrant()) + if (building.getGuild().isEmptyGuild()) return true; diff --git a/src/engine/net/client/handlers/DisbandGuildHandler.java b/src/engine/net/client/handlers/DisbandGuildHandler.java index a36e88ca..016ac4b2 100644 --- a/src/engine/net/client/handlers/DisbandGuildHandler.java +++ b/src/engine/net/client/handlers/DisbandGuildHandler.java @@ -52,7 +52,7 @@ public class DisbandGuildHandler extends AbstractClientMsgHandler { guild = player.getGuild(); - if (guild == null || guild.isErrant()) + if (guild == null || guild.isEmptyGuild()) return true; // Don't allow disbanding if a city is owned @@ -86,7 +86,7 @@ public class DisbandGuildHandler extends AbstractClientMsgHandler { // Remove us as a subguild of our nation - if (guild.getNation() != null && Guild.sameGuild(guild, guild.getNation()) == false && guild.getNation().isErrant() == false) + if (guild.getNation() != null && Guild.sameGuild(guild, guild.getNation()) == false && guild.getNation().isEmptyGuild() == false) guild.getNation().removeSubGuild(guild); // Update all online guild players diff --git a/src/engine/net/client/handlers/InviteToGuildHandler.java b/src/engine/net/client/handlers/InviteToGuildHandler.java index 4ccadb4c..84123cca 100644 --- a/src/engine/net/client/handlers/InviteToGuildHandler.java +++ b/src/engine/net/client/handlers/InviteToGuildHandler.java @@ -79,7 +79,7 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler { // get sourcePlayer guild. Verify sourcePlayer player is in guild - if (sourcePlayer.getGuild().getObjectUUID() == 0 || sourcePlayer.getGuild().isErrant()) { + if (sourcePlayer.getGuild().getObjectUUID() == 0 || sourcePlayer.getGuild().isEmptyGuild()) { ChatManager.chatGuildError(sourcePlayer, "You cannot invite someone for errant!"); return true; @@ -107,7 +107,7 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler { if (targetPlayer.isIgnoringPlayer(sourcePlayer)) return true; - if ((targetPlayer.getGuild().isErrant() == false)) { + if ((targetPlayer.getGuild().isEmptyGuild() == false)) { ChatManager.chatGuildError(sourcePlayer, targetPlayer.getFirstName() + " already belongs to a guild!"); return true; diff --git a/src/engine/net/client/handlers/InviteToSubHandler.java b/src/engine/net/client/handlers/InviteToSubHandler.java index 9c16ce90..78578a21 100644 --- a/src/engine/net/client/handlers/InviteToSubHandler.java +++ b/src/engine/net/client/handlers/InviteToSubHandler.java @@ -68,7 +68,7 @@ public class InviteToSubHandler extends AbstractClientMsgHandler { return true; } - if (sourceGuild.isErrant()){ + if (sourceGuild.isEmptyGuild()){ sendChat(source, "You must be in a guild to invite to sub."); return true; } @@ -80,7 +80,7 @@ public class InviteToSubHandler extends AbstractClientMsgHandler { return true; } - if (sourceGuild.getNation().isErrant()) + if (sourceGuild.getNation().isEmptyGuild()) return true; //target must be in a guild diff --git a/src/engine/net/client/handlers/LeaveGuildHandler.java b/src/engine/net/client/handlers/LeaveGuildHandler.java index 3c6173cc..a369faee 100644 --- a/src/engine/net/client/handlers/LeaveGuildHandler.java +++ b/src/engine/net/client/handlers/LeaveGuildHandler.java @@ -57,7 +57,7 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler { // get old Guild Guild oldGuild = playerCharacter.getGuild(); - if (oldGuild == null || oldGuild.isErrant()) { + if (oldGuild == null || oldGuild.isEmptyGuild()) { return true; } diff --git a/src/engine/net/client/handlers/MerchantMsgHandler.java b/src/engine/net/client/handlers/MerchantMsgHandler.java index 687a29f9..9ce314c4 100644 --- a/src/engine/net/client/handlers/MerchantMsgHandler.java +++ b/src/engine/net/client/handlers/MerchantMsgHandler.java @@ -129,12 +129,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { return; } - if (player.getGuild().isErrant()){ + if (player.getGuild().isEmptyGuild()){ ErrorPopupMsg.sendErrorMsg(player, "You do not belong to a guild!"); //Cannot sub as errant guild. return; } - if (player.getGuild().getNation() != null && !player.getGuild().getNation().isErrant()){ + if (player.getGuild().getNation() != null && !player.getGuild().getNation().isEmptyGuild()){ ErrorPopupMsg.sendErrorMsg(player, "You already belong to a nation!"); //Cannot sub as errant guild. return; } diff --git a/src/engine/net/client/handlers/MineWindowChangeHandler.java b/src/engine/net/client/handlers/MineWindowChangeHandler.java index e24c81b4..a39f1c7b 100644 --- a/src/engine/net/client/handlers/MineWindowChangeHandler.java +++ b/src/engine/net/client/handlers/MineWindowChangeHandler.java @@ -9,19 +9,15 @@ package engine.net.client.handlers; import engine.Enum; -import engine.Enum.DispatchChannel; import engine.exception.MsgSendException; import engine.gameManager.BuildingManager; import engine.gameManager.ChatManager; import engine.gameManager.DbManager; import engine.gameManager.SessionManager; -import engine.net.Dispatch; -import engine.net.DispatchMessage; import engine.net.client.ClientConnection; import engine.net.client.msg.ArcMineWindowChangeMsg; import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ErrorPopupMsg; -import engine.net.client.msg.KeepAliveServerClientMsg; import engine.objects.Building; import engine.objects.Guild; import engine.objects.GuildStatusController; @@ -65,7 +61,7 @@ public class MineWindowChangeHandler extends AbstractClientMsgHandler { Guild mineGuild = treeOfLife.getGuild(); - if (mineGuild.isErrant()) + if (mineGuild.isEmptyGuild()) return true; if (!Guild.sameGuild(mineGuild, playerCharacter.getGuild())) diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index 79cc7aa8..98e225d1 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -431,7 +431,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { if (building.getGuild() == null) continue; - if (building.getGuild().isErrant()) + if (building.getGuild().isEmptyGuild()) continue; if (!building.getGuild().equals(serverCity.getGuild()) && !building.getGuild().equals(serverCity.getBane().getOwner().getGuild())) @@ -1384,7 +1384,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Make sure it's not an errant tree - if ( (city.getGuild() == null || city.getGuild().isErrant() == true)) { + if ( (city.getGuild() == null || city.getGuild().isEmptyGuild() == true)) { PlaceAssetMsg.sendPlaceAssetError(origin, 18, ""); //"There are no guild trees to be found" return false; } diff --git a/src/engine/net/client/handlers/TaxCityMsgHandler.java b/src/engine/net/client/handlers/TaxCityMsgHandler.java index e03a6528..895b132d 100644 --- a/src/engine/net/client/handlers/TaxCityMsgHandler.java +++ b/src/engine/net/client/handlers/TaxCityMsgHandler.java @@ -68,7 +68,7 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler { } - if (playerGuild == null || playerGuild.isErrant()){ + if (playerGuild == null || playerGuild.isEmptyGuild()){ ErrorPopupMsg.sendErrorMsg(player, "You must belong to a guild to do that!"); return true; } diff --git a/src/engine/net/client/msg/GuildTreeStatusMsg.java b/src/engine/net/client/msg/GuildTreeStatusMsg.java index 9a6c2666..389d0711 100644 --- a/src/engine/net/client/msg/GuildTreeStatusMsg.java +++ b/src/engine/net/client/msg/GuildTreeStatusMsg.java @@ -100,7 +100,7 @@ public class GuildTreeStatusMsg extends ClientNetMsg { canAccess = this.canModify(); canBind = 0; - if (player.getGuild() != null && this.treeOfLife.getGuild() != null && !this.treeOfLife.getGuild().isErrant() + if (player.getGuild() != null && this.treeOfLife.getGuild() != null && !this.treeOfLife.getGuild().isEmptyGuild() && player.getGuild().getNation() == this.treeOfLife.getGuild().getNation()) canBind = 1; diff --git a/src/engine/net/client/msg/OpenFriendsCondemnListMsg.java b/src/engine/net/client/msg/OpenFriendsCondemnListMsg.java index b28fb317..b73dd300 100644 --- a/src/engine/net/client/msg/OpenFriendsCondemnListMsg.java +++ b/src/engine/net/client/msg/OpenFriendsCondemnListMsg.java @@ -644,7 +644,7 @@ public class OpenFriendsCondemnListMsg extends ClientNetMsg { writer.putInt(guild.getObjectType().ordinal()); writer.putInt(guild.getObjectUUID()); - if (!guild.getNation().isErrant()) { + if (!guild.getNation().isEmptyGuild()) { writer.putInt(guild.getNation().getObjectType().ordinal()); writer.putInt(guild.getNation().getObjectUUID()); }else{ @@ -741,7 +741,7 @@ public class OpenFriendsCondemnListMsg extends ClientNetMsg { writer.putInt(heraldryCharacter.getGuild().getObjectType().ordinal()); writer.putInt(heraldryCharacter.getGuild().getObjectUUID()); - if (!heraldryCharacter.getGuild().getNation().isErrant()) { + if (!heraldryCharacter.getGuild().getNation().isEmptyGuild()) { writer.putInt(heraldryCharacter.getGuild().getNation().getObjectType().ordinal()); writer.putInt(heraldryCharacter.getGuild().getNation().getObjectUUID()); }else{ diff --git a/src/engine/objects/Bane.java b/src/engine/objects/Bane.java index 22370a67..45774964 100644 --- a/src/engine/objects/Bane.java +++ b/src/engine/objects/Bane.java @@ -120,7 +120,7 @@ public final class Bane { baningGuild = player.getGuild(); - if (baningGuild.getNation().isErrant()) { + if (baningGuild.getNation().isEmptyGuild()) { PlaceAssetMsg.sendPlaceAssetError( origin, 55, ""); // You must be in a Nation return false; } @@ -464,7 +464,7 @@ public final class Bane { public static Bane getBaneByAttackerGuild(Guild guild) { - if (guild == null || guild.isErrant()) + if (guild == null || guild.isEmptyGuild()) return null; ArrayList baneList; @@ -620,10 +620,10 @@ public final class Bane { return isErrant; - if (this.getOwner().getGuild().isErrant() == true) + if (this.getOwner().getGuild().isEmptyGuild() == true) return isErrant; - if (this.getOwner().getGuild().getNation().isErrant() == true) + if (this.getOwner().getGuild().getNation().isEmptyGuild() == true) return isErrant; // Bane passes validation diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 0d8a4ef1..8dbe69aa 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -159,7 +159,7 @@ public class City extends AbstractWorldObject { if (this.motto.isEmpty()){ Guild guild = this.getGuild(); - if (guild != null && guild.isErrant() == false) + if (guild != null && guild.isEmptyGuild() == false) this.motto = guild.getMotto(); } @@ -489,7 +489,7 @@ public class City extends AbstractWorldObject { // Begin serializing nation guild info - if (rulingNation.isErrant()){ + if (rulingNation.isEmptyGuild()){ writer.putInt(rulingGuild.getObjectType().ordinal()); writer.putInt(rulingGuild.getObjectUUID()); } @@ -502,7 +502,7 @@ public class City extends AbstractWorldObject { // Serialize nation name - if (rulingNation.isErrant()) + if (rulingNation.isEmptyGuild()) writer.putString("None"); else writer.putString(rulingNation.getName()); @@ -516,7 +516,7 @@ public class City extends AbstractWorldObject { writer.putInt(city.population); - if (rulingNation.isErrant()) + if (rulingNation.isEmptyGuild()) writer.putString(" "); else writer.putString(Guild.GetGL(rulingNation).getFirstName() + ' ' + Guild.GetGL(rulingNation).getLastName()); @@ -1126,7 +1126,7 @@ public class City extends AbstractWorldObject { sourceNation = sourcePlayer.getGuild().getNation(); - if (sourceGuild.isErrant()) + if (sourceGuild.isEmptyGuild()) return; //cant claim tree with owned tree. @@ -1147,7 +1147,7 @@ public class City extends AbstractWorldObject { // If currently a sub of another guild, desub when // claiming your new tree and set as Landed - if (!sourceNation.isErrant() && sourceNation != sourceGuild) { + if (!sourceNation.isEmptyGuild() && sourceNation != sourceGuild) { if (!DbManager.GuildQueries.UPDATE_PARENT(sourceGuild.getObjectUUID(), MBServerStatics.worldUUID)) { ChatManager.chatGuildError((PlayerCharacter) sourcePlayer, "A Serious error has occurred. Please post details for to ensure transaction integrity"); return; @@ -1221,7 +1221,7 @@ public class City extends AbstractWorldObject { if (sourceGuild == null) return false; - if (sourceGuild.isErrant()) + if (sourceGuild.isEmptyGuild()) return false; cityZone = this.parentZone; @@ -1364,7 +1364,7 @@ public class City extends AbstractWorldObject { } - if (playerGuild == null || playerGuild.isErrant()){ + if (playerGuild == null || playerGuild.isEmptyGuild()){ ErrorPopupMsg.sendErrorMsg(player, "You must belong to a guild to do that!"); return true; } diff --git a/src/engine/objects/Experience.java b/src/engine/objects/Experience.java index c0ae278a..ab5c2789 100644 --- a/src/engine/objects/Experience.java +++ b/src/engine/objects/Experience.java @@ -403,7 +403,7 @@ public class Experience { xp -= (penalty * 0.01) * xp; // Errant Penalty Calculation - if (pc.getGuild().isErrant()) + if (pc.getGuild().isEmptyGuild()) xp *= 0.6; } @@ -431,7 +431,7 @@ public class Experience { // Errant penalty if (xp != 1) - if (killer.getGuild().isErrant()) + if (killer.getGuild().isEmptyGuild()) xp *= .6; // Grant XP diff --git a/src/engine/objects/Guild.java b/src/engine/objects/Guild.java index b3e096ff..650bca72 100644 --- a/src/engine/objects/Guild.java +++ b/src/engine/objects/Guild.java @@ -37,8 +37,6 @@ import org.pmw.tinylog.Logger; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Timestamp; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; @@ -322,7 +320,7 @@ public class Guild extends AbstractWorldObject { if (ac == null) return false; // errant guilds cant be guild leader. - if (this.isErrant()) + if (this.isEmptyGuild()) return false; if (!DbManager.GuildQueries.SET_GUILD_LEADER(ac.getObjectUUID(), this.getObjectUUID())) { @@ -348,7 +346,7 @@ public class Guild extends AbstractWorldObject { if (ac == null) return false; // errant guilds cant be guild leader. - if (this.isErrant()) + if (this.isEmptyGuild()) return false; if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)) @@ -401,7 +399,7 @@ public class Guild extends AbstractWorldObject { * Utils */ - public boolean isErrant() { + public boolean isEmptyGuild() { return this.getObjectUUID() == Guild.errantGuild.getObjectUUID(); } @@ -415,7 +413,7 @@ public class Guild extends AbstractWorldObject { public static boolean sameGuildExcludeErrant(Guild a, Guild b) { if (a == null || b == null) return false; - if (a.isErrant() || b.isErrant()) + if (a.isEmptyGuild() || b.isEmptyGuild()) return false; return a.getObjectUUID() == b.getObjectUUID(); } @@ -423,7 +421,7 @@ public class Guild extends AbstractWorldObject { public static boolean sameGuildIncludeErrant(Guild a, Guild b) { if (a == null || b == null) return false; - if (a.isErrant() || b.isErrant()) + if (a.isEmptyGuild() || b.isEmptyGuild()) return true; return a.getObjectUUID() == b.getObjectUUID(); } @@ -445,7 +443,7 @@ public class Guild extends AbstractWorldObject { return true; if (a.nation == null || b.nation == null) 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) { @@ -465,7 +463,7 @@ public class Guild extends AbstractWorldObject { */ 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."); return; } @@ -830,9 +828,9 @@ public class Guild extends AbstractWorldObject { this.guildState = GuildState.Nation; else if (this.nation.equals(this)) this.guildState = GuildState.Sovereign; - else if (!this.nation.isErrant() && this.cityUUID != 0) + else if (!this.nation.isEmptyGuild() && this.cityUUID != 0) this.guildState = GuildState.Province; - else if (!this.nation.isErrant()) + else if (!this.nation.isEmptyGuild()) this.guildState = GuildState.Sworn; else this.guildState = GuildState.Errant; @@ -1253,7 +1251,7 @@ public class Guild extends AbstractWorldObject { if (guild == null) return roster; - if (guild.isErrant()) + if (guild.isEmptyGuild()) return roster; if (DbManager.getList(GameObjectType.PlayerCharacter) == null) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 8503028e..26b54f28 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -104,7 +104,7 @@ public class Mine extends AbstractGameObject { this.owningGuild = Guild.getGuild(ownerUID); Guild nation = null; - if (this.owningGuild.isErrant()) { + if (this.owningGuild.isEmptyGuild()) { this.guildName = ""; this.guildTag = GuildTag.ERRANT; nation = Guild.getErrantGuild(); @@ -115,7 +115,7 @@ public class Mine extends AbstractGameObject { nation = this.owningGuild.getNation(); } - if (!nation.isErrant()) { + if (!nation.isEmptyGuild()) { this.nationName = nation.getName(); this.nationTag = nation.getGuildTag(); } else { @@ -152,10 +152,10 @@ public class Mine extends AbstractGameObject { return; - if (mine.getGuild().isErrant()) + if (mine.getGuild().isEmptyGuild()) return; - if (mine.getGuild().getNation().isErrant()) + if (mine.getGuild().getNation().isEmptyGuild()) return; if (mine.getTimeStamp("MineAttack") > System.currentTimeMillis()) @@ -298,7 +298,7 @@ public class Mine extends AbstractGameObject { // If a mine is active serialize current datetime irrespective // of any claim. - if (mineNatonGuild.isErrant() == false && mine.isActive == false) { + if (mineNatonGuild.isEmptyGuild() == false && mine.isActive == false) { int guildWOO = mineNatonGuild.getNation().getMineTime(); LocalDateTime guildMineTime = mineOpenTime.withHour(guildWOO); @@ -401,10 +401,10 @@ public class Mine extends AbstractGameObject { playerGuild = playerCharacter.getGuild(); - if (playerGuild.isErrant()) + if (playerGuild.isEmptyGuild()) return false; - if (playerGuild.getNation().isErrant()) + if (playerGuild.getNation().isEmptyGuild()) return false; //Get a count of nation mines, can't go over capital tol rank. @@ -523,7 +523,7 @@ public class Mine extends AbstractGameObject { return false; } - if (this.owningGuild.isErrant() || this.owningGuild.getNation().isErrant()) + if (this.owningGuild.isEmptyGuild() || this.owningGuild.getNation().isEmptyGuild()) return false; //Update ownership to map @@ -580,7 +580,7 @@ public class Mine extends AbstractGameObject { } public boolean depositMineResources() { - if (this.owningGuild.isErrant()) + if (this.owningGuild.isEmptyGuild()) return false; if (this.owningGuild.getOwnedCity() == null) @@ -667,7 +667,7 @@ public class Mine extends AbstractGameObject { if (this.isExpansion()) return (int) totalModded; - if (this.owningGuild.isErrant() == false) { + if (this.owningGuild.isEmptyGuild() == false) { if (this.owningGuild.getOwnedCity() != null) { float distanceSquared = this.owningGuild.getOwnedCity().getLoc().distanceSquared2D(mineBuilding.getLoc()); diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index b91547f1..2d2698fc 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -262,7 +262,7 @@ public class NPC extends AbstractCharacter { else this.guild = Guild.getGuild(guildID); - if (guildID != 0 && (this.guild == null || this.guild.isErrant())) + if (guildID != 0 && (this.guild == null || this.guild.isEmptyGuild())) NPC.Oprhans.add(currentID); else if(this.building == null && buildingID > 0) { NPC.Oprhans.add(currentID); diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 0545a150..af72c69e 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -529,7 +529,7 @@ public class PlayerCharacter extends AbstractCharacter { aN = attacker.getGuild().getNation(); if (this.getGuild() != null) tN = this.getGuild().getNation(); - if (aN == null || tN == null || aN.isErrant() || Guild.sameGuild(aN, tN) || this.isDeathShroud()) { + if (aN == null || tN == null || aN.isEmptyGuild() || Guild.sameGuild(aN, tN) || this.isDeathShroud()) { //skip giving xp if same guild or attacker is errant, or target is in death shroud. } else { doPVPEXP = true; @@ -1458,7 +1458,7 @@ public class PlayerCharacter extends AbstractCharacter { Building returnBuilding; - if (player.getGuild() == null || player.getGuild().isErrant()) + if (player.getGuild() == null || player.getGuild().isEmptyGuild()) return null; if (player.getGuild().getOwnedCity() == null){ @@ -1899,7 +1899,7 @@ public void dismissNecroPets() { Guild g = this.guild; - if (g == null || g.isErrant() || GuildStatusController.isGuildLeader(guildStatus)) + if (g == null || g.isEmptyGuild() || GuildStatusController.isGuildLeader(guildStatus)) return; //check level @@ -4584,7 +4584,7 @@ public void dismissNecroPets() { int guildID = 0; - if (!value.isErrant()) + if (!value.isEmptyGuild()) guildID = value.getObjectUUID(); DbManager.PlayerCharacterQueries.UPDATE_GUILD(this, guildID); super.setGuild(value); @@ -5306,7 +5306,7 @@ public void dismissNecroPets() { public static int GetPlayerRealmTitle(PlayerCharacter player){ - if (player.getGuild().isErrant()) + if (player.getGuild().isEmptyGuild()) return 0; if (!player.getGuild().isGuildLeader(player.getObjectUUID())) return 0; diff --git a/src/engine/workthreads/HourlyJobThread.java b/src/engine/workthreads/HourlyJobThread.java index 02c8e72d..e28417e7 100644 --- a/src/engine/workthreads/HourlyJobThread.java +++ b/src/engine/workthreads/HourlyJobThread.java @@ -183,7 +183,7 @@ public class HourlyJobThread implements Runnable { // Open Errant Mines - if (mine.getOwningGuild().isErrant()) { + if (mine.getOwningGuild().isEmptyGuild()) { mine.handleStartMineWindow(); Mine.setLastChange(System.currentTimeMillis()); continue;