Giter Site home page Giter Site logo

graftmc / friendconnect Goto Github PK

View Code? Open in Web Editor NEW
70.0 4.0 20.0 370 KB

A tool for minecraft bedrock that allows console players to join a server

Home Page: https://github.com/Androecia/FriendConnect

License: Other

TypeScript 96.60% JavaScript 3.40%
mcbe minecraft bedrock realms bds geyser nukkit pocketmine java server connect

friendconnect's Introduction

FriendConnect

UPDATE

We are working on a rust port to solve the issues that have occurred, please be patient. Thank you

WARNING

BEFORE YOU USE THIS TOOL, PLEASE READ THE FOLLOWING: WE AS CONTRIBUTORS ARE NOT RESPONSIBLE FOR ANY DAMAGE OR LOSS CAUSED BY THIS APP. USE AN ALT ACCOUNT, JUST IN CASE THERE IS AN ISSUE WITH THIS METHOD.

About

This is a project for minecraft bedrock/(java with geyser) that allows you to join servers via the in game friends tab. The most notable differing factor is, that console players can connect to servers without using an advanced method.

This project is still in development, so please be patient if there are issues.

The best way to use this tool at the moment is as a node module. Read the tutorial below for more information of how to set this up.

Feature Note

This tool includes a lesser known fix that flushes the sessions once it hits 35 players. Another feature is efficient multi account management, this is achieved by having all of the accounts join the same session.

Discord

If you want to be notified when any changes occur to this project, you can join the discord server.
FriendConnect Support Server Invite

How it works in game

A New Realms Replacement, A new method for joining servers on console.

How to use it:

If you are using this standalone or via npm you will need to have at least node 18.2 installed with npm.

Pterodactyl

If you use Pterodactyl Panel you can refer to https://github.com/Androecia/FriendConnect-Pterodactyl for the official egg. You'll still want to read below so you understand what certain variables do and are as informed as possible.

Standalone

You can download this repository and edit the .env file to use this tool standalone. The process is pretty straight forward and only requires a couple of steps to get going.

Step 1: Clone the repo, or download the repos files as a zip archive

Github Download

Unzip the archive and/or navigate to the root directory of the tool.

Step 2: Make sure you are on node version 18

Node v18

Note: Unless you have downloaded this verson of node. You may need to install NVM (node version manager) to setup an alias in you bashrc or zshrc file to change the version to node 18.

nvm install 18
nvm use 18
nvm alias default 18

Step 3: Generate an index.js file to setup a default Friend-Connect configuration, and place it into the main directory

import { Session } from "friend-connect";

new Session({
	hostName: "Server Name", // The hostname of the server
	worldName: "Message of the Day: Hello World", // Use as a MOTD
	version: "1.19.60", // The version of the session, this can be any string.

	protocol: 565, //The protocol of the server you are connecting to.

	connectedPlayers: 0, // Used as a fallback if pinging the server fails.
	maxConnectedPlayers: 40, // Used as a fallback if pinging the server fails.

	ip: "tailvile.xyz", // The ip of the server you are using.
	port: 19132, // The port of the server you are using.
	connectionType: 6, // I don't recommend changing this.

	log: true, // If you want to see the console output set to true.
	joinability: "joinable_by_friends", // The joinability of the session, if this is changed only one account can be used to connect to the session.
	autoFriending: true, // Set this to true if you want to automatically add people who follow the accounts.
	pingServerForInfo: true, // If FriendConnect keeps erroring out due to a rakNet ping error you can set this to false.

	tokenPath: "./auth", // The path to the directory that contains the authentication tokens.
	accounts: ["[email protected]", "[email protected]"], // A list of emails that correspond to accounts you want to use with FriendConnect.

	//These are values retrieved from the server on when the server advertisement is fetched, if true it will use a value from above.
	constants: {
		//worldName: true,
		//hostName: true,
		maxConnectedPlayers: true,
		connectedPlayers: true,
		//protocol: true,
		version: true,
	},
});

Step 4: Run the following command in your terminal and include the absolute path for your index.js file

node --es-module-specifier-resolution=node  --experimental-fetch ./path/to/file.js

Step 5: If all goes well you should be greeted with this output

First Startup

Step 6: Navigate to https://www.microsoft.com/link and enter the auth code given to you in the output. This will link the xbox live account to the Friend-Connect tool.

Microsoft Auth

Step 7: Output should be relatively normal, assuming you actually have a server running that the program can ping, if not, there will be an error showing that the ping timed out.

Ping Timeout

If this happens, double check your server IP and ensure your ports are forwarded propely 19132 and 19133.

Congratulations! You are all set to use the Friend-Connect Tool!

As an NPM library

npm install friend-connect

Create a file and name it whatever you want. Then paste this example into it:

import { Session } from "friend-connect";

new Session({
	hostName: "Server Name", // The hostname of the server
	worldName: "Message of the Day: Hello World", // Use as a MOTD
	version: "1.19.60", // The version of the session, this can be any string.

	protocol: 565, //The protocol of the server you are connecting to.

	connectedPlayers: 0, // Used as a fallback if pinging the server fails.
	maxConnectedPlayers: 40, // Used as a fallback if pinging the server fails.

	ip: "tailvile.xyz", // The ip of the server you are using.
	port: 19132, // The port of the server you are using.
	connectionType: 6, // I don't recommend changing this.

	log: true, // If you want to see the console output set to true.
	joinability: "joinable_by_friends", // The joinability of the session, if this is changed only one account can be used to connect to the session.
	autoFriending: true, // Set this to true if you want to automatically add people who follow the accounts.
	pingServerForInfo: true, // If FriendConnect keeps erroring out due to a rakNet ping error you can set this to false.

	tokenPath: "./auth", // The path to the directory that contains the authentication tokens.
	accounts: ["[email protected]", "[email protected]"], // A list of emails that correspond to accounts you want to use with FriendConnect.

	//These are values retrieved from the server on when the server advertisement is fetched, if true it will use a value from above.
	constants: {
		//worldName: true,
		//hostName: true,
		maxConnectedPlayers: true,
		connectedPlayers: true,
		//protocol: true,
		version: true,
	},
});

Set type to module in the package.json file. If you don't know what I am talking about, make a file called package.json and add the following.

{ "type": "module" }

You can run the file with node --es-module-specifier-resolution=node --experimental-fetch ./path/to/file.js.

Debug Info

If you want to see extra debug information. Set this environment variable as seen below.

FRIEND_CONNECT_DEBUG=true

To Do List

  • Add a way to fetch the version and protocol of the server on session Update.
  • Add automatically querying the player numbers from the server on session Update.
  • Add the ability to provide an array of strings to be chosen from for the hostName and worldName that is rotated through on session Update.
  • Check if the user owns any games if so send an error telling them to use an alt account.

    I was unable to get the games owned, but I do check if there are achievements on the profile.

  • Add an option to disable auto friending.
  • Make a user friendly way to use this tool like a discord bot or something.
  • Add a cli tool maybe.

Testing

If you are contributing to this project, edit the .env file in the root directory. This file is used in ./test/index.js to test the tool.

# The hostname of the server
HOSTNAME=FriendConnect
# The world name of the server
WORLD_NAME=Message of the Day: Hello World
# The version of the server
VERSION=1.19.60
# The protocol of the server
PROTOCOL=565
# The connected players of the server
CONNECTED_PLAYERS=0
# The max connected players of the server
MAX_CONNECTED_PLAYERS=40
# The ip of the server
IP=tailvile.xyz
# The port of the server
PORT=19132
# The connection type of the server
CONNECTION_TYPE=6
# If you want to log the server
LOG=false
# The joinability of the server
JOINABILITY=joinable_by_friends
# If you want to auto friend people
AUTO_FRIENDING=true
# If you want to ping the server for info
PING_SERVER_FOR_INFO=true
# The accounts to use separated by a comma
ACCOUNTS=
# The constant world name
CONSTANT_WORLD_NAME=false
# The constant host name
CONSTANT_HOST_NAME=false
# The constant max connected players
CONSTANT_MAX_CONNECTED_PLAYERS=false
# The constant connected players
CONSTANT_CONNECTED_PLAYERS=false
# The constant protocol
CONSTANT_PROTOCOL=false
# The constant version
CONSTANT_VERSION=false
# The account limit
ACC_LIMIT=1
# If you want debug messages
#FRIEND_CONNECT_DEBUG=true

Credit

This project is inspired by and is a js port of the rtm516/MCXboxBroadcast from java.

FriendConnect adds a key feature that makes the friending automated.

I worked with rtm516 to figure out the uri and headers for finding the followers of an xbox profile.

friendconnect's People

Contributors

atxltheaxolotl avatar densellp avatar djstompzone avatar erisfiregamer1 avatar jrcarl624 avatar loki-101 avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

friendconnect's Issues

Friendconnect sometimes just stops working

[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] 79 profile(s) have this account friended.

This happens randomly depending of how many players are connecting through friendconnect.

Friendconnect sometimes just stops working

[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] 79 profile(s) have this account friended.
[FriendConnect [email protected]] AutoFriend Interval
[FriendConnect [email protected]] 79 profile(s) have this account friended.

not working on: new version

i dont use friend connect anymore because it crashesh the most of times and that makes my server crash. also please update it for node.js v20

1.19.10 issue

It seems that 1.19.10 is stuck on joining multiplayer game.

Can't run new version

Hi, im updating from an old version of friend-connect and usually launch this project with the following batch script:

:start
@cmd /C "node --es-module-specifier-resolution=node %~dp0\index.js"
timeout /t 5
goto :start

However now im getting the following error:

C:\Users\minecraft\Desktop\bdsx-master\plugins\FriendConnect-main\src>goto :start
(node:13732) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/errors:491
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/C:/Users/minecraft/Desktop/bdsx-master/plugins/FriendConnect-main/src/index.js' imported from C:\Users\minecraft\Desktop\bdsx-master\plugins\FriendConnect-main\src\
    at new NodeError (node:internal/errors:400:5)
    at finalizeResolution (node:internal/modules/esm/resolve:308:15)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:525:22)
    at node:internal/modules/run_main:58:28
    at loadESM (node:internal/process/esm_loader:91:11) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.13.0

Any idea why it's not working?

TypeError: Wrong arguments

node --es-module-specifier-resolution=node  --experimental-fetch index.js

I get the following error when I run

(node:17644) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
[FriendConnect [email protected]] Initializing Account
[FriendConnect [email protected]] Initializing Account
[FriendConnect ] Server Advertisement Error
Error Name:  TypeError
Error Message:  Wrong arguments
Error Stack:  TypeError: Wrong arguments
    at new Client (C:\Users\hm74c\OneDrive\ドキュメント\FriendConnect\node_modules\raknet-native\lib\RakNet.js:8:19)
    at new RakNativeClient (C:\Users\hm74c\OneDrive\ドキュメント\FriendConnect\node_modules\bedrock-protocol\src\rak.js:35:19)
    at ping (C:\Users\hm74c\OneDrive\ドキュメント\FriendConnect\node_modules\bedrock-protocol\src\createClient.js:87:15)
    at Session.getAdvertisement (file:///C:/Users/hm74c/OneDrive/%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88/FriendConnect/node_modules/friend-connect/dist/index.js:419:30)
    at new Session (file:///C:/Users/hm74c/OneDrive/%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88/FriendConnect/node_modules/friend-connect/dist/index.js:76:14)
    at file:///C:/Users/hm74c/OneDrive/%E3%83%89%E3%82%AD%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88/FriendConnect/index.js:3:1

The part that looks like%E3%83%89%E3%82%AD%E3 is a Japanese character.

Server Advertisement Error for an IPv6 server.

This is a geyser enabled java server, natively running on IPv6 with the java flag -Djava.net.preferIPv6Addresses=true. When I use the IPv6 domain of this server as the ip in this tool, I get these errors in the console and I get stuck on connecting to multiplayer game.

[FriendConnect ] Server Advertisement Error
Error Name:  Error
Error Message:  Invalid connection address minecraft.domain.com/19132
Error Stack:  Error: Invalid connection address minecraft.domain.com/19132
    at new Client (/home/ryuo/FriendConnect/node_modules/raknet-native/lib/RakNet.js:8:19)
    at new RakNativeClient (/home/ryuo/FriendConnect/node_modules/bedrock-protocol/src/rak.js:45:19)
    at ping (/home/ryuo/FriendConnect/node_modules/bedrock-protocol/src/createClient.js:87:15)
    at Session.getAdvertisement (file:///home/ryuo/FriendConnect/node_modules/friend-connect/dist/index.js:419:30)
    at Timeout._onTimeout (file:///home/ryuo/FriendConnect/node_modules/friend-connect/dist/index.js:133:26)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

JSON parse error

Was working fine for a couple of days, then suddenly:

undefined:1

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at packageData (node:internal/deps/undici/undici:6370:23)
at specConsumeBody (node:internal/deps/undici/undici:6348:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///C:/Users/minecraft/Desktop/bds/node_modules/friend-connect/dist/xbox/modules/rta.js:126:24

and

node:internal/deps/undici/undici:14062
Error.captureStackTrace(err, this);
^

TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:14062:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
cause: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:7897:28)
at node:internal/deps/undici/undici:7855:50
at Immediate._onImmediate (node:internal/deps/undici/undici:7884:37)
at process.processImmediate (node:internal/timers:471:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}

dist folder error

C:\APPS\FRIEND-CONNECT\FriendConnect-main\FriendConnect-main\test>node --es-module-specifier-resolution=node --experimental-fetch C:\APPS\FRIEND-CONNECT\FriendConnect-main\FriendConnect-main\test\index.js
(node:26820) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
(Use node --trace-warnings ... to show where the warning was created)
node:internal/errors:496
ErrorCaptureStackTrace(err);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/C:/APPS/FRIEND-CONNECT/FriendConnect-main/FriendConnect-main/dist/index.js' imported from C:\APPS\FRIEND-CONNECT\FriendConnect-main\FriendConnect-main\test\index.js
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:306:15)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
at ModuleWrap. (node:internal/modules/esm/module_job:76:39)
at link (node:internal/modules/esm/module_job:75:36) {
url: 'module',
code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.19.1

C:\APPS\FRIEND-CONNECT\FriendConnect-main\FriendConnect-main\test>

AutoFriend kicks people when trying to connect

When I try to join the bot's server, it just kicks me out and says unable to connect to world. I checked the console and when I'm kicked out, the AutoFriend is doing its work. How can I fix this?

Can't connect to world

When I try to join the bot's server, it displays me this message: Unable to connect to world. The world is no longer available to join. Unable to connect to world.

How to fix this?
P.S. Sometimes I can join, but rarely

random crash and not auto restarting

Hello, I managed to get this setup up and running on my server and it works pretty darn good for the most part. However I ran into an issue where the friend-connect disconnected for some reason and after attempting to reconnect, it just gets stuck on this step and doesn't progress any further. I know I can just restart it manually, but that's not a good long term solution. Any ideas?

Screenshot 2022-09-01 133444

Doesent work with latest version

Doesent work with latest version it just gives The error saying, The hhost is using and older version of minecraft Image attached below all of my devices and server is update
image

Unable to Connect to World

I have the Pteradactyl Egg running on my server...

The friend request is accepted automatically, the server shows in my friends list no problem, relays the correct server stats (Name, MOTD, and Player Counts). However when I attempt to connect, I just get the Unable to connect to world error.

I have verified in my .env file, and the test/index.js file that all settings are correct for my server, and have tried to get a friend (outside my home network) to connect as well. Same result

bug: npm modules are out of date

Modules in the package.json file are very out of date. My suggestion would be to install a tool like renovate to the repo so it can submit PRs one at a time for dependency updates. Work can also be done locally to fund all the node modules one at a time to update their versions to be more stable and supported.

I can't run it

when I run it, the error message always comes and the download and installation was not successful
Screenshot_20230204-074858

Tool does not work

Server is not being served.
I'm on arch linux. Tool runs without error, gets my server data- and dies.

Server Advertisement Error

Not sure if this is a bug or if I am doing something wrong, but when I run "node --es-module-specifier-resolution=node ./start.js" (./start.js is the file path) I get the following error. It begins by initializing the accounts listed in the start.js file (which it should), but then immediately throws a "Server Advertisement Error). I tested this on two different computers and got the same results. I also reinstalled Node JS and FriendConnect and restarted my computer and still got the same error. I copied the error from the friend-connect-error.log file.

OS: Windows 10 (10.0.19044 Build 19044)
Node JS version: 18.12.1

[1670742559799] Server Advertisement Error:

	Name: TypeError

	Message: Wrong arguments

	Stack: TypeError: Wrong arguments
at new Client (C:\Users\Tyler\Desktop\XboxConnect\node_modules\raknet-native\lib\RakNet.js:8:19)
at new RakNativeClient (C:\Users\Tyler\Desktop\XboxConnect\node_modules\bedrock-protocol\src\rak.js:35:19)
at ping (C:\Users\Tyler\Desktop\XboxConnect\node_modules\bedrock-protocol\src\createClient.js:87:15)
at Session.getAdvertisement (file:///C:/Users/Tyler/Desktop/XboxConnect/node_modules/friend-connect/dist/index.js:419:30)
at new Session (file:///C:/Users/Tyler/Desktop/XboxConnect/node_modules/friend-connect/dist/index.js:76:14)
at file:///C:/Users/Tyler/Desktop/XboxConnect/start.js:3:1
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadESM (node:internal/process/esm_loader:91:5)

	Error: TypeError: Wrong arguments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.