Fixed probable giveResidentialSkills NPE.
This commit is contained in:
		| @@ -88,6 +88,10 @@ public class CastleManager | ||||
| 	 | ||||
| 	public Castle getCastleByOwner(Clan clan) | ||||
| 	{ | ||||
| 		if (clan == null) | ||||
| 		{ | ||||
| 			return null; | ||||
| 		} | ||||
| 		for (Castle temp : _castles.values()) | ||||
| 		{ | ||||
| 			if (temp.getOwnerId() == clan.getId()) | ||||
|   | ||||
| @@ -74,6 +74,10 @@ public class FortManager | ||||
| 	 | ||||
| 	public Fort getFortByOwner(Clan clan) | ||||
| 	{ | ||||
| 		if (clan == null) | ||||
| 		{ | ||||
| 			return null; | ||||
| 		} | ||||
| 		for (Fort f : _forts.values()) | ||||
| 		{ | ||||
| 			if (f.getOwnerClan() == clan) | ||||
|   | ||||
| @@ -63,6 +63,8 @@ import org.l2jmobius.gameserver.model.interfaces.IIdentifiable; | ||||
| import org.l2jmobius.gameserver.model.interfaces.INamable; | ||||
| import org.l2jmobius.gameserver.model.itemcontainer.ClanWarehouse; | ||||
| import org.l2jmobius.gameserver.model.itemcontainer.ItemContainer; | ||||
| import org.l2jmobius.gameserver.model.siege.Castle; | ||||
| import org.l2jmobius.gameserver.model.siege.Fort; | ||||
| import org.l2jmobius.gameserver.model.skill.CommonSkill; | ||||
| import org.l2jmobius.gameserver.model.skill.Skill; | ||||
| import org.l2jmobius.gameserver.model.variables.ClanVariables; | ||||
| @@ -440,6 +442,7 @@ public class Clan implements IIdentifiable, INamable | ||||
| 			LOGGER.warning("Member Object ID: " + objectId + " not found in clan while trying to remove"); | ||||
| 			return; | ||||
| 		} | ||||
| 		 | ||||
| 		final int leadssubpledge = getLeaderSubPledge(objectId); | ||||
| 		if (leadssubpledge != 0) | ||||
| 		{ | ||||
| @@ -484,10 +487,12 @@ public class Clan implements IIdentifiable, INamable | ||||
| 			} | ||||
| 		} | ||||
| 		exMember.saveApprenticeAndSponsor(0, 0); | ||||
| 		 | ||||
| 		if (Config.REMOVE_CASTLE_CIRCLETS) | ||||
| 		{ | ||||
| 			CastleManager.getInstance().removeCirclet(exMember, getCastleId()); | ||||
| 		} | ||||
| 		 | ||||
| 		if (exMember.isOnline()) | ||||
| 		{ | ||||
| 			final Player player = exMember.getPlayer(); | ||||
| @@ -509,16 +514,23 @@ public class Clan implements IIdentifiable, INamable | ||||
| 			player.getEffectList().stopSkillEffects(SkillFinishType.REMOVED, CommonSkill.CLAN_ADVENT.getId()); | ||||
| 			 | ||||
| 			// remove Residential skills | ||||
| 			if (player.getClan().getCastleId() > 0) | ||||
| 			if (getCastleId() > 0) | ||||
| 			{ | ||||
| 				CastleManager.getInstance().getCastleByOwner(player.getClan()).removeResidentialSkills(player); | ||||
| 				final Castle castle = CastleManager.getInstance().getCastleByOwner(this); | ||||
| 				if (castle != null) | ||||
| 				{ | ||||
| 					castle.removeResidentialSkills(player); | ||||
| 				} | ||||
| 			} | ||||
| 			if (player.getClan().getFortId() > 0) | ||||
| 			if (getFortId() > 0) | ||||
| 			{ | ||||
| 				FortManager.getInstance().getFortByOwner(player.getClan()).removeResidentialSkills(player); | ||||
| 				final Fort fort = FortManager.getInstance().getFortByOwner(this); | ||||
| 				if (fort != null) | ||||
| 				{ | ||||
| 					fort.removeResidentialSkills(player); | ||||
| 				} | ||||
| 			} | ||||
| 			player.sendSkillList(); | ||||
| 			 | ||||
| 			player.setClan(null); | ||||
| 			 | ||||
| 			// players leaving from clan academy have no penalty | ||||
|   | ||||
| @@ -58,6 +58,7 @@ import org.l2jmobius.gameserver.model.punishment.PunishmentAffect; | ||||
| import org.l2jmobius.gameserver.model.punishment.PunishmentType; | ||||
| import org.l2jmobius.gameserver.model.quest.Quest; | ||||
| import org.l2jmobius.gameserver.model.residences.ClanHall; | ||||
| import org.l2jmobius.gameserver.model.siege.Castle; | ||||
| import org.l2jmobius.gameserver.model.siege.Fort; | ||||
| import org.l2jmobius.gameserver.model.siege.FortSiege; | ||||
| import org.l2jmobius.gameserver.model.siege.Siege; | ||||
| @@ -301,14 +302,22 @@ public class EnterWorld implements IClientIncomingPacket | ||||
| 			} | ||||
| 			 | ||||
| 			// Residential skills support | ||||
| 			if (player.getClan().getCastleId() > 0) | ||||
| 			if (clan.getCastleId() > 0) | ||||
| 			{ | ||||
| 				CastleManager.getInstance().getCastleByOwner(clan).giveResidentialSkills(player); | ||||
| 				final Castle castle = CastleManager.getInstance().getCastleByOwner(clan); | ||||
| 				if (castle != null) | ||||
| 				{ | ||||
| 					castle.giveResidentialSkills(player); | ||||
| 				} | ||||
| 			} | ||||
| 			 | ||||
| 			if (player.getClan().getFortId() > 0) | ||||
| 			if (clan.getFortId() > 0) | ||||
| 			{ | ||||
| 				FortManager.getInstance().getFortByOwner(clan).giveResidentialSkills(player); | ||||
| 				final Fort fort = FortManager.getInstance().getFortByOwner(clan); | ||||
| 				if (fort != null) | ||||
| 				{ | ||||
| 					fort.giveResidentialSkills(player); | ||||
| 				} | ||||
| 			} | ||||
| 			 | ||||
| 			showClanNotice = clan.isNoticeEnabled(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment