From 2b9d89fb41d58739645823fa0fe7472dc73b06eb Mon Sep 17 00:00:00 2001 From: q13x <84165981+WorldEditAxe@users.noreply.github.com> Date: Sun, 18 Jun 2023 20:14:32 -0800 Subject: [PATCH] Update utils.ts --- src/plugins/EagProxyAAS/utils.ts | 34 ++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/plugins/EagProxyAAS/utils.ts b/src/plugins/EagProxyAAS/utils.ts index cca71cd..cc76c2b 100644 --- a/src/plugins/EagProxyAAS/utils.ts +++ b/src/plugins/EagProxyAAS/utils.ts @@ -14,6 +14,8 @@ const MAX_LIFETIME_CONNECTED = 10 * 60 * 1000, MAX_LIFETIME_AUTH = 5 * 60 * 1000 const REGISTRY = Registry.default('1.8.8'), McBlock = (Block as any).default('1.8.8'), LOGIN_CHUNK = generateSpawnChunk().dump() const logger = new PLUGIN_MANAGER.Logger("PlayerHandler") +const FORK_URL = "https://repl.it/github/WorldEditAxe/eaglerproxy" + let SERVER: ServerGlobals = null export function setSG(svr: ServerGlobals) { @@ -125,7 +127,7 @@ export function sendMessageLogin(client: Client, url: string, token: string) { color: 'gold', hoverEvent: { action: "show_text", - value: Enums.ChatColor.GOLD + "Click me to copy to chat to copy from there!" + value: Enums.ChatColor.GOLD + "Click me to copy to chat!" }, clickEvent: { action: "suggest_command", @@ -141,6 +143,27 @@ export function sendMessageLogin(client: Client, url: string, token: string) { }) } +export function sendMessageFork(client: Client, url: string) { + client.write('chat', { + message: JSON.stringify({ + text: "Fork me here: ", + color: 'aqua', + extra: [{ + text: "", + color: 'green', + clickEvent: { + action: "open_url", + value: url + }, + hoverEvent: { + action: "show_text", + value: Enums.ChatColor.GOLD + "Click me to open in a new window!" + } + }] + }) + }) +} + export function updateState(client: Client, newState: 'AUTH' | 'SERVER', uri?: string, code?: string) { switch(newState) { case 'AUTH': @@ -172,11 +195,10 @@ export async function onConnect(client: ClientState) { client.state = ConnectionState.AUTH client.lastStatusUpdate = Date.now() - sendMessageWarning(client.gameClient, `WARNING: This proxy allows you to connect to any 1.8.9 server. Gameplay has shown no major issues, but please note that EaglercraftX may flag some anticheats while playing.`) + sendMessageWarning(client.gameClient, `This proxy allows you to connect to any 1.8.9 server. Gameplay has shown no major issues, but please note that EaglercraftX may flag some anticheats while playing.`) await new Promise(res => setTimeout(res, 2000)) - sendMessageWarning(client.gameClient, `WARNING: It is highly suggested that you turn down settings and use Resent Client, as gameplay tends to be very laggy and unplayable on low powered devices.`) - await new Promise(res => setTimeout(res, 2000)) - sendMessageWarning(client.gameClient, `WARNING: You will be prompted to log in via Microsoft to obtain a session token necessary to join games. Any data related to your account will not be saved and for transparency reasons this proxy's source code is available on Github.`) + sendMessageWarning(client.gameClient, `You will be prompted to log in via Microsoft to obtain a session token necessary to join games. Any data related to your account will not be saved and for transparency reasons this proxy's source code is available on Github. Using any untrusted proxies may put your account at risk.`) + sendMessageFork(client.gameClient, FORK_URL) await new Promise(res => setTimeout(res, 2000)) client.lastStatusUpdate = Date.now() @@ -260,4 +282,4 @@ export function generateSpawnChunk(): Chunk.PCChunk { chunk.setBlock(new Vec3(8, 66, 9), new McBlock(REGISTRY.blocksByName.barrier.id, REGISTRY.biomesByName.plains.id, 0)) chunk.setSkyLight(new Vec3(8, 66, 8), 15) return chunk -} \ No newline at end of file +}