diff --git a/bot/bot.ts b/bot/bot.ts index 3a2f528..14d8e92 100644 --- a/bot/bot.ts +++ b/bot/bot.ts @@ -2,10 +2,10 @@ import mc from "minecraft-protocol"; import { EventEmitter } from "events"; export class createBot { - - bot: any - + bot: any; bots: any; + debugEnabled: any; + console: any; constructor (options: any) { this.bot = new EventEmitter(); @@ -19,8 +19,9 @@ export class createBot { hideErrors: (options.hideErrors ??= true), scInterval: (options.scInterval ??= 1000) } - //options.hideError = true; + bot.options = options; + bot.on("init_client", (client: any) => { client?.on('packet', (data: any, meta: any) => { bot.emit("packet", data, meta); diff --git a/bot/debug/packets/chat/disguised.ts b/bot/debug/packets/chat/disguised.ts new file mode 100644 index 0000000..e69de29 diff --git a/bot/debug/packets/chat/player.ts b/bot/debug/packets/chat/player.ts new file mode 100644 index 0000000..e69de29 diff --git a/bot/debug/packets/chat/system.ts b/bot/debug/packets/chat/system.ts new file mode 100644 index 0000000..e69de29 diff --git a/bot/index.ts b/bot/index.ts index 04648fc..8b738e5 100644 --- a/bot/index.ts +++ b/bot/index.ts @@ -1,15 +1,32 @@ -import fs from "fs"; -import path from "path" -import { createBot } from "./bot" +import fs from "fs";; +import path from "path"; +import readline from 'readline' +import { createBot } from "./bot"; import { parseToml } from './util/parseToml'; import loadModules from './util/loadModules'; +import version from './data/version.json' +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, +}) + +let debugEnabled = false; + +if (process.argv[2] === "--debug"?.toLowerCase()) { + debugEnabled = true +} + +if (debugEnabled) console.log(`Starting FNFBoyfriendBot ${version.codename} ${version.version} Build: ${version.build}`) +else console.log('Starting FNFBoyfriendBot....'); const config = parseToml('./config.toml'); -const bots = [] -console.log(config) +const bots = []; + for (const options of config.bots) { const bot = new createBot(options); - loadModules(bot, config) + bot.debugEnabled = debugEnabled; bots.push(bot); bot.bots = bots; + loadModules(bot, config, rl); + bot?.console?.interface(rl); } \ No newline at end of file diff --git a/bot/modules/chat.ts b/bot/modules/chat.ts index dbb86ef..ade708c 100644 --- a/bot/modules/chat.ts +++ b/bot/modules/chat.ts @@ -66,6 +66,8 @@ export default class chat { message: parsed }) + if (bot.debugEnabled) bot.emit("disguised", parsed); + parseMessage(parsed, { senderName: sender, players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine, chatType: "minecraft:diguised_chat" }) }); @@ -77,6 +79,8 @@ export default class chat { message: unsigned }) + if (bot.debugEnabled) bot.emit("player", unsigned) + parseMessage(unsigned, { senderUuid: packet.senderUuid, players: bot.players, @@ -87,7 +91,7 @@ export default class chat { bot.on("packet.system_chat", (packet: any) => { const message = convertNbtComponentToJson(null, packet.content); - bot.emit("system_chat", message); + bot.emit("system", message); if ( // message.translate === "advMode.setCommand.success" //|| @@ -104,6 +108,8 @@ export default class chat { message: message }); + // if (bot.debugEnabled) bot.emit("system", message) + parseMessage(message, { players: bot.players, getMessageAsPrismarine: bot.getMessageAsPrismarine, diff --git a/bot/modules/console.ts b/bot/modules/console.ts index ee4e942..cc35929 100644 --- a/bot/modules/console.ts +++ b/bot/modules/console.ts @@ -1,8 +1,62 @@ -export default class console { +export default class Console { constructor (context: any) { const bot = context.bot; const config = context.config; + const options = bot.options; + let host = `${options.host}:${options.port}`; + + bot.console = { + readline: null, + + currentServer: "all", + + interface(rl: any) { + this.readline = rl; + + rl.on("line", (args: any) => { + if (options.serverName !== this.server && this.server !== "all") return; + + if (args.startsWith(config.console.prefix)) { + + } else { + bot.chat.send(args) + } + }); + + rl.on("close", () => { + this.readline = null; + }); + }, + + refreshLine(...args: any) { + this?.readline?.output.write("\x1b[2K\r"); + console.log.apply(console, args); + this?.readline?._refreshLine(); + }, + + prefix(type: any, server: any, message: any) { + let time = new Date().toLocaleTimeString("en-US", { timeZone: config.console.timezone }); + let date = new Date().toLocaleDateString("en-US", { timeZone: config.console.timezone }) + return bot.getMessageAsPrismarine(`§8[§1${time} §3${date} ${type}§8] §8[§b${server}§8]§r `)?.toAnsi() + bot.getMessageAsPrismarine(message)?.toAnsi() + }, + + log(message: any) { + this.refreshLine( + this.prefix('§6log', host, message) + ) + }, + + info(info: any) { + this.refreshLine( + this.prefix('§6info', host, info) + ) + } + } + + bot.on('message', (data: any) => { + const message = data.message; + bot.console.log(message) + }); } } - diff --git a/bot/modules/debugBridge.ts b/bot/modules/debugBridge.ts new file mode 100644 index 0000000..16a73a0 --- /dev/null +++ b/bot/modules/debugBridge.ts @@ -0,0 +1,30 @@ +import { connect } from 'socket.io-client'; +import version from '../data/version.json'; + +export default class debugBridge { + constructor (context: any) { + const bot = context.bot; + const config = context.config; + const options = bot.options; + + if (!bot.debugEnabled) return; + + bot.debugBridge = { + client: connect(config.debug.host) + } +// `Starting FNFBoyfriendBot ${version.codename} ${version.version} Build: ${version.build}` + const client = bot.debugBridge.client; + + client.on('connect', (socket: any) => { + bot.console.info('Connected to Debug Bridge'); + + bot.emit('version', { version: version.version, codename: version.codename, build: version.build }) + + bot.on('disguised', (data: any) => socket.emit('diguised', data)); + + bot.on('player', (data: any) => socket.emit('player', data)); + + bot.on('system', (data: any) => socket.emit('system', data)); + }); + } +} \ No newline at end of file diff --git a/bot/modules/playerList.ts b/bot/modules/playerList.ts index f682abe..4c2a0e2 100644 --- a/bot/modules/playerList.ts +++ b/bot/modules/playerList.ts @@ -2,7 +2,6 @@ const convertNbtComponentToJson = require("../util/convertNbtComponentToJson"); const entityUUID = require('../util/entityUUID'); // taken from FNFBoyfriendBot v8.0.0 -console.log(entityUUID) export default class playerList { constructor(context: any) { const bot = context.bot; diff --git a/bot/util/loadModules.ts b/bot/util/loadModules.ts index 2d7cf25..a353a84 100644 --- a/bot/util/loadModules.ts +++ b/bot/util/loadModules.ts @@ -1,12 +1,14 @@ import fs from "fs"; import path from "path"; -export default async function loadModules (bot: any, config: any) { +export default async function loadModules (bot: any, config: any, rl: any) { + bot.modules = [] for (const filename of fs.readdirSync(path.join(__dirname, '../modules'))) { try { if (filename.endsWith(".ts") || filename.endsWith(".js")) { const module = await import(path.join(__dirname, '../modules/', filename)) const modules = module.default; + bot.modules.push(modules) new modules({ bot, config }) } } catch (error: unknown) { @@ -15,5 +17,6 @@ export default async function loadModules (bot: any, config: any) { console.error(`\x1b[31m${error.stack}\x1b[0m`); } } - } + } + if (bot.debugEnabled) console.info(`Loaded ${bot.modules.length} Modules`); } \ No newline at end of file diff --git a/debug-bridge/.gitattributes b/debug-bridge/.gitattributes deleted file mode 100644 index f91f646..0000000 --- a/debug-bridge/.gitattributes +++ /dev/null @@ -1,12 +0,0 @@ -# -# https://help.github.com/articles/dealing-with-line-endings/ -# -# Linux start script should use lf -/gradlew text eol=lf - -# These are Windows script files and should use crlf -*.bat text eol=crlf - -# Binary files should be left untouched -*.jar binary - diff --git a/debug-bridge/build.gradle.kts b/debug-bridge/build.gradle.kts deleted file mode 100644 index abc98ff..0000000 --- a/debug-bridge/build.gradle.kts +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id("org.jetbrains.kotlin.jvm") version "1.9.23" - application -} - -repositories { - mavenCentral() -} - -tasks.jar { - manifest { - attributes["Main-Class"] = "land.chipmunk.parker2991.debugbridge.Main" - } -} - -dependencies { - -} - -application { - mainClass = "land.chipmunk.parker2991.debugbridge.Main" -} \ No newline at end of file diff --git a/debug-bridge/client.js b/debug-bridge/client.js new file mode 100644 index 0000000..0cf7f3d --- /dev/null +++ b/debug-bridge/client.js @@ -0,0 +1,7 @@ +const io = require('socket.io-client'); + +const client = io.connect('http://localhost:8080'); + +client.on('connect', () => { + client.emit('meow', ':3') +}) diff --git a/debug-bridge/gradle.properties b/debug-bridge/gradle.properties deleted file mode 100644 index 8cea2f0..0000000 --- a/debug-bridge/gradle.properties +++ /dev/null @@ -1,5 +0,0 @@ -# This file was generated by the Gradle 'init' task. -# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties - -org.gradle.configuration-cache=false - diff --git a/debug-bridge/gradle/libs.versions.toml b/debug-bridge/gradle/libs.versions.toml deleted file mode 100644 index 4ac3234..0000000 --- a/debug-bridge/gradle/libs.versions.toml +++ /dev/null @@ -1,2 +0,0 @@ -# This file was generated by the Gradle 'init' task. -# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format diff --git a/debug-bridge/gradle/wrapper/gradle-wrapper.jar b/debug-bridge/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index f8e1ee3..0000000 Binary files a/debug-bridge/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/debug-bridge/gradle/wrapper/gradle-wrapper.properties b/debug-bridge/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index bad7c24..0000000 --- a/debug-bridge/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/debug-bridge/gradlew b/debug-bridge/gradlew deleted file mode 100755 index adff685..0000000 --- a/debug-bridge/gradlew +++ /dev/null @@ -1,248 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/debug-bridge/gradlew.bat b/debug-bridge/gradlew.bat deleted file mode 100644 index c4bdd3a..0000000 --- a/debug-bridge/gradlew.bat +++ /dev/null @@ -1,93 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/debug-bridge/server.js b/debug-bridge/server.js new file mode 100644 index 0000000..2689551 --- /dev/null +++ b/debug-bridge/server.js @@ -0,0 +1,23 @@ +const io = require('socket.io'); +let port = 8080; +// should i even have this here? +const server = new io.Server(8080); +console.log('server started'); + +server.on('connection', (socket) => { + socket.on('player', (data) => { + console.log(data) + }); + + socket.on('disguised', (data) => { + console.log(data) + }); + + socket.on('system', (data) => { + console.log(data) + }); + +/* socket.on('meow', (data) => { + console.log(data) + })*/ +}); diff --git a/debug-bridge/settings.gradle.kts b/debug-bridge/settings.gradle.kts deleted file mode 100644 index daf8ff7..0000000 --- a/debug-bridge/settings.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/9.2.0/userguide/multi_project_builds.html in the Gradle documentation. - */ - -rootProject.name = "debugbridge" diff --git a/debug-bridge/src/main/java/land/chipmunk/parker2991/debugbridge/Main.java b/debug-bridge/src/main/java/land/chipmunk/parker2991/debugbridge/Main.java deleted file mode 100644 index d5d447a..0000000 --- a/debug-bridge/src/main/java/land/chipmunk/parker2991/debugbridge/Main.java +++ /dev/null @@ -1,18 +0,0 @@ -package land.chipmunk.parker2991.debugbridge; -import com.sun.net.httpserver.*; -import java.net.InetSocketAddress; - -public class Main { - String host = "localhost"; - - Number port = 22; - - public static void main(String[] args) { - System.out.println("Meow"); - } - - public void createServer() { - - HttpsServer server = new create(host, port) - } -} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d430bef..fc82b25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "FNFBoyfriendBot-v9", + "name": "FNFBoyfriendBot-Reimu", "lockfileVersion": 3, "requires": true, "packages": { @@ -9,6 +9,8 @@ "prismarine-chat": "^1.12.0", "prismarine-registry": "^1.11.0", "smol-toml": "^1.5.2", + "socket.io": "^4.8.1", + "socket.io-client": "^4.8.1", "yaml": "^2.8.2" }, "devDependencies": { @@ -38,6 +40,21 @@ "node": ">=16" } }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", + "license": "MIT" + }, + "node_modules/@types/cors": { + "version": "2.8.19", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", + "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/node": { "version": "24.10.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.2.tgz", @@ -93,6 +110,19 @@ "node": ">=6.5" } }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/aes-js": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", @@ -150,6 +180,15 @@ ], "license": "MIT" }, + "node_modules/base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "license": "MIT", + "engines": { + "node": "^4.5.0 || >= 5.9" + } + }, "node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -198,6 +237,28 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "license": "MIT" }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -236,6 +297,82 @@ "integrity": "sha512-ShfqhXeHRE4TmggSlHXG8CMGIcsOsqDw/GcoPcosToE59Rm9e4aXaMhEQf2kPBsBRrKem1bbOAv5gOKnkliMFQ==", "license": "MIT" }, + "node_modules/engine.io": { + "version": "6.6.4", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.4.tgz", + "integrity": "sha512-ZCkIjSYNDyGn0R6ewHDtXgns/Zre/NT6Agvq1/WobF7JXgFff4SeDroKiCO3fNJreU9YG429Sc81o4w5ok/W5g==", + "license": "MIT", + "dependencies": { + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.7.2", + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.17.1" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/engine.io-client": { + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.3.tgz", + "integrity": "sha512-T0iLjnyNWahNyv/lcjS2y4oE358tVS/SYQNxYXGAJ9/GLgH4VCvOQ/mhTjqU88mLZCQgiG8RIegFHYCdVC+j5w==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.17.1", + "xmlhttprequest-ssl": "~2.1.1" + } + }, + "node_modules/engine.io-client/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", @@ -415,6 +552,27 @@ "integrity": "sha512-vGBKTA+jwM4KgjGZ+S/8/Mkj9rWzePyGY6jManXPGhiWu63RYwW8dKPyk5koP+8qNVhPhHgFa1y/MJ4wrjsNrg==", "license": "MIT" }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minecraft-data": { "version": "3.101.0", "resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.101.0.tgz", @@ -501,6 +659,15 @@ "url": "https://nearley.js.org/#give-to-nearley" } }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -530,6 +697,15 @@ "asn1": "0.2.3" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/prismarine-auth": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.7.0.tgz", @@ -761,6 +937,130 @@ "url": "https://github.com/sponsors/cyyynthia" } }, + "node_modules/socket.io": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.1.tgz", + "integrity": "sha512-oZ7iUCxph8WYRHHcjBEc9unw3adt5CmSNlppj/5Q4k2RIrhl8Z5yY2Xr4j9zj0+wzVZ0bxmYoGSzKJnRl6A4yg==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.3.2", + "engine.io": "~6.6.0", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz", + "integrity": "sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==", + "license": "MIT", + "dependencies": { + "debug": "~4.3.4", + "ws": "~8.17.1" + } + }, + "node_modules/socket.io-adapter/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-client": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.1.tgz", + "integrity": "sha512-hJVXfu3E28NmzGk8o1sHhN3om52tRvwYeidbj7xKy2eIIse5IoKX3USlS6Tqt3BHAtflLIkCQBkzVrEEfWUyYQ==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.2", + "engine.io-client": "~6.6.1", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-client/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -809,6 +1109,15 @@ "macaddress": "^0.5.1" } }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -825,6 +1134,35 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xmlhttprequest-ssl": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz", + "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/yaml": { "version": "2.8.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", diff --git a/package.json b/package.json index 75472e3..d3041da 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,8 @@ "prismarine-chat": "^1.12.0", "prismarine-registry": "^1.11.0", "smol-toml": "^1.5.2", + "socket.io": "^4.8.1", + "socket.io-client": "^4.8.1", "yaml": "^2.8.2" }, "devDependencies": { diff --git a/tsconfig.json b/tsconfig.json index d193ddc..a257037 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,5 +18,6 @@ "moduleDetection": "force", "skipLibCheck": true, "esModuleInterop": true, - } + }, + "exclude": ["./debug-bridge", "./build"] }