mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-18 22:11:07 +00:00
Implemented commands
This commit is contained in:
parent
6509f513a8
commit
ec51d1e875
2 changed files with 8 additions and 2 deletions
4
app.js
4
app.js
|
|
@ -1,13 +1,15 @@
|
|||
var mcServer=require("./index");
|
||||
|
||||
var settings = require('./config/settings');
|
||||
var commands = require('./config/commands');
|
||||
|
||||
var options = {
|
||||
motd: settings.motd,
|
||||
'max-players': settings.maxPlayers,
|
||||
port: settings.port,
|
||||
'online-mode': settings.onlineMode,
|
||||
gameMode:settings.gameMode
|
||||
gameMode:settings.gameMode,
|
||||
commands: commands
|
||||
};
|
||||
|
||||
mcServer.createMCServer(options);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
module.exports=inject;
|
||||
|
||||
function inject(serv,player)
|
||||
function inject(serv, player, options)
|
||||
{
|
||||
player._client.on('chat', function (data) {
|
||||
if(data.message[0]=="/" && options.commands[data.message.slice(1)]) {
|
||||
player.chat("" + options.commands[data.message.slice(1)]);
|
||||
} else {
|
||||
serv.broadcast('<' + player.username + '>' + ' ' + data.message);
|
||||
player.emit("chat",data.message);
|
||||
}
|
||||
});
|
||||
|
||||
function chat(message) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue