520 main проблема с аденной

  • Автор темы Автор темы Dev_mod
  • Дата начала Дата начала
Статус
В этой теме нельзя размещать новые ответы.

Dev_mod

Пляшущий с бубном
Участник
Сообщения
63
Розыгрыши
0
Решения
3
Репутация
5
Реакции
20
Баллы
240
Хроники
  1. Master Class
Исходники
Присутствуют
Сборка
L2scripts
всем привет не мог бы кто-подсказать как решить баг или куда капать чтобы его решить
проблема вот в чём у меня призаходе на сервер начинает двоиться адена илидобавлять лишенее 1782588732612.webp
вот на фото у меня в инвентарк только 9 милиардов и визуально показываеь 29 но когда я в пакете ентер ворлд убираю пакет
ExAdenaInvenCount то аденны стаёт 0 тоесть сверху не чё не закидуется ну а есль отправляеться этот пакет с другого места там есль что токупить или тип того то всё отлично работает. как вы думаете в чём проблема. бадаюсь с этим багом уже месяц(
 
Решение
я решил эту проблему метадом тыка и был удёвлён что это могло так сильно повлиять
у меня в пакете
RestartResponse
отправлялся лишний стринг

Java:
    @Override
    protected final void writeImpl() {
        writeD(_param); //01-ok
        //writeS(_message);
    }
и как я понял иза этого не правельно считывался пакет CharacterSelectionInfo и клиент что-то не то сохранял в кеш
всем привет не мог бы кто-подсказать как решить баг или куда капать чтобы его решить
проблема вот в чём у меня призаходе на сервер начинает двоиться адена илидобавлять лишенееПосмотреть вложение 96294
вот на фото у меня в инвентарк только 9 милиардов и визуально показываеь 29 но когда я в пакете ентер ворлд убираю пакет
ExAdenaInvenCount то аденны стаёт 0 тоесть сверху не чё не закидуется ну а есль отправляеться этот пакет с другого места там есль что токупить или тип того то всё отлично работает. как вы думаете в чём проблема. бадаюсь с этим багом уже месяц(
Правда у меня 542, но сути не меняет думаю.
 
Правда у меня 542, но сути не меняет думаю.
помогло большое спасибо
Сообщение объединено:
Правда у меня 542, но сути не меняет думаю.
чёт я вчера плохо проверил всеравно этот баг остался может я реализовал не правельно?
1782635039590.webp
 
Последнее редактирование:
помогло большое спасибо
Сообщение объединено:
чёт я вчера плохо проверил всеравно этот баг остался может я реализовал не правельно?
Посмотреть вложение 96329
Screenshot_7.webp

Screenshot_8.webp

У меня он отсылается в классе PlayerInventory, а не в статус апдейте или ентер ворлде.
 
А при чем тут ентер ворд, если у тебя в реалтайме обновляется количество адены?
У меня в ркал тайме всё гуд отрабатывает у меня оно плохо отрабатывает только при заходе в мир и всё
 
У меня в ркал тайме всё гуд отрабатывает у меня оно плохо отрабатывает только при заходе в мир и всё
Так ты видимо своей отправкой в ентер ворлд и ломаешь отображение адены, она у тебя обновляется в реалтайме.
Сообщение объединено:
Посмотреть вложение video.mp4
 
Последнее редактирование:
Так ты видимо своей отправкой в ентер ворлд и ломаешь отображение адены, она у тебя обновляется в реалтайме.
Сообщение объединено:
Посмотреть вложение 96335
Так у меня прикол в том что когда я вообще убираю то у меня при заходе Адены 0 хотя она есть
 
У скриптов такой проблемы не наблюдалось из коробки. Может ты сам что то сломал ? Запусти из коробки и глянь.
 
У скриптов такой проблемы не наблюдалось из коробки. Может ты сам что то сломал ? Запусти из коробки и глянь.
он апает пакет а из коробки у него был салватион
 
Вот с сорков 542 ентер ворлд.

Посмотреть вложение 96340

Вот это убрать попробуй.

Посмотреть вложение 96342
у меня так изначально было ошибка всё та же
Java:
package org.mmocore.gameserver.clientpackets;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.mmocore.commons.util.Rnd;
import org.mmocore.gameserver.Announcements;
import org.mmocore.gameserver.Config;
import org.mmocore.gameserver.common.DifferentMethods;
import org.mmocore.gameserver.dao.*;
import org.mmocore.gameserver.data.htm.HtmCache;
import org.mmocore.gameserver.data.xml.QuestHolder;
import org.mmocore.gameserver.data.xml.holder.NewQuestHolder;
import org.mmocore.gameserver.data.xml.holder.ResidenceHolder;
import org.mmocore.gameserver.data.xml.holder.StringHolder;
import org.mmocore.gameserver.handler.voicecommands.IVoicedCommandHandler;
import org.mmocore.gameserver.handler.voicecommands.VoicedCommandHandler;
import org.mmocore.gameserver.handler.voicecommands.impl.Moderator;
import org.mmocore.gameserver.instancemanager.*;
import org.mmocore.gameserver.listener.Acts;
import org.mmocore.gameserver.listener.actor.player.OnAnswerListener;
import org.mmocore.gameserver.listener.actor.player.impl.PlayerChatListener;
import org.mmocore.gameserver.listener.actor.player.impl.ReviveAnswerListener;
import org.mmocore.gameserver.listener.actor.player.impl.SevenSignListener;
import org.mmocore.gameserver.listener.hooks.ListenerHook;
import org.mmocore.gameserver.listener.hooks.ListenerHookType;
import org.mmocore.gameserver.model.*;
import org.mmocore.gameserver.model.Mods.GiveSpAndAdena;
import org.mmocore.gameserver.model.actor.CreatureSkillCast;
import org.mmocore.gameserver.model.actor.instances.creature.Abnormal;
import org.mmocore.gameserver.model.base.NobleType;
import org.mmocore.gameserver.model.components.player.interfaces.ShortCut;
import org.mmocore.gameserver.model.entity.Hero;
import org.mmocore.gameserver.model.entity.SevenSigns;
import org.mmocore.gameserver.model.entity.residence.Castle;
import org.mmocore.gameserver.model.items.Inventory;
import org.mmocore.gameserver.model.items.ItemInstance;
import org.mmocore.gameserver.model.items.PcInventory;
import org.mmocore.gameserver.model.mail.Mail;
import org.mmocore.gameserver.instancemanager.OfflineBufferManager;
import org.mmocore.gameserver.model.pledge.Clan;
import org.mmocore.gameserver.model.premium.PremiumEnd;
import org.mmocore.gameserver.model.punishment.PunishmentAffect;
import org.mmocore.gameserver.model.punishment.PunishmentTask;
import org.mmocore.gameserver.model.punishment.PunishmentType;
import org.mmocore.gameserver.model.quest.Quest;
import org.mmocore.gameserver.model.quest.QuestDialogType;
import org.mmocore.gameserver.model.quest.QuestState;
import org.mmocore.gameserver.model.quest.newquest.NewQuestInfo;
import org.mmocore.gameserver.network.GameClient;
import org.mmocore.gameserver.network.authcomm.AuthServerCommunication;
import org.mmocore.gameserver.network.authcomm.gs2as.ChangeAllowedHwid;
import org.mmocore.gameserver.serverpackets.ConfirmDlg;
import org.mmocore.gameserver.serverpackets.Post.ExNoticePostArrived;
import org.mmocore.gameserver.serverpackets.Post.ExReceiveShowPostFriend;
import org.mmocore.gameserver.serverpackets.collection.ExCollectionActiveEvent;
import org.mmocore.gameserver.serverpackets.collection.ExCollectionInfo;
import org.mmocore.gameserver.serverpackets.components.CustomMessage;
import org.mmocore.gameserver.serverpackets.components.HtmlMessage;
import org.mmocore.gameserver.serverpackets.components.StatusUpdate;
import org.mmocore.gameserver.serverpackets.components.SystemMsg;
import org.mmocore.gameserver.serverpackets.henna.HennaInfo;
import org.mmocore.gameserver.serverpackets.herobook.ExHeroBookInfo;
import org.mmocore.gameserver.serverpackets.homunculus.ExHomunculusPointInfo;
import org.mmocore.gameserver.serverpackets.homunculus.ExHomunculusReady;
import org.mmocore.gameserver.serverpackets.homunculus.ExHomunculusSidebar;
import org.mmocore.gameserver.serverpackets.homunculus.ExShowHomunculusBirthInfo;
import org.mmocore.gameserver.serverpackets.huntPass.ExL2PassSimpleInfo;
import org.mmocore.gameserver.serverpackets.limitshop.ExBloodyCoinCount;
import org.mmocore.gameserver.serverpackets.newPacket.*;
import org.mmocore.gameserver.serverpackets.*;
import org.mmocore.gameserver.serverpackets.pledge.ExPledgeCoinInfo;
import org.mmocore.gameserver.serverpackets.pledge.ExPledgeCount;
import org.mmocore.gameserver.serverpackets.pledge.PledgeShowInfoUpdate;
import org.mmocore.gameserver.serverpackets.pledge.PledgeSkillList;
import org.mmocore.gameserver.serverpackets.quest.ExQuestDialog;
import org.mmocore.gameserver.serverpackets.quest.ExQuestNotificationAll;
import org.mmocore.gameserver.serverpackets.relics.ExRelicsCollectionInfo;
import org.mmocore.gameserver.serverpackets.relics.ExRelicsExchangeList;
import org.mmocore.gameserver.serverpackets.relics.ExRelicsList;
import org.mmocore.gameserver.serverpackets.updatetype.NpcInfoType;
import org.mmocore.gameserver.serverpackets.virtualItem.ExVirtualItemSystemBaseInfo;
import org.mmocore.gameserver.skills.AbnormalEffect;
import org.mmocore.gameserver.skills.SkillCastingType;
import org.mmocore.gameserver.skills.SkillEntry;
import org.mmocore.gameserver.skills.SkillEntryType;
import org.mmocore.gameserver.stats.triggers.TriggerType;
import org.mmocore.gameserver.templates.item.ItemTemplate;
import org.mmocore.gameserver.utils.*;


import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;

public class EnterWorld extends L2GameClientPacket {
    private static final DateFormat TIME_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm");
    private static final SevenSignListener sevenSignListener = new SevenSignListener();

    private static final PlayerChatListener chatListener = new PlayerChatListener();

    @Override
    protected void readImpl() {
        //readS(); - клиент всегда отправляет строку "narcasse"
    }

    @Override
    protected void runImpl() {
        GameClient client = getClient();
        Player activeChar = client.getActiveChar();

        if (activeChar == null) {
            client.closeNow(false);
            return;
        }
        if (Config.ALLOW_REG_ONLY_GM && Config.AUTH_SERVER_GM_ONLY && !activeChar.isGM()){
            client.closeNow(false);
            return;
        }

        GameStats.incrementPlayerEnterGame();

        boolean first = activeChar.entering;
        activeChar.sendPacket(new ExShowScreenMessage());
        activeChar.sendPacket(ExLightingCandleEvent.DISABLED);
        activeChar.sendPacket(new UserInfo(activeChar));

        activeChar.sendPacket(new ExVitalityEffectInfo(activeChar));

        // Enable Homunculus system.
        activeChar.calculateHomunculusSlots();
        activeChar.sendPacket(new ExShowHomunculusBirthInfo(activeChar));
        activeChar.sendPacket(new ExHomunculusPointInfo(activeChar));
        activeChar.sendPacket(new ExHomunculusReady(true));
        activeChar.sendPacket(new ExHomunculusSidebar(activeChar));

        // Send time.
        activeChar.sendPacket(new ExEnterWorld());

        activeChar.sendPacket(ExConnectedTimeAndGettableReward.STATIC);
        activeChar.sendPacket(new ExOneDayReceiveRewardList(activeChar));
        activeChar.sendPacket(ExConnectedTimeAndGettableReward.STATIC);

        // Send Macro List
        activeChar.getMacroses().sendMacroses();

        // Send Teleport Bookmark List
        activeChar.sendPacket(new ExGetBookMarkInfo(activeChar));

        // Send Item List
        // Send Quest Item List
        activeChar.sendItemList(false);

        // Send Shortcuts
        activeChar.sendPacket(new ShortCutInit(activeChar));

        // Send Action list
        activeChar.sendPacket(new ExBasicActionList(activeChar));

        // Send blank skill list
        activeChar.sendPacket(new SkillList(activeChar));

        // Send Dye Information
        activeChar.sendPacket(new ExPeriodicHenna(activeChar));
        activeChar.sendPacket(new HennaInfo(activeChar));

        // Send Skill list
        activeChar.sendSkillList();

        activeChar.sendAbilitiesInfo();

        // Send EtcStatusUpdate
        activeChar.sendPacket(new EtcStatusUpdate(activeChar));

        List<Castle> castleList = ResidenceHolder.getInstance().getResidenceList(Castle.class);
        for(Castle c : castleList)
        {
            activeChar.sendPacket(new ExCastleState(c));
        }

        // Clan packets
        if(activeChar.getClan() != null)
        {
            activeChar.getClan().loginClanCond(activeChar, true);
            activeChar.sendPacket(activeChar.getClan().listAll());
            activeChar.sendPacket(new PledgeShowInfoUpdate(activeChar.getClan()), new PledgeSkillList(activeChar.getClan()));
        }
        else
        {
            activeChar.sendPacket(new ExPledgeCount(0));
        }

        // Send SubClass Info
        activeChar.sendPacket(new ExSubjobInfo(activeChar, false));

        activeChar.sendPacket(new ExUserInfoInvenWeight(activeChar));

        activeChar.sendPacket(new ExAdenaInvenCount(activeChar));

        activeChar.sendPacket(new ExBloodyCoinCount(activeChar));

        // Send honor coin count.
        activeChar.sendPacket(new ExPledgeCoinInfo(activeChar));

        // Send Unread Mail Count
        List<Mail> mails = MailDAO.getInstance().getReceivedMailByOwnerId(activeChar.getObjectId());
        if (!mails.isEmpty()){
            boolean flagMail = false;
            for(Mail mail : mails)
            {
                if(mail.isUnread())
                {
                    flagMail = true;
                    break;
                }
            }
            if (flagMail){
                activeChar.sendPacket(new ExUnReadMailCount(activeChar));
            }
        }

        // Faction System todo

        Quest.restoreQuestStates(activeChar);

        activeChar.sendPacket(new QuestList(activeChar));

        // Send quest list.
        if (true)//!Config.DISABLE_TUTORIAL
        {
            // Обновить иконки всех NewQuest-квестов в UI клиента
            activeChar.sendPacket(new ExQuestNotificationAll(activeChar));

            // Найти первый квест, который игрок ещё не начал и может взять
            for (NewQuestInfo questInfo : NewQuestHolder.getInstance().getAllQuests())
            {
                // Пропускаем тип 2 (party/group квесты — у них другой флоу)
                if (questInfo.getType() == 2)
                    continue;

                // Пропускаем квесты с specificStart (берутся только особым образом,
                // например через NPC или предмет, не автоматически при входе)
                if (questInfo.getConditions().getSpecificStart())
                    continue;

                final Quest quest = QuestHolder.getInstance().getQuest(questInfo.getId());

                if (quest == null)
                    continue;

                final QuestState questState = activeChar.getQuestState(questInfo.getId());

                // Показываем диалог только если квест ещё не взят/завершён
                // и все условия старта выполнены
                if (questState == null && quest.checkStartCondition(null, activeChar) == null)
                {
                    activeChar.sendPacket(new ExQuestDialog(quest.getId(), QuestDialogType.ACCEPT));
                    break; // Показываем только ПЕРВЫЙ доступный квест
                }
            }
        }

        activeChar.sendPacket(new ExUserInfoEquipSlot(activeChar));

        activeChar.sendPacket(new ExUserInfoCubic(activeChar));

        activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar));


        double mpCostDiff = activeChar.getMPCostDiff(Skill.SkillMagicType.PHYSIC);
        if(mpCostDiff != 0)
        {
            activeChar.sendPacket(new ExChangeMPCost(Skill.SkillMagicType.PHYSIC, mpCostDiff));
        }

        mpCostDiff = activeChar.getMPCostDiff(Skill.SkillMagicType.MAGIC);
        if(mpCostDiff != 0)
        {
            activeChar.sendPacket(new ExChangeMPCost(Skill.SkillMagicType.MAGIC, mpCostDiff));
        }

        mpCostDiff = activeChar.getMPCostDiff(Skill.SkillMagicType.MUSIC);
        if(mpCostDiff != 0)
        {
            activeChar.sendPacket(new ExChangeMPCost(Skill.SkillMagicType.MUSIC, mpCostDiff));
        }


        activeChar.updateSymbolSealSkills();

        if (Config.ENABLE_HUNT_PASS)
        {
            activeChar.sendPacket(new ExL2PassSimpleInfo(activeChar));
        }

        activeChar.initActiveAutoShots();

        Announcements.getInstance().showAnnouncements(activeChar);

        if (first) {
            activeChar.setOnlineStatus(true);
            if(activeChar.getPlayerAccess().GodMode && !Config.SHOW_GM_LOGIN)
            {
                activeChar.setGMInvisible(true);
                activeChar.startAbnormalEffect(AbnormalEffect.STEALTH);
            }
            activeChar.setNonAggroTime(Long.MAX_VALUE);
            activeChar.setNonPvpTime(System.currentTimeMillis() + Config.NONPVP_TIME_ONTELEPORT);
            activeChar.setPendingOlyEnd(false);

            if(activeChar.isInBuffStore())
            {
                activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
            }
            else if(activeChar.isInStoreMode())
            {
                if(!TradeHelper.validateStore(activeChar))
                {
                    activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
                    activeChar.storePrivateStore();
                }
            }

/*            if ((activeChar.isInStoreMode()) && (!activeChar.isInBuffStore())) {
                if (!TradeHelper.checksIfCanOpenStore(activeChar, activeChar.getPrivateStoreType())) {
                    activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
                    activeChar.broadcastPacket(new ChangeWaitType(activeChar, ChangeWaitType.WT_STANDING));
                    activeChar.setSitting(false);
                    activeChar.broadcastCharInfo();
                } else if (activeChar.isInBuffStore()) {
                    activeChar.setPrivateStoreType(0);
                    activeChar.broadcastCharInfo();
                }
            }*/

            activeChar.setRunning();
            activeChar.standUp();
            activeChar.spawnMe();
            activeChar.startTimers();

            if (ArrayUtils.contains(Config.DEBUGNAME, activeChar.getName())) {
                Log.LogName(activeChar.getName(), "EnterGame", "EnterGame", "char: " + activeChar.getName() + " entered into game");
            }
            DailyQuestsManager.checkAndRemoveDisabledQuests(activeChar);
        }


        // Relic Collections.
        if (Config.RELIC_SYSTEM_ENABLED)
        {
            activeChar.sendPacket(new ExRelicsList(activeChar));
            activeChar.sendPacket(new ExRelicsCollectionInfo(activeChar));
            activeChar.sendPacket(new ExRelicsExchangeList(activeChar));
        }

        // Illusory Equipment.
        if (Config.ILLUSORY_EQUIPMENT_ENABLED)
        {
            activeChar.sendPacket(new ExVirtualItemSystemBaseInfo(activeChar));
        }

        // Tome of Hero.
        activeChar.sendPacket(new ExHeroBookInfo());


        // shortcut fix
        for (ShortCut shortCut : activeChar.getAllShortCuts())
        {
            if (shortCut.getAutoUse())
            {
                activeChar.sendPacket(new ExActivateAutoShortcut(shortCut.getSlot(), shortCut.getPage(), true));
                activeChar.getAutoShortCuts().activate(activeChar, shortCut.getSlot(), shortCut.getPage(), true, true);
            }
        }

        for (int i = 1; i < 8; i++)
        {
            activeChar.sendPacket(new ExCollectionInfo(activeChar, i));
        }
        activeChar.sendPacket(new ExCollectionActiveEvent());


        boolean isPremium = activeChar.hasBonus();

        if (!isPremium)
            activeChar.stopBonusTask(false);
        if (activeChar.getVarB("PremiumGifts") && !isPremium)
            PremiumEnd.getInstance().stopBonuses(activeChar);
        activeChar.sendPacket(new ExBR_PremiumState(activeChar, isPremium));
        activeChar.sendPacket(new ExFactionInfo(activeChar, 0));

        activeChar.sendPacket(new ExSetCompassZoneCode(activeChar));

        //TODO: Исправить посылаемые данные.
        activeChar.sendPacket(new MagicAndSkillList(activeChar, 3503292, 730502));
        activeChar.sendPacket(new ExStorageMaxCount(activeChar));
        activeChar.getAttendanceRewards().onEnterWorld();
        activeChar.sendPacket(new ExVoteSystemInfo(activeChar));
        // activeChar.sendPacket(new ExBeautyItemList(activeChar));
        activeChar.sendPacket(new SkillCoolTime(activeChar));
        activeChar.sendPacket(new ExReceiveShowPostFriend(activeChar));


        if(Config.GLOBAL_SHOUT)
        {
            activeChar.sendPacket(new ExWorldChatCnt(activeChar));
        }


        if(first)
        {
            activeChar.getListeners().onEnter();
            RankManager.getInstance().onPlayerEnter(activeChar);
        }

        activeChar.addListener(chatListener);
        activeChar.addListener(sevenSignListener);
        SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);

        if (activeChar.getTitle().startsWith("*Away*") || activeChar.getTitle().startsWith("*Отошел*"))
            AwayManager.getInstance().extraBack(activeChar);

        if (first && activeChar.getCreateTime() > 0) {
            Calendar create = Calendar.getInstance();
            create.setTimeInMillis(activeChar.getCreateTime());
            Calendar now = Calendar.getInstance();

            int day = create.get(Calendar.DAY_OF_MONTH);
            if (create.get(Calendar.MONTH) == Calendar.FEBRUARY && day == 29)
                day = 28;

            int myBirthdayReceiveYear = activeChar.getVarInt(Player.MY_BIRTHDAY_RECEIVE_YEAR, 0);
            if (create.get(Calendar.MONTH) == now.get(Calendar.MONTH) && create.get(Calendar.DAY_OF_MONTH) == day && !Config.ALLOW_BIRTH_DAY) {
                if ((myBirthdayReceiveYear == 0 && create.get(Calendar.YEAR) != now.get(Calendar.YEAR)) || myBirthdayReceiveYear > 0 && myBirthdayReceiveYear != now.get(Calendar.YEAR)) {
                    Mail mail = new Mail();
                    mail.setSenderId(1);
                    mail.setSenderName(StringHolder.getInstance().getString(activeChar, "birthday.npc"));
                    mail.setReceiverId(activeChar.getObjectId());
                    mail.setReceiverName(activeChar.getName());
                    mail.setTopic(StringHolder.getInstance().getString(activeChar, "birthday.title"));
                    mail.setBody(StringHolder.getInstance().getString(activeChar, "birthday.text"));

                    ItemInstance item = ItemFunctions.createItem(21169);
                    item.setLocation(ItemInstance.ItemLocation.MAIL);
                    item.setCount(1L);
                    item.save();

                    mail.addAttachment(item);
                    mail.setUnread(true);
                    mail.setType(Mail.SenderType.BIRTHDAY);
                    mail.setExpireTime(720 * 3600 + (int) (System.currentTimeMillis() / 1000L));
                    mail.save();

                    activeChar.setVar(Player.MY_BIRTHDAY_RECEIVE_YEAR, String.valueOf(now.get(Calendar.YEAR)), -1);
                }
            }
        }



        // показывает анонсы на весь мир, когда герой заходит в игру
        if (Config.ANNOUNCE_HERO_LOGIN_TO_GAME) {
            if (activeChar.isHero())
                Announcements.getInstance().announceToAll(activeChar.isLangRus() ? "Герой " + activeChar.getName() + " вошел в мир." : "Hero " + activeChar.getName() + " entered into the world.");
        }
        if (activeChar.getVarB("FormalWear"))
            activeChar.unsetVar("FormalWear");

        if (Config.SERVICES_HERO_SELL_ENABLED){
            if (activeChar.getVarB("hasFakeHero") && activeChar.getVarLong("hasFakeHero") > System.currentTimeMillis()) {
                activeChar.setHero(true);
                if (Config.SERVICES_HERO_SELL_SKILL) {
                    Hero.addSkills(activeChar);
                }
            }
            else if (activeChar.getVarB("hasFakeHero") && activeChar.getVarLong("hasFakeHero") < System.currentTimeMillis()){
                activeChar.setHero(false);
                if (Config.SERVICES_HERO_SELL_SKILL) {
                    Hero.removeSkills(activeChar);
                }
                activeChar.unsetVar("hasFakeHero");
            }
        }
        if (Config.LastHero_SetHero && !Config.LAST_HERO_TIME) {
            if (activeChar.getVarB("hasFakeHeroLastHero") && activeChar.getVarLong("hasFakeHeroLastHero") > System.currentTimeMillis()) {
                activeChar.setHero(true);
                Hero.addSkills(activeChar);
            }
            else if (activeChar.getVarB("hasFakeHeroLastHero") && activeChar.getVarLong("hasFakeHeroLastHero") < System.currentTimeMillis()){
                activeChar.setHero(false);
                Hero.removeSkills(activeChar);
                activeChar.unsetVar("hasFakeHeroLastHero");
            }
        }

        if (activeChar.hasBonus()) {
            String msg = new CustomMessage("PremiumDate").toString(activeChar) + TIME_FORMAT.format(new Date(activeChar.getBonus().getBonusExpire() * 1000L));
            activeChar.sendPacket(new ExShowScreenMessage(msg, 3000, ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER, true));
            activeChar.sendMessage(msg);
        }

        if (Config.CLAN_ENABLED) {
            if (activeChar.isClanLeader()) {
                List<ClanListObject> listClan = ClanListServiceDAO.getInstance().getData(3);
                for (ClanListObject object : listClan)
                    if (activeChar.getClanId() == object.get_obj_id()) {
                        activeChar.setLectureMark(2);
                        break;
                    }
                listClan.clear();
                List<ClanListObject> listAcadem = ClanListServiceDAO.getInstance().getData(2);
                for (ClanListObject object : listAcadem)
                    if (activeChar.getClanId() == object.get_obj_id()) {
                        activeChar.setLectureMark(2);
                        break;
                    }
                listAcadem.clear();
            } else if (activeChar.getClanId() == 0) {
                List<ClanListObject> listCandidate = ClanListServiceDAO.getInstance().getData(1);
                for (ClanListObject object : listCandidate)
                    if (activeChar.getObjectId() == object.get_obj_id()) {
                        activeChar.setLectureMark(1);
                        break;
                    }
                listCandidate.clear();
            }
        }

        if (Config.HWID_LOCK_ENTER && !client.hasLocked()) {
            AuthServerCommunication.getInstance().sendPacket(new ChangeAllowedHwid(activeChar.getAccountName(), activeChar.getNetConnection().getStrixClientData().getClientHWID()));
            activeChar.sendMessage("Access to your account is available now only from your PC");
            activeChar.broadcastPacket(new MagicSkillUse(activeChar, activeChar, 5662, 1, 1000, 0));
        }

        if (Config.ENTER_WORLD_SHOW_HTML_LOCK) {
            if (!client.getShareBlock()) {
                if (!client.hasLocked())
                    DifferentMethods.communityNextPage(activeChar, "_bbspage:lock");
            } else
                DifferentMethods.communityNextPage(activeChar, "_bbspage:not_owner");
        }
        if (Config.ALT_HERO_AT_START) {
            if (!activeChar.isHero()) {
                activeChar.setHero(true);
                activeChar.updatePledgeClass();
                Hero.addSkills(activeChar);
                activeChar.sendSkillList();
                activeChar.broadcastUserInfo(true);
            }
        }
        if (activeChar.getVarB("CostumeSkill")) {
            String var = activeChar.getVar("CostumeSkill");
            if (var != null) {
                String[] skills = var.split(";");
                if (skills.length < 2)
                    return;
                int skillId = Integer.parseInt(skills[0]);
                int skillLvL = Integer.parseInt(skills[1]);
                SkillEntry skill = SkillEntry.makeSkillEntry(SkillEntryType.NONE, skillId, skillLvL);
                activeChar.addSkill(skill, false);
                activeChar.sendSkillList();
                activeChar.broadcastUserInfo(true);
            }
        }
        // engage and notify Partner
        if (first && Config.ALLOW_WEDDING) {
            CoupleManager.getInstance().engage(activeChar);
            CoupleManager.getInstance().notifyPartner(activeChar);
        }

        if (first) {
            activeChar.getFriendComponent().notifyFriends(true);
            //activeChar.restoreDisableSkills();
        }

        if (Config.SERVICES_ANNOUNCE_CASTLE_LORDS)
            notifyCastleOwner(activeChar);
        activeChar.sendPacket(new QuestList(activeChar), new L2FriendList(activeChar));

        activeChar.checkHpMessages(activeChar.getMaxHp(), activeChar.getCurrentHp());
        activeChar.checkDayNightMessages();

        if (Config.SHOW_HTML_WELCOME && activeChar.getClan() == null) {
            String html = HtmCache.getInstance().getHtml("enterworld/welcome.htm", activeChar);
            HtmlMessage msg = new HtmlMessage(5);
            msg.setHtml(HtmlUtils.bbParse(html));
            activeChar.sendPacket(msg);
        }

        if (Config.SHOW_NEW_CHAR_HTM && !activeChar.getVarB("newchar")) {
            String html = HtmCache.getInstance().getHtml("enterworld/newchar.htm", activeChar);
            HtmlMessage msg = new HtmlMessage(5);
            msg.setHtml(HtmlUtils.bbParse(html));
            activeChar.sendPacket(msg);
            activeChar.setVar("newchar", -1, -1);
        }
        if (Config.ENABLE_PASS_CHAR) {
            activeChar.setVar("passchar_auth", "false", -1);
            IVoicedCommandHandler vc = VoicedCommandHandler.getInstance().getVoicedCommandHandler("passchar");
            if (vc != null) {
                vc.useVoicedCommand("passchar", activeChar, "enterWorld");
            }
        }

        if (Config.PETITIONING_ALLOWED)
            PetitionManager.getInstance().checkPetitionMessages(activeChar);

        // Защита От Нелегальных Гмов
        if (Config.ENABLE_GM_LIST) {
            if ((activeChar.isGM()) && !(ArrayUtils.contains(Config.GM_NAME, activeChar.getName()))) {
                if (Config.DEFAULT_PUNISH == 1)
                    activeChar.kick();
                else if (Config.DEFAULT_PUNISH == 2) {
                    PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Бан за нелегальное использование Админа", activeChar.getName()));
                    activeChar.kick();
                }
                else
                    PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.JAIL, 0, "Бан за нелегальное использование Админа", activeChar.getName()));

                Util.handleIllegalPlayerAction(activeChar, "Игрок", " " + activeChar.getName() + " получил БАН! ", Config.DEFAULT_PUNISH);
            }
        }
        //проврка на заточку вещей выше чем положено
        if (Config.CHECK_ENCHANT && !activeChar.isGM()) {
            PcInventory inventory = activeChar.getInventory();
            inventory.writeLock();
            try {
                for (ItemInstance item : activeChar.getInventory().getItems()) {
                    if (item.isWeapon() && item.getEnchantLevel() > Config.MAX_ENCHANT_WEAPON && item.getItemId() != 13539 && !activeChar.isGM()) {
                        activeChar.getInventory().destroyItem(item);
                        PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Бан за переточку", activeChar.getName()));
                    } else if (item.isArmor() && item.getEnchantLevel() > Config.MAX_ENCHANT_ARMOR && !activeChar.isGM()) {
                        activeChar.getInventory().destroyItem(item);
                        PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Бан за переточку", activeChar.getName()));
                    } else if (item.getTemplate().getType2() == ItemTemplate.TYPE2_ACCESSORY && item.getEnchantLevel() > Config.MAX_ENCHANT_JEWELS && !activeChar.isGM()) {
                        activeChar.getInventory().destroyItem(item);
                        PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Бан за переточку", activeChar.getName()));
                    }
                }
            } finally {
                inventory.writeUnlock();
            }
        }
        if (!first)
        {
            CreatureSkillCast skillCast = activeChar.getSkillCast(SkillCastingType.NORMAL);
            if(skillCast.isCastingNow())
            {
                Creature castingTarget = skillCast.getTarget();
                SkillEntry castingSkillEntry = skillCast.getSkillEntry();
                long animationEndTime = skillCast.getAnimationEndTime();
                if(castingSkillEntry != null && !castingSkillEntry.getTemplate().isNotBroadcastable() && castingTarget != null && castingTarget.isCreature() && animationEndTime > 0)
                    activeChar.sendPacket(new MagicSkillUse(activeChar, castingTarget, castingSkillEntry.getId(), castingSkillEntry.getLevel(), (int) (animationEndTime - System.currentTimeMillis()), 0, SkillCastingType.NORMAL));
            }

            skillCast = activeChar.getSkillCast(SkillCastingType.NORMAL_SECOND);
            if(skillCast.isCastingNow())
            {
                Creature castingTarget = skillCast.getTarget();
                SkillEntry castingSkillEntry = skillCast.getSkillEntry();
                long animationEndTime = skillCast.getAnimationEndTime();
                if(castingSkillEntry != null && !castingSkillEntry.getTemplate().isNotBroadcastable() && castingTarget != null && castingTarget.isCreature() && animationEndTime > 0)
                    activeChar.sendPacket(new MagicSkillUse(activeChar, castingTarget, castingSkillEntry.getId(), castingSkillEntry.getLevel(), (int) (animationEndTime - System.currentTimeMillis()), 0, SkillCastingType.NORMAL_SECOND));
            }

            if (activeChar.isInBoat())
                activeChar.sendPacket(activeChar.getBoat().getOnPacket(activeChar, activeChar.getInBoatPosition()));

            if (activeChar.getMovement().isMoving() || activeChar.getMovement().isFollow())
                sendPacket(activeChar.movePacket());

            if (activeChar.getMountNpcId() != 0)
                sendPacket(new Ride(activeChar));

            if(activeChar.isFishing())
            {
                activeChar.getFishing().stop();
            }
        }

        activeChar.entering = false;
        //activeChar.sendUserInfo(true);

        if (activeChar.isSitting()) {
            activeChar.sendPacket(new ChangeWaitType(activeChar, ChangeWaitType.WT_SITTING));
            activeChar.setSitting(true);
        }

        if(activeChar.isInStoreMode())
            sendPacket(activeChar.getPrivateStoreMsgPacket(activeChar));

        if (activeChar.isDead())
            sendPacket(new Die(activeChar));

        activeChar.unsetVar("offline");
        activeChar.unsetVar("offlinebuff");
        activeChar.unsetVar("offlinebuff_price");
        activeChar.unsetVar("offlinebuff_skills");
        activeChar.unsetVar("offlinebuff_title");

        OfflineBufferManager.getInstance().getBuffStores().remove(activeChar.getObjectId());

        // на всякий случай
        activeChar.sendActionFailed();

        if (first && activeChar.isGM() && Config.SAVE_GM_EFFECTS && activeChar.getPlayerAccess().CanUseGMCommand) {
            //silence
            if (activeChar.getVarB("gm_silence")) {
                activeChar.setMessageRefusal(true);
                activeChar.sendPacket(SystemMsg.MESSAGE_REFUSAL_MODE);
            }
            //invul
            if (activeChar.getVarB("gm_invul")) {
                activeChar.getFlags().getInvulnerable().start();
                activeChar.startAbnormalEffect(AbnormalEffect.INVINCIBILITY);
                activeChar.sendMessage(activeChar.getName() + " is now immortal.");
            }
            //gmspeed
            try {
                int var_gmspeed = Integer.parseInt(activeChar.getVar("gm_gmspeed"));
                if (var_gmspeed >= 1 && var_gmspeed <= 4)
                    activeChar.doCast(SkillEntry.makeSkillEntry(SkillEntryType.NONE, 7029, var_gmspeed), activeChar, true);
            } catch (Exception E) {
            }
        }

        PlayerMessageStack.getInstance().CheckMessages(activeChar);

        Pair<Integer, OnAnswerListener> entry = activeChar.getAskListener(false);
        if (entry != null && entry.getValue() instanceof ReviveAnswerListener)
            sendPacket(new ConfirmDlg(SystemMsg.C1_IS_MAKING_AN_ATTEMPT_TO_RESURRECT_YOU_IF_YOU_CHOOSE_THIS_PATH_S2_EXPERIENCE_WILL_BE_RETURNED_FOR_YOU, 0).addString("Other player").addString("some"));

        if (!activeChar.isCursedWeaponEquipped() && activeChar.getVar("curse") != null) {
            activeChar.setKarma(0);
            activeChar.setPkKills(0);
            activeChar.unsetVar("curse");
        }
        if (activeChar.isCursedWeaponEquipped())
            CursedWeaponsManager.getInstance().showUsageTime(activeChar, activeChar.getCursedWeaponEquippedId());

        // if (Config.OFFLINE_BUFFER_STORE_ENABLED) {
        //     OfflineBuffers.getInstance().onLogin(activeChar);
        //     activeChar.sendUserInfo();
        // }

        //затычка на удаление хиро оружия и короны, если ты не хиро
        if (!activeChar.isHero() && !activeChar.isFakeHero()) {
            PcInventory inventory = activeChar.getInventory();
            inventory.writeLock();
            try {
                for (ItemInstance item : activeChar.getInventory().getItems()) {
                    if (item.isHeroWeapon())
                        activeChar.getInventory().destroyItem(item);
                }
                activeChar.getInventory().destroyItemByItemId(6842, 1);
                if (activeChar.getInventory().getCountOf(34935) > 0)
                    activeChar.getInventory().destroyItemByItemId(34935, 1);
            } finally {
                inventory.writeUnlock();
            }

            activeChar.setHero(false);
            activeChar.updatePledgeClass();
            activeChar.broadcastUserInfo(true);
        }

        if (!activeChar.isHero() && !activeChar.FakeHeroSkill()) {
            Hero.removeSkills(activeChar);
        }

        if (!first) {
            //Персонаж вылетел во время просмотра
            if(activeChar.isInObserverMode())
            {
                if(activeChar.getObserverMode() == Player.OBSERVER_LEAVING)
                    activeChar.returnFromObserverMode();
                else
                    activeChar.leaveObserverMode();
            }
            else if(activeChar.isVisible())
                World.showObjectsToPlayer(activeChar);

            List<Servitor> servitors = activeChar.getServitors();
            for(Servitor servitor : servitors)
                activeChar.sendPacket(new MyPetSummonInfoPacket(servitor));


            if(activeChar.isInParty()) {
                //sends new member party window for all members
                //we do all actions before adding member to a list, this speeds things up a little
                activeChar.sendPacket(new PartySmallWindowAll(activeChar.getParty(), activeChar));

                RelationChanged rcp = new RelationChanged();
                for (Player member : activeChar.getParty().getPartyMembers()) {
                    if (member != activeChar) {
                        activeChar.sendPacket(new PartySpelled(member, true));
                        if (member.hasServitor())
                        {
                            member.getServitors().forEach(s -> activeChar.sendPacket(new PartySpelled(s, true)));
                        }
                    }

                    rcp.add(member, activeChar);
                    for(Servitor servitor : member.getServitors())
                        rcp.add(servitor, activeChar);

                    for(Servitor servitor : servitors)
                        servitor.broadcastCharInfoImpl(activeChar, NpcInfoType.VALUES);
                }

                activeChar.sendPacket(rcp);


                // Если партия уже в СС, то вновь прибывшем посылаем пакет открытия окна СС
                if (activeChar.getParty().isInCommandChannel())
                    sendPacket(ExOpenMPCCPacket.STATIC);
            }

            for(Abnormal e : activeChar.getAbnormalList())
            {
                if(e.getSkill().isToggle() && !e.getSkill().isNotBroadcastable())
                    activeChar.sendPacket(new MagicSkillLaunched(activeChar.getObjectId(), e.getSkill().getId(), e.getSkill().getLevel(), activeChar, SkillCastingType.NORMAL));
            }
            activeChar.broadcastCharInfo();
        }
/*        if(activeChar.isDead())
        {
            activeChar.sendPacket(new Die(activeChar));
        }*/

        activeChar.updateAbnormalIcons();
        activeChar.updateStats();
        activeChar.updateUserBonus();

        if (Config.ALT_PCBANG_POINTS_ENABLED)
            activeChar.sendPacket(new ExPCCafePointInfo(activeChar, 0, 1, 2, 12));

        if (activeChar.getLevel() >= Config.ALT_PCBANG_POINTS_MIN_LVL) {
            if (Config.ALT_PCBANG_POINTS_ENABLED && activeChar.getVar("pcBangOnStart") == null) {
                activeChar.addPcBangPoints(Config.ALT_PCBANG_POINTS_ON_START, false);
                activeChar.setVar("pcBangOnStart", String.valueOf(Config.ALT_PCBANG_POINTS_ON_START), -1);
            } else if (Config.ALT_PCBANG_POINTS_ENABLED)
                activeChar.sendMessage(activeChar.isLangRus() ? "Вы уже получали очки PC Cafe сегодня" : "You already received PC Cafe points today");
        }

        if (!activeChar.getPremiumItemList().isEmpty())
            activeChar.sendPacket(Config.GOODS_INVENTORY_ENABLED ? ExGoodsInventoryChangedNotify.STATIC : ExNotifyPremiumItem.STATIC);

        if(first)
        {
            activeChar.useTriggers(activeChar, TriggerType.ON_ENTER_WORLD, null, null, 0);

            for(ListenerHook hook : ListenerHook.getGlobalListenerHooks(ListenerHookType.PLAYER_ENTER_GAME))
                hook.onPlayerEnterGame(activeChar);
        }

        if (Config.ENTER_WORLD_SHOW_HTML_PREMIUM_BUY) {
            if (activeChar.getClan() == null) {
                HtmlMessage html = new HtmlMessage(5).setFile(activeChar.getNetConnection().getBonus() <= 1 ? "enterworld/advertise.htm" : "enterworld/welcome.htm").replace("%playername%", activeChar.getName());
                activeChar.sendPacket(html);
            }
        }

        if(!Config.BONUS_RECOM_SHOW_INFO)
            activeChar.sendVoteSystemInfo();

        if (Config.ALLOW_NEVIT_SYSTEM)
            activeChar.getNevitSystem().onEnterWorld();

        if (Config.MAIL_ALLOW)
            checkNewMail(activeChar);

        DifferentMethods.setMaxOnline();

        if (activeChar.isChatBanned()) {
            long exp_time = 0;
            String reason = "";
            if (PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.CHAT_BAN) > exp_time) {
                exp_time = PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.CHAT_BAN);
                reason = PunishmentDAO.getInstance().getPunishmentReason(activeChar.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.CHAT_BAN);
            }
            if (PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getIP(), PunishmentAffect.IP, PunishmentType.CHAT_BAN) > exp_time) {
                exp_time = PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getIP(), PunishmentAffect.IP, PunishmentType.CHAT_BAN);
                reason = PunishmentDAO.getInstance().getPunishmentReason(activeChar.getIP(), PunishmentAffect.IP, PunishmentType.CHAT_BAN);
            }
            if (PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN) > exp_time) {
                exp_time = PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
                reason = PunishmentDAO.getInstance().getPunishmentReason(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
            }
            if (Config.STRIX_BAN && activeChar.getNetConnection().getStrixClientData().getClientHWID() != null) {
                if (PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getNetConnection().getStrixClientData().getClientHWID(), PunishmentAffect.HWID, PunishmentType.CHAT_BAN) > exp_time) {
                    exp_time = PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getNetConnection().getStrixClientData().getClientHWID(), PunishmentAffect.HWID, PunishmentType.CHAT_BAN);
                    reason = PunishmentDAO.getInstance().getPunishmentReason(activeChar.getNetConnection().getStrixClientData().getClientHWID(), PunishmentAffect.HWID, PunishmentType.CHAT_BAN);
                }
            }
            if (Moderator.checkBan(activeChar, true)){
                if (ModeratorChatDAO.getInstance().SelectAccount(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireACC(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentACC(activeChar);
                }
                else if (ModeratorChatDAO.getInstance().SelectIP(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireIP(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentIP(activeChar);
                }
                else if (ModeratorChatDAO.getInstance().SelectOBJ(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireOBJ(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentOBJ(activeChar);
                }
                else if (ModeratorChatDAO.getInstance().SelectCharName(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireCharName(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentCharName(activeChar);
                }
                else if (ModeratorChatDAO.getInstance().SelectHwid(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireHWID(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentHWID(activeChar);
                }
            }
            String msg1;
            String msg2;
            if (activeChar.isLangRus()) {
                msg1 = "Ваш чат забанен до: " + new Timestamp(exp_time);
                msg2 = "Причина: " + reason;
            } else {
                msg1 = "Your chat will be banned up: " + new Timestamp(exp_time);
                msg2 = "Reason: " + reason;

            }

            activeChar.sendMessage(msg1);
            activeChar.sendMessage(msg2);
        }

        JailUtils.checkPlayerToEnter(activeChar);

        if (Config.ENABLE_ANTIBOT_SYSTEM)
            activeChar.getAI().addTimer(25400, 60000);

        activeChar.getAI().addTimer(25501, 2000);

        SkillEntry skill = SkillEntry.makeSkillEntry(SkillEntryType.NONE, Skill.SKILL_NOBLESSE_BLESSING, 1);
        if (Config.GIVE_NOBLES_ENTER) {
            if (Config.GIVE_NOBLES_TYPE == 0)
                skill.getEffects(activeChar, activeChar);

            else if (Config.GIVE_NOBLES_TYPE == 1) {
                if (!activeChar.getAllSkills().contains(skill)) {
                    activeChar.addSkill(SkillEntry.makeSkillEntry(SkillEntryType.NONE, Skill.SKILL_NOBLESSE_BLESSING, 1), false);
                    activeChar.sendSkillList();
                    activeChar.broadcastUserInfo(true);
                }
            } else if (Config.GIVE_NOBLES_TYPE == 2) {
                if (!activeChar.isNoble()) {
                    activeChar.setNobleType(NobleType.NORMAL);
                }
            }
        }
        if (Config.EXP_AND_SP_ENABLED) {
            if (activeChar.getVar("EXPANDSPGIVE") != null && System.currentTimeMillis() < activeChar.getVarLong("EXPANDSP")) {
                int[][] data = new int[Config.COUNT_LEVEL.length][4];
                int i = 0;
                if (Config.COUNT_LEVEL.length != 0) {
                    for (String tele : Config.COUNT_LEVEL) {
                        String[] splitReward = tele.split(",");
                        data[i][0] = Integer.parseInt(splitReward[0]);
                        data[i][1] = Integer.parseInt(splitReward[1]);
                        data[i][2] = Integer.parseInt(splitReward[2]);
                        data[i][3] = Integer.parseInt(splitReward[3]);
                        i++;
                    }
                }
                long time = (System.currentTimeMillis() - activeChar.getVarLong("EXPANDSPGIVE")) / Config.EXP_AND_SP_DELAY;
                for (int[] datas : data) {
                    if (activeChar.getLevel() >= datas[0] && activeChar.getLevel() <= datas[1]) {
                        long EXP = datas[2] * time;
                        long SP = datas[3] * time;
                        activeChar.addExpAndSp(EXP, SP);
                    }
                }
                activeChar.unsetVar("EXPANDSPGIVE");
            } else {
                activeChar.unsetVar("EXPANDSPGIVE");
            }
        }
        if (ServerVariables.getString("lj_event", "off").equalsIgnoreCase("on"))
            activeChar.sendPacket(new ExBR_BroadcastEventState(ExBR_BroadcastEventState.LOVERS_JUBILEE, 1));

        if (activeChar.getVarB("pkItem")){
            if (activeChar.getVarLong("pkItem") <= System.currentTimeMillis()) {
                activeChar.unsetVar("pkItem");
                if (Config.TOP_PK_REMOVE_ITEM)
                    activeChar.getInventory().destroyItemByItemId(Config.TOP_PK_ITEM_ID[0], Config.TOP_PK_ITEM_COUNT);
            }
            if (Config.TOP_PK_LOCK_ITEM)
                TopPvpPk.Lock(activeChar, true);
        }
        if (activeChar.getVarB("pvpItem")) {
            if (activeChar.getVarLong("pvpItem") <= System.currentTimeMillis()){
                activeChar.unsetVar("pvpItem");
                if (Config.TOP_PVP_REMOVE_ITEM)
                    activeChar.getInventory().destroyItemByItemId(Config.TOP_PVP_ITEM_ID[0], Config.TOP_PVP_ITEM_COUNT);
            }
            if (Config.TOP_PVP_LOCK_ITEM)
                TopPvpPk.Lock(activeChar, false);
            if (activeChar.getVarB("pvpflag")) {
                activeChar.stopPvPFlag();
                activeChar.unsetVar("pvpflag");
            }
        }
        if (Config.GIVESPANDADENAENABLE)
            GiveSpAndAdena.Give(activeChar);

        if (Config.EMAIL_NOTIFY && CharacterDAO.getInstance().accountCharNumber(activeChar.getAccountName()) <= 1 && activeChar.getOnlineTime() == 0) {
            if (Config.FIRST_ENTER_WORLD) {
                for (String anArray : Config.FIRST_ENTER_GIVE) {
                    StringTokenizer st = new StringTokenizer(anArray, "{},()[]");
                    int item_id = Integer.parseInt(st.nextToken());
                    long item_count_min = Integer.parseInt(st.nextToken());
                    long item_count_max = Integer.parseInt(st.nextToken());
                    long count = Rnd.get(item_count_min, item_count_max);
                    ItemFunctions.addItem(activeChar, item_id, count, true);
                }
            }
            String[] args = {Config.EMAIL_SERVERINFO_NAME};
            Util.sendMail("NewChar", activeChar.getAccountName(), args);
        }

        int auctionItemObjectId = activeChar.getVarInt(Acts.RARE_AUCTION_PARTICIPATION_ACT, 0);
        if (auctionItemObjectId != 0)
        {
            ItemInstance auctionItem = ItemsDAO.getInstance().load(auctionItemObjectId);
            activeChar.getListeners().onAct(Acts.RARE_AUCTION_PARTICIPATION_ACT, auctionItem, false);
            activeChar.unsetVar(Acts.RARE_AUCTION_PARTICIPATION_ACT);
        }
    }

    private void notifyCastleOwner(Player activeChar) {
        Clan clan = activeChar.getClan();

        if (clan != null) {
            if (clan.getCastle() > 0) {
                Castle castle = ResidenceHolder.getInstance().getResidence(clan.getCastle());
                if ((castle != null) && (activeChar.getObjectId() == clan.getLeaderId()))
                    Announcements.getInstance().announceToAll(activeChar.isLangRus() ? "Лорд " + activeChar.getName() + " правитель " + castle.getName() + " Замка онлайн!" : "Lord " + activeChar.getName() + " prince " + castle.getName() + " castle online!");
            }
        }
    }

    private void checkNewMail(Player activeChar) {
        for (Mail mail : MailDAO.getInstance().getReceivedMailByOwnerId(activeChar.getObjectId())) {
            if (mail.isUnread()) {
                sendPacket(ExNoticePostArrived.STATIC_FALSE);
                break;
            }
        }
    }
}
 
у меня так изначально было ошибка всё та же
Java:
package org.mmocore.gameserver.clientpackets;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.mmocore.commons.util.Rnd;
import org.mmocore.gameserver.Announcements;
import org.mmocore.gameserver.Config;
import org.mmocore.gameserver.common.DifferentMethods;
import org.mmocore.gameserver.dao.*;
import org.mmocore.gameserver.data.htm.HtmCache;
import org.mmocore.gameserver.data.xml.QuestHolder;
import org.mmocore.gameserver.data.xml.holder.NewQuestHolder;
import org.mmocore.gameserver.data.xml.holder.ResidenceHolder;
import org.mmocore.gameserver.data.xml.holder.StringHolder;
import org.mmocore.gameserver.handler.voicecommands.IVoicedCommandHandler;
import org.mmocore.gameserver.handler.voicecommands.VoicedCommandHandler;
import org.mmocore.gameserver.handler.voicecommands.impl.Moderator;
import org.mmocore.gameserver.instancemanager.*;
import org.mmocore.gameserver.listener.Acts;
import org.mmocore.gameserver.listener.actor.player.OnAnswerListener;
import org.mmocore.gameserver.listener.actor.player.impl.PlayerChatListener;
import org.mmocore.gameserver.listener.actor.player.impl.ReviveAnswerListener;
import org.mmocore.gameserver.listener.actor.player.impl.SevenSignListener;
import org.mmocore.gameserver.listener.hooks.ListenerHook;
import org.mmocore.gameserver.listener.hooks.ListenerHookType;
import org.mmocore.gameserver.model.*;
import org.mmocore.gameserver.model.Mods.GiveSpAndAdena;
import org.mmocore.gameserver.model.actor.CreatureSkillCast;
import org.mmocore.gameserver.model.actor.instances.creature.Abnormal;
import org.mmocore.gameserver.model.base.NobleType;
import org.mmocore.gameserver.model.components.player.interfaces.ShortCut;
import org.mmocore.gameserver.model.entity.Hero;
import org.mmocore.gameserver.model.entity.SevenSigns;
import org.mmocore.gameserver.model.entity.residence.Castle;
import org.mmocore.gameserver.model.items.Inventory;
import org.mmocore.gameserver.model.items.ItemInstance;
import org.mmocore.gameserver.model.items.PcInventory;
import org.mmocore.gameserver.model.mail.Mail;
import org.mmocore.gameserver.instancemanager.OfflineBufferManager;
import org.mmocore.gameserver.model.pledge.Clan;
import org.mmocore.gameserver.model.premium.PremiumEnd;
import org.mmocore.gameserver.model.punishment.PunishmentAffect;
import org.mmocore.gameserver.model.punishment.PunishmentTask;
import org.mmocore.gameserver.model.punishment.PunishmentType;
import org.mmocore.gameserver.model.quest.Quest;
import org.mmocore.gameserver.model.quest.QuestDialogType;
import org.mmocore.gameserver.model.quest.QuestState;
import org.mmocore.gameserver.model.quest.newquest.NewQuestInfo;
import org.mmocore.gameserver.network.GameClient;
import org.mmocore.gameserver.network.authcomm.AuthServerCommunication;
import org.mmocore.gameserver.network.authcomm.gs2as.ChangeAllowedHwid;
import org.mmocore.gameserver.serverpackets.ConfirmDlg;
import org.mmocore.gameserver.serverpackets.Post.ExNoticePostArrived;
import org.mmocore.gameserver.serverpackets.Post.ExReceiveShowPostFriend;
import org.mmocore.gameserver.serverpackets.collection.ExCollectionActiveEvent;
import org.mmocore.gameserver.serverpackets.collection.ExCollectionInfo;
import org.mmocore.gameserver.serverpackets.components.CustomMessage;
import org.mmocore.gameserver.serverpackets.components.HtmlMessage;
import org.mmocore.gameserver.serverpackets.components.StatusUpdate;
import org.mmocore.gameserver.serverpackets.components.SystemMsg;
import org.mmocore.gameserver.serverpackets.henna.HennaInfo;
import org.mmocore.gameserver.serverpackets.herobook.ExHeroBookInfo;
import org.mmocore.gameserver.serverpackets.homunculus.ExHomunculusPointInfo;
import org.mmocore.gameserver.serverpackets.homunculus.ExHomunculusReady;
import org.mmocore.gameserver.serverpackets.homunculus.ExHomunculusSidebar;
import org.mmocore.gameserver.serverpackets.homunculus.ExShowHomunculusBirthInfo;
import org.mmocore.gameserver.serverpackets.huntPass.ExL2PassSimpleInfo;
import org.mmocore.gameserver.serverpackets.limitshop.ExBloodyCoinCount;
import org.mmocore.gameserver.serverpackets.newPacket.*;
import org.mmocore.gameserver.serverpackets.*;
import org.mmocore.gameserver.serverpackets.pledge.ExPledgeCoinInfo;
import org.mmocore.gameserver.serverpackets.pledge.ExPledgeCount;
import org.mmocore.gameserver.serverpackets.pledge.PledgeShowInfoUpdate;
import org.mmocore.gameserver.serverpackets.pledge.PledgeSkillList;
import org.mmocore.gameserver.serverpackets.quest.ExQuestDialog;
import org.mmocore.gameserver.serverpackets.quest.ExQuestNotificationAll;
import org.mmocore.gameserver.serverpackets.relics.ExRelicsCollectionInfo;
import org.mmocore.gameserver.serverpackets.relics.ExRelicsExchangeList;
import org.mmocore.gameserver.serverpackets.relics.ExRelicsList;
import org.mmocore.gameserver.serverpackets.updatetype.NpcInfoType;
import org.mmocore.gameserver.serverpackets.virtualItem.ExVirtualItemSystemBaseInfo;
import org.mmocore.gameserver.skills.AbnormalEffect;
import org.mmocore.gameserver.skills.SkillCastingType;
import org.mmocore.gameserver.skills.SkillEntry;
import org.mmocore.gameserver.skills.SkillEntryType;
import org.mmocore.gameserver.stats.triggers.TriggerType;
import org.mmocore.gameserver.templates.item.ItemTemplate;
import org.mmocore.gameserver.utils.*;


import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.StringTokenizer;

public class EnterWorld extends L2GameClientPacket {
    private static final DateFormat TIME_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm");
    private static final SevenSignListener sevenSignListener = new SevenSignListener();

    private static final PlayerChatListener chatListener = new PlayerChatListener();

    @Override
    protected void readImpl() {
        //readS(); - клиент всегда отправляет строку "narcasse"
    }

    @Override
    protected void runImpl() {
        GameClient client = getClient();
        Player activeChar = client.getActiveChar();

        if (activeChar == null) {
            client.closeNow(false);
            return;
        }
        if (Config.ALLOW_REG_ONLY_GM && Config.AUTH_SERVER_GM_ONLY && !activeChar.isGM()){
            client.closeNow(false);
            return;
        }

        GameStats.incrementPlayerEnterGame();

        boolean first = activeChar.entering;
        activeChar.sendPacket(new ExShowScreenMessage());
        activeChar.sendPacket(ExLightingCandleEvent.DISABLED);
        activeChar.sendPacket(new UserInfo(activeChar));

        activeChar.sendPacket(new ExVitalityEffectInfo(activeChar));

        // Enable Homunculus system.
        activeChar.calculateHomunculusSlots();
        activeChar.sendPacket(new ExShowHomunculusBirthInfo(activeChar));
        activeChar.sendPacket(new ExHomunculusPointInfo(activeChar));
        activeChar.sendPacket(new ExHomunculusReady(true));
        activeChar.sendPacket(new ExHomunculusSidebar(activeChar));

        // Send time.
        activeChar.sendPacket(new ExEnterWorld());

        activeChar.sendPacket(ExConnectedTimeAndGettableReward.STATIC);
        activeChar.sendPacket(new ExOneDayReceiveRewardList(activeChar));
        activeChar.sendPacket(ExConnectedTimeAndGettableReward.STATIC);

        // Send Macro List
        activeChar.getMacroses().sendMacroses();

        // Send Teleport Bookmark List
        activeChar.sendPacket(new ExGetBookMarkInfo(activeChar));

        // Send Item List
        // Send Quest Item List
        activeChar.sendItemList(false);

        // Send Shortcuts
        activeChar.sendPacket(new ShortCutInit(activeChar));

        // Send Action list
        activeChar.sendPacket(new ExBasicActionList(activeChar));

        // Send blank skill list
        activeChar.sendPacket(new SkillList(activeChar));

        // Send Dye Information
        activeChar.sendPacket(new ExPeriodicHenna(activeChar));
        activeChar.sendPacket(new HennaInfo(activeChar));

        // Send Skill list
        activeChar.sendSkillList();

        activeChar.sendAbilitiesInfo();

        // Send EtcStatusUpdate
        activeChar.sendPacket(new EtcStatusUpdate(activeChar));

        List<Castle> castleList = ResidenceHolder.getInstance().getResidenceList(Castle.class);
        for(Castle c : castleList)
        {
            activeChar.sendPacket(new ExCastleState(c));
        }

        // Clan packets
        if(activeChar.getClan() != null)
        {
            activeChar.getClan().loginClanCond(activeChar, true);
            activeChar.sendPacket(activeChar.getClan().listAll());
            activeChar.sendPacket(new PledgeShowInfoUpdate(activeChar.getClan()), new PledgeSkillList(activeChar.getClan()));
        }
        else
        {
            activeChar.sendPacket(new ExPledgeCount(0));
        }

        // Send SubClass Info
        activeChar.sendPacket(new ExSubjobInfo(activeChar, false));

        activeChar.sendPacket(new ExUserInfoInvenWeight(activeChar));

        activeChar.sendPacket(new ExAdenaInvenCount(activeChar));

        activeChar.sendPacket(new ExBloodyCoinCount(activeChar));

        // Send honor coin count.
        activeChar.sendPacket(new ExPledgeCoinInfo(activeChar));

        // Send Unread Mail Count
        List<Mail> mails = MailDAO.getInstance().getReceivedMailByOwnerId(activeChar.getObjectId());
        if (!mails.isEmpty()){
            boolean flagMail = false;
            for(Mail mail : mails)
            {
                if(mail.isUnread())
                {
                    flagMail = true;
                    break;
                }
            }
            if (flagMail){
                activeChar.sendPacket(new ExUnReadMailCount(activeChar));
            }
        }

        // Faction System todo

        Quest.restoreQuestStates(activeChar);

        activeChar.sendPacket(new QuestList(activeChar));

        // Send quest list.
        if (true)//!Config.DISABLE_TUTORIAL
        {
            // Обновить иконки всех NewQuest-квестов в UI клиента
            activeChar.sendPacket(new ExQuestNotificationAll(activeChar));

            // Найти первый квест, который игрок ещё не начал и может взять
            for (NewQuestInfo questInfo : NewQuestHolder.getInstance().getAllQuests())
            {
                // Пропускаем тип 2 (party/group квесты — у них другой флоу)
                if (questInfo.getType() == 2)
                    continue;

                // Пропускаем квесты с specificStart (берутся только особым образом,
                // например через NPC или предмет, не автоматически при входе)
                if (questInfo.getConditions().getSpecificStart())
                    continue;

                final Quest quest = QuestHolder.getInstance().getQuest(questInfo.getId());

                if (quest == null)
                    continue;

                final QuestState questState = activeChar.getQuestState(questInfo.getId());

                // Показываем диалог только если квест ещё не взят/завершён
                // и все условия старта выполнены
                if (questState == null && quest.checkStartCondition(null, activeChar) == null)
                {
                    activeChar.sendPacket(new ExQuestDialog(quest.getId(), QuestDialogType.ACCEPT));
                    break; // Показываем только ПЕРВЫЙ доступный квест
                }
            }
        }

        activeChar.sendPacket(new ExUserInfoEquipSlot(activeChar));

        activeChar.sendPacket(new ExUserInfoCubic(activeChar));

        activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar));


        double mpCostDiff = activeChar.getMPCostDiff(Skill.SkillMagicType.PHYSIC);
        if(mpCostDiff != 0)
        {
            activeChar.sendPacket(new ExChangeMPCost(Skill.SkillMagicType.PHYSIC, mpCostDiff));
        }

        mpCostDiff = activeChar.getMPCostDiff(Skill.SkillMagicType.MAGIC);
        if(mpCostDiff != 0)
        {
            activeChar.sendPacket(new ExChangeMPCost(Skill.SkillMagicType.MAGIC, mpCostDiff));
        }

        mpCostDiff = activeChar.getMPCostDiff(Skill.SkillMagicType.MUSIC);
        if(mpCostDiff != 0)
        {
            activeChar.sendPacket(new ExChangeMPCost(Skill.SkillMagicType.MUSIC, mpCostDiff));
        }


        activeChar.updateSymbolSealSkills();

        if (Config.ENABLE_HUNT_PASS)
        {
            activeChar.sendPacket(new ExL2PassSimpleInfo(activeChar));
        }

        activeChar.initActiveAutoShots();

        Announcements.getInstance().showAnnouncements(activeChar);

        if (first) {
            activeChar.setOnlineStatus(true);
            if(activeChar.getPlayerAccess().GodMode && !Config.SHOW_GM_LOGIN)
            {
                activeChar.setGMInvisible(true);
                activeChar.startAbnormalEffect(AbnormalEffect.STEALTH);
            }
            activeChar.setNonAggroTime(Long.MAX_VALUE);
            activeChar.setNonPvpTime(System.currentTimeMillis() + Config.NONPVP_TIME_ONTELEPORT);
            activeChar.setPendingOlyEnd(false);

            if(activeChar.isInBuffStore())
            {
                activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
            }
            else if(activeChar.isInStoreMode())
            {
                if(!TradeHelper.validateStore(activeChar))
                {
                    activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
                    activeChar.storePrivateStore();
                }
            }

/*            if ((activeChar.isInStoreMode()) && (!activeChar.isInBuffStore())) {
                if (!TradeHelper.checksIfCanOpenStore(activeChar, activeChar.getPrivateStoreType())) {
                    activeChar.setPrivateStoreType(Player.STORE_PRIVATE_NONE);
                    activeChar.broadcastPacket(new ChangeWaitType(activeChar, ChangeWaitType.WT_STANDING));
                    activeChar.setSitting(false);
                    activeChar.broadcastCharInfo();
                } else if (activeChar.isInBuffStore()) {
                    activeChar.setPrivateStoreType(0);
                    activeChar.broadcastCharInfo();
                }
            }*/

            activeChar.setRunning();
            activeChar.standUp();
            activeChar.spawnMe();
            activeChar.startTimers();

            if (ArrayUtils.contains(Config.DEBUGNAME, activeChar.getName())) {
                Log.LogName(activeChar.getName(), "EnterGame", "EnterGame", "char: " + activeChar.getName() + " entered into game");
            }
            DailyQuestsManager.checkAndRemoveDisabledQuests(activeChar);
        }


        // Relic Collections.
        if (Config.RELIC_SYSTEM_ENABLED)
        {
            activeChar.sendPacket(new ExRelicsList(activeChar));
            activeChar.sendPacket(new ExRelicsCollectionInfo(activeChar));
            activeChar.sendPacket(new ExRelicsExchangeList(activeChar));
        }

        // Illusory Equipment.
        if (Config.ILLUSORY_EQUIPMENT_ENABLED)
        {
            activeChar.sendPacket(new ExVirtualItemSystemBaseInfo(activeChar));
        }

        // Tome of Hero.
        activeChar.sendPacket(new ExHeroBookInfo());


        // shortcut fix
        for (ShortCut shortCut : activeChar.getAllShortCuts())
        {
            if (shortCut.getAutoUse())
            {
                activeChar.sendPacket(new ExActivateAutoShortcut(shortCut.getSlot(), shortCut.getPage(), true));
                activeChar.getAutoShortCuts().activate(activeChar, shortCut.getSlot(), shortCut.getPage(), true, true);
            }
        }

        for (int i = 1; i < 8; i++)
        {
            activeChar.sendPacket(new ExCollectionInfo(activeChar, i));
        }
        activeChar.sendPacket(new ExCollectionActiveEvent());


        boolean isPremium = activeChar.hasBonus();

        if (!isPremium)
            activeChar.stopBonusTask(false);
        if (activeChar.getVarB("PremiumGifts") && !isPremium)
            PremiumEnd.getInstance().stopBonuses(activeChar);
        activeChar.sendPacket(new ExBR_PremiumState(activeChar, isPremium));
        activeChar.sendPacket(new ExFactionInfo(activeChar, 0));

        activeChar.sendPacket(new ExSetCompassZoneCode(activeChar));

        //TODO: Исправить посылаемые данные.
        activeChar.sendPacket(new MagicAndSkillList(activeChar, 3503292, 730502));
        activeChar.sendPacket(new ExStorageMaxCount(activeChar));
        activeChar.getAttendanceRewards().onEnterWorld();
        activeChar.sendPacket(new ExVoteSystemInfo(activeChar));
        // activeChar.sendPacket(new ExBeautyItemList(activeChar));
        activeChar.sendPacket(new SkillCoolTime(activeChar));
        activeChar.sendPacket(new ExReceiveShowPostFriend(activeChar));


        if(Config.GLOBAL_SHOUT)
        {
            activeChar.sendPacket(new ExWorldChatCnt(activeChar));
        }


        if(first)
        {
            activeChar.getListeners().onEnter();
            RankManager.getInstance().onPlayerEnter(activeChar);
        }

        activeChar.addListener(chatListener);
        activeChar.addListener(sevenSignListener);
        SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);

        if (activeChar.getTitle().startsWith("*Away*") || activeChar.getTitle().startsWith("*Отошел*"))
            AwayManager.getInstance().extraBack(activeChar);

        if (first && activeChar.getCreateTime() > 0) {
            Calendar create = Calendar.getInstance();
            create.setTimeInMillis(activeChar.getCreateTime());
            Calendar now = Calendar.getInstance();

            int day = create.get(Calendar.DAY_OF_MONTH);
            if (create.get(Calendar.MONTH) == Calendar.FEBRUARY && day == 29)
                day = 28;

            int myBirthdayReceiveYear = activeChar.getVarInt(Player.MY_BIRTHDAY_RECEIVE_YEAR, 0);
            if (create.get(Calendar.MONTH) == now.get(Calendar.MONTH) && create.get(Calendar.DAY_OF_MONTH) == day && !Config.ALLOW_BIRTH_DAY) {
                if ((myBirthdayReceiveYear == 0 && create.get(Calendar.YEAR) != now.get(Calendar.YEAR)) || myBirthdayReceiveYear > 0 && myBirthdayReceiveYear != now.get(Calendar.YEAR)) {
                    Mail mail = new Mail();
                    mail.setSenderId(1);
                    mail.setSenderName(StringHolder.getInstance().getString(activeChar, "birthday.npc"));
                    mail.setReceiverId(activeChar.getObjectId());
                    mail.setReceiverName(activeChar.getName());
                    mail.setTopic(StringHolder.getInstance().getString(activeChar, "birthday.title"));
                    mail.setBody(StringHolder.getInstance().getString(activeChar, "birthday.text"));

                    ItemInstance item = ItemFunctions.createItem(21169);
                    item.setLocation(ItemInstance.ItemLocation.MAIL);
                    item.setCount(1L);
                    item.save();

                    mail.addAttachment(item);
                    mail.setUnread(true);
                    mail.setType(Mail.SenderType.BIRTHDAY);
                    mail.setExpireTime(720 * 3600 + (int) (System.currentTimeMillis() / 1000L));
                    mail.save();

                    activeChar.setVar(Player.MY_BIRTHDAY_RECEIVE_YEAR, String.valueOf(now.get(Calendar.YEAR)), -1);
                }
            }
        }



        // показывает анонсы на весь мир, когда герой заходит в игру
        if (Config.ANNOUNCE_HERO_LOGIN_TO_GAME) {
            if (activeChar.isHero())
                Announcements.getInstance().announceToAll(activeChar.isLangRus() ? "Герой " + activeChar.getName() + " вошел в мир." : "Hero " + activeChar.getName() + " entered into the world.");
        }
        if (activeChar.getVarB("FormalWear"))
            activeChar.unsetVar("FormalWear");

        if (Config.SERVICES_HERO_SELL_ENABLED){
            if (activeChar.getVarB("hasFakeHero") && activeChar.getVarLong("hasFakeHero") > System.currentTimeMillis()) {
                activeChar.setHero(true);
                if (Config.SERVICES_HERO_SELL_SKILL) {
                    Hero.addSkills(activeChar);
                }
            }
            else if (activeChar.getVarB("hasFakeHero") && activeChar.getVarLong("hasFakeHero") < System.currentTimeMillis()){
                activeChar.setHero(false);
                if (Config.SERVICES_HERO_SELL_SKILL) {
                    Hero.removeSkills(activeChar);
                }
                activeChar.unsetVar("hasFakeHero");
            }
        }
        if (Config.LastHero_SetHero && !Config.LAST_HERO_TIME) {
            if (activeChar.getVarB("hasFakeHeroLastHero") && activeChar.getVarLong("hasFakeHeroLastHero") > System.currentTimeMillis()) {
                activeChar.setHero(true);
                Hero.addSkills(activeChar);
            }
            else if (activeChar.getVarB("hasFakeHeroLastHero") && activeChar.getVarLong("hasFakeHeroLastHero") < System.currentTimeMillis()){
                activeChar.setHero(false);
                Hero.removeSkills(activeChar);
                activeChar.unsetVar("hasFakeHeroLastHero");
            }
        }

        if (activeChar.hasBonus()) {
            String msg = new CustomMessage("PremiumDate").toString(activeChar) + TIME_FORMAT.format(new Date(activeChar.getBonus().getBonusExpire() * 1000L));
            activeChar.sendPacket(new ExShowScreenMessage(msg, 3000, ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER, true));
            activeChar.sendMessage(msg);
        }

        if (Config.CLAN_ENABLED) {
            if (activeChar.isClanLeader()) {
                List<ClanListObject> listClan = ClanListServiceDAO.getInstance().getData(3);
                for (ClanListObject object : listClan)
                    if (activeChar.getClanId() == object.get_obj_id()) {
                        activeChar.setLectureMark(2);
                        break;
                    }
                listClan.clear();
                List<ClanListObject> listAcadem = ClanListServiceDAO.getInstance().getData(2);
                for (ClanListObject object : listAcadem)
                    if (activeChar.getClanId() == object.get_obj_id()) {
                        activeChar.setLectureMark(2);
                        break;
                    }
                listAcadem.clear();
            } else if (activeChar.getClanId() == 0) {
                List<ClanListObject> listCandidate = ClanListServiceDAO.getInstance().getData(1);
                for (ClanListObject object : listCandidate)
                    if (activeChar.getObjectId() == object.get_obj_id()) {
                        activeChar.setLectureMark(1);
                        break;
                    }
                listCandidate.clear();
            }
        }

        if (Config.HWID_LOCK_ENTER && !client.hasLocked()) {
            AuthServerCommunication.getInstance().sendPacket(new ChangeAllowedHwid(activeChar.getAccountName(), activeChar.getNetConnection().getStrixClientData().getClientHWID()));
            activeChar.sendMessage("Access to your account is available now only from your PC");
            activeChar.broadcastPacket(new MagicSkillUse(activeChar, activeChar, 5662, 1, 1000, 0));
        }

        if (Config.ENTER_WORLD_SHOW_HTML_LOCK) {
            if (!client.getShareBlock()) {
                if (!client.hasLocked())
                    DifferentMethods.communityNextPage(activeChar, "_bbspage:lock");
            } else
                DifferentMethods.communityNextPage(activeChar, "_bbspage:not_owner");
        }
        if (Config.ALT_HERO_AT_START) {
            if (!activeChar.isHero()) {
                activeChar.setHero(true);
                activeChar.updatePledgeClass();
                Hero.addSkills(activeChar);
                activeChar.sendSkillList();
                activeChar.broadcastUserInfo(true);
            }
        }
        if (activeChar.getVarB("CostumeSkill")) {
            String var = activeChar.getVar("CostumeSkill");
            if (var != null) {
                String[] skills = var.split(";");
                if (skills.length < 2)
                    return;
                int skillId = Integer.parseInt(skills[0]);
                int skillLvL = Integer.parseInt(skills[1]);
                SkillEntry skill = SkillEntry.makeSkillEntry(SkillEntryType.NONE, skillId, skillLvL);
                activeChar.addSkill(skill, false);
                activeChar.sendSkillList();
                activeChar.broadcastUserInfo(true);
            }
        }
        // engage and notify Partner
        if (first && Config.ALLOW_WEDDING) {
            CoupleManager.getInstance().engage(activeChar);
            CoupleManager.getInstance().notifyPartner(activeChar);
        }

        if (first) {
            activeChar.getFriendComponent().notifyFriends(true);
            //activeChar.restoreDisableSkills();
        }

        if (Config.SERVICES_ANNOUNCE_CASTLE_LORDS)
            notifyCastleOwner(activeChar);
        activeChar.sendPacket(new QuestList(activeChar), new L2FriendList(activeChar));

        activeChar.checkHpMessages(activeChar.getMaxHp(), activeChar.getCurrentHp());
        activeChar.checkDayNightMessages();

        if (Config.SHOW_HTML_WELCOME && activeChar.getClan() == null) {
            String html = HtmCache.getInstance().getHtml("enterworld/welcome.htm", activeChar);
            HtmlMessage msg = new HtmlMessage(5);
            msg.setHtml(HtmlUtils.bbParse(html));
            activeChar.sendPacket(msg);
        }

        if (Config.SHOW_NEW_CHAR_HTM && !activeChar.getVarB("newchar")) {
            String html = HtmCache.getInstance().getHtml("enterworld/newchar.htm", activeChar);
            HtmlMessage msg = new HtmlMessage(5);
            msg.setHtml(HtmlUtils.bbParse(html));
            activeChar.sendPacket(msg);
            activeChar.setVar("newchar", -1, -1);
        }
        if (Config.ENABLE_PASS_CHAR) {
            activeChar.setVar("passchar_auth", "false", -1);
            IVoicedCommandHandler vc = VoicedCommandHandler.getInstance().getVoicedCommandHandler("passchar");
            if (vc != null) {
                vc.useVoicedCommand("passchar", activeChar, "enterWorld");
            }
        }

        if (Config.PETITIONING_ALLOWED)
            PetitionManager.getInstance().checkPetitionMessages(activeChar);

        // Защита От Нелегальных Гмов
        if (Config.ENABLE_GM_LIST) {
            if ((activeChar.isGM()) && !(ArrayUtils.contains(Config.GM_NAME, activeChar.getName()))) {
                if (Config.DEFAULT_PUNISH == 1)
                    activeChar.kick();
                else if (Config.DEFAULT_PUNISH == 2) {
                    PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Бан за нелегальное использование Админа", activeChar.getName()));
                    activeChar.kick();
                }
                else
                    PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.JAIL, 0, "Бан за нелегальное использование Админа", activeChar.getName()));

                Util.handleIllegalPlayerAction(activeChar, "Игрок", " " + activeChar.getName() + " получил БАН! ", Config.DEFAULT_PUNISH);
            }
        }
        //проврка на заточку вещей выше чем положено
        if (Config.CHECK_ENCHANT && !activeChar.isGM()) {
            PcInventory inventory = activeChar.getInventory();
            inventory.writeLock();
            try {
                for (ItemInstance item : activeChar.getInventory().getItems()) {
                    if (item.isWeapon() && item.getEnchantLevel() > Config.MAX_ENCHANT_WEAPON && item.getItemId() != 13539 && !activeChar.isGM()) {
                        activeChar.getInventory().destroyItem(item);
                        PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Бан за переточку", activeChar.getName()));
                    } else if (item.isArmor() && item.getEnchantLevel() > Config.MAX_ENCHANT_ARMOR && !activeChar.isGM()) {
                        activeChar.getInventory().destroyItem(item);
                        PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Бан за переточку", activeChar.getName()));
                    } else if (item.getTemplate().getType2() == ItemTemplate.TYPE2_ACCESSORY && item.getEnchantLevel() > Config.MAX_ENCHANT_JEWELS && !activeChar.isGM()) {
                        activeChar.getInventory().destroyItem(item);
                        PunishmentDAO.getInstance().startPunishment(new PunishmentTask(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, 0, "Бан за переточку", activeChar.getName()));
                    }
                }
            } finally {
                inventory.writeUnlock();
            }
        }
        if (!first)
        {
            CreatureSkillCast skillCast = activeChar.getSkillCast(SkillCastingType.NORMAL);
            if(skillCast.isCastingNow())
            {
                Creature castingTarget = skillCast.getTarget();
                SkillEntry castingSkillEntry = skillCast.getSkillEntry();
                long animationEndTime = skillCast.getAnimationEndTime();
                if(castingSkillEntry != null && !castingSkillEntry.getTemplate().isNotBroadcastable() && castingTarget != null && castingTarget.isCreature() && animationEndTime > 0)
                    activeChar.sendPacket(new MagicSkillUse(activeChar, castingTarget, castingSkillEntry.getId(), castingSkillEntry.getLevel(), (int) (animationEndTime - System.currentTimeMillis()), 0, SkillCastingType.NORMAL));
            }

            skillCast = activeChar.getSkillCast(SkillCastingType.NORMAL_SECOND);
            if(skillCast.isCastingNow())
            {
                Creature castingTarget = skillCast.getTarget();
                SkillEntry castingSkillEntry = skillCast.getSkillEntry();
                long animationEndTime = skillCast.getAnimationEndTime();
                if(castingSkillEntry != null && !castingSkillEntry.getTemplate().isNotBroadcastable() && castingTarget != null && castingTarget.isCreature() && animationEndTime > 0)
                    activeChar.sendPacket(new MagicSkillUse(activeChar, castingTarget, castingSkillEntry.getId(), castingSkillEntry.getLevel(), (int) (animationEndTime - System.currentTimeMillis()), 0, SkillCastingType.NORMAL_SECOND));
            }

            if (activeChar.isInBoat())
                activeChar.sendPacket(activeChar.getBoat().getOnPacket(activeChar, activeChar.getInBoatPosition()));

            if (activeChar.getMovement().isMoving() || activeChar.getMovement().isFollow())
                sendPacket(activeChar.movePacket());

            if (activeChar.getMountNpcId() != 0)
                sendPacket(new Ride(activeChar));

            if(activeChar.isFishing())
            {
                activeChar.getFishing().stop();
            }
        }

        activeChar.entering = false;
        //activeChar.sendUserInfo(true);

        if (activeChar.isSitting()) {
            activeChar.sendPacket(new ChangeWaitType(activeChar, ChangeWaitType.WT_SITTING));
            activeChar.setSitting(true);
        }

        if(activeChar.isInStoreMode())
            sendPacket(activeChar.getPrivateStoreMsgPacket(activeChar));

        if (activeChar.isDead())
            sendPacket(new Die(activeChar));

        activeChar.unsetVar("offline");
        activeChar.unsetVar("offlinebuff");
        activeChar.unsetVar("offlinebuff_price");
        activeChar.unsetVar("offlinebuff_skills");
        activeChar.unsetVar("offlinebuff_title");

        OfflineBufferManager.getInstance().getBuffStores().remove(activeChar.getObjectId());

        // на всякий случай
        activeChar.sendActionFailed();

        if (first && activeChar.isGM() && Config.SAVE_GM_EFFECTS && activeChar.getPlayerAccess().CanUseGMCommand) {
            //silence
            if (activeChar.getVarB("gm_silence")) {
                activeChar.setMessageRefusal(true);
                activeChar.sendPacket(SystemMsg.MESSAGE_REFUSAL_MODE);
            }
            //invul
            if (activeChar.getVarB("gm_invul")) {
                activeChar.getFlags().getInvulnerable().start();
                activeChar.startAbnormalEffect(AbnormalEffect.INVINCIBILITY);
                activeChar.sendMessage(activeChar.getName() + " is now immortal.");
            }
            //gmspeed
            try {
                int var_gmspeed = Integer.parseInt(activeChar.getVar("gm_gmspeed"));
                if (var_gmspeed >= 1 && var_gmspeed <= 4)
                    activeChar.doCast(SkillEntry.makeSkillEntry(SkillEntryType.NONE, 7029, var_gmspeed), activeChar, true);
            } catch (Exception E) {
            }
        }

        PlayerMessageStack.getInstance().CheckMessages(activeChar);

        Pair<Integer, OnAnswerListener> entry = activeChar.getAskListener(false);
        if (entry != null && entry.getValue() instanceof ReviveAnswerListener)
            sendPacket(new ConfirmDlg(SystemMsg.C1_IS_MAKING_AN_ATTEMPT_TO_RESURRECT_YOU_IF_YOU_CHOOSE_THIS_PATH_S2_EXPERIENCE_WILL_BE_RETURNED_FOR_YOU, 0).addString("Other player").addString("some"));

        if (!activeChar.isCursedWeaponEquipped() && activeChar.getVar("curse") != null) {
            activeChar.setKarma(0);
            activeChar.setPkKills(0);
            activeChar.unsetVar("curse");
        }
        if (activeChar.isCursedWeaponEquipped())
            CursedWeaponsManager.getInstance().showUsageTime(activeChar, activeChar.getCursedWeaponEquippedId());

        // if (Config.OFFLINE_BUFFER_STORE_ENABLED) {
        //     OfflineBuffers.getInstance().onLogin(activeChar);
        //     activeChar.sendUserInfo();
        // }

        //затычка на удаление хиро оружия и короны, если ты не хиро
        if (!activeChar.isHero() && !activeChar.isFakeHero()) {
            PcInventory inventory = activeChar.getInventory();
            inventory.writeLock();
            try {
                for (ItemInstance item : activeChar.getInventory().getItems()) {
                    if (item.isHeroWeapon())
                        activeChar.getInventory().destroyItem(item);
                }
                activeChar.getInventory().destroyItemByItemId(6842, 1);
                if (activeChar.getInventory().getCountOf(34935) > 0)
                    activeChar.getInventory().destroyItemByItemId(34935, 1);
            } finally {
                inventory.writeUnlock();
            }

            activeChar.setHero(false);
            activeChar.updatePledgeClass();
            activeChar.broadcastUserInfo(true);
        }

        if (!activeChar.isHero() && !activeChar.FakeHeroSkill()) {
            Hero.removeSkills(activeChar);
        }

        if (!first) {
            //Персонаж вылетел во время просмотра
            if(activeChar.isInObserverMode())
            {
                if(activeChar.getObserverMode() == Player.OBSERVER_LEAVING)
                    activeChar.returnFromObserverMode();
                else
                    activeChar.leaveObserverMode();
            }
            else if(activeChar.isVisible())
                World.showObjectsToPlayer(activeChar);

            List<Servitor> servitors = activeChar.getServitors();
            for(Servitor servitor : servitors)
                activeChar.sendPacket(new MyPetSummonInfoPacket(servitor));


            if(activeChar.isInParty()) {
                //sends new member party window for all members
                //we do all actions before adding member to a list, this speeds things up a little
                activeChar.sendPacket(new PartySmallWindowAll(activeChar.getParty(), activeChar));

                RelationChanged rcp = new RelationChanged();
                for (Player member : activeChar.getParty().getPartyMembers()) {
                    if (member != activeChar) {
                        activeChar.sendPacket(new PartySpelled(member, true));
                        if (member.hasServitor())
                        {
                            member.getServitors().forEach(s -> activeChar.sendPacket(new PartySpelled(s, true)));
                        }
                    }

                    rcp.add(member, activeChar);
                    for(Servitor servitor : member.getServitors())
                        rcp.add(servitor, activeChar);

                    for(Servitor servitor : servitors)
                        servitor.broadcastCharInfoImpl(activeChar, NpcInfoType.VALUES);
                }

                activeChar.sendPacket(rcp);


                // Если партия уже в СС, то вновь прибывшем посылаем пакет открытия окна СС
                if (activeChar.getParty().isInCommandChannel())
                    sendPacket(ExOpenMPCCPacket.STATIC);
            }

            for(Abnormal e : activeChar.getAbnormalList())
            {
                if(e.getSkill().isToggle() && !e.getSkill().isNotBroadcastable())
                    activeChar.sendPacket(new MagicSkillLaunched(activeChar.getObjectId(), e.getSkill().getId(), e.getSkill().getLevel(), activeChar, SkillCastingType.NORMAL));
            }
            activeChar.broadcastCharInfo();
        }
/*        if(activeChar.isDead())
        {
            activeChar.sendPacket(new Die(activeChar));
        }*/

        activeChar.updateAbnormalIcons();
        activeChar.updateStats();
        activeChar.updateUserBonus();

        if (Config.ALT_PCBANG_POINTS_ENABLED)
            activeChar.sendPacket(new ExPCCafePointInfo(activeChar, 0, 1, 2, 12));

        if (activeChar.getLevel() >= Config.ALT_PCBANG_POINTS_MIN_LVL) {
            if (Config.ALT_PCBANG_POINTS_ENABLED && activeChar.getVar("pcBangOnStart") == null) {
                activeChar.addPcBangPoints(Config.ALT_PCBANG_POINTS_ON_START, false);
                activeChar.setVar("pcBangOnStart", String.valueOf(Config.ALT_PCBANG_POINTS_ON_START), -1);
            } else if (Config.ALT_PCBANG_POINTS_ENABLED)
                activeChar.sendMessage(activeChar.isLangRus() ? "Вы уже получали очки PC Cafe сегодня" : "You already received PC Cafe points today");
        }

        if (!activeChar.getPremiumItemList().isEmpty())
            activeChar.sendPacket(Config.GOODS_INVENTORY_ENABLED ? ExGoodsInventoryChangedNotify.STATIC : ExNotifyPremiumItem.STATIC);

        if(first)
        {
            activeChar.useTriggers(activeChar, TriggerType.ON_ENTER_WORLD, null, null, 0);

            for(ListenerHook hook : ListenerHook.getGlobalListenerHooks(ListenerHookType.PLAYER_ENTER_GAME))
                hook.onPlayerEnterGame(activeChar);
        }

        if (Config.ENTER_WORLD_SHOW_HTML_PREMIUM_BUY) {
            if (activeChar.getClan() == null) {
                HtmlMessage html = new HtmlMessage(5).setFile(activeChar.getNetConnection().getBonus() <= 1 ? "enterworld/advertise.htm" : "enterworld/welcome.htm").replace("%playername%", activeChar.getName());
                activeChar.sendPacket(html);
            }
        }

        if(!Config.BONUS_RECOM_SHOW_INFO)
            activeChar.sendVoteSystemInfo();

        if (Config.ALLOW_NEVIT_SYSTEM)
            activeChar.getNevitSystem().onEnterWorld();

        if (Config.MAIL_ALLOW)
            checkNewMail(activeChar);

        DifferentMethods.setMaxOnline();

        if (activeChar.isChatBanned()) {
            long exp_time = 0;
            String reason = "";
            if (PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.CHAT_BAN) > exp_time) {
                exp_time = PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.CHAT_BAN);
                reason = PunishmentDAO.getInstance().getPunishmentReason(activeChar.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.CHAT_BAN);
            }
            if (PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getIP(), PunishmentAffect.IP, PunishmentType.CHAT_BAN) > exp_time) {
                exp_time = PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getIP(), PunishmentAffect.IP, PunishmentType.CHAT_BAN);
                reason = PunishmentDAO.getInstance().getPunishmentReason(activeChar.getIP(), PunishmentAffect.IP, PunishmentType.CHAT_BAN);
            }
            if (PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN) > exp_time) {
                exp_time = PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
                reason = PunishmentDAO.getInstance().getPunishmentReason(activeChar.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
            }
            if (Config.STRIX_BAN && activeChar.getNetConnection().getStrixClientData().getClientHWID() != null) {
                if (PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getNetConnection().getStrixClientData().getClientHWID(), PunishmentAffect.HWID, PunishmentType.CHAT_BAN) > exp_time) {
                    exp_time = PunishmentDAO.getInstance().getPunishmentExpiration(activeChar.getNetConnection().getStrixClientData().getClientHWID(), PunishmentAffect.HWID, PunishmentType.CHAT_BAN);
                    reason = PunishmentDAO.getInstance().getPunishmentReason(activeChar.getNetConnection().getStrixClientData().getClientHWID(), PunishmentAffect.HWID, PunishmentType.CHAT_BAN);
                }
            }
            if (Moderator.checkBan(activeChar, true)){
                if (ModeratorChatDAO.getInstance().SelectAccount(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireACC(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentACC(activeChar);
                }
                else if (ModeratorChatDAO.getInstance().SelectIP(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireIP(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentIP(activeChar);
                }
                else if (ModeratorChatDAO.getInstance().SelectOBJ(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireOBJ(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentOBJ(activeChar);
                }
                else if (ModeratorChatDAO.getInstance().SelectCharName(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireCharName(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentCharName(activeChar);
                }
                else if (ModeratorChatDAO.getInstance().SelectHwid(activeChar, false)) {
                    exp_time = ModeratorChatDAO.getInstance().SelectExpireHWID(activeChar);
                    reason = ModeratorChatDAO.getInstance().SelectCommentHWID(activeChar);
                }
            }
            String msg1;
            String msg2;
            if (activeChar.isLangRus()) {
                msg1 = "Ваш чат забанен до: " + new Timestamp(exp_time);
                msg2 = "Причина: " + reason;
            } else {
                msg1 = "Your chat will be banned up: " + new Timestamp(exp_time);
                msg2 = "Reason: " + reason;

            }

            activeChar.sendMessage(msg1);
            activeChar.sendMessage(msg2);
        }

        JailUtils.checkPlayerToEnter(activeChar);

        if (Config.ENABLE_ANTIBOT_SYSTEM)
            activeChar.getAI().addTimer(25400, 60000);

        activeChar.getAI().addTimer(25501, 2000);

        SkillEntry skill = SkillEntry.makeSkillEntry(SkillEntryType.NONE, Skill.SKILL_NOBLESSE_BLESSING, 1);
        if (Config.GIVE_NOBLES_ENTER) {
            if (Config.GIVE_NOBLES_TYPE == 0)
                skill.getEffects(activeChar, activeChar);

            else if (Config.GIVE_NOBLES_TYPE == 1) {
                if (!activeChar.getAllSkills().contains(skill)) {
                    activeChar.addSkill(SkillEntry.makeSkillEntry(SkillEntryType.NONE, Skill.SKILL_NOBLESSE_BLESSING, 1), false);
                    activeChar.sendSkillList();
                    activeChar.broadcastUserInfo(true);
                }
            } else if (Config.GIVE_NOBLES_TYPE == 2) {
                if (!activeChar.isNoble()) {
                    activeChar.setNobleType(NobleType.NORMAL);
                }
            }
        }
        if (Config.EXP_AND_SP_ENABLED) {
            if (activeChar.getVar("EXPANDSPGIVE") != null && System.currentTimeMillis() < activeChar.getVarLong("EXPANDSP")) {
                int[][] data = new int[Config.COUNT_LEVEL.length][4];
                int i = 0;
                if (Config.COUNT_LEVEL.length != 0) {
                    for (String tele : Config.COUNT_LEVEL) {
                        String[] splitReward = tele.split(",");
                        data[i][0] = Integer.parseInt(splitReward[0]);
                        data[i][1] = Integer.parseInt(splitReward[1]);
                        data[i][2] = Integer.parseInt(splitReward[2]);
                        data[i][3] = Integer.parseInt(splitReward[3]);
                        i++;
                    }
                }
                long time = (System.currentTimeMillis() - activeChar.getVarLong("EXPANDSPGIVE")) / Config.EXP_AND_SP_DELAY;
                for (int[] datas : data) {
                    if (activeChar.getLevel() >= datas[0] && activeChar.getLevel() <= datas[1]) {
                        long EXP = datas[2] * time;
                        long SP = datas[3] * time;
                        activeChar.addExpAndSp(EXP, SP);
                    }
                }
                activeChar.unsetVar("EXPANDSPGIVE");
            } else {
                activeChar.unsetVar("EXPANDSPGIVE");
            }
        }
        if (ServerVariables.getString("lj_event", "off").equalsIgnoreCase("on"))
            activeChar.sendPacket(new ExBR_BroadcastEventState(ExBR_BroadcastEventState.LOVERS_JUBILEE, 1));

        if (activeChar.getVarB("pkItem")){
            if (activeChar.getVarLong("pkItem") <= System.currentTimeMillis()) {
                activeChar.unsetVar("pkItem");
                if (Config.TOP_PK_REMOVE_ITEM)
                    activeChar.getInventory().destroyItemByItemId(Config.TOP_PK_ITEM_ID[0], Config.TOP_PK_ITEM_COUNT);
            }
            if (Config.TOP_PK_LOCK_ITEM)
                TopPvpPk.Lock(activeChar, true);
        }
        if (activeChar.getVarB("pvpItem")) {
            if (activeChar.getVarLong("pvpItem") <= System.currentTimeMillis()){
                activeChar.unsetVar("pvpItem");
                if (Config.TOP_PVP_REMOVE_ITEM)
                    activeChar.getInventory().destroyItemByItemId(Config.TOP_PVP_ITEM_ID[0], Config.TOP_PVP_ITEM_COUNT);
            }
            if (Config.TOP_PVP_LOCK_ITEM)
                TopPvpPk.Lock(activeChar, false);
            if (activeChar.getVarB("pvpflag")) {
                activeChar.stopPvPFlag();
                activeChar.unsetVar("pvpflag");
            }
        }
        if (Config.GIVESPANDADENAENABLE)
            GiveSpAndAdena.Give(activeChar);

        if (Config.EMAIL_NOTIFY && CharacterDAO.getInstance().accountCharNumber(activeChar.getAccountName()) <= 1 && activeChar.getOnlineTime() == 0) {
            if (Config.FIRST_ENTER_WORLD) {
                for (String anArray : Config.FIRST_ENTER_GIVE) {
                    StringTokenizer st = new StringTokenizer(anArray, "{},()[]");
                    int item_id = Integer.parseInt(st.nextToken());
                    long item_count_min = Integer.parseInt(st.nextToken());
                    long item_count_max = Integer.parseInt(st.nextToken());
                    long count = Rnd.get(item_count_min, item_count_max);
                    ItemFunctions.addItem(activeChar, item_id, count, true);
                }
            }
            String[] args = {Config.EMAIL_SERVERINFO_NAME};
            Util.sendMail("NewChar", activeChar.getAccountName(), args);
        }

        int auctionItemObjectId = activeChar.getVarInt(Acts.RARE_AUCTION_PARTICIPATION_ACT, 0);
        if (auctionItemObjectId != 0)
        {
            ItemInstance auctionItem = ItemsDAO.getInstance().load(auctionItemObjectId);
            activeChar.getListeners().onAct(Acts.RARE_AUCTION_PARTICIPATION_ACT, auctionItem, false);
            activeChar.unsetVar(Acts.RARE_AUCTION_PARTICIPATION_ACT);
        }
    }

    private void notifyCastleOwner(Player activeChar) {
        Clan clan = activeChar.getClan();

        if (clan != null) {
            if (clan.getCastle() > 0) {
                Castle castle = ResidenceHolder.getInstance().getResidence(clan.getCastle());
                if ((castle != null) && (activeChar.getObjectId() == clan.getLeaderId()))
                    Announcements.getInstance().announceToAll(activeChar.isLangRus() ? "Лорд " + activeChar.getName() + " правитель " + castle.getName() + " Замка онлайн!" : "Lord " + activeChar.getName() + " prince " + castle.getName() + " castle online!");
            }
        }
    }

    private void checkNewMail(Player activeChar) {
        for (Mail mail : MailDAO.getInstance().getReceivedMailByOwnerId(activeChar.getObjectId())) {
            if (mail.isUnread()) {
                sendPacket(ExNoticePostArrived.STATIC_FALSE);
                break;
            }
        }
    }
}
Ну тогда смотри где ты еще сломал. Вангую что оно изначально из коробки работало. Я ж надеюсь ты гитом пользуешься?
 
Ну тогда смотри где ты еще сломал. Вангую что оно изначально из коробки работало. Я ж надеюсь ты гитом пользуешься?
когда я с салватиона на 474 апнул то работало всё гуд а вот на 520 уже сломалось но вот прикол в том что я не чего не трогал связанное с этим чтобы даже поломать я думаю вообще сделать костыль а то пока идей ноль
 
когда я с салватиона на 474 апнул то работало всё гуд а вот на 520 уже сломалось но вот прикол в том что я не чего не трогал связанное с этим чтобы даже поломать я думаю вообще сделать костыль а то пока идей ноль
Я вообще с хф апнул на 542, у меня таких проблем нету.
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху Снизу