Bugfix: empty guild not errant
This commit is contained in:
@@ -54,6 +54,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
|||||||
GuildCreationFinalizeMsg msg;
|
GuildCreationFinalizeMsg msg;
|
||||||
Enum.GuildType charterType;
|
Enum.GuildType charterType;
|
||||||
Guild newGuild;
|
Guild newGuild;
|
||||||
|
Guild playerGuild;
|
||||||
ItemBase itemBase;
|
ItemBase itemBase;
|
||||||
Item charter;
|
Item charter;
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
@@ -61,9 +62,9 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
|||||||
msg = (GuildCreationFinalizeMsg) baseMsg;
|
msg = (GuildCreationFinalizeMsg) baseMsg;
|
||||||
|
|
||||||
player = SessionManager.getPlayerCharacter(origin);
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
playerGuild = player.getGuild();
|
||||||
|
|
||||||
boolean isGuildLeader = GuildStatusController.isGuildLeader(player.getGuildStatus());
|
if (playerGuild.isEmptyGuild() == false && player.getGuild().getGuildLeaderUUID() == player.getObjectUUID()) {
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) || player.getGuild() != null && player.getGuild().getGuildLeaderUUID() == player.getObjectUUID()) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(player, GuildManager.MUST_LEAVE_GUILD);
|
ErrorPopupMsg.sendErrorPopup(player, GuildManager.MUST_LEAVE_GUILD);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -77,30 +78,22 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
itemBase = charter.getItemBase();
|
itemBase = charter.getItemBase();
|
||||||
|
|
||||||
|
|
||||||
// Item must be a valid charterType (type 10 in db)
|
// Item must be a valid charterType (type 10 in db)
|
||||||
|
|
||||||
if (itemBase == null || (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)) {
|
if (itemBase == null || (itemBase.getType().equals(ItemType.GUILDCHARTER) == false)) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);
|
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
charterType = Enum.GuildType.getGuildTypeFromCharter(itemBase);
|
charterType = Enum.GuildType.getGuildTypeFromCharter(itemBase);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (charterType == null){
|
if (charterType == null){
|
||||||
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);
|
ErrorPopupMsg.sendErrorPopup(player, GuildManager.NO_CHARTER_FOUND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Validate Guild Tags
|
//Validate Guild Tags
|
||||||
|
|
||||||
if (!msg.getGuildTag().isValid()) {
|
if (!msg.getGuildTag().isValid()) {
|
||||||
@@ -110,11 +103,9 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Validation passes. Leave current guild and create new one.
|
// 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);
|
player.getGuild().removePlayer(player,GuildHistoryType.LEAVE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int leadershipType = ((msg.getICVoteFlag() << 1) | msg.getMemberVoteFlag());
|
int leadershipType = ((msg.getICVoteFlag() << 1) | msg.getMemberVoteFlag());
|
||||||
|
|
||||||
newGuild = new Guild( msg.getName(),null, charterType.ordinal(),
|
newGuild = new Guild( msg.getName(),null, charterType.ordinal(),
|
||||||
|
|||||||
Reference in New Issue
Block a user