private static final void dissolveClan(L2PcInstance player, int clanId) { if (!player.isClanLeader()) { player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT)); return; } final L2Clan clan = player.getClan(); if (clan.getAllyId() != 0) { player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISPERSE_THE_CLANS_IN_ALLY)); return; } if (clan.isAtWar()) { player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_IN_WAR)); return; } if (clan.getHasCastle() != 0 || clan.getHasHideout() != 0 || clan.getHasFort() != 0) { player.sendPacket( new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_OWNING_CLAN_HALL_OR_CASTLE)); return; } for (Castle castle : CastleManager.getInstance().getCastles()) { if (SiegeManager.getInstance().checkIsRegistered(clan, castle.getCastleId())) { player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_IN_SIEGE)); return; } } for (Fort fort : FortManager.getInstance().getForts()) { if (FortSiegeManager.getInstance().checkIsRegistered(clan, fort.getFortId())) { player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_IN_SIEGE)); return; } } if (player.isInsideZone(L2PcInstance.ZONE_SIEGE)) { player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_IN_SIEGE)); return; } if (clan.getDissolvingExpiryTime() > System.currentTimeMillis()) { player.sendPacket(new SystemMessage(SystemMessageId.DISSOLUTION_IN_PROGRESS)); return; } clan.setDissolvingExpiryTime( System.currentTimeMillis() + Config.ALT_CLAN_DISSOLVE_DAYS * 86400000L); // 24*60*60*1000 = 86400000 clan.updateClanInDB(); ClanTable.getInstance().scheduleRemoveClan(clan.getClanId()); // The clan leader should take the XP penalty of a full death. player.deathPenalty(false, false, false); }
public L2SiegeFlagInstance( L2PcInstance player, int objectId, L2NpcTemplate template, boolean advanced, boolean outPost) { super(objectId, template); setInstanceType(InstanceType.L2SiegeFlagInstance); if (TerritoryWarManager.getInstance().isTWInProgress()) { _clan = player.getClan(); _player = player; _canTalk = false; if (_clan == null) deleteMe(); if (outPost) { _isAdvanced = false; setIsInvul(true); } else { _isAdvanced = advanced; setIsInvul(false); } getStatus(); return; } _clan = player.getClan(); _player = player; _canTalk = true; _siege = SiegeManager.getInstance().getSiege(_player.getX(), _player.getY(), _player.getZ()); if (_siege == null) _siege = FortSiegeManager.getInstance().getSiege(_player.getX(), _player.getY(), _player.getZ()); if (_siege == null) _siege = CHSiegeManager.getInstance().getSiege(player); if (_clan == null || _siege == null) { throw new NullPointerException(getClass().getSimpleName() + ": Initialization failed."); } L2SiegeClan sc = _siege.getAttackerClan(_clan); if (sc == null) throw new NullPointerException(getClass().getSimpleName() + ": Cannot find siege clan."); sc.addFlag(this); _isAdvanced = advanced; getStatus(); setIsInvul(false); }