Secret Experience

Secret Experience (https://secretexperience.net/index.php)
-   [Lineage] Java Mods (https://secretexperience.net/forumdisplay.php?f=636)
-   -   [L2JServer] Block Chat para Mortos (https://secretexperience.net/showthread.php?t=27742)

Lanterna-Verde 20-11-2010 07:53 PM

Block Chat para Mortos
 
1 Anexo(s)
Com Este Mod, todos os chats são desabilitados enquanto o player está Morto

Código:

Index: java/net/sf/l2j/gameserver/clientpackets/Say2.java
===================================================================
--- java/net/sf/l2j/gameserver/clientpackets/Say2.java    (revision 3721)
+++ java/net/sf/l2j/gameserver/clientpackets/Say2.java    (working copy)
@@ -128,7 +128,15 @@
            {
           
  activeChar.sendMessage("You may not chat while a chat ban is in effect.");
  return;
            }
+            if (activeChar.isDead())
+            {
+            activeChar.sendMessage("You cannot talk while you are dead");
+            return;
+        }
        }

        if (activeChar.isInJail() && Config.JAIL_DISABLE_CHAT)

Créditos: MaCe

Mazokista 21-11-2010 11:36 AM

[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]

CavaleiroNegro 21-11-2010 04:30 PM

É bom para não ter choro quando vc mata o cara okasopas...

Agora um que seria bastante legal tb é para desabilitar o chat GLOBAL e TRADE por algum comando de GM...

paytaly 22-11-2010 03:56 PM

Está ai CavaleiroNegro:
Código:

### Author: paytaly
# http://www.secretexperience.net/
Index: java/net/sf/l2j/gameserver/network/SystemMessageId.java
===================================================================
--- java/net/sf/l2j/gameserver/network/SystemMessageId.java        (revision 0)
+++ java/net/sf/l2j/gameserver/network/SystemMessageId.java        (working copy)
@@ -2091,6 +2091,12 @@
      * it something goes unrecognized.
      */
        CANNOT_GIVE_ITEMS_TO_DEAD_PET(590),
+       
+        /**
+        * ID: 599<br>
+        * Message: The GM has an imprtant notice. Chat has been temporarily disabled.
+        */
+        CHAT_HAS_BEEN_TEMPORARILY_DISABLED(599),
 
        /**
          * ID: 600<br>
Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java        (revision 0)
+++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java        (working copy)
@@ -25,6 +25,7 @@
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBan;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCache;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminChangeAccessLevel;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminChatManager;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCreateItem;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCursedWeapons;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminDelete;
@@ -92,6 +93,7 @@
        {
                _datatable = new FastMap<String, IAdminCommandHandler>();
                registerAdminCommandHandler(new AdminAdmin());
+                registerAdminCommandHandler(new AdminChatManager());
                registerAdminCommandHandler(new AdminInvul());
                registerAdminCommandHandler(new AdminDelete());
                registerAdminCommandHandler(new AdminKill());
Index: java/net/sf/l2j/gameserver/handler/chathandlers/ChatShout.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/chathandlers/ChatShout.java        (revision 0)
+++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatShout.java        (working copy)
@@ -22,7 +22,9 @@
 import net.sf.l2j.gameserver.model.BlockList;
 import net.sf.l2j.gameserver.model.L2World;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.serverpackets.CreatureSay;
+import net.sf.l2j.gameserver.serverpackets.SystemMessage;
 
 
 /**
@@ -37,12 +39,20 @@
                1
        };
       
+        public static boolean _chatDisabled = false;
+       
        /**
          * Handle chat type 'shout'
          * @see net.sf.l2j.gameserver.handler.IChatHandler#handleChat(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
          */
        public void handleChat(int type, L2PcInstance activeChar, String target, String text)
        {
+                if (_chatDisabled && !activeChar.isGM())
+                {
+                        activeChar.sendPacket(new SystemMessage(SystemMessageId.CHAT_HAS_BEEN_TEMPORARILY_DISABLED));
+                        return;
+                }
+               
                CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
               
                Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChatManager.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChatManager.java        (revision 0)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChatManager.java        (revision 0)
@@ -0,0 +1,80 @@
+/*
+ * 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.admincommandhandlers;
+
+import net.sf.l2j.gameserver.clientpackets.Say2;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.handler.chathandlers.ChatShout;
+import net.sf.l2j.gameserver.handler.chathandlers.ChatTrade;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *
+ * @author paytaly
+ *
+ */
+public class AdminChatManager implements IAdminCommandHandler
+{
+        private static final String[] ADMIN_COMMANDS =
+        {
+                "admin_disable_global_chat",
+                "admin_disable_trade_chat",
+                "admin_disable_chat",
+                "admin_enable_global_chat",
+                "admin_enable_trade_chat",
+                "admin_enable_chat"
+        };
+       
+        public boolean useAdminCommand(String command, L2PcInstance activeChar)
+        {
+                if (command.equals("admin_disable_global_chat"))
+                {
+                        ChatShout._chatDisabled = true;
+                        activeChar.sendMessage("Global Chat has been disabled!");
+                }
+                else if (command.equals("admin_disable_trade_chat"))
+                {
+                        ChatTrade._chatDisabled = true;
+                        activeChar.sendMessage("Trade Chat has been disabled!");
+                }
+                else if (command.equals("admin_disable_chat"))
+                {
+                        Say2._chatDisabled = true;
+                        activeChar.sendMessage("Chat has been disabled!");
+                }
+                else if (command.equals("admin_enable_global_chat"))
+                {
+                        ChatShout._chatDisabled = false;
+                        activeChar.sendMessage("Global Chat has been enabled!");
+                }
+                else if (command.equals("admin_enable_trade_chat"))
+                {
+                        ChatTrade._chatDisabled = false;
+                        activeChar.sendMessage("Trade Chat has been enabled!");
+                }
+                else if (command.equals("admin_enable_chat"))
+                {
+                        Say2._chatDisabled = false;
+                        activeChar.sendMessage("Chat has been enabled!");
+                }
+               
+                return true;
+        }
+       
+        public String[] getAdminCommandList()
+        {
+                return ADMIN_COMMANDS;
+        }
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/handler/chathandlers/ChatTrade.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/chathandlers/ChatTrade.java        (revision 0)
+++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatTrade.java        (working copy)
@@ -22,7 +22,9 @@
 import net.sf.l2j.gameserver.model.BlockList;
 import net.sf.l2j.gameserver.model.L2World;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.serverpackets.CreatureSay;
+import net.sf.l2j.gameserver.serverpackets.SystemMessage;
 
 
 /**
@@ -37,12 +39,20 @@
                8
        };
       
+        public static boolean _chatDisabled = false;
+       
        /**
          * Handle chat type 'trade'
          * @see net.sf.l2j.gameserver.handler.IChatHandler#handleChat(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
          */
        public void handleChat(int type, L2PcInstance activeChar, String target, String text)
        {
+                if (_chatDisabled && !activeChar.isGM())
+                {
+                        activeChar.sendPacket(new SystemMessage(SystemMessageId.CHAT_HAS_BEEN_TEMPORARILY_DISABLED));
+                        return;
+                }
+               
                CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
               
                Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
Index: java/net/sf/l2j/gameserver/clientpackets/Say2.java
===================================================================
--- java/net/sf/l2j/gameserver/clientpackets/Say2.java        (revision 0)
+++ java/net/sf/l2j/gameserver/clientpackets/Say2.java        (working copy)
@@ -96,6 +96,8 @@
        private int _type;
        private String _target;
       
+        public static boolean _chatDisabled = false;
+       
        @Override
        protected void readImpl()
        {
@@ -114,6 +116,12 @@
                if (activeChar == null)
                        return;
               
+                if (_chatDisabled && !activeChar.isGM())
+                {
+                        activeChar.sendPacket(new SystemMessage(SystemMessageId.CHAT_HAS_BEEN_TEMPORARILY_DISABLED));
+                        return;
+                }
+               
                if (_type < 0 || _type >= CHAT_NAMES.length)
                {
                        _log.warning("Say2: Invalid type: " +_type + " Player : " + activeChar.getName() + " text: " + String.valueOf(_text));

Créditos: paytaly

Nesse Mod tem a opção para desabilitar separadamente o Chat Global, Trade e todos eles. Pode haver alguma incompatibilidade, usem o cérebro e resolvam. Já testei e funciona perfeitamente.
Os comandos são:
Código:

//disable_global_chat --> Desabilita o Chat Global (!)
//disable_trade_chat --> Desabilita o Chat Trade (+)
//disable_chat --> Desabilita TODOS os Chats
//enable_global_chat --> Habilita o Chat Global
//enable_trade_chat --> Habilita o Chat Trade
//enable_chat --> Habilita TODOS os Chats

Algumas Observações:
  • GMs são ignorados (Podem usar o Chat mesmo ele estando desabilitado). Antes de dizer que não funciona por estar testando com GM, teste com um Player normal.
  • Será necessário criar a parte do arquivo GMAccess.properties ou da tabela admin_command_access_rights

Se quiserem postar em outro tópico, sintam-se à vontade. Apenas mantenham os créditos.

leonardoalves 23-01-2011 12:45 PM

Adcionei no L2J2010 , e não funciono tem alguma adaptação?

Mazokista 25-01-2011 07:28 AM

Tente Adiciona o do paytaly

leonardoalves 25-01-2011 12:22 PM

vlw mazokista , consegui add.

tx300 30-01-2011 07:00 AM

Se possivel poderia alterar para blokear o chat hero tb Funciono 100%


Horários baseados na GMT -3. Agora são 12:30 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.