Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
vincss committed Dec 24, 2023
1 parent 8f6491c commit 5c3cff8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"express": "^4.18.2",
"express-handlebars": "^7.0.4",
"js-yaml": "^4.1.0",
"minecraft-protocol": "git://github.com:vincss/node-minecraft-protocol.git",
"minecraft-protocol": "file:/../node-minecraft-protocol",
"prismarine-chat": "^1.8.0",
"winston": "^3.8.2"
},
Expand Down
2 changes: 1 addition & 1 deletion sleepingSettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ webStopOnStart: false
# webServeDynmap: true # true or false to enable, by default it will serve ./plugins/dynmap/web/. You can specify an absolute path to serve instead or an url to redirect to.

startMinecraft: true # false to disable
minecraftCommand: "java -jar paper.jar nogui" # or paper.jar or whatever flavor you like
minecraftCommand: "ping 127.0.0.1 -n 1" # or paper.jar or whatever flavor you like

# preventStop: true # Prevent the user to stop the server (trought web-server or cli).

Expand Down
14 changes: 10 additions & 4 deletions src/sleepingLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { createLogger, format, transports, transport } from "winston";
export const { version } = require("../package.json"); // eslint-disable-line

const DefaultLogger = {
info: (...params: any) => console.info(params),
error: (...params: any) => console.error(params),
warn: (...params: any) => console.warn(params),
silly: (...params: any) => console.trace(params),
info: console.info,
error: console.error,
warn: console.warn,
silly: console.trace,
};

export type LoggerType = typeof DefaultLogger;
Expand All @@ -22,6 +22,12 @@ export const getLogger = () => {
return logger;
}

if (process.env.DEFAULT_LOGGER) {
initialized = true;
logger.info("... Default Logger ...");
return logger;
}

const loggers: transport[] = [new transports.Console()];
if (
!process.env.DISABLE_FILE_LOGS ||
Expand Down
11 changes: 6 additions & 5 deletions src/sleepingMcJava.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class SleepingMcJava implements ISleepingServer {
errorHandler: (client, error) =>
console.warn("SleepingMcJava.errorHandler: ", client, error),
enforceSecureProfile: this.settings.serverOnlineMode,
hideErrors: true,
// encryption: false,
// host: '0.0.0.0',
});
Expand All @@ -51,11 +52,11 @@ export class SleepingMcJava implements ISleepingServer {

this.server.on("connection", (client: Client) => {
!this.settings.hideOnConnectionLogs &&
this.logger.info(
`A Prince has taken a quick peek. [${client.version}${this.getIp(
client
)}]`
);
this.logger.info(
`A Prince has taken a quick peek. [${client.version}${this.getIp(
client
)}]`
);
});

this.server.on("listening", () => {
Expand Down

0 comments on commit 5c3cff8

Please sign in to comment.