Advertisement
Guest User

Untitled

a guest
Feb 8th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.59 KB | None | 0 0
  1. var Logger = require('./Logger');
  2. var UserRoleEnum = require("../enum/UserRoleEnum");
  3.  
  4. function PlayerCommand(gameServer, playerTracker) {
  5. this.gameServer = gameServer;
  6. this.playerTracker = playerTracker;
  7. this.roleList = [];
  8. this.admins = [];
  9. }
  10. module.exports = PlayerCommand;
  11.  
  12. PlayerCommand.prototype.writeLine = function (text) {
  13. this.gameServer.sendChatMessage(null, this.playerTracker, text);
  14. };
  15.  
  16. PlayerCommand.prototype.executeCommandLine = function(commandLine) {
  17. if (!commandLine) return;
  18.  
  19. // Splits the string
  20. var args = commandLine.split(" ");
  21.  
  22. // Process the first string value
  23. var first = args[0].toLowerCase();
  24.  
  25. // Get command function
  26. var execute = playerCommands[first];
  27. if (typeof execute != 'undefined') {
  28. execute.bind(this)(args);
  29. } else {
  30. this.writeLine("ERROR: Unknown command, type /help for command list");
  31. }
  32. };
  33.  
  34.  
  35. PlayerCommand.prototype.userLogin = function (ip, password) {
  36. if (!password) return null;
  37. password = password.trim();
  38. if (!password) return null;
  39. for (var i = 0; i < this.gameServer.userList.length; i++) {
  40. var user = this.gameServer.userList[i];
  41. if (user.password != password)
  42. continue;
  43. if (user.ip && user.ip != ip)
  44. continue;
  45. return user;
  46. }
  47. return null;
  48. };
  49.  
  50. var playerCommands = {
  51. help: function (args) {
  52. var page = parseInt(args[1]);
  53. if (this.playerTracker.userRole == UserRoleEnum.ADMIN || this.playerTracker.userRole == UserRoleEnum.MODER) {
  54. if (isNaN(page)) {
  55. this.writeLine("Please Enter a Page Number!");
  56. return;
  57. }
  58. if (page == 1) {
  59. this.writeLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  60. this.writeLine("/skin %shark - change skin");
  61. this.writeLine("/kill - self kill");
  62. this.writeLine("/help [page #] - this command list");
  63. this.writeLine("/id - Gets your playerID");
  64. this.writeLine("/mass - gives mass to yourself or to other players");
  65. this.writeLine("/merge - Instantly Recombines all of your cells or other players cells");
  66. this.writeLine("/rec - Toggles rec mode for you or for other players - MUST BE ADMIN");
  67. this.writeLine("/spawnmass - gives yourself or other players spawnmass - MUST BE ADMIN");
  68. this.writeLine("/minion - gives yourself or other players minions");
  69. this.writeLine("/minion remove - removes all of your minions or other players minions");
  70. this.writeLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  71. this.writeLine("Showing Page 1 of 2.");
  72. } else if (page == 2) {
  73. this.writeLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  74. this.writeLine("/userrole - Allows you to give User Role to a player ID - MUST BE ADMIN");
  75. this.writeLine("/userrole list - Lists all the people you have given a Role - MUST BE ADMIN");
  76. this.writeLine("/kick - Kicks a Player ID to make them lose their Temporarily Role");
  77. this.writeLine("/addbot - Adds Bots to the Server - MUST BE ADMIN");
  78. this.writeLine("/change - Allows you to Temporarily change the config of the Server! - MUST BE ADMIN");
  79. this.writeLine("/reloadconfig - Reloads the config of the Server to the gameServer.ini file - MUST BE ADMIN");
  80. this.writeLine("/shutdown - SHUTDOWNS THE SERVER - MUST BE ADMIN");
  81. this.writeLine("/restart - RESTARTS THE SERVER - MUST BE ADMIN");
  82. this.writeLine("/status - Shows Status of the Server");
  83. this.writeLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  84. this.writeLine("Showing Page 2 of 2.");
  85. }
  86. }
  87. else {
  88. this.writeLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  89. this.writeLine("/skin %shark - change skin");
  90. this.writeLine("/kill - self kill");
  91. this.writeLine("/help - this command list");
  92. this.writeLine("/id - Gets your playerID");
  93. this.writeLine("/list - Lists the players in-game");
  94. this.writeLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  95. }
  96. },
  97. id: function (args) {
  98. this.writeLine("Your PlayerID is " + this.playerTracker.pID);
  99. },
  100. skin: function (args) {
  101. if (this.playerTracker.cells.length) {
  102. this.writeLine("ERROR: Cannot change skin while player in game!");
  103. return;
  104. }
  105. var skinName = "";
  106. if (args[1]) skinName = args[1];
  107. this.playerTracker.setSkin(skinName);
  108. if (skinName == "")
  109. this.writeLine("Your skin was removed");
  110. else
  111. this.writeLine("Your skin set to " + skinName);
  112. },
  113. kill: function (args) {
  114. if (!this.playerTracker.cells.length) {
  115. this.writeLine("You cannot kill yourself, because you're still not joined to the game!");
  116. return;
  117. }
  118. while (this.playerTracker.cells.length) {
  119. var cell = this.playerTracker.cells[0];
  120. this.gameServer.removeNode(cell);
  121. // replace with food
  122. var food = require('../entity/Food');
  123. food = new food(this.gameServer, null, cell.position, cell._size);
  124. food.setColor(cell.color);
  125. this.gameServer.addNode(food);
  126. }
  127. this.writeLine("You killed yourself");
  128. },
  129. list: function (args) {
  130. if (this.admins == null) {
  131. this.writeLine("There are no admins or mods in this server.");
  132. }
  133. for (var i in this.admins) {
  134. this.writeLine(this.admins[i].username + " ~~~~ " + this.admins[i].name);
  135. }
  136. },
  137. mass: function (args) {
  138. if (this.playerTracker.userRole != UserRoleEnum.ADMIN && this.playerTracker.userRole != UserRoleEnum.MODER) {
  139. this.writeLine("ERROR: access denied!");
  140. return;
  141. }
  142. var mass = parseInt(args[1]);
  143. var id = parseInt(args[2]);
  144. var size = Math.sqrt(mass * 100);
  145.  
  146. if (isNaN(mass)) {
  147. this.writeLine("ERROR: missing mass argument!");
  148. return;
  149. }
  150.  
  151. if (isNaN(id)) {
  152. this.writeLine("Warn: missing ID arguments. This will change your mass.");
  153. for (var i in this.playerTracker.cells) {
  154. this.playerTracker.cells[i].setSize(size);
  155. }
  156. this.writeLine("Set mass of " + this.playerTracker._name + " to " + size * size / 100);
  157.  
  158. } else {
  159. for (var i in this.gameServer.clients) {
  160. var client = this.gameServer.clients[i].playerTracker;
  161. if (client.pID == id) {
  162. for (var j in client.cells) {
  163. client.cells[j].setSize(size);
  164. }
  165. this.writeLine("Set mass of " + client._name + " to " + size * size / 100);
  166. var text = this.playerTracker._name + " changed your mass to " + size * size / 100;
  167. this.gameServer.sendChatMessage(null, client, text);
  168. break;
  169. }
  170. }
  171. }
  172.  
  173. },
  174. spawnmass: function (args) {
  175. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  176. this.writeLine("ERROR: access denied!");
  177. return;
  178. }
  179. var mass = parseInt(args[1]);
  180. var id = parseInt(args[2]);
  181. var size = Math.sqrt(mass * 100);
  182.  
  183. if (isNaN(mass)) {
  184. this.writeLine("ERROR: missing mass argument!");
  185. return;
  186. }
  187.  
  188. if (isNaN(id)) {
  189. this.playerTracker.spawnmass = size;
  190. this.writeLine("Warn: missing ID arguments. This will change your spawnmass.");
  191. this.writeLine("Set spawnmass of " + this.playerTracker._name + " to " + size * size / 100);
  192. } else {
  193. for (var i in this.gameServer.clients) {
  194. var client = this.gameServer.clients[i].playerTracker;
  195. if (client.pID == id) {
  196. client.spawnmass = size;
  197. this.writeLine("Set spawnmass of " + client._name + " to " + size * size / 100);
  198. var text = this.playerTracker._name + " changed your spawn mass to " + size * size / 100;
  199. this.gameServer.sendChatMessage(null, client, text);
  200. }
  201. }
  202. }
  203. },
  204. minion: function(args) {
  205. if (this.playerTracker.userRole != UserRoleEnum.ADMIN && this.playerTracker.userRole != UserRoleEnum.MODER) {
  206. this.writeLine("ERROR: access denied!");
  207. return;
  208. }
  209. if (this.playerTracker.userRole == UserRoleEnum.ADMIN) {
  210. var add = args[1];
  211. var id = parseInt(args[2]);
  212. }
  213. var player = this.playerTracker;
  214. if (this.playerTracker.userRole == UserRoleEnum.MODER) {
  215. var add = args[1];
  216. }
  217. /** For you **/
  218. if (this.playerTracker.userRole == UserRoleEnum.ADMIN) {
  219. if (isNaN(id)) {
  220. this.writeLine("Warn: missing ID arguments. This will give you minions.");
  221. // Remove minions
  222. if (player.minionControl == true && add == "remove") {
  223. player.minionControl = false;
  224. player.miQ = 0;
  225. this.writeLine("Succesfully removed minions for " + player._name);
  226. // Add minions
  227. } else {
  228. player.minionControl = true;
  229. // Add minions for self
  230. if (isNaN(parseInt(add))) add = 1;
  231. for (var i = 0; i < add; i++) {
  232. this.gameServer.bots.addMinion(player);
  233. }
  234. this.writeLine("Added " + add + " minions for " + player._name);
  235. }
  236.  
  237. } else {
  238. /** For others **/
  239. for (var i in this.gameServer.clients) {
  240. var client = this.gameServer.clients[i].playerTracker;
  241. if (client.pID == id) {
  242. // Remove minions
  243. if (client.minionControl == true) {
  244. client.minionControl = false;
  245. client.miQ = 0;
  246. this.writeLine("Succesfully removed minions for " + client._name);
  247. var text = this.playerTracker._name + " removed all off your minions.";
  248. this.gameServer.sendChatMessage(null, client, text);
  249. // Add minions
  250. } else {
  251. client.minionControl = true;
  252. // Add minions for client
  253. if (isNaN(parseInt(add))) add = 1;
  254. for (var i = 0; i < add; i++) {
  255. this.gameServer.bots.addMinion(client);
  256. }
  257. this.writeLine("Added " + add + " minions for " + client._name);
  258. var text = this.playerTracker._name + " gave you " + add + " minions.";
  259. this.gameServer.sendChatMessage(null, client, text);
  260. }
  261. }
  262. }
  263. }
  264. } else {
  265. if (add == "remove" && player.minionControl == true) {
  266. player.minionControl = false;
  267. player.miQ = 0;
  268. this.writeLine("Successfully removed minions for " + player._name);
  269. } else {
  270. player.minionControl = true;
  271. if (player.miQ > 1) {
  272. this.writeLine("You can't have more then 1 minion!");
  273. return;
  274. } else
  275. { this.gameServer.bots.addMinion(player);
  276. this.writeLine("Gave " + player._name + " 1 minion");
  277. }
  278. }
  279.  
  280. }
  281. },
  282. userrole: function(args) {
  283. // Temporarily changes the User Role of a player until that player leaves the server.
  284. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  285. this.writeLine("ERROR: access denied");
  286. return;
  287. }
  288. var id = args[1];
  289. var role = args[2];
  290. if(isNaN(parseInt(id))) {
  291. this.writeLine("Please specify a valid player ID!");
  292. if (id == "list") {
  293. if (!this.roleList.length) {
  294. this.writeLine("You have not given anyone a Role!");
  295. return;
  296. }
  297. this.writeLine(" ID | SCORE | NICK");
  298. for (var i in this.roleList) {
  299. var client = this.roleList[i];
  300. var id = client.pID;
  301. var nick = client._name;
  302. var score = Math.round(client._score);
  303. this.writeLine(id + " " + score + " " + nick);
  304. }
  305. return;
  306. }
  307. return;
  308. } else {
  309. if (role != "moder" && role != "user" && role != "guest" || role == null) {
  310. this.writeLine("Please specify a valid Role!");
  311. return;
  312. }
  313. if (this.playerTracker.pID == id) {
  314. this.writeLine("You cannot change your own Role!");
  315. return;
  316. }
  317. for (var i in this.gameServer.clients) {
  318. var client = this.gameServer.clients[i].playerTracker;
  319. if (client.pID == id) {
  320. if (client.userRole == UserRoleEnum.ADMIN) {
  321. this.writeLine("You cannot change Admins Roles!");
  322. return;
  323. }
  324. if (role == "moder") {
  325. client.userRole = UserRoleEnum.MODER;
  326. this.writeLine("Successfully changed " + client._name + "'s Role to Moder");
  327. this.gameServer.sendChatMessage(null, client, "You have been temporarily changed to MODER."); // notify
  328. this.roleList.push(client);
  329. } else if (role == "user") {
  330. client.userRole = UserRoleEnum.USER;
  331. this.writeLine("Successfully changed " + client._name + "'s Role to User!");
  332. this.gameServer.sendChatMessage(null, client, "You have been temporarily changed to USER."); // notify
  333. this.roleList.push(client);
  334. } else {
  335. client.userRole = UserRoleEnum.GUEST;
  336. this.writeLine("Successfully changed " + client._name + "'s Role to Guest!");
  337. this.gameServer.sendChatMessage(null, client, "You have been temporarily changed to GUEST."); // notify
  338. this.roleList.push(client);
  339. }
  340. }
  341. }
  342. }
  343. },
  344. kick: function(args) {
  345. var id = parseInt(args[1]);
  346. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  347. this.writeLine("ERROR: acces denied!");
  348. return;
  349. }
  350. if (isNaN(id)) {
  351. this.writeLine("Please specify a valid player ID!");
  352. return;
  353. }
  354. // kick player
  355. var count = 0;
  356. this.gameServer.clients.forEach(function (socket) {
  357. if (socket.isConnected === false)
  358. return;
  359. if (id !== 0 && socket.playerTracker.pID != id)
  360. return;
  361. if (socket.playerTracker.userRole == UserRoleEnum.ADMIN) {
  362. this.writeLine("You cannot kick a ADMIN in game!");
  363. return;
  364. }
  365. // remove player cells
  366. for (var j = 0; j < socket.playerTracker.cells.length; j++) {
  367. this.gameServer.removeNode(socket.playerTracker.cells[0]);
  368. count++;
  369. }
  370. // disconnect
  371. socket.close(1000, "Kicked from server");
  372. var name = socket.playerTracker._name;
  373. this.writeLine("Successfully kicked " + name);
  374. count++;
  375. }, this);
  376. if (count) return;
  377. if (!id) this.writeLine("Warn: No players to kick!");
  378. else this.writeLine("Warn: Player with ID " + id + " not found!");
  379. },
  380. addbot: function(args) {
  381. var add = parseInt(args[1]);
  382. if (isNaN(add)) add = 1;
  383. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  384. this.writeLine("ERROR: access denied!");
  385. return;
  386. }
  387. for (var i = 0; i < add; i++) {
  388. this.gameServer.bots.addBot();
  389. }
  390. Logger.warn(this.playerTracker.socket.remoteAddress + " ADDED " + add + " BOTS");
  391. this.writeLine("Added " + add + " Bots");
  392. },
  393. status: function(args) {
  394. if (this.playerTracker.userRole != UserRoleEnum.ADMIN && this.playerTracker.userRole != UserRoleEnum.MODER) {
  395. this.writeLine("ERROR: access denied!");
  396. return;
  397. }
  398. // Get amount of humans/bots
  399. var humans = 0,
  400. bots = 0;
  401. for (var i = 0; i < this.gameServer.clients.length; i++) {
  402. if ('_socket' in this.gameServer.clients[i]) {
  403. humans++;
  404. } else {
  405. bots++;
  406. }
  407. }
  408. var ini = require('./ini.js');
  409. this.writeLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  410. this.writeLine("Connected players: " + this.gameServer.clients.length + "/" + this.gameServer.config.serverMaxConnections);
  411. this.writeLine("Players: " + humans + " - Bots: " + bots);
  412. this.writeLine("Server has been running for " + Math.floor(process.uptime() / 60) + " minutes");
  413. this.writeLine("Current memory usage: " + Math.round(process.memoryUsage().heapUsed / 1048576 * 10) / 10 + "/" + Math.round(process.memoryUsage().heapTotal / 1048576 * 10) / 10 + " mb");
  414. this.writeLine("Current game mode: " + this.gameServer.gameMode.name);
  415. this.writeLine("Current update time: " + this.gameServer.updateTimeAvg.toFixed(3) + " [ms] (" + ini.getLagMessage(this.gameServer.updateTimeAvg) + ")");
  416. this.writeLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  417. },
  418. merge: function(args) {
  419. // Validation checks
  420. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  421. this.writeLine("ERROR: access denied!");
  422. return;
  423. }
  424. var id = parseInt(args[1]);
  425. if (isNaN(id)) {
  426. this.writeLine("Warn: Missing ID arguments. This will merge you.");
  427. if (this.playerTracker.cells.length == 1) {
  428. this.writeLine("You already have one cell!");
  429. return;
  430. }
  431. this.playerTracker.mergeOverride = !this.playerTracker.mergeOverride;
  432. if (this.playerTracker.mergeOverride) this.writeLine(this.playerTracker._name + " is now force mergeing");
  433. else this.writeLine(this.playerTracker._name + " isn't force merging anymore");
  434. } else {
  435.  
  436. // Find client with same ID as player entered
  437. for (var i = 0; i < this.gameServer.clients.length; i++) {
  438. if (id == this.gameServer.clients[i].playerTracker.pID) {
  439. var client = this.gameServer.clients[i].playerTracker;
  440. if (client.cells.length == 1) {
  441. this.writeLine("Client already has one cell!");
  442. return;
  443. }
  444. // Set client's merge override
  445. client.mergeOverride = !client.mergeOverride;
  446. if (client.mergeOverride) {
  447. this.writeLine(client._name + " is now force merging");
  448. var text = this.playerTracker._name + " Caused you to merge!";
  449. this.gameServer.sendChatMessage(null, client, text); // notify
  450. }
  451. else {
  452. this.writeLine(client._name + " isn't force merging anymore");
  453. var text = this.playerTracker._name + " Stopped your mergeing"
  454. this.gameServer.sendChatMessage(null, client, text); // notify
  455. }
  456. }
  457. }
  458. }
  459. },
  460. rec: function(args) {
  461. var id = parseInt(args[1]);
  462. if (isNaN(id)) {
  463. this.writeLine("Warn: Missing ID arguments. This will give you rec mode.");
  464. this.playerTracker.rec = !this.playerTracker.rec;
  465. if (this.playerTracker.rec) this.writeLine(this.playerTracker._name + " is now in rec mode!");
  466. else this.writeLine(this.playerTracker._name + " is no longer in rec mode");
  467. }
  468.  
  469. // set rec for client
  470. for (var i in this.gameServer.clients) {
  471. if (this.gameServer.clients[i].playerTracker.pID == id) {
  472. var client = this.gameServer.clients[i].playerTracker;
  473. client.rec = !client.rec;
  474. if (client.rec) {
  475. this.writeLine(client._name + " is now in rec mode!");
  476. var text = this.playerTracker._name + " gave you rec mode!";
  477. this.gameServer.sendChatMessage(null, client, text); // notify
  478. } else {
  479. this.writeLine(client._name + " is no longer in rec mode");
  480. var text = this.playerTracker._name + " Removed your rec mode";
  481. this.gameServer.sendChatMessage(null, client, text); // notify
  482. }
  483. }
  484. }
  485. },
  486. change: function(args) {
  487. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  488. this.writeLine("ERROR: access denied!");
  489. return;
  490. }
  491. if (args.length < 3) {
  492. this.writeLine("Invalid command arguments");
  493. return;
  494. }
  495. var key = args[1];
  496. var value = args[2];
  497.  
  498. // Check if int/float
  499. if (value.indexOf('.') != -1) {
  500. value = parseFloat(value);
  501. } else {
  502. value = parseInt(value);
  503. }
  504.  
  505. if (value == null || isNaN(value)) {
  506. this.writeLine("Invalid value: " + value);
  507. return;
  508. }
  509. if (!this.gameServer.config.hasOwnProperty(key)) {
  510. this.writeLine("Unknown config value: " + key);
  511. return;
  512. }
  513. this.gameServer.config[key] = value;
  514.  
  515. // update/validate
  516. this.gameServer.config.playerMinSize = Math.max(32, this.gameServer.config.playerMinSize);
  517. Logger.setVerbosity(this.gameServer.config.logVerbosity);
  518. Logger.setFileVerbosity(this.gameServer.config.logFileVerbosity);
  519. this.writeLine("Set " + key + " = " + this.gameServer.config[key]);
  520. Logger.warn("CONFIGURATION CHANGE REQUEST FROM " + this.playerTracker.socket.remoteAddress + " as " + this.playerTracker.userAuth);
  521. Logger.info(key + " WAS CHANGED TO " + value);
  522. },
  523. reloadconfig: function(args) {
  524. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  525. this.writeLine("ERROR: access denied!");
  526. return;
  527. }
  528. this.gameServer.loadConfig();
  529. this.gameServer.loadIpBanList();
  530. Logger.warn("CONFIGURATION RELOAD REQUEST FROM " + this.playerTracker.socket.remoteAddress + " as " + this.playerTracker.userAuth);
  531. this.writeLine("Configuration was Successfully Reloaded!");
  532. },
  533. login: function (args) {
  534. try {
  535. var username = args[1].trim();
  536. } catch (error) {
  537. this.writeLine("ERROR: you have to type in a username!");
  538. return;
  539. }
  540. try {
  541. var password = args[2].trim();
  542. } catch (error) {
  543. this.writeLine("ERROR: You have to type in a password!");
  544. return;
  545. }
  546. var user = this.userLogin(username, password);
  547. if (!user) {
  548. this.writeLine("ERROR: login failed!");
  549. return;
  550. }
  551. Logger.info(username + " Logined in as " + user.name + " from " + this.playerTracker.socket.remoteAddress + ":" + this.playerTracker.socket.remotePort);
  552. var name = this.playerTracker._name;
  553. this.admin = {
  554. name,
  555. username,
  556. }
  557. var text = name + " Joined the Server";
  558. for (var i in this.gameServer.clients) {
  559. var client = this.gameServer.clients[i].playerTracker;
  560. this.gameServer.sendChatMessage(null, client, text);
  561. }
  562. this.admins.push(this.admins);
  563. this.playerTracker.userRole = user.role;
  564. this.playerTracker.userAuth = user.name;
  565. this.writeLine("Login done as \"" + user.name + "\"");
  566. return;
  567. },
  568. shutdown: function (args) {
  569. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  570. this.writeLine("ERROR: access denied!");
  571. return;
  572. }
  573. Logger.warn("SHUTDOWN REQUEST FROM " + this.playerTracker.socket.remoteAddress + " as " + this.playerTracker.userAuth);
  574. process.exit(0);
  575. },
  576. restart: function (args) {
  577. if (this.playerTracker.userRole != UserRoleEnum.ADMIN) {
  578. this.writeLine("ERROR: acces denied!");
  579. return;
  580. }
  581. Logger.warn("RESTART REQUEST FROM " + this.playerTracker.socket.remoteAddress + " as " + this.playerTracker.userAuth);
  582. process.exit(3);
  583. }
  584. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement