State being set manually

This commit is contained in:
2026-05-10 09:32:07 -04:00
parent b2bd3b7a92
commit 49005c6647
2 changed files with 35 additions and 38 deletions
@@ -37,7 +37,7 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
PlayerCharacter player;
SwearInGuildMsg swearInMsg;
Guild targetGuild;
Guild protectorate;
Guild nation;
Dispatch dispatch;
@@ -47,9 +47,9 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
if (player == null)
return true;
targetGuild = (Guild) DbManager.getObject(GameObjectType.Guild, swearInMsg.getGuildUUID());
protectorate = (Guild) DbManager.getObject(GameObjectType.Guild, swearInMsg.getGuildUUID());
if (targetGuild == null) {
if (protectorate == null) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
return true;
}
@@ -66,13 +66,13 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
ErrorPopupMsg.sendErrorMsg(player, "Your guild is not a nation!");
return true;
}
if (!nation.getSubGuildList().contains(targetGuild)) {
if (!nation.getSubGuildList().contains(protectorate)) {
ErrorPopupMsg.sendErrorMsg(player, "Your do not have such authority!");
return true;
}
if (!Guild.canSwearIn(targetGuild)) {
ErrorPopupMsg.sendErrorMsg(player, targetGuild.getGuildState().name() + "cannot be sworn in");
if (!Guild.canSwearIn(protectorate)) {
ErrorPopupMsg.sendErrorMsg(player, protectorate.getGuildState().name() + "cannot be sworn in");
return true;
}
@@ -81,29 +81,29 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
return true;
}
if (!DbManager.GuildQueries.UPDATE_PARENT(targetGuild.getObjectUUID(), nation.getObjectUUID())) {
if (!DbManager.GuildQueries.UPDATE_PARENT(protectorate.getObjectUUID(), nation.getObjectUUID())) {
ErrorPopupMsg.sendErrorMsg(player, "A Serious error has occured. Please post details for to ensure transaction integrity");
return true;
}
switch (targetGuild.getGuildState()) {
case Petitioner:
GuildManager.updateAllGuildBinds(targetGuild, nation.getOwnedCity());
break;
case Protectorate:
break;
default:
//shouldn't get here.
break;
}
//shouldn't get here.
if (protectorate.getGuildState().equals(GuildState.Petitioner))
GuildManager.updateAllGuildBinds(protectorate, nation.getOwnedCity());
//update Guild state.
targetGuild.setNation(nation);
GuildManager.updateAllGuildTags(targetGuild);
targetGuild.upgradeGuildState(false);
if (protectorate.getNation().isEmptyGuild())
protectorate.setGuildState(GuildState.Sworn);
else
protectorate.setGuildState(GuildState.Protectorate);
protectorate.setNation(nation);
GuildManager.updateAllGuildTags(protectorate);
protectorate.upgradeGuildState(false);
if (nation.getGuildState() == GuildState.Sovereign)
nation.upgradeGuildState(true);
nation.setGuildState(GuildState.Nation);
SendGuildEntryMsg msg = new SendGuildEntryMsg(player);
dispatch = Dispatch.borrow(player, msg);
@@ -117,7 +117,7 @@ public class SwearInGuildHandler extends AbstractClientMsgHandler {
ChatManager.chatGuildInfo(member, "Your Guild is now a Nation!");
}
ArrayList<PlayerCharacter> swornMembers = SessionManager.getActivePCsInGuildID(targetGuild.getObjectUUID());
ArrayList<PlayerCharacter> swornMembers = SessionManager.getActivePCsInGuildID(protectorate.getObjectUUID());
for (PlayerCharacter member : swornMembers) {
ChatManager.chatGuildInfo(member, "Your Guild has sword fealty to " + nation.getName() + '.');