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
-
View User Profile
-
Send Message
Posted Mar 14, 2012AH! I'm sorry, I thought I answered your question some days ago.
The file is completely empty.
-
View User Profile
-
Send Message
Posted Mar 8, 2012I have the repository setup now. Let me know what the status of the session file is on your server. It is the most likely culprit to the memory issue.
-
View User Profile
-
Send Message
Posted Mar 8, 2012@nLocus
nLocus, you should not have to increase the memory. If the system is using more than 32Mb then something is wrong. The only portion I can see where it would be overrunning the memory buffer is where it is reading the session file. I am adding some additional checks to verify the proper reading of session data.
And yes, I will setup a repository for this.
-
View User Profile
-
Send Message
Posted Mar 7, 2012He has a github, I am helping him get eGit working. (SO ANNOYING!)
Eventually everybody will use github and it will rule the coding world.
:-)
-
View User Profile
-
Send Message
Posted Mar 7, 2012Do you have any plans to get a github? I'd love to be able to contribute to the source of this plugin.
Also, the reason I would add a phpbb-authenticator file would be simply because not everyone feels comfortable trusting their minecraft account to every server they come across. My server already has a system to verify phpbb accounts with in-game ones, without requiring their password, so working with the phpbb system is a desirable attribute for this plugin in my mind. :P
I successfully installed the plugin, and can view the chat without issue, but I am getting a few issues. The most pressing of these is that when I attempt to authenticate, I get the following error:
I tried adding
to the beginning of minecraft_authenticator.php (default 32M), but ended up with the same error.
-
View User Profile
-
Send Message
Posted Mar 7, 2012@nLocus
I don't have this setup on GItHub, but it already uses Minecraft's authentication. So you only need a Minecraft account to authenticate.
I have tested and am currently using this on 1.2.3 with no issues.
-
View User Profile
-
Send Message
Posted Mar 7, 2012Looks like an excellent alternative to webchat, which turned into a (n apparently less functional) paid plugin. If it works like I hope it does in 1.2.3, I'll contribute a phpbb authentication add-on as soon as time allows. Do you have a github for this project? I'd love to contribute in other ways if possible.
-
View User Profile
-
Send Message
Posted Feb 23, 2012I am sorry, I must not have had it write the defaults out. I will have to fix that in the next revision, for now here is the default config:
http://pastebin.com/Tj4ixYm4
-
View User Profile
-
Send Message
Posted Feb 23, 2012@ArchmageInc
my ExternalChat config file is blank. Any chance of a pastebin copy of default?
-
View User Profile
-
Send Message
Posted Feb 23, 2012@ArchmageInc
Ah ok, cleared it all up for me. thanks alot ill config it now.
-
View User Profile
-
Send Message
Posted Feb 23, 2012Right now, the web server and minecraft server are assumed to be the same system. This is because they both must be able to read and write to the inChat.json file. There are ways around this which at this point are out of scope of the project. I have considered what it would take to allow the web server to be independent of the minecraft server, and intend on moving in that direction.
The plugin configuration directive chat_file is the pointer for the plugin that tells it where to look for the inChat.json file. Right now the default for this configuration directive is map/inChat.json. Since everyone configures there servers differently, there isn't a really good default for this to be.
If your web server's directory is /var/www/httpdocs then you would want to set the directive to /var/www/httpdocs/inChat.json
-
View User Profile
-
Send Message
Posted Feb 23, 2012@ArchmageInc
I'm sure i am being dense here.
I have the files (sub'd to your plugin so got emaild the link).
Define "web server" can it be on dif box's? or have to be var/www/html ect?
I dont understand how the plugin knows were the files are if i dont config it?
-
View User Profile
-
Send Message
Posted Feb 23, 2012What are you having problems with? Once the file is available it may make more sense:
-
View User Profile
-
Send Message
Posted Feb 23, 2012Really confused by the installation of this? Possible to make it a little more detailed/clear
-
View User Profile
-
Send Message
Posted Feb 23, 2012I am not sure what the problem is, the files have been waiting approval for for 27 hours now. Where are the admins?
-
View User Profile
-
Send Message
Posted Feb 23, 2012Says tested ok, wheres the download link?