Sign in to follow this  
Governor

Custom Chat Channel Creation

Recommended Posts

I am trying to make a server modification to create a new chat channel at player login. I would like to display some info about the server and such in it. I would prefer it if the channel was strictly informative and chat was disabled. I tried going through some of the wurmxxxx.db files and could not find anything useful.  If anyone would be so kind as to pint me in the right direction I would greatly appreciate it. Thank you.

Edited by Governor

Share this post


Link to post
Share on other sites

Check out Sindusk's server mod. It has an event tab that might do what you want or perhaps would give you a starting point.

  • Like 1

Share this post


Link to post
Share on other sites
On 2017-01-20 at 3:01 PM, Governor said:

Thank you. I will take a look at it this weekend.

Any progress?

Share this post


Link to post
Share on other sites

I have seen this on some servers, anybody know which mod facilitates this or is it custom code by the admins?

Share this post


Link to post
Share on other sites

I don't have a readymade mod for this, but if anyone wants to write one...

 

In your mod class you'll need to implement PlayerLoginListener and from there send your stuff to the player like this:

player.getCommunicator().sendMessage(new Message(player, (byte) 0, "ChannelName", "text goes here", r, g, b));

 

Also for good measure, implement PlayerMessageListener and do something like this to prevent sending messages to this channel:

 

    @Override
    public MessagePolicy onPlayerMessage(Communicator communicator, String message, String title) {
        if (title.equals("ChannelName") && !message.startsWith("#") && !message.startsWith("/")) {
            return MessagePolicy.DISCARD;
        } else {
            return MessagePolicy.PASS;
        }
    }

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks bdew, I have been a programmer for a long time but never in Java, I got the IntelliJ IDE and have been poking around...  bit of a learning curve for me but it would be very cool to do one, guess I'll try this... thank you

  • Like 1

Share this post


Link to post
Share on other sites

I got a script that makes a "PM" window in the chat with info and etc...

Share this post


Link to post
Share on other sites

Got it working, wrote my first really simple mod!  Now I'll keep playing with it to make use of the properties file so it is not hard coded.  too much fun! Thanks bdew for the pointers! 

Share this post


Link to post
Share on other sites

Wonderfull dear Elsa =)

 

where are you copying this file?

 

Eject

Edited by Eject

Share this post


Link to post
Share on other sites
1 hour ago, Eject said:

Wonderfull dear Elsa =)

 

where are you copying this file?

 

Eject

What you mean? You put it in scriptrunner in playerLogin 

Share this post


Link to post
Share on other sites

Not me who made it throu, got it from another person.. 

Share this post


Link to post
Share on other sites
On 2018-01-25 at 0:18 PM, Worfeus said:

Thank you Elsa

Np. 

Share this post


Link to post
Share on other sites
On 1/24/2018 at 11:48 AM, Elsa said:

What you mean? You put it in scriptrunner in playerLogin 

 

Can you please help me be very sure where?  Is it here:   

mods/scriptrunner/scripts/onPlayerLogin

 

I already have 2 files in there:

greet.js.example

make-all-admins.js.example

 

Do I delete these ones and put the greet file there? Or just drop the new greet file in with the other 2 files?

Share this post


Link to post
Share on other sites
6 hours ago, Batta said:

 

Can you please help me be very sure where?  Is it here:   

mods/scriptrunner/scripts/onPlayerLogin

 

I already have 2 files in there:

greet.js.example

make-all-admins.js.example

 

Do I delete these ones and put the greet file there? Or just drop the new greet file in with the other 2 files?

YOu can keep the exapmles there. And yes in here  in onplayerslogin

  • Like 1

Share this post


Link to post
Share on other sites

YOu can also make a copy of the file and write something else in it like event info or what you like. 

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, Elsa said:

YOu can also make a copy of the file and write something else in it like event info or what you like. 

 

Where do I write something else?  The greet file is a java file. Do I need to find a way to open it?

 

Never mind, I just discovered I can drag and drop it into Notepad++.  :-)

Edited by Batta
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this