{
String pledgeName = st.nextToken();
L2Clan clan = ClanTable.getInstance().createClan(target, pledgeName);
if(clan != null)
{
target.sendPacket(new PledgeShowInfoUpdate(clan));
target.sendUserInfo(true);
target.sendPacket(Msg.CLAN_HAS_BEEN_CREATED);
return true;
}
}
catch(Exception e)
{
}
}
else if(action.equals("dismiss"))
{
if(target.getClan() == null)
{
activeChar.sendPacket(Msg.INVALID_TARGET);
return false;
}
SiegeManager.removeSiegeSkills(target);
for(L2Player clanMember : target.getClan().getOnlineMembers(0))
{
clanMember.setClan(null);
clanMember.setTitle(null);
clanMember.sendPacket(Msg.CLAN_HAS_DISPERSED);
clanMember.broadcastUserInfo(true);
}
ThreadConnection con = null;
FiltredPreparedStatement statement = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("UPDATE characters SET clanid = 0 WHERE clanid=?");
statement.setInt(1, target.getClanId());
statement.execute();
DatabaseUtils.closeStatement(statement);
statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?");
statement.setInt(1, target.getClanId());
statement.execute();
DatabaseUtils.closeStatement(statement);
statement = null;
target.sendPacket(Msg.CLAN_HAS_DISPERSED);
target.broadcastUserInfo(true);
}
catch(Exception e)
{
}
finally
{
DatabaseUtils.closeDatabaseCS(con, statement);
}
return true;
}
else if(action.equals("setlevel"))
{
if(target.getClan() == null)
{
activeChar.sendPacket(Msg.INVALID_TARGET);
return false;
}
try
{
byte level = Byte.parseByte(st.nextToken());
L2Clan clan = target.getClan();
activeChar.sendMessage("You set level " + level + " for clan " + clan.getName());
clan.setLevel(level);
clan.updateClanInDB();
if(level < CastleSiegeManager.getSiegeClanMinLevel())
{
SiegeManager.removeSiegeSkills(target);
}
else
{
SiegeManager.addSiegeSkills(target);
}
if(level == 5)
{
target.sendPacket(Msg.NOW_THAT_YOUR_CLAN_LEVEL_IS_ABOVE_LEVEL_5_IT_CAN_ACCUMULATE_CLAN_REPUTATION_POINTS);
}
PledgeShowInfoUpdate pu = new PledgeShowInfoUpdate(clan);
PledgeStatusChanged ps = new PledgeStatusChanged(clan);
for(L2Player member : clan.getOnlineMembers(0))
{
member.updatePledgeClass();
member.sendPacket(Msg.CLANS_SKILL_LEVEL_HAS_INCREASED, pu, ps);