GM Chat?

🚫
Exiled
Joined
Sep 25, 2006
Messages
295
Reaction score
1
This lets you send a message to all online GMs no matter where they are.

Credits to GMLooney for idea?

In CharCommands.java
Add
Code:
import java.util.Collections;
import net.sf.odinms.tools.MaplePacketCreator;
import net.sf.odinms.tools.StringUtil;

Add
Code:
                } else if (splitted[0].equals("!gmchat")) {
                        if (player.getGmChatEnabled()) {
                                player.gmChatEnabled(false);
                                mc.dropMessage("Your GM chat has been disabled.");
                        } else {
                                player.gmChatEnabled(true);
                                mc.dropMessage("Your GM chat has been enabled");
                        }
                } else if (splitted[0].equals("!gmsg")) {
                        String gmMSG = StringUtil.joinStringFrom(splitted, 1);
                        for (ChannelServer cservs : ChannelServer.getAllInstances()){
                                for (MapleCharacter players : cservs.getPlayerStorage().getAllCharacters()) {
                                        if (players.isGM() && players.getGmChatEnabled()) {
                                                players.getClient().getSession().write(MaplePacketCreator.serverNotice(2, player.getName() + " : " + gmMSG));
                                        }
                                }
                        }
                }

Add
Code:
                        new CommandDefinition("gmchat", "", "Enables/disables gm chat.", 100),
                        new CommandDefinition("gmsg", "<message>", "Sends a message to all online GMs.", 100),

In MapleCharacter.java
Add
Code:
public boolean gmChat = true;

Add
Code:
        public void gmChatEnabled(boolean yn) {
                this.gmChat = yn;
        }

        public boolean getGmChatEnabled() {
                return this.gmChat;
        }
 
Last edited:
Re: [Release] GM Chat?

Description is incorrect. This is all GMs within the channel of where you use the command. Not all GMs online.

Also using the Collections.unmodifableCollection there does nothing at all.

Edit: !gmchat is completely useless also. Your method in MapleCharacter will always return true when it's in the !gmsg loop.
 
Re: [Release] GM Chat?

Description is incorrect. This is all GMs within the channel of where you use the command. Not all GMs online.

Also using the Collections.unmodifableCollection there does nothing at all.

^ I got told, sorry its 5:30 AM XD
 
Re: [Release] GM Chat?

Hey Thanks for helping me with this, Look forward to more Devs? Also Thanks for Giving Credits =)
 
Re: [Release] GM Chat?

Read my edit also. The !gmsg sends to every GM in channel, regardless of whether they turned on the !gmchat thing.
 
Re: [Release] GM Chat?

Edit: !gmchat is completely useless also. Your method in MapleCharacter will always return true when it's in the !gmsg loop.

It's working for me.
 
Re: [Release] GM Chat?

Well that was the intention...I also thought of the idea because GM's using the !notice Command was kind of Annoying...
 
Re: [Release] GM Chat?

Got a question...How would i add this if i dont have a CharCommands.java??? All i have is CommandProcessor...Thanks in Advance
 
Re: [Release] GM Chat?

*Updated, added all channels like it should have XD..
 
Re: [Release] GM Chat?

1. This will not work on multihost. But I guess that doesn't matter to most people.

2. This will be extremely inefficient to people who have a larger user count, as it will have to iterate through every single one of the user when you use one of these commands. But again it doesn't matter to most people.

I'm not trying to be negative. Just pointing out some possible issues with it.
 
Back