From ab554b5e3b976997d0151166f9805f614046168b Mon Sep 17 00:00:00 2001 From: snxraven Date: Tue, 17 Jun 2025 01:42:03 -0400 Subject: [PATCH] fix java wiki page --- wiki/mymc-java/index.html | 206 ++++++++++++++++++++------------------ 1 file changed, 109 insertions(+), 97 deletions(-) diff --git a/wiki/mymc-java/index.html b/wiki/mymc-java/index.html index 240c302..d6a7026 100644 --- a/wiki/mymc-java/index.html +++ b/wiki/mymc-java/index.html @@ -111,7 +111,7 @@

MyMCLib Library Documentation

-

JavaScript Library for My-MC.Link API

+

Java Library for My-MC.Link API

Home @@ -167,14 +167,25 @@

Installation

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

-
npm install mymc-lib
+
<dependency>
+    <groupId>io.github.mrmasrozytlive</groupId>
+    <artifactId>mymc-java-lib</artifactId>
+    <version>1.2.0</version>
+</dependency>

- 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. + or via Gradle: +

+
+
implementation group: 'io.github.mrmasrozytlive', name: 'mymc-java-lib', version: '1.2.0'
+ +
+

+ For other ways, visit:
https://central.sonatype.com/artifact/io.github.mrmasrozytlive/mymc-java-lib.

@@ -185,33 +196,33 @@ First, import the library into your project:

-
import MyMCLib from "mymc-lib";
+
import net.mitask.MyMCLib;

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

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

Example Usage

-
import MyMCLib from "mymc-lib";
+                
import net.mitask.MyMCLib;
 
-// 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);
+public class YourClass { + public void yourMethod() { + MyMCLib myMcLink = new MyMCLib("API_KEY_HERE"); + + // Will print information about API key expiration date + System.out.println(myMcLink.getTime().toString()); + } +}

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',
@@ -229,8 +240,8 @@ console.log(keyData);

Getting Server Time

-
const timeData = await MyMC.getTime();
-console.log(timeData);
+
JSONObject timeData = myMcLink.getTime();
+System.out.println(timeData.toString());
@@ -239,8 +250,8 @@ console.log(timeData);

Getting Server Statistics

-
const statsData = await MyMC.getStats();
-console.log(statsData);
+
JSONObject statsData = myMcLink.getStats();
+System.out.println(statsData.toString());
@@ -249,8 +260,8 @@ console.log(statsData);

Getting Server Logs

-
const logData = await MyMC.getLog();
-console.log(logData);
+
JSONObject logData = myMcLink.getLog();
+System.out.println(logData.toString());
@@ -259,8 +270,8 @@ console.log(logData);

Starting the Minecraft Server

-
const startResult = await MyMC.startServer();
-console.log(startResult);
+
JSONObject startResult = myMcLink.startServer();
+System.out.println(startResult.toString());
@@ -269,8 +280,8 @@ console.log(startResult);

Stopping the Minecraft Server

-
const stopResult = await MyMC.stopServer();
-console.log(stopResult);
+
JSONObject stopResult = myMcLink.stopServer();
+System.out.println(stopResult.toString());
@@ -279,8 +290,8 @@ console.log(stopResult);

Restarting the Minecraft Server

-
const restartResult = await MyMC.restartServer();
-console.log(restartResult);
+
JSONObject restartResult = myMcLink.restartServer();
+System.out.println(restartResult.toString());
@@ -289,8 +300,8 @@ console.log(restartResult); @@ -299,8 +310,8 @@ console.log(customLinkResult); @@ -309,8 +320,8 @@ console.log(deleteLinkResult); @@ -319,8 +330,8 @@ console.log(sftpLinkResult); @@ -329,8 +340,8 @@ console.log(deleteSftpLinkResult);

Getting Connection Hash

-
const hashData = await MyMC.getConnectionHash();
-console.log(hashData);
+
JSONObject hashData = myMcLink.getConnectionHash();
+System.out.println(hashData.toString());
@@ -339,8 +350,8 @@ console.log(hashData);

Getting SFTP Connection Hash

-
const sftpHashData = await MyMC.getConnectionHashSFTP();
-console.log(sftpHashData);
+
JSONObject sftpHashData = myMcLink.getConnectionHashSFTP();
+System.out.println(sftpHashData.toString());
@@ -349,8 +360,8 @@ console.log(sftpHashData);

Getting Online Players

-
const playersData = await MyMC.getOnlinePlayers();
-console.log(playersData);
+
JSONObject playersData = myMcLink.getOnlinePlayers();
+System.out.println(playersData.toString());
@@ -359,8 +370,8 @@ console.log(playersData);

Getting Server's Website URL

-
const websiteURL = await MyMC.getWebsiteURL();
-console.log(websiteURL);
+
JSONObject websiteURL = myMcLink.getWebsiteURL();
+System.out.println(websiteURL.toString());
@@ -369,8 +380,8 @@ console.log(websiteURL);

Getting Server's Map URL

-
const mapURL = await MyMC.getMapURL();
-console.log(mapURL);
+
JSONObject mapURL = myMcLink.getMapURL();
+System.out.println(mapURL.toString());
@@ -379,8 +390,8 @@ console.log(mapURL);

Banning a Player

-
const banResult = await MyMC.postBan("username");
-console.log(banResult);
+
JSONObject banResult = myMcLink.postBan("username");
+System.out.println(banResult.toString());
@@ -389,8 +400,8 @@ console.log(banResult);

Unbanning a Player

-
const unbanResult = await MyMC.postUnban("username");
-console.log(unbanResult);
+
JSONObject unbanResult = myMcLink.postUnban("username");
+System.out.println(unbanResult.toString());
@@ -399,8 +410,8 @@ console.log(unbanResult);

Sending a Message to All Players

-
const sayResult = await MyMC.postSay("Hello, everyone!");
-console.log(sayResult);
+
JSONObject sayResult = myMcLink.postSay("Hello, everyone!");
+System.out.println(sayResult.toString());
@@ -409,8 +420,8 @@ console.log(sayResult);

Sending a Private Message to a Player

-
const tellResult = await MyMC.postTell("username", "Hey, how are you?");
-console.log(tellResult);
+
JSONObject tellResult = myMcLink.postTell("username", "Hey, how are you?");
+System.out.println(tellResult.toString());
@@ -419,8 +430,8 @@ console.log(tellResult);

Executing a Command in Server Console

-
const consoleResult = await MyMC.postConsole("say Hello, world!");
-console.log(consoleResult);
+
JSONObject consoleResult = myMcLink.postConsole("say Hello, world!");
+System.out.println(consoleResult.toString());
@@ -429,8 +440,8 @@ console.log(consoleResult);

Giving an Item to a Player

-
const giveResult = await MyMC.postGive("username", "item", 1);
-console.log(giveResult);
+
JSONObject giveResult = myMcLink.postGive("username", "item", 1);
+System.out.println(giveResult.toString());
@@ -439,9 +450,9 @@ console.log(giveResult);

Installing a Mod by ID

-
const modID = "exampleMod123";
-const installResult = await MyMC.installMod(modID);
-console.log(installResult);
+
String modID = "exampleMod123";
+JSONObject installResult = myMcLink.installMod(modID);
+System.out.println(installResult.toString());
@@ -450,9 +461,9 @@ console.log(installResult);

Uninstalling a Mod by ID

-
const modID = "exampleMod123";
-const uninstallResult = await MyMC.uninstallMod(modID);
-console.log(uninstallResult);
+
String modID = "exampleMod123";
+JSONObject uninstallResult = myMcLink.uninstallMod(modID);
+System.out.println(uninstallResult.toString());
@@ -461,8 +472,8 @@ console.log(uninstallResult);

Retrieving a List of Installed Mods

-
const installedMods = await MyMC.getInstalledMods();
-console.log(installedMods);
+
JSONObject installedMods = myMcLink.getInstalledMods();
+System.out.println(installedMods.toString());
@@ -475,45 +486,45 @@ console.log(installedMods);

MyMCLib Class

Constructor

-
constructor(token: string)
+
public MyMCLib(String token)

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

Methods

ApiUtils Class

Methods

@@ -539,9 +550,10 @@ console.log(installedMods); - - - + + + +