Skip to content

Commit

Permalink
feat: add Paper API dependency example for Maven (#485)
Browse files Browse the repository at this point in the history
* add maven dependency info

* Fix indent

* Apply Indent Config

* fix snapshot

---------

Co-authored-by: olijeffers0n <[email protected]>
  • Loading branch information
powercasgamer and olijeffers0n authored Oct 2, 2024
1 parent a192539 commit 7f6cdc8
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 53 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ indent_size = 2
max_line_length = 100
insert_final_newline = true
trim_trailing_whitespace = true

[{*.md,*.mdx}]
indent_size = 4
68 changes: 34 additions & 34 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,49 +106,49 @@ of a few ways:

1. `SoftwareVersion` component

This component is used to embed the current version of the software into the documentation. An example of this would be:
This component is used to embed the current version of the software into the documentation. An example of this would be:

```jsx
<SoftwareVersion versionType={"maj-min-pat"}/> // e.g. 1.19.2
<SoftwareVersion versionType={"maj-min"}/> // e.g. 1.19
<SoftwareVersion versionType={"maj"}/> // e.g. 1
```jsx
<SoftwareVersion versionType={"maj-min-pat"}/> // e.g. 1.19.2
<SoftwareVersion versionType={"maj-min"}/> // e.g. 1.19
<SoftwareVersion versionType={"maj"}/> // e.g. 1

// You can set the project name to be used for the versioning (defaults to paper):
<SoftwareVersion versionType={"maj-min-pat"} project={"velocity"}/> // e.g. 3.3.0-SNAPSHOT
```
// You can set the project name to be used for the versioning (defaults to paper):
<SoftwareVersion versionType={"maj-min-pat"} project={"velocity"}/> // e.g. 3.3.0-SNAPSHOT
```

2. `Javadoc` component

This component is used to embed a link to the current version of the corresponding Javadoc. An example of this would be:
This component is used to embed a link to the current version of the corresponding Javadoc. An example of this would be:

```jsx
<Javadoc name={"org.bukkit.event.Event"}>here</Javadoc>
// The project can also be set here, and defaults to Paper
```
```jsx
<Javadoc name={"org.bukkit.event.Event"}>here</Javadoc>
// The project can also be set here, and defaults to Paper
```

3. `VersionFormattedCode` component

This component is used to embed a code block with the current version of the software. An example of this would be:

````jsx
<VersionFormattedCode language={"yaml"}>
```
name: Paper-Test-Plugin
version: '1.0'
main: io.papermc.testplugin.TestPlugin
description: Paper Test Plugin
api-version: '%%_MAJ_MIN_PAT_MC_%%'
bootstrapper: io.papermc.testplugin.TestPluginBootstrap
loader: io.papermc.testplugin.TestPluginLoader
```
</VersionFormattedCode>

// The possible placeholders are:
%%_MAJ_MIN_MC_%% - Major-Minor Paper Version (E.g. 1.20)
%%_MAJ_MIN_PAT_MC_%% - Major-Minor-Patch Paper Version (E.g. 1.20.4)
%%_MAJ_MIN_VEL_%% - Major Velocity Version (E.g. 3.1.0)
%%_MAJ_MIN_PAT_VEL_%% - Major-Minor-Patch Velocity Version (E.g. 3.1.1-SNAPSHOT)
````
This component is used to embed a code block with the current version of the software. An example of this would be:

````jsx
<VersionFormattedCode language={"yaml"}>
```
name: Paper-Test-Plugin
version: '1.0'
main: io.papermc.testplugin.TestPlugin
description: Paper Test Plugin
api-version: '%%_MAJ_MIN_PAT_MC_%%'
bootstrapper: io.papermc.testplugin.TestPluginBootstrap
loader: io.papermc.testplugin.TestPluginLoader
```
</VersionFormattedCode>

// The possible placeholders are:
%%_MAJ_MIN_MC_%% - Major-Minor Paper Version (E.g. 1.20)
%%_MAJ_MIN_PAT_MC_%% - Major-Minor-Patch Paper Version (E.g. 1.20.4)
%%_MAJ_MIN_VEL_%% - Major Velocity Version (E.g. 3.1.0)
%%_MAJ_MIN_PAT_VEL_%% - Major-Minor-Patch Velocity Version (E.g. 3.1.1-SNAPSHOT)
````

When the major version of the software changes, the docs will still need to have a "snapshot" created to keep documentation
for older versions. This is done by using Docusaurus's `version` command:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ How to get docs running on your local machine for development.

### Prerequisites

- [node](https://nodejs.org)
- [pnpm](https://pnpm.io/installation)
- [node](https://nodejs.org)
- [pnpm](https://pnpm.io/installation)

### Local Development

Expand Down
79 changes: 62 additions & 17 deletions docs/paper/dev/getting-started/project-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,69 @@ You will land into the `build.gradle.kts` file where you can add your dependenci

### Adding Paper as a dependency

To add Paper as a dependency, you will need to add the Paper repository to your `build.gradle.kts` file as well as the dependency itself.
To add Paper as a dependency, you will need to add the Paper repository to your `build.gradle.kts` or `pom.xml` file as well as the dependency itself.

<VersionFormattedCode language={"kotlin"} title={"build.gradle.kts"}>
```
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
}
dependencies {
compileOnly("io.papermc.paper:paper-api:%%_MAJ_MIN_PAT_MC_%%-R0.1-SNAPSHOT")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
```
</VersionFormattedCode>
<Tabs groupId="author-front-matter">
<TabItem value="gradle-kotlin" label="Gradle Kotlin DSL" default>
<VersionFormattedCode language={"kotlin"} title={"build.gradle.kts"}>
```
repositories {
maven {
name = "papermc"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:%%_MAJ_MIN_PAT_MC_%%-R0.1-SNAPSHOT")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
```
</VersionFormattedCode>
</TabItem>
<TabItem value="gradle-groovy" label="Gradle Groovy DSL">
<VersionFormattedCode language={"groovy"} title={"build.gradle"}>
```
repositories {
maven {
name = 'papermc'
url = 'https://repo.papermc.io/repository/maven-public/'
}
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:%%_MAJ_MIN_PAT_MC_%%-R0.1-SNAPSHOT'
}
```
</VersionFormattedCode>
</TabItem>
<TabItem value="maven" label="Maven POM">
<VersionFormattedCode language={"xml"} title={"pom.xml"}>
```
<project>
<repositories>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>%%_MAJ_MIN_PAT_MC_%%-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
```
</VersionFormattedCode>
</TabItem>
</Tabs>

### Setting up the `src` directory

Expand Down

0 comments on commit 7f6cdc8

Please sign in to comment.