Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/l2jalpha/gameserver/network/clientpackets/Logout.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/Logout.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/Logout.java (working copy)
- @@ -27,6 +27,7 @@
- import net.l2jalpha.gameserver.datatables.xml.SkillTable;
- import net.l2jalpha.gameserver.model.L2World;
- import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
- import net.l2jalpha.gameserver.model.olympiad.OlympiadManager;
- import net.l2jalpha.gameserver.network.SystemMessageId;
- import net.l2jalpha.gameserver.network.serverpackets.ActionFailed;
- @@ -56,6 +57,13 @@
- if (player == null)
- return;
- +
- + if (CoastGuard.getInstance().getPlayers().contains(player))
- + {
- + player.sendMessage("You cannot logout while participating at Coast Guard event.");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- player.getInventory().updateDatabase();
- Index: java/net/l2jalpha/gameserver/GameServer.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/GameServer.java (revision 31)
- +++ java/net/l2jalpha/gameserver/GameServer.java (working copy)
- @@ -84,6 +84,7 @@
- import net.l2jalpha.gameserver.model.L2Manor;
- import net.l2jalpha.gameserver.model.L2World;
- import net.l2jalpha.gameserver.model.entity.Hero;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
- import net.l2jalpha.gameserver.model.entity.addons.events.QuizEvent;
- import net.l2jalpha.gameserver.model.olympiad.Olympiad;
- import net.l2jalpha.gameserver.model.olympiad.OlympiadGameManager;
- @@ -313,6 +314,7 @@
- {
- _log.config("Quiz Event is disabled.");
- }
- + CoastGuard.getInstance();
- printSection("Other");
- TaskManager.getInstance();
- Index: java/net/l2jalpha/gameserver/model/actor/L2Character.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/actor/L2Character.java (revision 31)
- +++ java/net/l2jalpha/gameserver/model/actor/L2Character.java (working copy)
- @@ -72,6 +72,8 @@
- import net.l2jalpha.gameserver.model.actor.stat.CharStat;
- import net.l2jalpha.gameserver.model.actor.status.CharStatus;
- import net.l2jalpha.gameserver.model.entity.Duel;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard.EventState;
- import net.l2jalpha.gameserver.model.quest.Quest;
- import net.l2jalpha.gameserver.model.quest.QuestState;
- import net.l2jalpha.gameserver.network.SystemMessageId;
- @@ -591,7 +593,12 @@
- {
- if (Config.DEBUG)
- _log.fine(getName()+" doAttack: target="+target);
- -
- +
- + if (CoastGuard.getInstance().getState() != EventState.INACTIVE && ((L2Attackable)this).getNpcId() == 65534)
- + {
- + getKnownList().addKnownObject(target);
- + }
- +
- if (isAlikeDead() || target == null || (this instanceof L2Npc && target.isAlikeDead())
- || (this instanceof L2PcInstance && target.isDead() && !target.isFakeDeath())
- || !getKnownList().knowsObject(target)
- Index: java/net/l2jalpha/gameserver/model/actor/instance/L2CoastMonsterInstance.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/actor/instance/L2CoastMonsterInstance.java (revision 0)
- +++ java/net/l2jalpha/gameserver/model/actor/instance/L2CoastMonsterInstance.java (working copy)
- @@ -0,0 +1,48 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.l2jalpha.gameserver.model.actor.instance;
- +
- +import net.l2jalpha.gameserver.ai.CtrlIntention;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
- +import net.l2jalpha.gameserver.templates.L2NpcTemplate;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class L2CoastMonsterInstance extends L2MonsterInstance
- +{
- + public L2CoastMonsterInstance(int objectId, L2NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public boolean isAggressive()
- + {
- + return true;
- + }
- +
- + @Override
- + public void onSpawn()
- + {
- + getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, CoastGuard.getInstance().getFlag());
- +
- + super.onSpawn();
- + }
- +}
- Index: java/net/l2jalpha/gameserver/model/entity/addons/events/CoastGuard.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/entity/addons/events/CoastGuard.java (revision 0)
- +++ java/net/l2jalpha/gameserver/model/entity/addons/events/CoastGuard.java (working copy)
- @@ -0,0 +1,300 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.l2jalpha.gameserver.model.entity.addons.events;
- +
- +import java.util.concurrent.ScheduledFuture;
- +import java.util.logging.Logger;
- +
- +import javolution.util.FastList;
- +import net.l2jalpha.gameserver.Announcements;
- +import net.l2jalpha.gameserver.ThreadPoolManager;
- +import net.l2jalpha.gameserver.ai.CtrlIntention;
- +import net.l2jalpha.gameserver.datatables.sql.NpcTable;
- +import net.l2jalpha.gameserver.datatables.sql.SpawnTable;
- +import net.l2jalpha.gameserver.model.L2Spawn;
- +import net.l2jalpha.gameserver.model.actor.L2Npc;
- +import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +import net.l2jalpha.gameserver.templates.L2NpcTemplate;
- +import net.l2jalpha.util.Rnd;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class CoastGuard
- +{
- + private static Logger _log = Logger.getLogger(CoastGuard.class.getName());
- +
- + public enum EventState
- + {
- + INACTIVE,
- + REGISTERING,
- + RUNNING
- + }
- +
- + private EventState state = EventState.INACTIVE;
- + private FastList<L2PcInstance> _players = new FastList<>();
- + private ScheduledFuture<?> _monstersSpawnTask = null;
- + protected L2Npc _flag = null;
- + protected FastList<L2Npc> _monsters = new FastList<>();
- +
- + public static CoastGuard getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + protected CoastGuard()
- + {
- + _log.info("Coast Guard event loaded.");
- + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
- + {
- + @Override
- + public void run()
- + {
- + runEvent();
- + }
- + }, 1000*60*60/2, 1000*60*60);
- + }
- +
- + public EventState getState()
- + {
- + return state;
- + }
- +
- + public void setState(EventState s)
- + {
- + state = s;
- + }
- +
- + public void runEvent()
- + {
- + Announcements.getInstance().announceToAll("Coast Guard event registrations have started. Type .register to join and .leave to leave.");
- + Announcements.getInstance().announceToAll("The registrations will close in 5 minutes.");
- + setState(EventState.REGISTERING);
- +
- + sleep(60*5);
- +
- + Announcements.getInstance().announceToAll("The registrations have closed.");
- + if (teleportPlayers())
- + {
- + Announcements.getInstance().announceToAll("The players have been teleported. 5 minutes till the event finish.");
- + }
- + else
- + {
- + setState(EventState.INACTIVE);
- + return;
- + }
- + spawnFlag();
- + _monstersSpawnTask = startMonstersSpawn();
- + setState(EventState.RUNNING);
- +
- + sleep(60*5);
- +
- + if (getState() == EventState.INACTIVE)
- + {
- + return;
- + }
- +
- + endEvent(true);
- + }
- +
- + public void removePlayer(L2PcInstance p)
- + {
- + if (getState() != EventState.REGISTERING)
- + {
- + p.sendMessage("You cannot remove your participation from the event right now.");
- + return;
- + }
- +
- + _players.remove(p);
- + p.sendMessage("You have successfully removed your participation from Coast Guard event.");
- + }
- +
- + public void registerPlayer(L2PcInstance p)
- + {
- + if (getState() != EventState.REGISTERING || p.isInOlympiadMode())
- + {
- + p.sendMessage("You cannot participate in the event right now.");
- + return;
- + }
- +
- + _players.add(p);
- + p.sendMessage("You have successfully registered for Coast Guard event.");
- + }
- +
- + public void endEvent(boolean won)
- + {
- + if (!won)
- + {
- + Announcements.getInstance().announceToAll("The event has finished. Monsters have won.");
- + if (!_monstersSpawnTask.isCancelled())
- + {
- + _monstersSpawnTask.cancel(true);
- + }
- + for (L2PcInstance p : _players)
- + {
- + p.sendMessage("You have lost!");
- + p.teleToLocation(38017, -48154, 896, true);
- + }
- + _players.clear();
- + _flag.deleteMe();
- + _flag = null;
- + for (L2Npc m : _monsters)
- + {
- + m.deleteMe();
- + }
- + _monsters.clear();
- + setState(EventState.INACTIVE);
- + }
- + else
- + {
- + Announcements.getInstance().announceToAll("The event has finished. Players have won.");
- + if (!_monstersSpawnTask.isCancelled())
- + {
- + _monstersSpawnTask.cancel(true);
- + }
- + for (L2PcInstance p : _players)
- + {
- + p.addItem("Won event.", 57, 1, p, true);
- + p.sendMessage("You have won!");
- + p.teleToLocation(38017, -48154, 896, true);
- + }
- + _players.clear();
- + _flag.deleteMe();
- + _flag = null;
- + for (L2Npc m : _monsters)
- + {
- + m.deleteMe();
- + }
- + _monsters.clear();
- + setState(EventState.INACTIVE);
- + }
- + }
- +
- + private ScheduledFuture<?> startMonstersSpawn()
- + {
- + return ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
- + {
- + @Override
- + public void run()
- + {
- + L2NpcTemplate t = NpcTable.getInstance().getTemplate(65534);
- + try
- + {
- + L2Spawn sp = new L2Spawn(t);
- + switch (Rnd.get(3))
- + {
- + case 0:
- + sp.setLocx(38966);
- + sp.setLocy(-48203);
- + sp.setLocz(896);
- + break;
- + case 1:
- + sp.setLocx(38907);
- + sp.setLocy(-48525);
- + sp.setLocz(896);
- + break;
- + case 2:
- + sp.setLocx(38412);
- + sp.setLocy(-48362);
- + sp.setLocz(896);
- + break;
- + }
- + sp.setAmount(1);
- + sp.setHeading(_flag.getHeading());
- + sp.setRespawnDelay(40);
- + SpawnTable.getInstance().addNewSpawn(sp, false);
- + sp.init();
- + sp.stopRespawn();
- + sp.getLastSpawn().getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, _flag);
- + _monsters.add(sp.getLastSpawn());
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + }
- + }
- + }, 3000, 2500);
- + }
- +
- + private void spawnFlag()
- + {
- + L2NpcTemplate t = NpcTable.getInstance().getTemplate(65535);
- + try
- + {
- + L2Spawn sp = new L2Spawn(t);
- + sp.setLocx(38667);
- + sp.setLocy(-48392);
- + sp.setLocz(896);
- + sp.setAmount(1);
- + sp.setHeading(_players.getFirst().getHeading());
- + sp.setRespawnDelay(40);
- + SpawnTable.getInstance().addNewSpawn(sp, false);
- + sp.init();
- + sp.stopRespawn();
- + _flag = sp.getLastSpawn();
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + }
- + }
- +
- + private boolean teleportPlayers()
- + {
- + if (_players.size() < 2)
- + {
- + Announcements.getInstance().announceToAll("The event was cancelled due to low participation.");
- + _players.clear();
- + return false;
- + }
- +
- + for (L2PcInstance p : _players)
- + {
- + p.teleToLocation(38681, -48234, 896, true);
- + p.sendMessage("You have 5 minutes left to defend the flag!");
- + }
- +
- + return true;
- + }
- +
- + public L2Npc getFlag()
- + {
- + return _flag;
- + }
- +
- + public FastList<L2PcInstance> getPlayers()
- + {
- + return _players;
- + }
- +
- + private void sleep(int secs)
- + {
- + try
- + {
- + Thread.sleep(secs*1000);
- + }
- + catch (InterruptedException e)
- + { }
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final CoastGuard _instance = new CoastGuard();
- + }
- +}
- Index: java/net/l2jalpha/gameserver/ai/L2AttackableAI.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/ai/L2AttackableAI.java (revision 31)
- +++ java/net/l2jalpha/gameserver/ai/L2AttackableAI.java (working copy)
- @@ -46,6 +46,8 @@
- import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- import net.l2jalpha.gameserver.model.actor.instance.L2PenaltyMonsterInstance;
- import net.l2jalpha.gameserver.model.actor.instance.L2RaidBossInstance;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard.EventState;
- import net.l2jalpha.gameserver.templates.L2Weapon;
- import net.l2jalpha.gameserver.templates.L2WeaponType;
- import net.l2jalpha.util.Rnd;
- @@ -479,7 +481,7 @@
- _attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
- }
- }
- -
- +
- // Check if target is dead or if timeout is expired to stop this attack
- if (getAttackTarget() == null || getAttackTarget().isAlikeDead()
- || _attackTimeout < GameTimeController.getGameTicks())
- @@ -502,7 +504,6 @@
- if (((L2Npc) _actor).getFactionId() != null)
- {
- String faction_id = ((L2Npc) _actor).getFactionId();
- -
- // Go through all L2Object that belong to its faction
- for (L2Object obj : _actor.getKnownList().getKnownObjects().values())
- {
- @@ -522,6 +523,7 @@
- && (npc.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE
- || npc.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE))
- {
- + System.out.println("Fourth pass.");
- // Notify the L2Object AI with EVT_AGGRESSION
- npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, getAttackTarget(), 1);
- }
- @@ -583,6 +585,11 @@
- L2Character hated;
- if (_actor.isConfused()) hated = getAttackTarget();
- else hated = ((L2Attackable) _actor).getMostHated();
- +
- + if (CoastGuard.getInstance().getState() != EventState.INACTIVE && ((L2Attackable)_actor).getNpcId() == 65534)
- + {
- + hated = CoastGuard.getInstance().getFlag();
- + }
- if (hated == null)
- {
- Index: java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java (working copy)
- @@ -22,6 +22,7 @@
- import net.l2jalpha.gameserver.communitybbs.Manager.RegionBBSManager;
- import net.l2jalpha.gameserver.datatables.xml.SkillTable;
- import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
- import net.l2jalpha.gameserver.model.olympiad.OlympiadManager;
- import net.l2jalpha.gameserver.network.L2GameClient;
- import net.l2jalpha.gameserver.network.SystemMessageId;
- @@ -56,6 +57,12 @@
- _log.warning("[RequestRestart] activeChar null!?");
- return;
- }
- +
- + if (CoastGuard.getInstance().getPlayers().contains(player))
- + {
- + player.sendMessage("You cannot restart while participating at Coast Guard event.");
- + return;
- + }
- if (player.isInOlympiadMode() || OlympiadManager.getInstance().isRegistered(player))
- {
- Index: java/net/l2jalpha/gameserver/model/actor/instance/L2CoastFlagInstance.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/actor/instance/L2CoastFlagInstance.java (revision 0)
- +++ java/net/l2jalpha/gameserver/model/actor/instance/L2CoastFlagInstance.java (working copy)
- @@ -0,0 +1,60 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.l2jalpha.gameserver.model.actor.instance;
- +
- +import net.l2jalpha.gameserver.model.actor.L2Character;
- +import net.l2jalpha.gameserver.model.actor.L2Npc;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard.EventState;
- +import net.l2jalpha.gameserver.templates.L2NpcTemplate;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class L2CoastFlagInstance extends L2Npc
- +{
- + public L2CoastFlagInstance(int objectId, L2NpcTemplate template)
- + {
- + super(objectId, template);
- + getAI();
- + }
- +
- + @Override
- + public boolean isAutoAttackable(L2Character attacker)
- + {
- + return true;
- + }
- +
- + @Override
- + public boolean isAttackable()
- + {
- + return true;
- + }
- +
- + @Override
- + public boolean doDie(L2Character killer)
- + {
- + if (CoastGuard.getInstance().getState() != EventState.INACTIVE)
- + {
- + CoastGuard.getInstance().endEvent(false);
- + }
- +
- + return true;
- + }
- +}
- #P l2jalpha_datapack_mxc
- Index: sql/npc.sql
- ===================================================================
- --- sql/npc.sql (revision 31)
- +++ sql/npc.sql (working copy)
- @@ -6263,7 +6263,9 @@
- (35653,35653,'Court Magician',0,'Innadril',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'),
- (35654,35654,'Court Magician',0,'Goddard',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'),
- (35655,35655,'Court Magician',0,'Rune',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'),
- - (35656,35656,'Court Magician',0,'Schuttgart',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT');
- + (35656,35656,'Court Magician',0,'Schuttgart',0,'Monster3.Elite_Mage',6.50,21.96,70,'male','L2Npc',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,0,0,0,88,132,NULL,0,0,0,'LAST_HIT'),
- + (65535,35062,'Flag',0,'Coast Guard',0,'Deco.flag_a',21.00,82.00,1,'etc','L2CoastFlag',40,158000,989,3.16,0.91,40,43,30,21,20,10,0,0,652,753,358,295,423,0,333,0,0,0,55,132,NULL,0,1,0,'LAST_HIT'),
- + (65534,22124,'Monster',0,'Coast Guard',0,'Monster3.solina_brother',20.00,25.00,80,'male','L2CoastMonster',80,4609,2085,13.43,3.09,40,43,30,21,20,10,10198,1158,1972,574,1182,477,278,0,333,8212,0,0,88,132,NULL,0,0,0,'LAST_HIT');
- INSERT INTO `npc` VALUES
- (50007,31324,'Andromeda',1,'Wedding Manager',1,'NPC.a_casino_FDarkElf',8.00,23.00,70,'female','L2WeddingManager',40,3862,1493,11.85,2.78,40,43,30,21,20,10,0,0,1314,470,780,382,278,0,333,316,0,0,55,132,NULL,0,1,0,'LAST_HIT');
- \ No newline at end of file
- Index: data/scripts/handlers/voicedcommandhandlers/CoastGuardCommands.java
- ===================================================================
- --- data/scripts/handlers/voicedcommandhandlers/CoastGuardCommands.java (revision 0)
- +++ data/scripts/handlers/voicedcommandhandlers/CoastGuardCommands.java (working copy)
- @@ -0,0 +1,49 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package handlers.voicedcommandhandlers;
- +
- +import net.l2jalpha.gameserver.handler.IVoicedCommandHandler;
- +import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +import net.l2jalpha.gameserver.model.entity.addons.events.CoastGuard;
- +
- +public class CoastGuardCommands implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS = { "register", "leave" };
- +
- + @Override
- + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
- + {
- + if (command.equals("register"))
- + {
- + CoastGuard.getInstance().registerPlayer(activeChar);
- + }
- +
- + if (command.equals("leave"))
- + {
- + CoastGuard.getInstance().removePlayer(activeChar);
- + }
- +
- + return true;
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
- Index: data/scripts/handlers/MasterHandler.java
- ===================================================================
- --- data/scripts/handlers/MasterHandler.java (revision 31)
- +++ data/scripts/handlers/MasterHandler.java (working copy)
- @@ -152,6 +152,7 @@
- import handlers.usercommandhandlers.OlympiadStat;
- import handlers.usercommandhandlers.PartyInfo;
- import handlers.usercommandhandlers.Time;
- +import handlers.voicedcommandhandlers.CoastGuardCommands;
- import java.util.logging.Logger;
- @@ -276,7 +277,7 @@
- private static void loadVoicedHandlers()
- {
- - //VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Name());
- + VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new CoastGuardCommands());
- _log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " voiced command handlers.");
- }
Advertisement
Add Comment
Please, Sign In to add comment