I am in Java, a complete zero.
I would be grateful.
Code: Select all
### Eclipse Workspace Patch 1.0
#P official
Index: trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2Character.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 11)
+++ trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
@@ -5501,6 +5501,27 @@
}
}
+
+ public float getMovementSpeedMultiplier()
+ {
+ return getStat().getMovementSpeedMultiplier();
+ }
+
+ public int getRunSpeed()
+ {
+ return getStat().getBaseRunSpeed();
+ }
+
+ public final int getWalkSpeed()
+ {
+ return getStat().getBaseWalkSpeed();
+ }
+
+ public final float getAttackSpeedMultiplier()
+ {
+ return getStat().getAttackSpeedMultiplier();
+ }
+
/**
* @return true if the character is located in an arena (aka a PvP zone which isn't a siege).
*/
Index: trunk/aCis_gameserver/java/net/sf/l2j/gameserver/instancemanager/CharacterKillingManager.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/gameserver/instancemanager/CharacterKillingManager.java (revision 0)
+++ trunk/aCis_gameserver/java/net/sf/l2j/gameserver/instancemanager/CharacterKillingManager.java (working copy)
@@ -0,0 +1,321 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.instancemanager;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.model.CharSelectInfoPackage;
+import net.sf.l2j.gameserver.model.actor.L2PcPolymorph;
+import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
+
+/**
+ * @author paytaly
+ */
+public final class CharacterKillingManager
+{
+ private static final Logger _log = Logger.getLogger(CharacterKillingManager.class.getName());
+
+ private int _cycle = 0;
+ private long _cycleStart = 0L;
+ private int _winnerPvPKills;
+ private int _winnerPvPKillsCount;
+ private int _winnerPKKills;
+ private int _winnerPKKillsCount;
+
+ private volatile CharSelectInfoPackage _winnerPvPKillsInfo;
+ private volatile CharSelectInfoPackage _winnerPKKillsInfo;
+
+ private ScheduledFuture<?> _scheduledKillingCycleTask = null;
+
+ private List<L2PcPolymorph> pvpMorphListeners = new CopyOnWriteArrayList<>();
+ private List<L2PcPolymorph> pkMorphListeners = new CopyOnWriteArrayList<>();
+
+ protected CharacterKillingManager()
+ {
+ }
+
+ public synchronized void init()
+ {
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement st = con.prepareStatement("SELECT cycle, cycle_start, winner_pvpkills, winner_pvpkills_count, winner_pkkills, winner_pkkills_count FROM character_kills_info ORDER BY cycle_start DESC LIMIT 1");
+ ResultSet rs = st.executeQuery())
+ {
+ if (rs.next())
+ {
+ _cycle = rs.getInt("cycle");
+ _cycleStart = rs.getLong("cycle_start");
+ _winnerPvPKills = rs.getInt("winner_pvpkills");
+ _winnerPvPKillsCount = rs.getInt("winner_pvpkills_count");
+ _winnerPKKills = rs.getInt("winner_pkkills");
+ _winnerPKKillsCount = rs.getInt("winner_pkkills_count");
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Could not load characters killing cycle: " + e.getMessage(), e);
+ }
+
+ broadcastMorphUpdate();
+
+ if (_scheduledKillingCycleTask != null)
+ {
+ _scheduledKillingCycleTask.cancel(true);
+ }
+ long millisToNextCycle = (_cycleStart + Config.CKM_CYCLE_LENGTH) - System.currentTimeMillis();
+ _scheduledKillingCycleTask = ThreadPoolManager.getInstance().scheduleGeneral(new CharacterKillingCycleTask(), millisToNextCycle);
+
+ _log.info(getClass().getSimpleName() + ": Started! Cycle: " + _cycle + " - Next cycle in: " + _scheduledKillingCycleTask.getDelay(TimeUnit.SECONDS) + "s");
+ }
+
+ public synchronized void newKillingCycle()
+ {
+ _cycleStart = System.currentTimeMillis();
+ computateCyclePvPWinner();
+ computateCyclePKWinner();
+ refreshKillingSnapshot();
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement st = con.prepareStatement("INSERT INTO character_kills_info (cycle_start, winner_pvpkills, winner_pvpkills_count, winner_pkkills, winner_pkkills_count) VALUES (?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS))
+ {
+ st.setLong(1, _cycleStart);
+ st.setInt(2, _winnerPvPKills);
+ st.setInt(3, _winnerPvPKillsCount);
+ st.setInt(4, _winnerPKKills);
+ st.setInt(5, _winnerPKKillsCount);
+ st.execute();
+
+ try (ResultSet rs = st.getGeneratedKeys())
+ {
+ if (rs.next())
+ {
+ _cycle = rs.getInt(1);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Could not create characters killing cycle: " + e.getMessage(), e);
+ }
+
+ broadcastMorphUpdate();
+
+ if (_scheduledKillingCycleTask != null)
+ {
+ _scheduledKillingCycleTask.cancel(true);
+ }
+ _scheduledKillingCycleTask = ThreadPoolManager.getInstance().scheduleGeneral(new CharacterKillingCycleTask(), Config.CKM_CYCLE_LENGTH);
+ }
+
+ private void computateCyclePvPWinner()
+ {
+ _winnerPvPKills = 0;
+ _winnerPvPKillsCount = 0;
+ _winnerPvPKillsInfo = null;
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement st = con.prepareStatement("SELECT c.obj_Id, (c.pvpkills - COALESCE(ck.pvpkills, 0)) pvpkills FROM characters c LEFT JOIN character_kills_snapshot ck ON ck.charId = c.obj_Id WHERE accesslevel = 0 ORDER BY pvpkills DESC LIMIT 1");
+ ResultSet rs = st.executeQuery();)
+ {
+ if (rs.next())
+ {
+ int kills = rs.getInt(2);
+ if (kills > 0)
+ {
+ _winnerPvPKills = rs.getInt(1);
+ _winnerPvPKillsCount = kills;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Could not computate characters killing cycle winners: " + e.getMessage(), e);
+ }
+ }
+
+ private void computateCyclePKWinner()
+ {
+ _winnerPKKills = 0;
+ _winnerPKKillsCount = 0;
+ _winnerPKKillsInfo = null;
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement st = con.prepareStatement("SELECT c.obj_Id, (c.pkkills - COALESCE(ck.pkkills, 0)) pkkills FROM characters c LEFT JOIN character_kills_snapshot ck ON ck.charId = c.obj_Id WHERE accesslevel = 0 ORDER BY pkkills DESC LIMIT 1");
+ ResultSet rs = st.executeQuery();)
+ {
+ if (rs.next())
+ {
+ int kills = rs.getInt(2);
+ if (kills > 0)
+ {
+ _winnerPKKills = rs.getInt(1);
+ _winnerPKKillsCount = kills;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Could not computate characters killing cycle winners: " + e.getMessage(), e);
+ }
+ }
+
+ private static void refreshKillingSnapshot()
+ {
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement stTruncate = con.prepareStatement("TRUNCATE TABLE character_kills_snapshot");
+ PreparedStatement stRefresh = con.prepareStatement("INSERT INTO character_kills_snapshot (charId, pvpkills, pkkills) SELECT obj_Id, pvpkills, pkkills FROM characters WHERE (pvpkills > 0 OR pkkills > 0) AND accesslevel = 0"))
+ {
+ stTruncate.executeUpdate();
+ stRefresh.executeUpdate();
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Could not refresh characters killing snapshot: " + e.getMessage(), e);
+ }
+ }
+
+ public void broadcastMorphUpdate()
+ {
+ final CharSelectInfoPackage winnerPvPKillsInfo = getWinnerPvPKillsInfo();
+ for (L2PcPolymorph npc : pvpMorphListeners)
+ {
+ broadcastPvPMorphUpdate(npc, winnerPvPKillsInfo);
+ }
+
+ final CharSelectInfoPackage winnerPKKillsInfo = getWinnerPKKillsInfo();
+ for (L2PcPolymorph npc : pkMorphListeners)
+ {
+ broadcastPKMorphUpdate(npc, winnerPKKillsInfo);
+ }
+ }
+
+ private void broadcastPvPMorphUpdate(L2PcPolymorph npc, CharSelectInfoPackage winnerPvPKillsInfo)
+ {
+ if (winnerPvPKillsInfo == null)
+ {
+ npc.setPolymorphInfo(null);
+ return;
+ }
+ npc.setVisibleTitle(Config.CKM_PVP_NPC_TITLE.replaceAll("%kills%", String.valueOf(_winnerPvPKillsCount)));
+ npc.setTitleColor(Config.CKM_PVP_NPC_TITLE_COLOR);
+ npc.setNameColor(Config.CKM_PVP_NPC_NAME_COLOR);
+ npc.setPolymorphInfo(winnerPvPKillsInfo);
+ npc.broadcastPacket(new SocialAction(npc, 16));
+ }
+
+ private void broadcastPKMorphUpdate(L2PcPolymorph npc, CharSelectInfoPackage winnerPKKillsInfo)
+ {
+ if (winnerPKKillsInfo == null)
+ {
+ npc.setPolymorphInfo(null);
+ return;
+ }
+ npc.setVisibleTitle(Config.CKM_PK_NPC_TITLE.replaceAll("%kills%", String.valueOf(_winnerPKKillsCount)));
+ npc.setTitleColor(Config.CKM_PK_NPC_TITLE_COLOR);
+ npc.setNameColor(Config.CKM_PK_NPC_NAME_COLOR);
+ npc.setPolymorphInfo(winnerPKKillsInfo);
+ npc.broadcastPacket(new SocialAction(npc, 16));
+ }
+
+ public boolean addPvPMorphListener(L2PcPolymorph npc)
+ {
+ if (npc == null)
+ {
+ return false;
+ }
+ broadcastPvPMorphUpdate(npc, getWinnerPvPKillsInfo());
+ return pvpMorphListeners.add(npc);
+ }
+
+ public boolean removePvPMorphListener(L2PcPolymorph npc)
+ {
+ return pvpMorphListeners.remove(npc);
+ }
+
+ public boolean addPKMorphListener(L2PcPolymorph npc)
+ {
+ if (npc == null)
+ {
+ return false;
+ }
+ broadcastPKMorphUpdate(npc, getWinnerPKKillsInfo());
+ return pkMorphListeners.add(npc);
+ }
+
+ public boolean removePKMorphListener(L2PcPolymorph npc)
+ {
+ return pkMorphListeners.remove(npc);
+ }
+
+ private CharSelectInfoPackage getWinnerPvPKillsInfo()
+ {
+ if (_winnerPvPKills != 0 && _winnerPvPKillsInfo == null)
+ {
+ synchronized (this)
+ {
+ if (_winnerPvPKillsInfo == null)
+ {
+ _winnerPvPKillsInfo = L2PcPolymorph.loadCharInfo(_winnerPvPKills);
+ }
+ }
+ }
+ return _winnerPvPKillsInfo;
+ }
+
+ private CharSelectInfoPackage getWinnerPKKillsInfo()
+ {
+ if (_winnerPKKills != 0 && _winnerPKKillsInfo == null)
+ {
+ synchronized (this)
+ {
+ if (_winnerPKKillsInfo == null)
+ {
+ _winnerPKKillsInfo = L2PcPolymorph.loadCharInfo(_winnerPKKills);
+ }
+ }
+ }
+ return _winnerPKKillsInfo;
+ }
+
+ protected static class CharacterKillingCycleTask implements Runnable
+ {
+ @Override
+ public void run()
+ {
+ CharacterKillingManager.getInstance().newKillingCycle();
+ }
+ }
+
+ public static CharacterKillingManager getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final CharacterKillingManager _instance = new CharacterKillingManager();
+}
+}
\ No newline at end of file
Index: trunk/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/NpcInfoPolymorph.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/NpcInfoPolymorph.java (revision 0)
+++ trunk/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/NpcInfoPolymorph.java (working copy)
@@ -0,0 +1,203 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.network.serverpackets;
+
+import net.sf.l2j.gameserver.datatables.CharTemplateTable;
+import net.sf.l2j.gameserver.datatables.ClanTable;
+import net.sf.l2j.gameserver.model.CharSelectInfoPackage;
+import net.sf.l2j.gameserver.model.L2Clan;
+import net.sf.l2j.gameserver.model.actor.L2PcPolymorph;
+import net.sf.l2j.gameserver.model.actor.template.PcTemplate;
+import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
+
+/**
+ * @author paytaly
+ */
+public final class NpcInfoPolymorph extends L2GameServerPacket
+{
+ private final L2PcPolymorph _activeChar;
+ private final CharSelectInfoPackage _morph;
+ private final PcTemplate _template;
+ private final L2Clan _clan;
+ private final int _x, _y, _z, _heading;
+ private final int _mAtkSpd, _pAtkSpd;
+ private final int _runSpd, _walkSpd;
+ private final float _moveMultiplier;
+
+ public NpcInfoPolymorph(L2PcPolymorph cha)
+ {
+ _activeChar = cha;
+ _morph = cha.getPolymorphInfo();
+ _template = CharTemplateTable.getInstance().getTemplate(_morph.getBaseClassId());
+ _clan = ClanTable.getInstance().getClan(_morph.getClanId());
+
+ _x = _activeChar.getX();
+ _y = _activeChar.getY();
+ _z = _activeChar.getZ();
+ _heading = _activeChar.getHeading();
+
+ _mAtkSpd = _activeChar.getMAtkSpd();
+ _pAtkSpd = _activeChar.getPAtkSpd();
+
+ _moveMultiplier = _activeChar.getMovementSpeedMultiplier();
+ _runSpd = (int) (_activeChar.getRunSpeed() / _moveMultiplier);
+ _walkSpd = (int) (_activeChar.getWalkSpeed() / _moveMultiplier);
+ }
+
+ @Override
+ protected final void writeImpl()
+ {
+ writeC(0x03);
+ writeD(_x);
+ writeD(_y);
+ writeD(_z);
+ writeD(_heading);
+ writeD(_activeChar.getObjectId());
+ writeS(_morph.getName());
+ writeD(_morph.getRace());
+ writeD(_morph.getSex());
+
+ writeD(_morph.getBaseClassId());
+
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_HAIRALL));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_HEAD));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_LHAND));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_CHEST));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_LEGS));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_FEET));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_BACK));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_RHAND));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_HAIR));
+ writeD(_morph.getPaperdollItemId(Inventory.PAPERDOLL_FACE));
+
+ // c6 new h's
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeD(_morph.getAugmentationId());
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeD(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+ writeH(0x00);
+
+ writeD(0);
+ writeD(0);
+
+ writeD(_mAtkSpd);
+ writeD(_pAtkSpd);
+
+ writeD(0);
+ writeD(0);
+
+ writeD(_runSpd);
+ writeD(_walkSpd);
+ writeD(_runSpd); // swim run speed
+ writeD(_walkSpd); // swim walk speed
+ writeD(_runSpd); // fl run speed
+ writeD(_walkSpd); // fl walk speed
+ writeD(_runSpd); // fly run speed
+ writeD(_walkSpd); // fly walk speed
+ writeF(_activeChar.getMovementSpeedMultiplier());
+ writeF(_activeChar.getAttackSpeedMultiplier());
+
+ writeF(_template.getCollisionRadius());
+ writeF(_template.getCollisionHeight());
+
+ writeD(_morph.getHairStyle());
+ writeD(_morph.getHairColor());
+ writeD(_morph.getFace());
+
+ writeS(_activeChar.getVisibleTitle());
+
+ if (_clan != null)
+ {
+ writeD(_clan.getClanId());
+ writeD(_clan.getCrestId());
+ writeD(_clan.getAllyId());
+ writeD(_clan.getAllyCrestId());
+ }
+ else
+ {
+ writeD(0);
+ writeD(0);
+ writeD(0);
+ writeD(0);
+ }
+
+ writeD(0);
+
+ writeC(1); // standing = 1 sitting = 0
+ writeC(_activeChar.isRunning() ? 1 : 0); // running = 1 walking = 0
+ writeC(_activeChar.isInCombat() ? 1 : 0);
+ writeC(_activeChar.isAlikeDead() ? 1 : 0);
+
+ writeC(0); // invisible = 1 visible =0
+
+ writeC(0); // 1 on strider 2 on wyvern 0 no mount
+ writeC(0); // 1 - sellshop
+
+ writeH(0);
+
+ writeC(0);
+
+ writeD(_activeChar.getAbnormalEffect());
+
+ writeC(0);
+ writeH(0); // Blue value for name (0 = white, 255 = pure blue)
+ writeD(_morph.getClassId());
+
+ writeD(_activeChar.getMaxCp());
+ writeD((int) _activeChar.getCurrentCp());
+ writeC((_morph.getEnchantEffect() > 127) ? 127 : _morph.getEnchantEffect());
+
+ writeC(0x00); // team circle around feet 1= Blue, 2 = red
+
+ writeD(_clan != null ? _clan.getCrestLargeId() : 0);
+ writeC(0); // Symbol on char menu ctrl+I
+ writeC(0); // Hero Aura
+
+ writeC(0); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
+ writeD(0);
+ writeD(0);
+ writeD(0);
+
+ writeD(_activeChar.getNameColor());
+
+ writeD(0x00); // isRunning() as in UserInfo?
+
+ writeD(0);
+ writeD(0);
+
+ writeD(_activeChar.getTitleColor());
+
+ writeD(0x00);
+ }
+}
\ No newline at end of file
Index: trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2PcPolymorph.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2PcPolymorph.java (revision 0)
+++ trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2PcPolymorph.java (working copy)
@@ -0,0 +1,191 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.model.actor;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.logging.Level;
+
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.model.CharSelectInfoPackage;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.network.serverpackets.NpcInfoPolymorph;
+
+/**
+ * @author paytaly
+ */
+public class L2PcPolymorph extends L2Npc
+{
+ private CharSelectInfoPackage _polymorphInfo;
+ private int _nameColor = 0xFFFFFF;
+ private int _titleColor = 0xFFFF77;
+ private String _visibleTitle = "";
+
+ public L2PcPolymorph(int objectId, NpcTemplate template)
+ {
+ super(objectId, template);
+ setIsInvul(true);
+ }
+
+ @Override
+ public boolean hasRandomAnimation()
+ {
+ return false;
+ }
+
+ public CharSelectInfoPackage getPolymorphInfo()
+ {
+ return _polymorphInfo;
+ }
+
+ public void setPolymorphInfo(CharSelectInfoPackage polymorphInfo)
+ {
+ _polymorphInfo = polymorphInfo;
+
+ for (L2Object object : getKnownList().getKnownObjects())
+ {
+ if (object instanceof L2PcInstance)
+ {
+ sendInfo(object.getActingPlayer());
+ }
+ }
+ }
+
+ public int getNameColor()
+ {
+ return _nameColor;
+ }
+
+ public void setNameColor(int nameColor)
+ {
+ _nameColor = nameColor;
+ }
+
+ public int getTitleColor()
+ {
+ return _titleColor;
+ }
+
+ public void setTitleColor(int titleColor)
+ {
+ _titleColor = titleColor;
+ }
+
+ public String getVisibleTitle()
+ {
+ return _visibleTitle;
+ }
+
+ public void setVisibleTitle(String title)
+ {
+ _visibleTitle = title == null ? "" : title;
+ }
+
+ @Override
+ public void sendInfo(L2PcInstance activeChar)
+ {
+ if (getPolymorphInfo() == null)
+ {
+ super.sendInfo(activeChar);
+ return;
+ }
+
+ activeChar.sendPacket(new NpcInfoPolymorph(this));
+ }
+
+ @Override
+ public String getHtmlPath(int npcId, int val)
+ {
+ String pom = "" + npcId;
+ if (val != 0)
+ {
+ pom += "-" + val;
+ }
+ return "data/html/polymorph/" + pom + ".htm";
+ }
+
+ @Override
+ public void showChatWindow(L2PcInstance player, int val)
+ {
+ String filename = getHtmlPath(getNpcId(), val);
+
+ // Send a Server->Client NpcHtmlMessage containing the text of the L2Npc to the L2PcInstance
+ final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
+ html.setFile(filename);
+ html.replace("%objectId%", getObjectId());
+ html.replace("%ownername%", getPolymorphInfo() != null ? getPolymorphInfo().getName() : "");
+ player.sendPacket(html);
+
+ // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ }
+
+ public static CharSelectInfoPackage loadCharInfo(int objectId)
+ {
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT char_name, race, base_class, classid, sex, face, hairStyle, hairColor, clanid FROM characters WHERE obj_Id = ?"))
+ {
+ statement.setInt(1, objectId);
+
+ try (ResultSet rs = statement.executeQuery())
+ {
+ if (rs.next())
+ {
+ final CharSelectInfoPackage charInfo = new CharSelectInfoPackage(objectId, rs.getString("char_name"));
+ charInfo.setRace(rs.getInt("race"));
+ charInfo.setBaseClassId(rs.getInt("base_class"));
+ charInfo.setClassId(rs.getInt("classid"));
+ charInfo.setSex(rs.getInt("sex"));
+ charInfo.setFace(rs.getInt("face"));
+ charInfo.setHairStyle(rs.getInt("hairStyle"));
+ charInfo.setHairColor(rs.getInt("hairColor"));
+ charInfo.setClanId(rs.getInt("clanid"));
+
+ // Get the augmentation id for equipped weapon
+ int weaponObjId = charInfo.getPaperdollObjectId(Inventory.PAPERDOLL_RHAND);
+ if (weaponObjId > 0)
+ {
+ try (PreparedStatement statementAugment = con.prepareStatement("SELECT attributes FROM augmentations WHERE item_id = ?"))
+ {
+ statementAugment.setInt(1, weaponObjId);
+ try (ResultSet rsAugment = statementAugment.executeQuery())
+ {
+ if (rsAugment.next())
+ {
+ int augment = rsAugment.getInt("attributes");
+ charInfo.setAugmentationId(augment == -1 ? 0 : augment);
+ }
+ }
+ }
+ }
+
+ return charInfo;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.WARNING, "Could not restore char info: " + e.getMessage(), e);
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
Index: trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPvPMonumentInstance.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPvPMonumentInstance.java (revision 0)
+++ trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPvPMonumentInstance.java (working copy)
@@ -0,0 +1,51 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.instancemanager.CharacterKillingManager;
+import net.sf.l2j.gameserver.model.actor.L2PcPolymorph;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+
+/**
+ * @author paytaly
+ */
+public class L2TopPvPMonumentInstance extends L2PcPolymorph
+{
+ public L2TopPvPMonumentInstance(int objectId, NpcTemplate template)
+ {
+ super(objectId, template);
+ }
+
+ @Override
+ public void onSpawn()
+ {
+ super.onSpawn();
+ if (Config.CKM_ENABLED)
+ {
+ CharacterKillingManager.getInstance().addPvPMorphListener(this);
+ }
+ }
+
+ @Override
+ public void deleteMe()
+ {
+ super.deleteMe();
+ if (Config.CKM_ENABLED)
+ {
+ CharacterKillingManager.getInstance().removePvPMorphListener(this);
+ }
+ }
+}
\ No newline at end of file
Index: trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPKMonumentInstance.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPKMonumentInstance.java (revision 0)
+++ trunk/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2TopPKMonumentInstance.java (working copy)
@@ -0,0 +1,51 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.instancemanager.CharacterKillingManager;
+import net.sf.l2j.gameserver.model.actor.L2PcPolymorph;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+
+/**
+ * @author paytaly
+ */
+public class L2TopPKMonumentInstance extends L2PcPolymorph
+{
+ public L2TopPKMonumentInstance(int objectId, NpcTemplate template)
+ {
+ super(objectId, template);
+ }
+
+ @Override
+ public void onSpawn()
+ {
+ super.onSpawn();
+ if (Config.CKM_ENABLED)
+ {
+ CharacterKillingManager.getInstance().addPKMorphListener(this);
+ }
+ }
+
+ @Override
+ public void deleteMe()
+ {
+ super.deleteMe();
+ if (Config.CKM_ENABLED)
+ {
+ CharacterKillingManager.getInstance().removePKMorphListener(this);
+ }
+ }
+}
\ No newline at end of file
Index: trunk/aCis_gameserver/java/net/sf/l2j/Config.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/Config.java (revision 13)
+++ trunk/aCis_gameserver/java/net/sf/l2j/Config.java (working copy)
@@ -28,6 +28,7 @@
import java.util.StringTokenizer;
import java.util.logging.Logger;
+import net.sf.l2j.gameserver.util.StringUtil;
import net.sf.l2j.commons.config.ExProperties;
import net.sf.l2j.gameserver.model.holder.BuffSkillHolder;
import net.sf.l2j.gameserver.model.holder.IntIntHolder;
@@ -117,7 +118,16 @@
public static int SIEGEDAYCASTLESchuttgart;
public static int NEXT_SIEGE_TIME;
public static int HOUR_OF_SIEGE;
-
+ /** Character Killing Monument settings */
+ public static boolean CKM_ENABLED;
+ public static long CKM_CYCLE_LENGTH;
+ public static String CKM_PVP_NPC_TITLE;
+ public static int CKM_PVP_NPC_TITLE_COLOR;
+ public static int CKM_PVP_NPC_NAME_COLOR;
+ public static String CKM_PK_NPC_TITLE;
+ public static int CKM_PK_NPC_TITLE_COLOR;
+ public static int CKM_PK_NPC_NAME_COLOR;
+
/** Manor */
public static int ALT_MANOR_REFRESH_TIME;
public static int ALT_MANOR_REFRESH_MIN;
@@ -853,6 +863,14 @@
NEXT_SIEGE_TIME = Integer.parseInt(custom.getProperty("NextSiegeTime", "2"));
/** Hour of the siege will start*/
HOUR_OF_SIEGE = Integer.parseInt(custom.getProperty("HourOfSiege", "18"));
+ CKM_ENABLED = custom.getProperty("CKMEnabled", false);
+ CKM_CYCLE_LENGTH = custom.getProperty("CKMCycleLength", 86400000);
+ CKM_PVP_NPC_TITLE = custom.getProperty("CKMPvPNpcTitle", "%kills% PvPs in the last 24h");
+ CKM_PVP_NPC_TITLE_COLOR = Integer.decode(StringUtil.concat("0x", custom.getProperty("CKMPvPNpcTitleColor", "00CCFF")));
+ CKM_PVP_NPC_NAME_COLOR = Integer.decode(StringUtil.concat("0x", custom.getProperty("CKMPvPNpcNameColor", "FFFFFF")));
+ CKM_PK_NPC_TITLE = custom.getProperty("CKMPKNpcTitle", "%kills% PKs in the last 24h");
+ CKM_PK_NPC_TITLE_COLOR = Integer.decode(StringUtil.concat("0x", custom.getProperty("CKMPKNpcTitleColor", "00CCFF")));
+ CKM_PK_NPC_NAME_COLOR = Integer.decode(StringUtil.concat("0x", custom.getProperty("CKMPKNpcNameColor", "FFFFFF")));
}
Index: trunk/aCis_gameserver/config/custom/custom.properties
===================================================================
--- trunk/aCis_gameserver/config/custom/custom.properties (revision 13)
+++ trunk/aCis_gameserver/config/custom/custom.properties (working copy)
@@ -166,3 +166,40 @@
# if put 16 the siege will start 16:00 hour.
# Default: 18
HourOfSiege = 18
+
+#=============================================================
+# Character Killing Monuments (by paytaly)
+#=============================================================
+# Enable the Character Killing Monuments
+# Default: False
+CKMEnabled = False
+
+# The killing cycle length
+# Default: 86400000 (24h)
+CKMCycleLength = 86400000
+
+# The title of the Monument for the PvP winner
+# Note: %kills% will be replaced with the winner's PvP count in the cycle
+# Default: %kills% PvPs in the last 24h
+CKMPvPNpcTitle = %kills% PvPs in the last 24h
+
+# The title color of the Monument for the PvP winner
+# Default: 00CCFF (yellow)
+CKMPvPNpcTitleColor = 00CCFF
+
+# The name color of the Monument for the PvP winner
+# Default: FFFFFF (white)
+CKMPvPNpcNameColor = FFFFFF
+
+# The title of the Monument for the PK winner
+# Note: %kills% will be replaced with the winner's PK count in the cycle
+# Default: %kills% PvPs in the last 24h
+CKMPKNpcTitle = %kills% PKs in the last 24h
+
+# The title color of the Monument for the PK winner
+# Default: 00CCFF (yellow)
+CKMPKNpcTitleColor = 00CCFF
+
+# The name color of the Monument for the PK winner
+# Default: FFFFFF (white)
+CKMPKNpcNameColor = FFFFFF
\ No newline at end of file
Index: trunk/aCis_gameserver/java/net/sf/l2j/util/StringUtil.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/util/StringUtil.java (revision 0)
+++ trunk/aCis_gameserver/java/net/sf/l2j/util/StringUtil.java (working copy)
@@ -0,0 +1,297 @@
+/*
+ * $Header$
+ *
+ * $Author: fordfrog $ $Date$ $Revision$ $Log$
+ *
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.util;
+
+/**
+ * String utilities optimized for the best performance.
+ *
+ * <h1>How to Use It</h1> <h2>concat() or append()</h2> If concatenating strings
+ * in single call, use StringUtil.concat(), otherwise use StringUtil.append()
+ * and its variants. <h2>Minimum Calls</h2> Bad:
+ *
+ * <pre>
+ * final StringBuilder sbString = new StringBuilder();
+ * StringUtil.append(sbString, "text 1", String.valueOf(npcId));
+ * StringUtil.append("text 2");
+ * </pre>
+ *
+ * Good:
+ *
+ * <pre>
+ * final StringBuilder sbString = new StringBuilder();
+ * StringUtil.append(sbString, "text 1", String.valueOf(npcId), "text 2");
+ * </pre>
+ *
+ * Why?<br/>
+ * Because the less calls you do, the less memory re-allocations have to be done
+ * so the whole text fits into the memory and less array copy tasks has to be
+ * performed. So if using less calls, less memory is used and string
+ * concatenation is faster. <h2>Size Hints for Loops</h2> Bad:
+ *
+ * <pre>
+ * final StringBuilder sbString = new StringBuilder();
+ * StringUtil.append(sbString, "header start", someText, "header end");
+ * for (int i = 0; i < 50; i++)
+ * {
+ * StringUtil.append(sbString, "text 1", stringArray[i], "text 2");
+ * }
+ * </pre>
+ *
+ * Good:
+ *
+ * <pre>
+ * final StringBuilder sbString = StringUtil.startAppend(1300, "header start", someText, "header end");
+ * for (int i = 0; i < 50; i++)
+ * {
+ * StringUtil.append(sbString, "text 1", stringArray[i], "text 2");
+ * }
+ * </pre>
+ *
+ * Why?<br/>
+ * When using StringUtil.append(), memory is only allocated to fit in the
+ * strings in method argument. So on each loop new memory for the string has to
+ * be allocated and old string has to be copied to the new string. With size
+ * hint, even if the size hint is above the needed memory, memory is saved
+ * because new memory has not to be allocated on each cycle. Also it is much
+ * faster if no string copy tasks has to be performed. So if concatenating
+ * strings in a loop, count approximately the size and set it as the hint for
+ * the string builder size. It's better to make the size hint little bit larger
+ * rather than smaller.<br/>
+ * In case there is no text appended before the cycle, just use <code>new
+ * StringBuilder(1300)</code>. <h2>Concatenation and Constants</h2> Bad:
+ *
+ * <pre>
+ * StringUtil.concat("text 1 ", "text 2", String.valueOf(npcId));
+ * </pre>
+ *
+ * Good:
+ *
+ * <pre>
+ * StringUtil.concat("text 1 " + "text 2", String.valueOf(npcId));
+ * </pre>
+ *
+ * or
+ *
+ * <pre>
+ * StringUtil.concat("text 1 text 2", String.valueOf(npcId));
+ * </pre>
+ *
+ * Why?<br/>
+ * It saves some cycles when determining size of memory that needs to be
+ * allocated because less strings are passed to concat() method. But do not use
+ * + for concatenation of non-constant strings, that degrades performance and
+ * makes extra memory allocations needed. <h2>Concatenation and Constant
+ * Variables</h2> Bad:
+ *
+ * <pre>
+ * String glue = "some glue";
+ * StringUtil.concat("text 1", glue, "text 2", glue, String.valueOf(npcId));
+ * </pre>
+ *
+ * Good:
+ *
+ * <pre>
+ * final String glue = "some glue";
+ * StringUtil.concat("text 1" + glue + "text2" + glue, String.valueOf(npcId));
+ * </pre>
+ *
+ * Why? Because when using <code>final</code> keyword, the <code>glue</code> is
+ * marked as constant string and compiler treats it as a constant string so it
+ * is able to create string "text1some gluetext2some glue" during the
+ * compilation. But this only works in case the value is known at compilation
+ * time, so this cannot be used for cases like
+ * <code>final String objectIdString =
+ * String.valueOf(getObjectId)</code>. <h2>StringBuilder Reuse</h2> Bad:
+ *
+ * <pre>
+ * final StringBuilder sbString1 = new StringBuilder();
+ * StringUtil.append(sbString1, "text 1", String.valueOf(npcId), "text 2");
+ * ... // output of sbString1, it is no more needed
+ * final StringBuilder sbString2 = new StringBuilder();
+ * StringUtil.append(sbString2, "text 3", String.valueOf(npcId), "text 4");
+ * </pre>
+ *
+ * Good:
+ *
+ * <pre>
+ * final StringBuilder sbString = new StringBuilder();
+ * StringUtil.append(sbString, "text 1", String.valueOf(npcId), "text 2");
+ * ... // output of sbString, it is no more needed
+ * sbString.setLength(0);
+ * StringUtil.append(sbString, "text 3", String.valueOf(npcId), "text 4");
+ * </pre>
+ *
+ * Why?</br> In first case, new memory has to be allocated for the second
+ * string. In second case already allocated memory is reused, but only in case
+ * the new string is not longer than the previously allocated string. Anyway,
+ * the second way is better because the string either fits in the memory and
+ * some memory is saved, or it does not fit in the memory, and in that case it
+ * works as in the first case. <h2>Primitives to Strings</h2> To convert
+ * primitives to string, use String.valueOf(). <h2>How much faster is it?</h2>
+ * Here are some results of my tests. Count is number of strings concatenated.
+ * Don't take the numbers as 100% true as the numbers are affected by other
+ * programs running on my computer at the same time. Anyway, from the results it
+ * is obvious that using StringBuilder with predefined size is the fastest (and
+ * also most memory efficient) solution. It is about 5 times faster when
+ * concatenating 7 strings, compared to TextBuilder. Also, with more strings
+ * concatenated, the difference between StringBuilder and TextBuilder gets
+ * larger. In code, there are many cases, where there are concatenated 50+
+ * strings so the time saving is even greater.
+ *
+ * <pre>
+ * Count: 2
+ * TextBuilder: 1893
+ * TextBuilder with size: 1703
+ * String: 1033
+ * StringBuilder: 993
+ * StringBuilder with size: 1024
+ * Count: 3
+ * TextBuilder: 1973
+ * TextBuilder with size: 1872
+ * String: 2583
+ * StringBuilder: 1633
+ * StringBuilder with size: 1156
+ * Count: 4
+ * TextBuilder: 2188
+ * TextBuilder with size: 2229
+ * String: 4207
+ * StringBuilder: 1816
+ * StringBuilder with size: 1444
+ * Count: 5
+ * TextBuilder: 9185
+ * TextBuilder with size: 9464
+ * String: 6937
+ * StringBuilder: 2745
+ * StringBuilder with size: 1882
+ * Count: 6
+ * TextBuilder: 9785
+ * TextBuilder with size: 10082
+ * String: 9471
+ * StringBuilder: 2889
+ * StringBuilder with size: 1857
+ * Count: 7
+ * TextBuilder: 10169
+ * TextBuilder with size: 10528
+ * String: 12746
+ * StringBuilder: 3081
+ * StringBuilder with size: 2139
+ * </pre>
+ *
+ * @author fordfrog
+ */
+public final class StringUtil
+{
+
+ private StringUtil()
+ {
+ }
+
+ /**
+ * Concatenates strings.
+ *
+ * @param strings
+ * strings to be concatenated
+ *
+ * @return concatenated string
+ *
+ * @see StringUtil
+ */
+ public static String concat(final String... strings)
+ {
+ final StringBuilder sbString = new StringBuilder(getLength(strings));
+
+ for (final String string : strings)
+ {
+ sbString.append(string);
+ }
+
+ return sbString.toString();
+ }
+
+ /**
+ * Creates new string builder with size initializated to
+ * <code>sizeHint</code>, unless total length of strings is greater than
+ * <code>sizeHint</code>.
+ *
+ * @param sizeHint
+ * hint for string builder size allocation
+ * @param strings
+ * strings to be appended
+ *
+ * @return created string builder
+ *
+ * @see StringUtil
+ */
+ public static StringBuilder startAppend(final int sizeHint, final String... strings)
+ {
+ final int length = getLength(strings);
+ final StringBuilder sbString = new StringBuilder(sizeHint > length ? sizeHint : length);
+
+ for (final String string : strings)
+ {
+ sbString.append(string);
+ }
+
+ return sbString;
+ }
+
+ /**
+ * Appends strings to existing string builder.
+ *
+ * @param sbString
+ * string builder
+ * @param strings
+ * strings to be appended
+ *
+ * @see StringUtil
+ */
+ public static void append(final StringBuilder sbString, final String... strings)
+ {
+ sbString.ensureCapacity(sbString.length() + getLength(strings));
+
+ for (final String string : strings)
+ {
+ sbString.append(string);
+ }
+ }
+
+ /**
+ * Counts total length of all the strings.
+ *
+ * @param strings
+ * array of strings
+ *
+ * @return total length of all the strings
+ */
+ private static int getLength(final String[] strings)
+ {
+ int length = 0;
+
+ for (final String string : strings)
+ {
+ if (string == null)
+ length += 4;
+ else
+ length += string.length();
+ }
+
+ return length;
+ }
+}
\ No newline at end of file
Index: trunk/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- trunk/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java (revision 11)
+++ trunk/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java (working copy)
@@ -78,6 +78,7 @@
import net.sf.l2j.gameserver.instancemanager.BoatManager;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.instancemanager.CastleManorManager;
+import net.sf.l2j.gameserver.instancemanager.CharacterKillingManager;
import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
import net.sf.l2j.gameserver.instancemanager.CoupleManager;
import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
@@ -301,6 +302,11 @@
if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED)
FishingChampionshipManager.getInstance();
+ if (Config.CKM_ENABLED)
+ {
+ CharacterKillingManager.getInstance().init();
+ }
+
StringUtil.printSection("System");
TaskManager.getInstance();
Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());