Skip to content
This repository was archived by the owner on Feb 9, 2020. It is now read-only.

Commit

Permalink
lots of changes lel..
Browse files Browse the repository at this point in the history
added pocketnode method.
  • Loading branch information
hcortezr committed Dec 9, 2017
1 parent bca0858 commit 7e8631b
Show file tree
Hide file tree
Showing 30 changed files with 64 additions and 44 deletions.
Empty file modified LICENSE
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
7 changes: 1 addition & 6 deletions package-lock.json
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pocketnode",
"version": "1.0.0",
"version": "0.0.2",
"description": "Server software written in Javascript for Minecraft: PE",
"main": "start.js",
"scripts": {
Expand All @@ -16,7 +16,6 @@
"author": "eDroid",
"license": "ISC",
"dependencies": {
"invert-kv": "^1.0.0",
"raknet": "git+https://github.com/PocketNode/RakNet.git",
"time-stamp": "^2.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion src/pocketnode/Player.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const CommandSender = require("./command/CommandSender");
const CommandSender = pocketnode("command/CommandSender");

class Player extends CommandSender {
initVars(){
Expand Down
12 changes: 8 additions & 4 deletions src/pocketnode/PocketNode.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
const Logger = require("./logger/Logger");
const Server = require("./Server");
global.pocketnode = function(path){
return require(__dirname + "/" + path);
};

const Logger = pocketnode("logger/Logger");
const Server = pocketnode("Server");
class PocketNode {
constructor(){
this.START_TIME = new Date().getTime();
this.START_TIME = Date.now();
this.NAME = "PocketNode";
this.CODENAME = "[BEGINNINGS]";
this.VERSION = "0.0.1dev";
this.VERSION = "0.0.2";
this.API_VERSION = "1.0.0";

let logger = new Logger("Server");
Expand Down
24 changes: 12 additions & 12 deletions src/pocketnode/Server.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const MinecraftInfo = require("./network/minecraft/Info");
const Config = require("./utils/Config").Config;
const ConfigTypes = require("./utils/Config").Types;
const PluginLoader = require("./plugin/PluginLoader");
const MinecraftInfo = pocketnode("network/minecraft/Info");
const Config = pocketnode("utils/Config").Config;
const ConfigTypes = pocketnode("utils/Config").Types;
const PluginLoader = pocketnode("plugin/PluginLoader");

const RakNetServer = (process.argv.length === 3 && process.argv[2] === "LOCAL" ? require("../../../RakNet") : require("raknet"));

const CommandMap = require("./command/CommandMap");
const ConsoleCommandReader = require("./command/ConsoleCommandReader");
const HelpCommand = require("./command/defaults/HelpCommand");
const StopCommand = require("./command/defaults/StopCommand");
const CommandMap = pocketnode("command/CommandMap");
const ConsoleCommandReader = pocketnode("command/ConsoleCommandReader");
const HelpCommand = pocketnode("command/defaults/HelpCommand");
const StopCommand = pocketnode("command/defaults/StopCommand");

const Player = require("./Player");
const Player = pocketnode("Player");

const FileSystem = require("fs");

Expand Down Expand Up @@ -86,15 +86,15 @@ class Server {

this.plugins = new PluginLoader(this.getDataPath() + "plugins/", this);

this.getLogger().info("Done ("+(new Date().getTime() - this.PocketNode.START_TIME)+"ms)!");
this.getLogger().info("Done ("+(Date.now() - this.PocketNode.START_TIME)+"ms)!");

// plugin stuff here
}

registerDefaultCommands(){
this.getCommandMap().registerCommand(new HelpCommand());
this.getCommandMap().registerCommand(new StopCommand());
this.getCommandMap().registerCommand(new (require("./command/defaults/FakePlayerCommand"))());
this.getCommandMap().registerCommand(new (pocketnode("command/defaults/FakePlayerCommand"))());
}

/**
Expand Down Expand Up @@ -245,7 +245,7 @@ class Server {
* @return {Logger}
*/
static getLogger(){
return new (require("./logger/Logger"));
return new (pocketnode("logger/Logger"));
}
getLogger(){
return this.logger;
Expand Down
2 changes: 1 addition & 1 deletion src/pocketnode/command/Command.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const TextFormat = require("../utils/TextFormat");
const TextFormat = pocketnode("utils/TextFormat");

class Command {
initVars(){
Expand Down
8 changes: 4 additions & 4 deletions src/pocketnode/command/CommandMap.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Command = require("./Command");
const Plugin = require("../plugin/Plugin");
const CommandSender = require("./CommandSender");
const InvalidParameterError = require("../error/InvalidParameterError");
const Command = pocketnode("command/Command");
const Plugin = pocketnode("plugin/Plugin");
const CommandSender = pocketnode("command/CommandSender");
const InvalidParameterError = pocketnode("error/InvalidParameterError");

class CommandMap {
initVars(){
Expand Down
Empty file modified src/pocketnode/command/CommandSender.js
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion src/pocketnode/command/ConsoleCommandReader.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const readline = require('readline');
const ConsoleCommandSender = require("./ConsoleCommandSender");
const ConsoleCommandSender = pocketnode("command/ConsoleCommandSender");

class ConsoleCommandReader {
constructor(Server){
Expand Down
4 changes: 2 additions & 2 deletions src/pocketnode/command/ConsoleCommandSender.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const CommandSender = require("./CommandSender");
const TerminalTextFormat = require("../utils/TerminalTextFormat");
const CommandSender = pocketnode("command/CommandSender");
const TerminalTextFormat = pocketnode("utils/TerminalTextFormat");

class ConsoleCommandSender extends CommandSender {
constructor(server){
Expand Down
4 changes: 2 additions & 2 deletions src/pocketnode/command/defaults/FakePlayerCommand.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Command = require("../Command");
const Player = require("../../Player");
const Command = pocketnode("command/Command");
const Player = pocketnode("Player");

class FakePlayerCommand extends Command {
constructor(){
Expand Down
4 changes: 2 additions & 2 deletions src/pocketnode/command/defaults/HelpCommand.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Command = require("../Command");
const TextFormat = require("../../utils/TextFormat");
const Command = pocketnode("command/Command");
const TextFormat = pocketnode("utils/TextFormat");

class HelpCommand extends Command {
constructor(){
Expand Down
2 changes: 1 addition & 1 deletion src/pocketnode/command/defaults/StopCommand.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Command = require("../Command");
const Command = pocketnode("command/Command");

class StopCommand extends Command {
constructor(){
Expand Down
Empty file modified src/pocketnode/error/InvalidParameterError.js
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions src/pocketnode/logger/Logger.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const TimeStamp = require("time-stamp");

const TextFormat = require("../utils/TextFormat");
const TerminalTextFormat = require("../utils/TerminalTextFormat");
const TextFormat = pocketnode("utils/TextFormat");
const TerminalTextFormat = pocketnode("utils/TerminalTextFormat");

class Logger {
constructor(caller){
Expand Down
Empty file modified src/pocketnode/network/minecraft/Info.js
100755 → 100644
Empty file.
Empty file modified src/pocketnode/permission/PermissionLevel.js
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion src/pocketnode/plugin/Plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const TextFormat = require("../utils/TextFormat");
const TextFormat = pocketnode("utils/TextFormat");

class Plugin {
initVars(){
Expand Down
2 changes: 1 addition & 1 deletion src/pocketnode/plugin/PluginLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PluginLoader {
}

loadPlugins(directory){
let Logger = require("../logger/Logger");
let Logger = pocketnode("logger/Logger");
let logger = new Logger("Server");
let pluginList = [];
let plugins = [];
Expand Down
22 changes: 22 additions & 0 deletions src/pocketnode/plugin/PluginManager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class PluginManager {
initVars() {
this.server = {};
this.plugins = new Map();
}

constructor(server) {
this.initVars();
this.server = server;
}

getPlugin(name) {
if (this.plugins.has(name)) {
return this.plugins.get(name);
}
return null;
}

loadPlugin(path){

}
}
2 changes: 1 addition & 1 deletion src/pocketnode/utils/Config.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Config {
}
FileSystem.writeFileSync(this.file, content);
} catch (e) {
let Logger = require("../logger/Logger");
let Logger = pocketnode("logger/Logger");
let logger = new Logger("Server");
logger.critical("Couldn't save Config["+this.file+"]: " + e);
}
Expand Down
Empty file modified src/pocketnode/utils/TerminalTextFormat.js
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion src/pocketnode/utils/TextFormat.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const TerminalTextFormat = require("./TerminalTextFormat");
const TerminalTextFormat = pocketnode("utils/TerminalTextFormat");

const TextFormat = {};
TextFormat.ESCAPE = "\u00A7";
Expand Down
Empty file modified src/pocketnode/utils/methods/ClassHasMethod.js
100755 → 100644
Empty file.
Empty file modified src/pocketnode/utils/methods/UCFirst.js
100755 → 100644
Empty file.
Empty file modified start.cmd
100755 → 100644
Empty file.
Empty file modified start.js
100755 → 100644
Empty file.
Empty file modified start.ps1
100755 → 100644
Empty file.

0 comments on commit 7e8631b

Please sign in to comment.