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