ExternalChat
ExternalChat
Overview
This plugin will allow the ability to send chat messages from a web page. It uses JSON to communicate from inside and outside the minecraft world. Web users are authenticated against minecraft's servers in order to provide an accurate account of who is sending messages.
- Tested okay in CB 1.1-R6
- Tested okay in CB 1.2.2-Dev
Features
- Send messages to minecraft clients from the web
- Send messages to the web from within minecraft
- Secure web user authentication
- No database required
- Users use their minecraft user name and password
Configuration
Plugin Configuration
- show_death (default: true) - Send death messages to the web
- death_name (default: Humiliator) - When sending death messages to the web, what username should be displayed
- chat_delay (default: 3000) - The number of milliseconds between checks for new messages
- clean_delay (default: 30000) - The number of milliseconds between checks to clean old messages
- clean_age (default: 45000) - The number of milliseconds old a message must be to be removed
- chat_file (default: map/inChat.json) - The file name used to read and write messages
Minecraft Server Configuration
- The minecraft server must have read and write access to the chat_file as defined by the Plugin Configuration
Web Server Configuration
- PHP version > 5.2.0, or JSON extensions enabled
- SSL certificate installed and configured
- Write access on the following files: chat_sessions, inChat.json
player_chat.js Configuration
- player_chat.js: line 1 - chatRead (default: /inChat.json) - The file name used to read messages
- player_chat.js: line 2 - chatWrite (default: /outChat.php) - The file name used to write messages when authenticated
- player_chat.js: line 3 - authenticator (default: /minecraft_authenticator.php) - The file name used to send authentication requests
- player_chat.js: line 4 - expireDays (default: 365) - The number of days the cookie should stay active on the client browser
- player_chat.js: line 5 - chatDelay (default: 3000) - The number of milliseconds between checks for new messages
outChat.php Configuration
- outChat.php: line 2 - chatJSON (default: inChat.json) - The file name used to write messages
- outChat.php: line 3 - sessionFile (default: chat_sessions) - The file name used to read and write session information
- outChat.php: line 4 - timeZone (default: America/New_York) - The timezone specification of the server (see: PHP Supported Timezones for supported timezones)
minecraft_authenticator.php Configuration
- minecraft_authenticator.php: line 2 - sessionFile (default: chat_sessions) - The file name used to read and write session information
Requirements
- The web server must use SSL (while this is not technically a requirement, it is highly inadvisable to send authentication information over a non-SSL connection. Should you decide to modify these files to allow this, please notify your users.)
- Unless the chat page itself is loaded via HTTPS, the client browser must support the Access-Control-Allow-Origin header (most do) This is per the cross-domain AJAX security policies.
- The chat_sessions file should not be web accessible. While, the server must be able to read and write to this file, it should not be displayed to the world.
Installation
- To install the plugin, just simply place the jar in the plugins directory.
- Copy the js/player_chat.js, outChat.php, minecraft_authenticator.php, inChat.json, chat_sessions, and chat.html files to your web directory
- Setup write access for the web server on the chat_sessions and inChat.json files
- Setup write access for the minecraft server on the inChat.json file
- Start the CraftBukkit server, and chat away.
Commands
- private Allows a player to set their chat mode to private (i.e. their chat messages will not be published to the web).
- public Allows a player to reset their chat mode to public (i.e. their chat messages will be published to the web).
Bugs / Known Limitations
- The chat.html file is included only as an example. It is not pretty and is designed to allow you to integrate the chat feature where and how you want.
- Messages sent from within Minecraft that contain HTML notation will display the HTML on the chat page. (potential for abuse)
- This chat feature requires that web users have a Minecraft account in order to authenticate. If a user is not premium, it will still let them in to chat.
Future Plans
- Maybe FaceBook integration
- Announce web users within minecraft
- Escape any HTML chat messages coming out of Minecraft
this plugin sounds great! could you update to 1.8+ please? or did that someone already? pls let me know thanks!
Sounds good. I might update the source and use it on my server 1.7.9+
Does this plugin still work?
@Holt1
Look at the license. It says "Public Domain," so yes, you may upload your own version of it.
Hello Guys, i hope its ok, because i updated this plugin to the 1.6.2 so i will ask you: ArchmageInc. Can i upload it? I hope its ok :D
Hello everyone. I apologize that it has been quite a long time since I have even visited the bukkit site. All my development with bukkit has been stalled for well over a year. While this does sadden me, it is part of life. I may one day find time to continue the development of existing plugins and maybe some new ones. For now though, no. As for the status of this plugin: while it is complicated and messy to configure, does still operate with 1.6 as it is still in operation on my server which was just upgraded today. The source code is available on GitHub if anyone wishes to fork the project and continue on their own. By now, I imagine there are many plugins that do what this one does but are better build and/or explained. While it pains me to not be able to help everyone in getting this to work, community development does not pay the bills. :( If it did, I would be more than happy to spend my 16 hours of work per day building bukkit plugins and making them easy for everyone to use. For now, I hope the community is able to continue to help those that use this plugin.
Oh. I need a plugin like this. I see that it hasn't been updated for over a year thought but people still comment on it like it works kinda ok. Is there ever gonna be an update to this? And/or does this work with 1.5.2 or 1.6?
im having trouble with this plugin... can you be more scific with what we have to do with the files..? because i read in come comments that another file has to be in the server side along with the .jar file...
please let me know what has to be on the website and the server, annnd how they connect..
p.s. im renting my server, if that changes anything.
@waco001
I cant get it to read the inchat.json file at all. Do you mean map or maps? And does it go into the server plugins folder? I tryed this but it won't find it.
@MineDing
I had this same issue. To fix it, you have to create a folder in your plugins directory and name it 'maps' and then put the inChat.json into it
Hi people,
I have a problem. On my server the plugin says "16:07:33 [INFO] [ExternalChat 0.5]: Unable to read from map/inChat.json: map/inChat.json (No such file or directory)" How can i fix it? :D
Hi ArchmageInc,
I tried your plugin, it works fine for me, but I'm getting an error that it can't parse the date format every .5 seconds..
Could you help me turning this off?
Thanks, Daniël
@ArchmageInc: Go
Authenticator: http://pastebin.com/uQbbDspk
player_chat.js http://pastebin.com/6uDzB9yG
Using firefox 12.0
and getting
Failed to authenticate... sorry.
SyntaxError: JSON.parse unexpected character
FireBug:
- Could not convert JavaScript argument
- https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
- Line 4
@deleted_7536780
The indicated JSON parse error is related to the communication between the browser and the minecraft_authenticator.php file. Has this file been modified? What browser are you using? I tried to catch most errors in the PHP file, but perhaps something unexpected is happening in relation to the server configuration.
when attempt to login
Failed to authenticate... sorry.
SyntaxError: JSON.parse: unexpected character
@ArchmageInc
Cool, thanks. Can it save a few of the most recent messages so when people open it up it isn't blank? Also, login/logout notices?
@judam
In the player_chat.js file on line 77 there is an alert that is issued when the system is unable to get the chat messages. This may be safely commented out by placing a "//" before the alert
@judam
Yes, This occurs when the client is unable to communicate to the server in order to receive the JSON chat information. It can be caused by a temporary laps in connectivity.
Got it working nicely, just needed to double check all the config values. :D Now to customize. XD
@nLocus
nLocus,
This seems to be an intermittent issue, as I was able to authenticate via your web sever using the following:
curl -d 'user=Elminster2031' -d 'pass=xxxx' http://softslayer.com/serverScripts/ExternalChat/minecraft_authenticator.php
The response I have received is: [{"response":"Successful login","result":true,"user":"elminster2031","session":"3223053547971607817"}]
If I then query your chat_sessions file... which should not be web accessible BTW, I am able to see that the session was created on the server.
I will be on #BukkitDev on IRC tonight (3/14/12) at 7:00PM eastern time, if you would like help troubleshooting this issue.