Сообщений: 151
Тем: 9
Зарегистрирован: Jul 2012
Репутация:
617
Что-то моск не варит....
Добавил команду запуска твт, но при запуске гс выбивает ошибку:
2012.12.19 09:13:20,002 WARNING 296 net.sf.l2j.gameserver.network.clientpackets.L2GameClientPacket No handler registered for admin command 'admin_admin_tvt_add'
Сборка ACis rev.260 Interlude
Сообщений: 5,863
Тем: 105
Зарегистрирован: Sep 2010
Репутация:
13,014
12-19-2012, 12:30 PM
(Сообщение последний раз редактировалось: 12-19-2012, 12:40 PM Zubastic.)
Хоть бы выложили, что сделали...
Добавлено через 9 минут
Цитата:Здесь присутствуют: 3 (пользователей: 3 , гостей: 0)
Zubastic, Dеmon, MasVild
Пришел специалист по ацису
Сообщений: 151
Тем: 9
Зарегистрирован: Jul 2012
Репутация:
617
12-19-2012, 12:40 PM
(Сообщение последний раз редактировалось: 12-19-2012, 01:25 PM MasVild.)
в net.sf.l2j.gameserver.handler.admincommandhandlers добавил класс:
AdminTvTEvent.java
AdminTvTEvent.java
[src=java]
package net.sf.l2j.gameserver.handler.admincommandhandlers;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.TvTEvent;
import net.sf.l2j.gameserver.model.entity.TvTEventTeleporter;
import net.sf.l2j.gameserver.model.entity.TvTManager;
import net.sf.l2j.gameserver.network.clientpackets.Say2;
/**
* @author FBIagent
*/
public class AdminTvTEvent implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_tvt_add",
"admin_tvt_remove",
"admin_tvt_advance"
};
@Override
public boolean useAdminCommand(final String command, final L2PcInstance activeChar)
{
if (Config.TVT_EVENT_ENABLED)
{
switch (command)
{
case "admin_tvt_add":
{
final L2Object target = activeChar.getTarget();
if (!(target instanceof L2PcInstance))
{
activeChar.sendChatMessage(0, Say2.ALL, "SYS", "You should select a player!");
return true;
}
add(activeChar, (L2PcInstance) target);
break;
}
case "admin_tvt_remove":
final L2Object target = activeChar.getTarget();
if (!(target instanceof L2PcInstance))
{
activeChar.sendChatMessage(0, Say2.ALL, "SYS", "You should select a player!");
return true;
}
remove(activeChar, (L2PcInstance) target);
break;
case "admin_tvt_advance":
TvTManager.getInstance().skipDelay();
break;
}
}
else
{
activeChar.sendChatMessage(0, Say2.ALL, "SYS", "TvT Event is disabled.");
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
private void add(final L2PcInstance activeChar, final L2PcInstance playerInstance)
{
if (TvTEvent.isPlayerParticipant(playerInstance.getObjectId()))
{
activeChar.sendChatMessage(0, Say2.ALL, "SYS", "Player already participated in the event!");
return;
}
if (!TvTEvent.addParticipant(playerInstance))
{
activeChar.sendChatMessage(0, Say2.ALL, "SYS", "Player instance could not be added, it seems to be null!");
return;
}
if (TvTEvent.isStarted())
{
new TvTEventTeleporter(playerInstance, TvTEvent.getParticipantTeamCoordinates(playerInstance.getObjectId()), true, false);
}
}
private void remove(final L2PcInstance activeChar, final L2PcInstance playerInstance)
{
if (!TvTEvent.removeParticipant(playerInstance.getObjectId()))
{
activeChar.sendChatMessage(0, Say2.ALL, "SYS", "Player is not part of the event!");
return;
}
new TvTEventTeleporter(playerInstance, Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES, true, true);
}
}
[/src]
AdminCommandHandler.java
AdminCommandHandler.java
[src=java]
* 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.handler;
import gnu.trove.map.hash.TIntObjectHashMap;
import java.util.logging.Logger;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAdmin;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAnnouncements;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBan;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBookmark;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBuffs;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCache;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCamera;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminChangeAccessLevel;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCreateItem;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCursedWeapons;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminDelete;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminDoorControl;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditChar;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditNpc;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEffects;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEnchant;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminExpSp;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGeodata;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGm;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGmChat;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHeal;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHelpPage;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminInvul;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminKick;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminKill;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminLevel;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMaintenance;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMammon;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminManor;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMenu;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMonsterRace;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMovieMaker;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminOlympiad;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPForge;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPathNode;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPetition;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPledge;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPolymorph;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRepairChar;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRes;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRideWyvern;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminShop;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSiege;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSkill;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSpawn;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTarget;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTvTEvent;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminUnblockIp;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
public class AdminCommandHandler
{
private static Logger _log = Logger.getLogger(AdminCommandHandler.class.getName());
private final TIntObjectHashMap<IAdminCommandHandler> _datatable;
public static AdminCommandHandler getInstance()
{
return SingletonHolder._instance;
}
protected AdminCommandHandler()
{
_datatable = new TIntObjectHashMap<>();
registerAdminCommandHandler(new AdminAdmin());
registerAdminCommandHandler(new AdminAnnouncements());
registerAdminCommandHandler(new AdminBan());
registerAdminCommandHandler(new AdminBookmark());
registerAdminCommandHandler(new AdminBuffs());
registerAdminCommandHandler(new AdminCache());
registerAdminCommandHandler(new AdminCamera());
registerAdminCommandHandler(new AdminChangeAccessLevel());
registerAdminCommandHandler(new AdminCreateItem());
registerAdminCommandHandler(new AdminCursedWeapons());
registerAdminCommandHandler(new AdminDelete());
registerAdminCommandHandler(new AdminDoorControl());
registerAdminCommandHandler(new AdminEditChar());
registerAdminCommandHandler(new AdminEditNpc());
registerAdminCommandHandler(new AdminEffects());
registerAdminCommandHandler(new AdminEnchant());
registerAdminCommandHandler(new AdminExpSp());
registerAdminCommandHandler(new AdminGeodata());
registerAdminCommandHandler(new AdminGm());
registerAdminCommandHandler(new AdminGmChat());
registerAdminCommandHandler(new AdminHeal());
registerAdminCommandHandler(new AdminHelpPage());
registerAdminCommandHandler(new AdminInvul());
registerAdminCommandHandler(new AdminKick());
registerAdminCommandHandler(new AdminKill());
registerAdminCommandHandler(new AdminLevel());
registerAdminCommandHandler(new AdminMaintenance());
registerAdminCommandHandler(new AdminMammon());
registerAdminCommandHandler(new AdminManor());
registerAdminCommandHandler(new AdminMenu());
registerAdminCommandHandler(new AdminMonsterRace());
registerAdminCommandHandler(new AdminMovieMaker());
registerAdminCommandHandler(new AdminOlympiad());
registerAdminCommandHandler(new AdminPathNode());
registerAdminCommandHandler(new AdminPetition());
registerAdminCommandHandler(new AdminPForge());
registerAdminCommandHandler(new AdminPledge());
registerAdminCommandHandler(new AdminPolymorph());
registerAdminCommandHandler(new AdminRepairChar());
registerAdminCommandHandler(new AdminRes());
registerAdminCommandHandler(new AdminRideWyvern());
registerAdminCommandHandler(new AdminShop());
registerAdminCommandHandler(new AdminSiege());
registerAdminCommandHandler(new AdminSkill());
registerAdminCommandHandler(new AdminSpawn());
registerAdminCommandHandler(new AdminTarget());
registerAdminCommandHandler(new AdminTeleport());
registerAdminCommandHandler(new AdminTvTEvent());
registerAdminCommandHandler(new AdminUnblockIp());
registerAdminCommandHandler(new AdminZone());
}
public void registerAdminCommandHandler(IAdminCommandHandler handler)
{
String[] ids = handler.getAdminCommandList();
for (String id : ids)
{
if (Config.DEBUG)
_log.fine("Adding handler for command " + id);
_datatable.put(id.hashCode(), handler);
}
}
public IAdminCommandHandler getAdminCommandHandler(String adminCommand)
{
String command = adminCommand;
if (adminCommand.indexOf(" ") != -1)
command = adminCommand.substring(0, adminCommand.indexOf(" "));
if (Config.DEBUG)
_log.fine("getting handler for command: " + command + " -> " + (_datatable.get(command.hashCode()) != null));
return _datatable.get(command.hashCode());
}
/**
* @return
*/
public int size()
{
return _datatable.size();
}
private static class SingletonHolder
{
protected static final AdminCommandHandler _instance = new AdminCommandHandler();
}
}[/src]
А вот сам
L2GameClientPacket.java
L2GameClientPacket.java
[src=java]
package net.sf.l2j.gameserver.network.clientpackets;
import java.nio.BufferUnderflowException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.L2GameClient;
import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket;
import org.mmocore.network.ReceivablePacket;
/**
* Packets received by the game server from clients
* @author KenM
*/
public abstract class L2GameClientPacket extends ReceivablePacket<L2GameClient>
{
protected static final Logger _log = Logger.getLogger(L2GameClientPacket.class.getName());
@Override
protected boolean read()
{
if (Config.DEBUG)
_log.info(getType());
try
{
readImpl();
return true;
}
catch (Exception e)
{
_log.log(Level.SEVERE, "Client: " + getClient().toString() + " - Failed reading: " + getType() + " ; " + e.getMessage(), e);
if (e instanceof BufferUnderflowException) // only one allowed per client per minute
getClient().onBufferUnderflow();
}
return false;
}
protected abstract void readImpl();
@Override
public void run()
{
try
{
runImpl();
// Depending of the packet send, removes spawn protection
if (triggersOnActionRequest())
{
final L2PcInstance actor = getClient().getActiveChar();
if (actor != null && actor.isSpawnProtected())
{
actor.onActionRequest();
if (Config.DEBUG)
_log.info("Spawn protection for player " + actor.getName() + " removed by packet: " + getType());
}
}
}
catch (Throwable t)
{
_log.log(Level.SEVERE, "Client: " + getClient().toString() + " - Failed reading: " + getType() + " ; " + t.getMessage(), t);
if (this instanceof EnterWorld)
getClient().closeNow();
}
}
protected abstract void runImpl();
protected final void sendPacket(L2GameServerPacket gsp)
{
getClient().sendPacket(gsp);
}
/**
* @return A String with this packet name for debuging purposes
*/
public String getType()
{
return "[C] " + getClass().getSimpleName();
}
/**
* Overriden with true value on some packets that should disable spawn protection
* @return
*/
protected boolean triggersOnActionRequest()
{
return true;
}
}
[/src]
Сообщений: 5,863
Тем: 105
Зарегистрирован: Sep 2010
Репутация:
13,014
MasVild, используем [SRC ="java"]1[/ SRC] для кода
Сообщений: 151
Тем: 9
Зарегистрирован: Jul 2012
Репутация:
617
12-19-2012, 12:43 PM
(Сообщение последний раз редактировалось: 12-19-2012, 01:25 PM MasVild.)
Zubastic Написал:Хоть бы выложили, что сделали...
Добавлено через 9 минут
Пришел специалист по ацису
Точно-точно)
Добавлено через 7 минут
Zubastic Написал:MasVild, используем [SRC ="java"]1[/ SRC] для кода
Щас подправлю
исправил
Сообщений: 1,485
Тем: 12
Зарегистрирован: Mar 2010
Репутация:
2,994
Не помнюю уже по ацису, не забудьте зарегить если нужно команды в базе admin_tvt_add ...
Сообщений: 2,303
Тем: 24
Зарегистрирован: Sep 2010
Репутация:
5,617
Вы вводите //admin_tvt_add, а надо //tvt_add. admin служит маркером для гм-комманд.
|