diff --git a/index.html b/index.html index ce7b73b..0a56f78 100644 --- a/index.html +++ b/index.html @@ -137,7 +137,7 @@

- Special Note: It’s always 127.0.0.1—say goodbye to the internet and hello to localhost! +

It’s always 127.0.0.1—say goodbye to the internet and hello to localhost!

@@ -159,7 +159,7 @@

- Ready to code?
Dive into our API documentation and MyMCLib guide to start building today! + Ready to code?
Dive into our API documentation and MyMCLib guide to start building today!

@@ -173,7 +173,7 @@

Join Our Discord - Explore the Wiki + Explore the Wiki
diff --git a/wiki/api/index.html b/wiki/api/index.html new file mode 100644 index 0000000..4e88088 --- /dev/null +++ b/wiki/api/index.html @@ -0,0 +1,896 @@ + + + + + + + My-MC.Link API Wiki + + + + + + + + + + + +
+
+
+
+
+ +
+
+
+

+ My-MC.Link API Wiki

+

Documentation for My-MC.Link REST API

+
+ Home +
+
+ + + + +
+
+

+ Getting Started with the API

+

+ To use the My-MC.Link API, you need an API key. Generate one by running /api-key in our server. The key, valid for 365 days, will be sent to your Direct Messages. +

+

+ API URL: https://api.my-mc.link
+ Include the authentication header x-my-mc-auth with your token in all requests. +

+

+ The examples below use UniRest for JavaScript. New methods will be added over time, so check back regularly. +

+
+ +
+

+ API Endpoints

+
+ +
+

GET /hello

+

Test the API and verify the authenticated user.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/hello')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{ success: true, message: 'Hello, mc_342128351638585344!' }
+
+ + +
+

GET /time

+

Check the expiration time of your API key.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/time')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  keyexpireString: 'Tue Apr 15 2025 06:14:59 GMT-0400 (Eastern Daylight Time)',
+  expireDate: '2025-04-15T10:14:59.000Z',
+  expireEpoch: 1744712099000
+}
+
+ + +
+

GET /stats

+

Retrieve statistics for your Minecraft server.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/stats')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  stats: {
+    serverName: 'mc_342128351638585344',
+    memory: { raw: '185MiB / 4GiB', percent: '4.52%' },
+    cpu: '317.98%'
+  }
+}
+
+ + +
+

GET /log

+

Get the URL for your server’s live log.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/log')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'https://logs.my-mc.link/container/3a48afc921c6'
+}
+
+ + +
+

GET /start

+

Start your server container.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/start')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{ success: true, message: 'Started', completed: 'OK' }
+
+ + +
+

GET /stop

+

Stop your server container.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/stop')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{ success: true, message: 'Stopped', completed: 'OK' }
+
+ + +
+

GET /restart

+

Restart your server container.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/restart')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{ success: true, message: 'Restarted', completed: 'OK' }
+
+ + +
+ +

Generate or retrieve your server’s connection link.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/my-link')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  action: 'New-Link',
+  message: 'Success!',
+  hostname: 'my-mc.link',
+  port: 40129
+}
+
+ + +
+ +

Generate or retrieve the Geyser UDP connection link.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/my-geyser-link')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  action: 'New-Geyser-Link',
+  message: 'Geyser connection established successfully!',
+  hostname: 'my-mc.link',
+  port: 35633
+}
+
+ + +
+

GET /my-sftp

+

Generate or retrieve the SFTP connection details.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/my-sftp')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  action: 'New-Link',
+  message: 'Success!',
+  hostname: 'sftp://my-mc.link',
+  port: 34149,
+  user: 'mc',
+  password: 'Fyuak12tq0NcuvcQ'
+}
+
+ + +
+

GET /my-hash

+

Retrieve the P2P hash for your server container.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/my-hash')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  action: 'getConnectionHash',
+  message: '9b63a54507d4473350cec0ce34c4e6f9ass3657887e659a7efd341e32100c15e'
+}
+
+ + +
+

GET /my-geyser-hash

+

Retrieve the P2P hash for Geyser connections.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/my-geyser-hash')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  action: 'getConnectionHashGeyser',
+  message: 'hs://s0006fbd2c4d48a4cef8df3417deec0194888d115672fb12bdaf91d61dd4ee0087d1'
+}
+
+ + +
+

GET /my-sftp-hash

+

Retrieve the P2P hash for SFTP connections.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/my-sftp-hash')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  action: 'getConnectionHashSFTP',
+  message: '1832805e6dd13d61572c6cb1egg7f071acc65507c5df9f78a7a6ae39ae6f206'
+}
+
+ + +
+

GET /list-players

+

Get information about players connected to the server.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/list-players')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'On mc_342128351638585344 there are 1 of a max of 20 players.',
+  players: [ ' snxravenmc' ]
+}
+
+ + +
+

GET /website

+

Retrieve your server’s website URL.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/website')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  title: 'Website',
+  message: 'https://smjdmfqkl25kw6mdkveqqu6hddbyv4hkroojuxfuv7k6iwptz2bq.my-mc.link'
+}
+
+ + +
+

GET /map

+

Retrieve your server’s BlueMap URL.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/map')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  title: 'BlueMap',
+  message: 'https://sf5bk42u6y32wsvifa3rvowioowfsypem3qrebjfaxs5vi5z3asa.my-mc.link'
+}
+
+ + +
+

POST /ban

+

Ban a user by their username.

+

Payload:

+
+
{"username": "snxravenmc"}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/ban')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"username": "snxravenmc"})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'snxravenmc has been banned from mc_342128351638585344'
+}
+
+ + +
+

POST /unban

+

Unban a user by their username.

+

Payload:

+
+
{"username": "snxravenmc"}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/unban')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"username": "snxravenmc"})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'snxravenmc has been unbanned from mc_342128351638585344'
+}
+
+ + +
+

POST /say

+

Send a global message to the server via RCON.

+

Payload:

+
+
{"message": "Hello There, This is a test!\nDid this work?"}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/say')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"message": "Hello There, This is a test!\nDid this work?"})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{ success: true, message: 'Message Sent Successfully!' }
+
+ + +
+

POST /tell

+

Send a private message to a specific user via RCON.

+

Payload:

+
+
{"username": "snxravenmc","message": "hiiiii"}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/tell')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"username": "snxravenmc","message": "hiiiii"})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{ success: true, message: 'Message Sent Successfully!' }
+
+ + +
+

POST /console

+

Send RCON commands to your server.

+

Payload:

+
+
{"command": "time set day"}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/console')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"command": "time set day"})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{ success: true, message: 'Set the time to 1000' }
+
+ + +
+

POST /give

+

Give items to a specific user.

+

Payload:

+
+
{"username": "snxravenmc", item: "torch", amount: 1}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/give')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"username": "snxravenmc", item: "torch", amount: 1})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'Gave snxravenmc 1 torch',
+  username: 'snxravenmc',
+  amount: 1,
+  item: 'torch'
+}
+
+ + +
+

POST /install

+

Install a mod using a Modrinth ID or keyword search.

+

Payload:

+
+
{"mod": "IDHERE"}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/install')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"mod": "IDHERE"})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'Task Complete on mc_342128351638585344',
+  log: '- Searching for abooMhox...\n' +
+    '- Installing Tree Harvester...\n' +
+    '✔ Successfully installed Tree Harvester\n'
+}
+
+ + +
+

POST /uninstall

+

Uninstall a mod using a Modrinth ID or keyword search.

+

Payload:

+
+
{"mod": "IDHERE"}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/uninstall')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"mod": "IDHERE"})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'Task Complete on mc_342128351638585344',
+  log: '- Uninstalling abooMhox...\n' +
+    '- Uninstalling abooMhox...\n' +
+    '✔ Tree Harvester successfully uninstalled!\n'
+}
+
+ + +
+

POST /search

+

Search for mods by keyword with compatibility checking.

+

Payload:

+
+
{"mod": "Tree","offset": 0}
+ +
+
+
var unirest = require('unirest');
+
+unirest
+  .post('https://api.my-mc.link/search')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .send({"mod": "Tree","offset": 0})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'Search Results',
+  limit: 10,
+  offset: 0,
+  totalHits: 23,
+  results: [
+    {
+      title: 'FallingTree',
+      description: 'Break down your trees by only cutting one piece of it',
+      server: 'required',
+      client: 'unsupported',
+      downloads: 894148,
+      installID: 'Fb4jn8m6'
+    },
+    ...
+  ]
+}
+
+ + +
+

GET /mod-list

+

List all mods installed on your server.

+
+
var unirest = require('unirest');
+
+unirest
+  .get('https://api.my-mc.link/mod-list')
+  .headers({'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': 'TokenHere'})
+  .then((response) => {
+    console.log(response.body)
+  })
+ +
+

Response:

+
{
+  success: true,
+  message: 'Mods listed for mc_342128351638585344',
+  mods: [
+    {
+      name: 'Adrenaserver',
+      id: 'H9OFWiay',
+      fileName: 'Adrenaserver-1.5.0+1.20.4.fabric.mrpack',
+      version: '1.5.0+1.20.4.fabric',
+      source: 'Modrinth',
+      essential: false,
+      dependencies: ''
+    },
+    ...
+  ]
+}
+
+
+
+ +
+

+ Explore More

+

+ Ready to automate your server?
Join our community, dive into our resources, and start building with the My-MC.Link API. +

+ +
+
+ + + + + + + + + + \ No newline at end of file diff --git a/wiki/index.html b/wiki/index.html new file mode 100644 index 0000000..d53d74c --- /dev/null +++ b/wiki/index.html @@ -0,0 +1,475 @@ + + + + + + + My-MC.Link Wiki + + + + + + + + + +
+
+
+
+
+ +
+
+
+

+ My-MC.Link Wiki

+ +

Your Guide to Free Minecraft Hosting

+
+ Home +
+
+ + + + +
+ + +
+

+ Limitations +

+

+ While My-MC.Link is powerful, there are some constraints to be aware of: +

+ +
+ +
+

+ Getting Started

+

Prerequisites

+

+ Before you begin, ensure you: +

+ +

Creating a Server

+

+ 1. Run the following command in Discord:
+ /create-server
+ 2. Wait 1–2 minutes for server initialization. +

+

Connecting via Jump Host

+

+ - Create a Connection:
+ /my-mc-link
+ - Monitor logs at panel.my-mc.link.

+ ℹ️ No Login?
Run /panel-login to generate a one-time login link. +

+
+ +
+

+ Connecting to Your Server +

+ + +
+

Simple Connection

+
+

+ Follow these steps to connect quickly: +

+
    +
  1. Generate a P2P proxy link:
    + /my-mc-link +
  2. +
  3. Use the provided URL to connect in Minecraft.
  4. +
  5. For SFTP access:
    + /my-mc-sftp +
  6. +
+

+ Troubleshooting:
If the connection fails, rerun + /my-mc-link or + /my-mc-sftp to generate a new link.
+ All connections reset at 12 AM EST every Sunday. SFTP connections close daily at 12 AM EST. +

+
+
+ + +
+

Advanced Connection

+
+

+ For full control, bind your server using Holesail. +

+ + +
+

Manual Setup

+
    +
  1. Get your connector key:
    + /connection-details +
  2. +
  3. Install Node.js and Holesail:
    + npm i holesail -g +
  4. +
  5. Bind your server (replace yourConnectorHere with your key):
    + holesail --port 25565 yourConnectorHere
    + - Connect to 127.0.0.1:25565.
    + - For public access:
    + holesail --port 25565 --host 0.0.0.0 yourConnectorHere +
  6. +
+
+ + +
+

Automated Setup

+
    +
  1. Run the setup script:
    + bash <(curl -s https://my-mc.link/connectMC) +
  2. +
  3. Enter your connection hash and port when prompted.
  4. +
  5. Connect to localhost: in Minecraft.
  6. +
+
+
+
+
+ +
+

+ Geyser Support

+

+ My-MC.Link supports Geyser, enabling cross-platform play between Java and Bedrock editions. +

+

+ Setup Instructions:
+ 1. Install Geyser:
+ /mod-install mod: wKkoqHrH
+ 2. Reboot your server:
+ /reboot
+ - Confirm in logs: Connection 'geyser' created successfully on port 19132.
+ 3. Generate a Geyser link:
+ /my-mc-geyser
+ 4. Use the provided port to connect via Bedrock. +

+

+ Note: Geyser and standard connections can run simultaneously. +

+
+ +
+

+ Mod Management

+

+ Manage mods effortlessly with our bot. +

+ +
+ +
+

+ Remote Console Access

+

+ Run RCON commands via our bot. +

+ +
+ +
+

+ Automatic Website Hosting

+

+ Each server includes an Apache web server for hosting a basic website. +

+

+ 1. Connect via SFTP to /Minecraft/www and upload your files.
+ 2. Get your website URL:
+ /my-website-url +

+

+ Note: URLs are cryptographically generated and use our P2P proxy. +

+
+ +
+

+ Bluemap Integration

+

+ Every server includes a Bluemap instance for interactive maps. +

+

+ - Get your Bluemap URL:
+ /bluemap-url +

+

+ Note: URLs are long and P2P-based. +

+
+ +
+

+ Plugin Support

+

+ Plugins can be enabled using Cardboard or Banner, but they may cause instability. +

+

+ Recommended Mod Alternatives: +

+ +

+ Note: Use AuthMe/SkinsRestorer only for offline-mode servers. +

+
+ +
+

+ Proxy Servers (BungeeCord/Velocity)

+

+ Proxy servers like Velocity connect multiple Minecraft servers, allowing seamless player transfers. Players connect to a lightweight proxy, which redirects them to “slave” servers. +

+

+ Recommended Proxy: Use Velocity for stability and performance. Avoid BungeeCord (outdated) or Waterfall (unsupported). +

+

+ Connecting to My-MC.Link:
+ 1. Use /my-mc-link for a temporary domain (7-day limit) or the Advanced Connection method.
+ 2. Install FabricProxy-Lite on your Fabric server to prevent direct connections. +

+
+ +
+

+ MyMcRealms

+

+ MyMcRealms is a free alternative to Minecraft Realms, integrated with My-MC.Link. +

+

+ How to Connect:
+ 1. Install the Fabric mod loader.
+ 2. Download the MyMcRealms mod: MyMcRealms-1.0.jar.
+ 3. Place it in your Minecraft mods folder (e.g., .minecraft/versions/1.21/mods).
+ 4. Launch Minecraft and click the Minecraft Realms button. +

+

+ Troubleshooting:
+ - Server Not Visible: Run /my-mc-link and wait ~1 minute or restart the game.
+ - Not the Owner: Claim ownership with:
+ /mc-cmd cmd: op +

+

+ Managing Players:
+ - Operator Status:
+ - In-game: /op
+ - Via Realms: ConfigurePlayers
+ - Whitelist:
+ - In-game: /whitelist
+ - Via Realms: ConfigurePlayers or Settings +

+

+ Note: MyMcRealms is free, unlike Mojang’s premium Realms. +

+
+ +
+

+ My-MC API

+

+ The My-MC API allows programmatic server management via HTTP requests. +

+

+ Key Features: +

+ +

+ Documentation:
+ - API: API Docs
+ - JavaScript Library: MyMC Lib Docs +

+
+ +
+

+ Beta Phase Notice

+

+ My-MC.Link is in beta, so minor issues may arise. Please review our + Terms of + Service and + Discord + Rules before getting started. +

+
+
+ + + + + + \ No newline at end of file diff --git a/wiki/mymc-java/index.html b/wiki/mymc-java/index.html new file mode 100644 index 0000000..dfd6582 --- /dev/null +++ b/wiki/mymc-java/index.html @@ -0,0 +1,564 @@ + + + + + + + MyMCLib Library Documentation + + + + + + + + + + + +
+
+
+
+
+ +
+
+
+

+ MyMCLib Library Documentation

+

JavaScript Library for My-MC.Link API

+
+ Home +
+
+ + + + +
+
+

+ Overview

+

+ The MyMCLib library provides a convenient way to interact with the My-MC.Link API for managing Minecraft servers. It includes methods for performing various actions such as retrieving server information, managing server settings, controlling gameplay, and interacting with players. +

+
+ +
+

+ Installation

+

+ To use the MyMCLib library in your project, install it via npm: +

+
+
npm install mymc-lib
+ +
+

+ Proper Importing: To make use of this module, you'll need to either utilize the .mjs extension or incorporate "type": "module" in your package.json file. This requirement exists because modern JavaScript (ES6 and later) introduced the concept of modules, which allows for more organized and scalable code by encapsulating functionality within separate files. +

+
+ +
+

+ Usage

+

+ First, import the library into your project: +

+
+
import MyMCLib from "mymc-lib";
+ +
+

+ Then, create an instance of MyMCLib by providing your API token: +

+
+
const MyMC = new MyMCLib("your-api-token");
+ +
+

Example Usage

+
+
import MyMCLib from "mymc-lib";
+
+// Instantiate MyMCLib with your API token
+const MyMC = new MyMCLib("your-api-token");
+
+// Will print information about API key expiration date
+let keyData = await MyMC.getTime();
+
+console.log(keyData);
+ +
+

Output:

+
+
root@test:/home# node test
+{
+  success: true,
+  keyexpireString: 'Tue Apr 15 2025 06:14:59 GMT-0400 (Eastern Daylight Time)',
+  expireDate: '2025-04-15T10:14:59.000Z',
+  expireEpoch: 1744712099000
+}
+ +
+
+ +
+

+ Code Examples

+
+ +
+

Getting Server Time

+
+
const timeData = await MyMC.getTime();
+console.log(timeData);
+ +
+
+ + +
+

Getting Server Statistics

+
+
const statsData = await MyMC.getStats();
+console.log(statsData);
+ +
+
+ + +
+

Getting Server Logs

+
+
const logData = await MyMC.getLog();
+console.log(logData);
+ +
+
+ + +
+

Starting the Minecraft Server

+
+
const startResult = await MyMC.startServer();
+console.log(startResult);
+ +
+
+ + +
+

Stopping the Minecraft Server

+
+
const stopResult = await MyMC.stopServer();
+console.log(stopResult);
+ +
+
+ + +
+

Restarting the Minecraft Server

+
+
const restartResult = await MyMC.restartServer();
+console.log(restartResult);
+ +
+
+ + + + + + + + + + + + + + +
+

Getting Connection Hash

+
+
const hashData = await MyMC.getConnectionHash();
+console.log(hashData);
+ +
+
+ + +
+

Getting SFTP Connection Hash

+
+
const sftpHashData = await MyMC.getConnectionHashSFTP();
+console.log(sftpHashData);
+ +
+
+ + +
+

Getting Online Players

+
+
const playersData = await MyMC.getOnlinePlayers();
+console.log(playersData);
+ +
+
+ + +
+

Getting Server's Website URL

+
+
const websiteURL = await MyMC.getWebsiteURL();
+console.log(websiteURL);
+ +
+
+ + +
+

Getting Server's Map URL

+
+
const mapURL = await MyMC.getMapURL();
+console.log(mapURL);
+ +
+
+ + +
+

Banning a Player

+
+
const banResult = await MyMC.postBan("username");
+console.log(banResult);
+ +
+
+ + +
+

Unbanning a Player

+
+
const unbanResult = await MyMC.postUnban("username");
+console.log(unbanResult);
+ +
+
+ + +
+

Sending a Message to All Players

+
+
const sayResult = await MyMC.postSay("Hello, everyone!");
+console.log(sayResult);
+ +
+
+ + +
+

Sending a Private Message to a Player

+
+
const tellResult = await MyMC.postTell("username", "Hey, how are you?");
+console.log(tellResult);
+ +
+
+ + +
+

Executing a Command in Server Console

+
+
const consoleResult = await MyMC.postConsole("say Hello, world!");
+console.log(consoleResult);
+ +
+
+ + +
+

Giving an Item to a Player

+
+
const giveResult = await MyMC.postGive("username", "item", 1);
+console.log(giveResult);
+ +
+
+ + +
+

Installing a Mod by ID

+
+
const modID = "exampleMod123";
+const installResult = await MyMC.installMod(modID);
+console.log(installResult);
+ +
+
+ + +
+

Uninstalling a Mod by ID

+
+
const modID = "exampleMod123";
+const uninstallResult = await MyMC.uninstallMod(modID);
+console.log(uninstallResult);
+ +
+
+ + +
+

Retrieving a List of Installed Mods

+
+
const installedMods = await MyMC.getInstalledMods();
+console.log(installedMods);
+ +
+
+
+
+ +
+

+ API Reference

+

MyMCLib Class

+

Constructor

+
+
constructor(token: string)
+ +
+

Creates an instance of the MyMCLib class with the provided API token.

+ +

Methods

+ + +

ApiUtils Class

+

Methods

+ +
+ +
+

+ Explore More

+

+ Ready to automate your server?
Join our community, dive into our resources, and start building with the My-MC.Link API and MyMCLib. +

+ +
+
+ + + + + + + + + + + + \ No newline at end of file diff --git a/wiki/mymc-lib/index.html b/wiki/mymc-lib/index.html new file mode 100644 index 0000000..69283bd --- /dev/null +++ b/wiki/mymc-lib/index.html @@ -0,0 +1,577 @@ + + + + + + + MyMCLib Library Documentation + + + + + + + + + + + +
+
+
+
+
+ +
+
+
+

+ MyMCLib Library Documentation

+

A JavaScript library for interacting with the My-MC.Link API

+
+ Home +
+
+ + + + +
+
+

+ Overview

+

+ The MyMCLib library provides a convenient way to interact with the My-MC.Link API for managing Minecraft servers. It includes methods for performing various actions such as retrieving server information, managing server settings, controlling gameplay, and interacting with players. +

+
+ +
+

+ Installation

+

+ To use the MyMCLib library in your project, install it via npm: +

+
+
npm install mymc-lib
+ +
+

+ Proper Importing: To make use of this module, you'll need to either utilize the .mjs extension or incorporate "type": "module" in your package.json file. This ensures compatibility with ECMAScript modules. +

+
+ +
+

+ Usage

+

+ First, import the library and create an instance with your API token: +

+
+
import MyMCLib from "mymc-lib";
+
+const MyMC = new MyMCLib("your-api-token");
+
+ +
+

+ Example Usage: Retrieve information about your API key's expiration date. +

+
+
import MyMCLib from "mymc-lib";
+
+// Instantiate MyMCLib with your API token
+const MyMC = new MyMCLib("your-api-token");
+
+// Will print information about API key expiration date
+let keyData = await MyMC.getTime();
+
+console.log(keyData);
+
+ +
+

+ Output: +

+
+
{
+  success: true,
+  keyexpireString: 'Tue Apr 15 2025 06:14:59 GMT-0400 (Eastern Daylight Time)',
+  expireDate: '2025-04-15T10:14:59.000Z',
+  expireEpoch: 1744712099000
+}
+ +
+
+ +
+

+ Code Examples

+
+ +
+

Getting Server Time

+
+
const timeData = await MyMC.getTime();
+console.log(timeData);
+ +
+
+ + +
+

Getting Server Statistics

+
+
const statsData = await MyMC.getStats();
+console.log(statsData);
+ +
+
+ + +
+

Getting Server Logs

+
+
const logData = await MyMC.getLog();
+console.log(logData);
+ +
+
+ + +
+

Starting the Minecraft Server

+
+
const startResult = await MyMC.startServer();
+console.log(startResult);
+ +
+
+ + +
+

Stopping the Minecraft Server

+
+
const stopResult = await MyMC.stopServer();
+console.log(stopResult);
+ +
+
+ + +
+

Restarting the Minecraft Server

+
+
const restartResult = await MyMC.restartServer();
+console.log(restartResult);
+ +
+
+ + + + + + + + + + + + + + +
+

Getting Connection Hash

+
+
const hashData = await MyMC.getConnectionHash();
+console.log(hashData);
+ +
+
+ + +
+

Getting SFTP Connection Hash

+
+
const sftpHashData = await MyMC.getConnectionHashSFTP();
+console.log(sftpHashData);
+ +
+
+ + +
+

Getting Online Players

+
+
const playersData = await MyMC.getOnlinePlayers();
+console.log(playersData);
+ +
+
+ + +
+

Getting Server's Website URL

+
+
const websiteURL = await MyMC.getWebsiteURL();
+console.log(websiteURL);
+ +
+
+ + +
+

Getting Server's Map URL

+
+
const mapURL = await MyMC.getMapURL();
+console.log(mapURL);
+ +
+
+ + +
+

Banning a Player

+
+
const banResult = await MyMC.postBan("username");
+console.log(banResult);
+ +
+
+ + +
+

Unbanning a Player

+
+
const unbanResult = await MyMC.postUnban("username");
+console.log(unbanResult);
+ +
+
+ + +
+

Sending a Message to All Players

+
+
const sayResult = await MyMC.postSay("Hello, everyone!");
+console.log(sayResult);
+ +
+
+ + +
+

Sending a Private Message to a Player

+
+
const tellResult = await MyMC.postTell("username", "Hey, how are you?");
+console.log(tellResult);
+ +
+
+ + +
+

Executing a Command in Server Console

+
+
const consoleResult = await MyMC.postConsole("say Hello, world!");
+console.log(consoleResult);
+ +
+
+ + +
+

Giving an Item to a Player

+
+
const giveResult = await MyMC.postGive("username", "item", 1);
+console.log(giveResult);
+ +
+
+ + +
+

Installing a Mod by ID

+
+
const modID = "exampleMod123";
+const installResult = await MyMC.installMod(modID);
+console.log(installResult);
+ +
+
+ + +
+

Uninstalling a Mod by ID

+
+
const modID = "exampleMod123";
+const uninstallResult = await MyMC.uninstallMod(modID);
+console.log(uninstallResult);
+ +
+
+ + +
+

Retrieving a List of Installed Mods

+
+
const installedMods = await MyMC.getInstalledMods();
+console.log(installedMods);
+ +
+
+
+
+ +
+

+ API Reference

+

MyMCLib Class

+

Constructor

+
+
constructor(token: string)
+ +
+

Creates an instance of the MyMCLib class with the provided API token.

+ +

Methods

+ + +

ApiUtils Class

+

Methods

+ +
+ +
+

+ Java Client

+

+ We also have a Java client that provides the same functionality. View the documentation at: +

+

+ Java Client Documentation +

+
+ +
+

+ Explore More

+

+ Ready to automate your server with MyMCLib
Join our community, dive into our resources, and start building with the My-MC.Link API. +

+ +
+
+ + + + + + + + + + + + + \ No newline at end of file