From 8dc647fb4f50637917afb8f432b212afd4555d34 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 18 Feb 2023 09:30:39 -0500 Subject: [PATCH] Bugfix: empty guild not errant --- .../GuildCreationFinalizeHandler.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java b/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java index 57295aa1..29b4e055 100644 --- a/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java +++ b/src/engine/net/client/handlers/GuildCreationFinalizeHandler.java @@ -54,6 +54,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { GuildCreationFinalizeMsg msg; Enum.GuildType charterType; Guild newGuild; + Guild playerGuild; ItemBase itemBase; Item charter; Dispatch dispatch; @@ -61,9 +62,9 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { msg = (GuildCreationFinalizeMsg) baseMsg; player = SessionManager.getPlayerCharacter(origin); + playerGuild = player.getGuild(); - boolean isGuildLeader = GuildStatusController.isGuildLeader(player.getGuildStatus()); - if (GuildStatusController.isGuildLeader(player.getGuildStatus()) || player.getGuild() != null && player.getGuild().getGuildLeaderUUID() == player.getObjectUUID()) { + if (playerGuild.isEmptyGuild() == false && player.getGuild().getGuildLeaderUUID() == player.getObjectUUID()) { ErrorPopupMsg.sendErrorPopup(player, GuildManager.MUST_LEAVE_GUILD); return true; } @@ -77,30 +78,22 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { return true; } - - itemBase = charter.getItemBase(); - // Item must be a valid charterType (type 10 in db) if (itemBase == null || (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)) { ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND); return true; } - charterType = Enum.GuildType.getGuildTypeFromCharter(itemBase); - + charterType = Enum.GuildType.getGuildTypeFromCharter(itemBase); if (charterType == null){ ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND); return true; } - - - - //Validate Guild Tags if (!msg.getGuildTag().isValid()) { @@ -110,11 +103,9 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { // Validation passes. Leave current guild and create new one. - if (player.getGuild() != null && player.getGuild().getObjectUUID() != 0) + if (player.getGuild() != null && player.getGuild().isEmptyGuild() == false) player.getGuild().removePlayer(player,GuildHistoryType.LEAVE); - - int leadershipType = ((msg.getICVoteFlag() << 1) | msg.getMemberVoteFlag()); newGuild = new Guild( msg.getName(),null, charterType.ordinal(),