mirror of
https://github.com/WorldEditAxe/eaglerproxy.git
synced 2024-12-21 06:44:13 -08:00
fixed bug that would cause the client to not disconnect if an error occurs whilst switching servers
This commit is contained in:
parent
b348c2bef2
commit
3e6f59b9e0
4
example_plugins/AutokickPlugin/config.js
Normal file
4
example_plugins/AutokickPlugin/config.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
export const config = {
|
||||
bindInternalServerPort: 25569,
|
||||
bindInternalServerIp: "127.0.0.1",
|
||||
};
|
|
@ -1,4 +0,0 @@
|
|||
export const config = {
|
||||
bindInternalServerPort: 25569,
|
||||
bindInternalServerIp: "127.0.0.1",
|
||||
};
|
|
@ -1,9 +1,7 @@
|
|||
import metadata from "./metadata.json" assert { type: "json" };
|
||||
import { createServer } from "minecraft-protocol";
|
||||
import { config } from "./config.js";
|
||||
|
||||
const PluginManager = PLUGIN_MANAGER as any;
|
||||
|
||||
const PluginManager = PLUGIN_MANAGER;
|
||||
const Logger = PluginManager.Logger;
|
||||
const Enums = PluginManager.Enums;
|
||||
const Chat = PluginManager.Chat;
|
||||
|
@ -13,36 +11,28 @@ const Player = PluginManager.Player;
|
|||
const MineProtocol = PluginManager.MineProtocol;
|
||||
const EaglerSkins = PluginManager.EaglerSkins;
|
||||
const Util = PluginManager.Util;
|
||||
|
||||
const logger = new Logger("AutoKicker");
|
||||
logger.info(`Starting ${metadata.name} v${metadata.version}...`);
|
||||
logger.info(
|
||||
`(internal server port: ${config.bindInternalServerPort}, internal server IP: ${config.bindInternalServerPort})`
|
||||
);
|
||||
|
||||
logger.info(`(internal server port: ${config.bindInternalServerPort}, internal server IP: ${config.bindInternalServerPort})`);
|
||||
logger.info("Starting internal server...");
|
||||
let server = createServer({
|
||||
host: config.bindInternalServerIp,
|
||||
port: config.bindInternalServerPort,
|
||||
motdMsg: `${Enums.ChatColor.GOLD}EaglerProxy as a Service`,
|
||||
"online-mode": false,
|
||||
version: "1.8.9",
|
||||
host: config.bindInternalServerIp,
|
||||
port: config.bindInternalServerPort,
|
||||
motdMsg: `${Enums.ChatColor.GOLD}EaglerProxy as a Service`,
|
||||
"online-mode": false,
|
||||
version: "1.8.9",
|
||||
});
|
||||
|
||||
server.on("login", (client) => {
|
||||
logger.info(`Client ${client.username} has connected to the dummy server.`);
|
||||
client.write("kick_disconnect", {
|
||||
reason: "NO",
|
||||
});
|
||||
logger.info(`Client ${client.username} has connected to the dummy server.`);
|
||||
client.write("kick_disconnect", {
|
||||
reason: "NO",
|
||||
});
|
||||
});
|
||||
|
||||
logger.info(
|
||||
"Redirecting backend server IP... (this is required for the plugin to function)"
|
||||
);
|
||||
logger.info("Redirecting backend server IP... (this is required for the plugin to function)");
|
||||
CONFIG.adapter.server = {
|
||||
host: config.bindInternalServerIp,
|
||||
port: config.bindInternalServerPort,
|
||||
host: config.bindInternalServerIp,
|
||||
port: config.bindInternalServerPort,
|
||||
};
|
||||
CONFIG.adapter.motd = {
|
||||
l1: Enums.ChatColor.RED + "Server Under Maintenance",
|
||||
l1: Enums.ChatColor.RED + "Server Under Maintenance",
|
||||
};
|
5
example_plugins/AutokickPlugin/types.d.ts
vendored
5
example_plugins/AutokickPlugin/types.d.ts
vendored
|
@ -1,5 +0,0 @@
|
|||
declare global {
|
||||
var PLUGIN_MANAGER;
|
||||
}
|
||||
|
||||
export {};
|
|
@ -290,7 +290,7 @@ export class Player extends EventEmitter {
|
|||
}, 30000);
|
||||
client.on("error", errListener);
|
||||
client.on("end", (reason) => {
|
||||
if (!this._switchingServers) {
|
||||
if (!this._switchingServers && !switchingServers) {
|
||||
this.disconnect(this._kickMessage ?? reason);
|
||||
}
|
||||
this.ws.removeListener("message", listener);
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
"moduleResolution": "node",
|
||||
"sourceMap": false,
|
||||
"outDir": "build",
|
||||
"resolveJsonModule": true
|
||||
"resolveJsonModule": true,
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src/**/*.json", "src/**/*", "example_plugins/AutokickPlugin"],
|
||||
"include": ["src/**/*.json", "src/**/*"],
|
||||
"hooks": ["copy-files"]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user