fix java wiki page
This commit is contained in:
@ -111,7 +111,7 @@
|
||||
<div>
|
||||
<h1 class="text-5xl minecraft-font bg-clip-text text-transparent bg-gradient-to-r from-teal-400 to-blue-500">
|
||||
<a href="https://info.my-mc.link/">MyMCLib Library Documentation</a></h1>
|
||||
<p class="text-lg mt-4 opacity-90 tracking-wide font-medium">JavaScript Library for My-MC.Link API</p>
|
||||
<p class="text-lg mt-4 opacity-90 tracking-wide font-medium">Java Library for My-MC.Link API</p>
|
||||
</div>
|
||||
<a href="https://my-mc.link" class="btn-minecraft text-base self-center" target="_blank">Home</a>
|
||||
</div>
|
||||
@ -167,14 +167,25 @@
|
||||
<h2 class="text-3xl minecraft-font mb-8 text-center bg-clip-text text-transparent bg-gradient-to-r from-teal-400 to-blue-500">
|
||||
Installation</h2>
|
||||
<p class="text-lg mb-8 max-w-3xl mx-auto opacity-90 leading-relaxed">
|
||||
To use the <code class="bg-gray-800 text-teal-400 px-1 rounded">MyMCLib</code> library in your project, install it via npm:
|
||||
To use the <code class="bg-gray-800 text-teal-400 px-1 rounded">MyMCLib</code> library in your project, install it via Maven:
|
||||
</p>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-bash"><code>npm install mymc-lib</code></pre>
|
||||
<pre class="language-xml"><code><dependency>
|
||||
<groupId>io.github.mrmasrozytlive</groupId>
|
||||
<artifactId>mymc-java-lib</artifactId>
|
||||
<version>1.2.0</version>
|
||||
</dependency></code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
<p class="text-lg mb-8 max-w-3xl mx-auto opacity-90 leading-relaxed">
|
||||
<strong>Proper Importing:</strong> To make use of this module, you'll need to either utilize the <code class="bg-gray-800 text-teal-400 px-1 rounded">.mjs</code> extension or incorporate <code class="bg-gray-800 text-teal-400 px-1 rounded">"type": "module"</code> in your <code class="bg-gray-800 text-teal-400 px-1 rounded">package.json</code> 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:
|
||||
</p>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-gradle"><code>implementation group: 'io.github.mrmasrozytlive', name: 'mymc-java-lib', version: '1.2.0'</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
<p class="text-lg mb-8 max-w-3xl mx-auto opacity-90 leading-relaxed">
|
||||
For other ways, visit:<BR> <a href="https://central.sonatype.com/artifact/io.github.mrmasrozytlive/mymc-java-lib" target="_blank">https://central.sonatype.com/artifact/io.github.mrmasrozytlive/mymc-java-lib</a>.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
@ -185,33 +196,33 @@
|
||||
First, import the library into your project:
|
||||
</p>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-typescript"><code>import MyMCLib from "mymc-lib";</code></pre>
|
||||
<pre class="language-java"><code>import net.mitask.MyMCLib;</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
<p class="text-lg mb-8 max-w-3xl mx-auto opacity-90 leading-relaxed">
|
||||
Then, create an instance of <code class="bg-gray-800 text-teal-400 px-1 rounded">MyMCLib</code> by providing your API token:
|
||||
</p>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-typescript"><code>const MyMC = new MyMCLib("your-api-token");</code></pre>
|
||||
<pre class="language-java"><code>MyMCLib myMcLink = new MyMCLib("API_KEY_HERE");</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400 mt-8">Example Usage</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-typescript"><code>import MyMCLib from "mymc-lib";
|
||||
<pre class="language-java"><code>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);</code></pre>
|
||||
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());
|
||||
}
|
||||
}</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
<p class="text-sm opacity-90 leading-relaxed mt-4"><strong>Output:</strong></p>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-bash"><code>root@test:/home# node test
|
||||
{
|
||||
<pre class="language-json"><code>{
|
||||
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);</code></pre>
|
||||
<div id="getting-server-time" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Getting Server Time</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const timeData = await MyMC.getTime();
|
||||
console.log(timeData);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject timeData = myMcLink.getTime();
|
||||
System.out.println(timeData.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -239,8 +250,8 @@ console.log(timeData);</code></pre>
|
||||
<div id="getting-server-statistics" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Getting Server Statistics</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const statsData = await MyMC.getStats();
|
||||
console.log(statsData);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject statsData = myMcLink.getStats();
|
||||
System.out.println(statsData.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -249,8 +260,8 @@ console.log(statsData);</code></pre>
|
||||
<div id="getting-server-logs" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Getting Server Logs</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const logData = await MyMC.getLog();
|
||||
console.log(logData);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject logData = myMcLink.getLog();
|
||||
System.out.println(logData.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -259,8 +270,8 @@ console.log(logData);</code></pre>
|
||||
<div id="starting-minecraft-server" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Starting the Minecraft Server</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const startResult = await MyMC.startServer();
|
||||
console.log(startResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject startResult = myMcLink.startServer();
|
||||
System.out.println(startResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -269,8 +280,8 @@ console.log(startResult);</code></pre>
|
||||
<div id="stopping-minecraft-server" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Stopping the Minecraft Server</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const stopResult = await MyMC.stopServer();
|
||||
console.log(stopResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject stopResult = myMcLink.stopServer();
|
||||
System.out.println(stopResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -279,8 +290,8 @@ console.log(stopResult);</code></pre>
|
||||
<div id="restarting-minecraft-server" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Restarting the Minecraft Server</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const restartResult = await MyMC.restartServer();
|
||||
console.log(restartResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject restartResult = myMcLink.restartServer();
|
||||
System.out.println(restartResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -289,8 +300,8 @@ console.log(restartResult);</code></pre>
|
||||
<div id="creating-custom-link" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Creating a Custom Link</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const customLinkResult = await MyMC.createMyLink();
|
||||
console.log(customLinkResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject customLinkResult = myMcLink.createMyLink();
|
||||
System.out.println(customLinkResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -299,8 +310,8 @@ console.log(customLinkResult);</code></pre>
|
||||
<div id="deleting-custom-link" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Deleting a Custom Link</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const deleteLinkResult = await MyMC.deleteMyLink();
|
||||
console.log(deleteLinkResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject deleteLinkResult = myMcLink.deleteMyLink();
|
||||
System.out.println(deleteLinkResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -309,8 +320,8 @@ console.log(deleteLinkResult);</code></pre>
|
||||
<div id="creating-sftp-link" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Creating an SFTP Link</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const sftpLinkResult = await MyMC.createLinkSFTP();
|
||||
console.log(sftpLinkResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject sftpLinkResult = myMcLink.createLinkSFTP();
|
||||
System.out.println(sftpLinkResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -319,8 +330,8 @@ console.log(sftpLinkResult);</code></pre>
|
||||
<div id="deleting-sftp-link" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Deleting an SFTP Link</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const deleteSftpLinkResult = await MyMC.deleteLinkSFTP();
|
||||
console.log(deleteSftpLinkResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject deleteSftpLinkResult = myMcLink.deleteLinkSFTP();
|
||||
System.out.println(deleteSftpLinkResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -329,8 +340,8 @@ console.log(deleteSftpLinkResult);</code></pre>
|
||||
<div id="getting-connection-hash" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Getting Connection Hash</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const hashData = await MyMC.getConnectionHash();
|
||||
console.log(hashData);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject hashData = myMcLink.getConnectionHash();
|
||||
System.out.println(hashData.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -339,8 +350,8 @@ console.log(hashData);</code></pre>
|
||||
<div id="getting-sftp-connection-hash" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Getting SFTP Connection Hash</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const sftpHashData = await MyMC.getConnectionHashSFTP();
|
||||
console.log(sftpHashData);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject sftpHashData = myMcLink.getConnectionHashSFTP();
|
||||
System.out.println(sftpHashData.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -349,8 +360,8 @@ console.log(sftpHashData);</code></pre>
|
||||
<div id="getting-online-players" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Getting Online Players</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const playersData = await MyMC.getOnlinePlayers();
|
||||
console.log(playersData);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject playersData = myMcLink.getOnlinePlayers();
|
||||
System.out.println(playersData.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -359,8 +370,8 @@ console.log(playersData);</code></pre>
|
||||
<div id="getting-website-url" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Getting Server's Website URL</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const websiteURL = await MyMC.getWebsiteURL();
|
||||
console.log(websiteURL);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject websiteURL = myMcLink.getWebsiteURL();
|
||||
System.out.println(websiteURL.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -369,8 +380,8 @@ console.log(websiteURL);</code></pre>
|
||||
<div id="getting-map-url" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Getting Server's Map URL</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const mapURL = await MyMC.getMapURL();
|
||||
console.log(mapURL);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject mapURL = myMcLink.getMapURL();
|
||||
System.out.println(mapURL.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -379,8 +390,8 @@ console.log(mapURL);</code></pre>
|
||||
<div id="banning-player" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Banning a Player</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const banResult = await MyMC.postBan("username");
|
||||
console.log(banResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject banResult = myMcLink.postBan("username");
|
||||
System.out.println(banResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -389,8 +400,8 @@ console.log(banResult);</code></pre>
|
||||
<div id="unbanning-player" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Unbanning a Player</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const unbanResult = await MyMC.postUnban("username");
|
||||
console.log(unbanResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject unbanResult = myMcLink.postUnban("username");
|
||||
System.out.println(unbanResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -399,8 +410,8 @@ console.log(unbanResult);</code></pre>
|
||||
<div id="sending-message-all" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Sending a Message to All Players</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const sayResult = await MyMC.postSay("Hello, everyone!");
|
||||
console.log(sayResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject sayResult = myMcLink.postSay("Hello, everyone!");
|
||||
System.out.println(sayResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -409,8 +420,8 @@ console.log(sayResult);</code></pre>
|
||||
<div id="sending-private-message" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Sending a Private Message to a Player</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const tellResult = await MyMC.postTell("username", "Hey, how are you?");
|
||||
console.log(tellResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject tellResult = myMcLink.postTell("username", "Hey, how are you?");
|
||||
System.out.println(tellResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -419,8 +430,8 @@ console.log(tellResult);</code></pre>
|
||||
<div id="executing-console-command" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Executing a Command in Server Console</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const consoleResult = await MyMC.postConsole("say Hello, world!");
|
||||
console.log(consoleResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject consoleResult = myMcLink.postConsole("say Hello, world!");
|
||||
System.out.println(consoleResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -429,8 +440,8 @@ console.log(consoleResult);</code></pre>
|
||||
<div id="giving-item" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Giving an Item to a Player</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const giveResult = await MyMC.postGive("username", "item", 1);
|
||||
console.log(giveResult);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject giveResult = myMcLink.postGive("username", "item", 1);
|
||||
System.out.println(giveResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -439,9 +450,9 @@ console.log(giveResult);</code></pre>
|
||||
<div id="installing-mod" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Installing a Mod by ID</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const modID = "exampleMod123";
|
||||
const installResult = await MyMC.installMod(modID);
|
||||
console.log(installResult);</code></pre>
|
||||
<pre class="language-java"><code>String modID = "exampleMod123";
|
||||
JSONObject installResult = myMcLink.installMod(modID);
|
||||
System.out.println(installResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -450,9 +461,9 @@ console.log(installResult);</code></pre>
|
||||
<div id="uninstalling-mod" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Uninstalling a Mod by ID</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const modID = "exampleMod123";
|
||||
const uninstallResult = await MyMC.uninstallMod(modID);
|
||||
console.log(uninstallResult);</code></pre>
|
||||
<pre class="language-java"><code>String modID = "exampleMod123";
|
||||
JSONObject uninstallResult = myMcLink.uninstallMod(modID);
|
||||
System.out.println(uninstallResult.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -461,8 +472,8 @@ console.log(uninstallResult);</code></pre>
|
||||
<div id="retrieving-installed-mods" class="feature-card tilt-card">
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">Retrieving a List of Installed Mods</h3>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-javascript"><code>const installedMods = await MyMC.getInstalledMods();
|
||||
console.log(installedMods);</code></pre>
|
||||
<pre class="language-java"><code>JSONObject installedMods = myMcLink.getInstalledMods();
|
||||
System.out.println(installedMods.toString());</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -475,45 +486,45 @@ console.log(installedMods);</code></pre>
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400">MyMCLib Class</h3>
|
||||
<h4 class="text-lg font-bold mb-2">Constructor</h4>
|
||||
<div class="code-block-wrapper">
|
||||
<pre class="language-typescript"><code>constructor(token: string)</code></pre>
|
||||
<pre class="language-java"><code>public MyMCLib(String token)</code></pre>
|
||||
<button class="copy-button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
<p class="text-sm opacity-90 leading-relaxed mb-4">Creates an instance of the <code class="bg-gray-800 text-teal-400 px-1 rounded">MyMCLib</code> class with the provided API token.</p>
|
||||
|
||||
<h4 class="text-lg font-bold mb-2 mt-6">Methods</h4>
|
||||
<ul class="text-sm opacity-90 leading-relaxed list-disc pl-6 mb-4">
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getTime(): Promise<any></code> - Retrieves the current server time.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getStats(): Promise<any></code> - Retrieves server statistics.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getLog(): Promise<any></code> - Retrieves server logs.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">startServer(): Promise<any></code> - Starts the Minecraft server.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">stopServer(): Promise<any></code> - Stops the Minecraft server.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">restartServer(): Promise<any></code> - Restarts the Minecraft server.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">createMyLink(): Promise<any></code> - Creates a custom link.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">deleteMyLink(): Promise<any></code> - Deletes a custom link.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">createLinkSFTP(): Promise<any></code> - Creates an SFTP link.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">deleteLinkSFTP(): Promise<any></code> - Deletes an SFTP link.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getConnectionHash(): Promise<any></code> - Retrieves a connection hash.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getConnectionHashSFTP(): Promise<any></code> - Retrieves an SFTP connection hash.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getOnlinePlayers(): Promise<any></code> - Retrieves a list of online players.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getWebsiteURL(): Promise<any></code> - Retrieves the server's website URL.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getMapURL(): Promise<any></code> - Retrieves the server's map URL.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">postBan(username: string): Promise<any></code> - Bans a player by username.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">postUnban(username: string): Promise<any></code> - Unbans a player by username.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">postSay(message: string): Promise<any></code> - Sends a message to all players.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">postTell(username: string, message: string): Promise<any></code> - Sends a private message to a player.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">postConsole(command: string): Promise<any></code> - Executes a command in the server console.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">postGive(username: string, item: string, amount: number): Promise<any></code> - Gives an item to a player.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">installMod(modID: string): Promise<any></code> - Installs a mod by ID.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">uninstallMod(modID: string): Promise<any></code> - Uninstalls a mod by ID.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getInstalledMods(): Promise<any></code> - Retrieves a list of installed mods.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getTime()</code> - Retrieves the current server time.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getStats()</code> - Retrieves server statistics.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getLog()</code> - Retrieves server logs.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject startServer()</code> - Starts the Minecraft server.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject stopServer()</code> - Stops the Minecraft server.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject restartServer()</code> - Restarts the Minecraft server.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject createMyLink()</code> - Creates a custom link.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject deleteMyLink()</code> - Deletes a custom link.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject createLinkSFTP()</code> - Creates an SFTP link.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject deleteLinkSFTP()</code> - Deletes an SFTP link.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getConnectionHash()</code> - Retrieves a connection hash.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getConnectionHashSFTP()</code> - Retrieves an SFTP connection hash.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getOnlinePlayers()</code> - Retrieves a list of online players.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getWebsiteURL()</code> - Retrieves the server's website URL.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getMapURL()</code> - Retrieves the server's map URL.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject postBan(String username)</code> - Bans a player by username.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject postUnban(String username)</code> - Unbans a player by username.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject postSay(String message)</code> - Sends a message to all players.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject postTell(String username, String message)</code> - Sends a private message to a player.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject postConsole(String command)</code> - Executes a command in the server console.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject postGive(String username, String item, int amount)</code> - Gives an item to a player.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject installMod(String modID)</code> - Installs a mod by ID.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject uninstallMod(String modID)</code> - Uninstalls a mod by ID.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getInstalledMods()</code> - Retrieves a list of installed mods.</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="text-xl minecraft-font mb-3 text-teal-400 mt-8">ApiUtils Class</h3>
|
||||
<h4 class="text-lg font-bold mb-2">Methods</h4>
|
||||
<ul class="text-sm opacity-90 leading-relaxed list-disc pl-6 mb-4">
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">getRequest(endpoint: ApiEndpoint, token: string): Promise<any></code> - Makes a GET request to the specified API endpoint.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">deleteRequest(endpoint: ApiEndpoint, token: string): Promise<any></code> - Makes a DELETE request to the specified API endpoint.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">postRequest(endpoint: ApiEndpoint, token: string, data: {}): Promise<any></code> - Makes a POST request to the specified API endpoint with the provided data.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject getRequest(ApiEndpoint endpoint, String token)</code> - Makes a GET request to the specified API endpoint.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject deleteRequest(ApiEndpoint endpoint, String token)</code> - Makes a DELETE request to the specified API endpoint.</li>
|
||||
<li><code class="bg-gray-800 text-teal-400 px-1 rounded">JSONObject postRequest(ApiEndpoint endpoint, String token, JSONObject data)</code> - Makes a POST request to the specified API endpoint with the provided data.</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
@ -539,9 +550,10 @@ console.log(installedMods);</code></pre>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-javascript.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-typescript.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-java.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-xml-doc.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-json.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-gradle.min.js"></script>
|
||||
<script>
|
||||
function copyCode(button) {
|
||||
const codeBlock = button.previousElementSibling.querySelector('code');
|
||||
|
Reference in New Issue
Block a user