Skip to content

Commit

Permalink
Improve introduction section
Browse files Browse the repository at this point in the history
  • Loading branch information
thegatesdev authored and mworzala committed Jul 24, 2024
1 parent cbeb67c commit dc505f5
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 199 deletions.
9 changes: 6 additions & 3 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ export default defineConfig({
link: "/docs/introduction",
},
{
text: "Setup",
text: "Getting Started",
items: [
{ text: "Dependencies", link: "/docs/setup/dependencies" },
{
text: "Project Setup",
link: "/docs/starting-out/project-setup"
},
{
text: "Your First Server",
link: "/docs/setup/your-first-server",
link: "/docs/starting-out/your-first-server",
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The goal of this wiki is to familiarize you with our library. The most important

The project Javadoc is currently hosted [here](https://minestom.github.io/Minestom/). Additionally, we do have a [Discord server](https://discord.gg/pkFRvqB) where you can ask anything you want.

If you do not know how you landed here, Minestom is a complete rewrite of the Minecraft server software without any Mojang code. You can learn more about it [here](https://github.com/Minestom/Minestom).
If you do not know how you landed here: Minestom is a complete rewrite of the Minecraft server software without any Mojang code. You can learn more about it [here](https://github.com/Minestom/Minestom).
96 changes: 0 additions & 96 deletions docs/setup/dependencies.md

This file was deleted.

179 changes: 179 additions & 0 deletions docs/starting-out/project-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
description: Describes how to set up a Minestom project.
---

<script setup>
import axios from "axios";
import { ref, onMounted } from 'vue'

const version = ref("<--version-->");

const fetchVersion = async () => {
try {
const response = await axios.get("/api/latest-version");
const ver = response.data.latestVersion;
if (ver != null) {
version.value = ver;
}
} catch (error) {
console.error("Error fetching libraries:", error);
}
}

onMounted(() => {
fetchVersion();
});
</script>

# Project Setup

## Adding the dependency

Minestom is available on Maven Central.
Get it by enabling Maven Central (on Gradle) and adding a version to your dependencies.

:::tabs

== Gradle (Groovy)

```groovy-vue
repositories {
mavenCentral()
}
dependencies {
implementation 'net.minestom:minestom-snapshots:{{ version }}'
}
```

== Gradle (Kotlin)

```kotlin-vue
repositories {
mavenCentral()
}
dependencies {
implementation("net.minestom:minestom-snapshots:{{version}}")
}
```

== Maven

```xml-vue
<dependencies>
<!-- ... -->
<dependency>
<groupId>net.minestom</groupId>
<artifactId>minestom-snapshots</artifactId>
<version>{{version}}</version>
</dependency>
</dependencies>
```

:::

The version string is always the first 10 characters of a commit hash. You can view commits
[here](https://github.com/Minestom/Minestom/commits/master/).

Minestom PR branches are also published and can be used to preview upcoming features. For such branches, the version
string is `{branch}-{first 10 chars of commit}`. For example, the 1_20_5 branch was usable with the version string
`1_20_5-dd965f4bb8`.

## Setting up shading

For Gradle users, we will use [the "Shadow" plugin](https://imperceptiblethoughts.com/shadow/introduction/) to include Minestom in the JAR file.

For Maven users, you will need [the "Shade" plugin](https://maven.apache.org/plugins/maven-shade-plugin/). If you use Maven and would like to contribute an example
it would be appreciated :)

::: warning
As of the time writing this, the original shadow plugin from johnrengelman has not been updated for Java 21 support, so we'll use a fork in this example.
:::

:::tabs

== Gradle (Groovy)

```groovy
plugins {
id "io.github.goooler.shadow" version "8.1.7"
}
```

== Gradle (Kotlin)

```kts
plugins {
id("io.github.goooler.shadow") version "8.1.7"
}
```

:::

## Finishing the configuration

Finally, to create a runnable JAR, set your main class to be run.

With all of this done, all we need to do is run the `shadowJar` task to create a working uber (fat) jar! (The jar will be put in `/build/libs/` by default)

Below is a complete `build.gradle`/`build.gradle.kts` file

:::tabs

== Gradle (Groovy)

```groovy
plugins {
id 'java'
id "io.github.goooler.shadow" version "8.1.7"
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
// Change this to the latest version
implementation 'net.minestom:minestom-snapshots:<version>'
}
jar {
manifest {
// Change this to your main class
attributes 'Main-Class': 'org.example.Main'
}
}
```

== Gradle (Kotlin)

```kts
plugins {
id("java")
// If you need Kotlin support, use the kotlin("jvm") plugin
id("io.github.goooler.shadow") version "8.1.7"
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
}

dependencies {
// Change this to the latest version
implementation("net.minestom:minestom-snapshots:<version>")
}

tasks.withType<Jar> {
manifest {
// Change this to your main class
attributes["Main-Class"] = "org.example.Main"
}
}
```

:::
Loading

0 comments on commit dc505f5

Please sign in to comment.