@ -20,6 +20,7 @@ import engine.net.client.msg.ClientNetMsg;
@@ -20,6 +20,7 @@ import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.guild.LeaveGuildMsg ;
import engine.objects.Guild ;
import engine.objects.GuildStatusController ;
import engine.objects.Mine ;
import engine.objects.PlayerCharacter ;
public class LeaveGuildHandler extends AbstractClientMsgHandler {
@ -35,35 +36,39 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
@@ -35,35 +36,39 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
// get PlayerCharacter of person leaving invite
PlayerCharacter sourcePlay er = SessionManager . getPlayerCharacter ( origin ) ;
PlayerCharacter playerCharact er = SessionManager . getPlayerCharacter ( origin ) ;
if ( sourcePlay er = = null )
if ( playerCharact er = = null )
return true ;
// Guild leader can't leave guild. must pass GL or disband
if ( GuildStatusController . isGuildLeader ( sourcePlay er. getGuildStatus ( ) ) ) {
if ( GuildStatusController . isGuildLeader ( playerCharact er. getGuildStatus ( ) ) ) {
msg . setMessage ( "You must switch leadership of your guild before leaving!" ) ;
dispatch = Dispatch . borrow ( sourcePlay er, msg ) ;
dispatch = Dispatch . borrow ( playerCharact er, msg ) ;
DispatchMessage . dispatchMsgDispatch ( dispatch , engine . Enum . DispatchChannel . SECONDARY ) ;
return true ;
}
// Release all mine claims
Mine . releaseMineClaims ( playerCharacter ) ;
// get old Guild
Guild oldGuild = sourcePlayer . getGuild ( ) ;
Guild oldGuild = playerCharact er. getGuild ( ) ;
if ( oldGuild = = null | | oldGuild . isErrant ( ) ) {
return true ;
}
// Send left guild message to rest of guild
ChatManager . chatGuildInfo ( oldGuild , sourcePlay er. getFirstName ( ) + " has left the guild." ) ;
ChatManager . chatGuildInfo ( oldGuild , playerCharact er. getFirstName ( ) + " has left the guild." ) ;
oldGuild . removePlayer ( sourcePlay er, GuildHistoryType . LEAVE ) ;
oldGuild . removePlayer ( playerCharact er, GuildHistoryType . LEAVE ) ;
// Send message back to client
msg . setMessage ( "You have left the guild." ) ;
dispatch = Dispatch . borrow ( sourcePlay er, msg ) ;
dispatch = Dispatch . borrow ( playerCharact er, msg ) ;
DispatchMessage . dispatchMsgDispatch ( dispatch , engine . Enum . DispatchChannel . SECONDARY ) ;
return true ;