diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java index 17fa6dd793bd12ce323431768a2b6893af1f0e1a..41a8ffa7e752c0b75960b6c2b478524fd49e486e 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java @@ -93,6 +93,7 @@ import handlers.admincommandhandlers.AdminSkill; import handlers.admincommandhandlers.AdminSpawn; import handlers.admincommandhandlers.AdminSummon; import handlers.admincommandhandlers.AdminTarget; +import handlers.admincommandhandlers.AdminTargetSay; import handlers.admincommandhandlers.AdminTeleport; import handlers.admincommandhandlers.AdminTerritoryWar; import handlers.admincommandhandlers.AdminTest; @@ -420,6 +421,7 @@ public class MasterHandler AdminSpawn.class, AdminSummon.class, AdminTarget.class, + AdminTargetSay.class, AdminTeleport.class, AdminTerritoryWar.class, AdminTest.class, diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminTargetSay.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminTargetSay.java new file mode 100644 index 0000000000000000000000000000000000000000..e5b210100bf09fcb5ef22135af2c9ea5ad05539c --- /dev/null +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminTargetSay.java @@ -0,0 +1,78 @@ +/* + * 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 handlers.admincommandhandlers; + +import com.l2jserver.gameserver.handler.IAdminCommandHandler; +import com.l2jserver.gameserver.model.L2Object; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2ControllableMobInstance; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.network.SystemMessageId; +import com.l2jserver.gameserver.network.clientpackets.Say2; +import com.l2jserver.gameserver.network.serverpackets.CreatureSay; + +/** + * This class handles following admin commands: - targetsay <message> = makes talk a L2Character + * @author nonom + */ +public class AdminTargetSay implements IAdminCommandHandler +{ + + private static final String[] ADMIN_COMMANDS = + { + "admin_targetsay" + }; + + @Override + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + if (command.startsWith("admin_targetsay")) + { + try + { + String message = command.substring(16); + + L2Object obj = activeChar.getTarget(); + + if ((obj instanceof L2ControllableMobInstance) || !(obj instanceof L2Character)) + { + activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); + return false; + } + else + { + talk(activeChar, (L2Character) obj, message); + } + } + catch (StringIndexOutOfBoundsException e) + { + activeChar.sendPacket(SystemMessageId.INCORRECT_SYNTAX); + return false; + } + } + return true; + } + + private void talk(L2PcInstance activeChar, L2Character target, String message) + { + target.broadcastPacket(new CreatureSay(target.getObjectId(), Say2.ALL, target.getName(), message)); + } + + @Override + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } +} diff --git a/L2J_DataPack_BETA/dist/sql/game/admin_command_access_rights.sql b/L2J_DataPack_BETA/dist/sql/game/admin_command_access_rights.sql index c005886e552a6ce81189d23ac105d485c9ff0e59..ee2859bde03b4a3b3767f415c97ce43fc2162043 100644 --- a/L2J_DataPack_BETA/dist/sql/game/admin_command_access_rights.sql +++ b/L2J_DataPack_BETA/dist/sql/game/admin_command_access_rights.sql @@ -557,6 +557,9 @@ INSERT IGNORE INTO `admin_command_access_rights` VALUES -- ADMIN TARGET ('admin_target',1,'false'), +-- ADMIN TARGETSAY +('admin_targetsay',1,'false'), + -- ADMIN TELEPORT ('admin_show_moves',1,'false'), ('admin_show_moves_other',1,'false'),