fs-plugin-autonick

A Tool to auto change the Nick to an random one
git clone git://archive.git.mtrnord.blog/Nordgedanken/fs-plugin-autonick.git
Log | Files | Refs | README

commit 586c128d3bd612d66e9e9e79479eb27f9eb16f0d
parent 455dd788fae74d304e0cba9d2a8bfba535ee03a2
Author: MTRNord <mtrnord1@gmail.com>
Date:   Thu, 18 Aug 2016 13:45:50 +0200

Version 0.0.1

Diffstat:
Mindex.js | 40++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js @@ -3,7 +3,43 @@ // Date: 17.08.2016 // Version: 0.0.1 /* -------------------------------------- */ +var util = require('util'); +var Moniker = require('moniker'); + + module.exports.player = function(player, serv) { // Player is a type of entity (entity inject is called first) with added properties and functions - player.setXp(100); // Example of a property player entities have but not other entities - player.on(',,,', ...); + player.commands.add({ + base: 'nickme', + info: 'Change the Nick of your self', + usage: '/nickme', + action({search, page}) { + var names = Moniker.generator([Moniker.noun]); + serv._writeAll('player_info',{ + action: 3, + data: [{ + UUID: player._client.uuid, + displayName: names.choose() + }] + }); + serv.log("Nick changed") + player.chat('Nick changed') + function simpleStringify (object){ + var simpleObject = {}; + for (var prop in object ){ + if (!object.hasOwnProperty(prop)){ + continue; + } + if (typeof(object[prop]) == 'object'){ + continue; + } + if (typeof(object[prop]) == 'function'){ + continue; + } + simpleObject[prop] = object[prop]; + } + return JSON.stringify(simpleObject); // returns cleaned up JSON +}; + serv.log('New Username: ' + serv.players) + } + }); }