2023-07-05 10:23:54 -07:00
|
|
|
import metadata from "./metadata.json" assert { type: "json" };
|
|
|
|
import { createServer } from "minecraft-protocol";
|
|
|
|
import { config } from "./config.js";
|
2023-07-05 11:09:30 -07:00
|
|
|
const PluginManager = PLUGIN_MANAGER;
|
2023-07-05 10:23:54 -07:00
|
|
|
const Logger = PluginManager.Logger;
|
|
|
|
const Enums = PluginManager.Enums;
|
|
|
|
const Chat = PluginManager.Chat;
|
|
|
|
const Constants = PluginManager.Constants;
|
|
|
|
const Motd = PluginManager.Motd;
|
|
|
|
const Player = PluginManager.Player;
|
|
|
|
const MineProtocol = PluginManager.MineProtocol;
|
|
|
|
const EaglerSkins = PluginManager.EaglerSkins;
|
|
|
|
const Util = PluginManager.Util;
|
2023-07-05 10:24:40 -07:00
|
|
|
const logger = new Logger("AutoKicker");
|
2023-07-05 10:23:54 -07:00
|
|
|
logger.info(`Starting ${metadata.name} v${metadata.version}...`);
|
2023-07-05 11:09:30 -07:00
|
|
|
logger.info(`(internal server port: ${config.bindInternalServerPort}, internal server IP: ${config.bindInternalServerPort})`);
|
2023-07-05 10:23:54 -07:00
|
|
|
logger.info("Starting internal server...");
|
|
|
|
let server = createServer({
|
2023-07-05 11:09:30 -07:00
|
|
|
host: config.bindInternalServerIp,
|
|
|
|
port: config.bindInternalServerPort,
|
|
|
|
motdMsg: `${Enums.ChatColor.GOLD}EaglerProxy as a Service`,
|
|
|
|
"online-mode": false,
|
|
|
|
version: "1.8.9",
|
2023-07-05 10:23:54 -07:00
|
|
|
});
|
|
|
|
server.on("login", (client) => {
|
2023-07-05 11:09:30 -07:00
|
|
|
logger.info(`Client ${client.username} has connected to the dummy server.`);
|
|
|
|
client.write("kick_disconnect", {
|
|
|
|
reason: "NO",
|
|
|
|
});
|
2023-07-05 10:23:54 -07:00
|
|
|
});
|
2023-07-05 11:09:30 -07:00
|
|
|
logger.info("Redirecting backend server IP... (this is required for the plugin to function)");
|
2023-07-05 10:23:54 -07:00
|
|
|
CONFIG.adapter.server = {
|
2023-07-05 11:09:30 -07:00
|
|
|
host: config.bindInternalServerIp,
|
|
|
|
port: config.bindInternalServerPort,
|
2023-07-05 10:23:54 -07:00
|
|
|
};
|
|
|
|
CONFIG.adapter.motd = {
|
2023-07-05 11:09:30 -07:00
|
|
|
l1: Enums.ChatColor.RED + "Server Under Maintenance",
|
2023-07-05 10:23:54 -07:00
|
|
|
};
|