Files
GeyserWebsite/wiki/geyser/getting-started-with-the-api.md
qscbm187531andKas-tle d70a839a0e Minor fixes and small changes (#26)
* Update link in wiki/other/geyserconnect.md

* fix: error title hierarchy in wiki\geyser\api.md

* Update linking.md

* Update geyser api version

* Update floodgate javadocs link

* Add the download link in hydraulic.md

* Update hydraulic.md

* Update understanding-the-config.md

* fix(config-editor): no showing checkbox

* Added the option to display the comments out

* Update config-editor.tsx

* Update config-editor.tsx

* Update hydraulic.md

---------

Co-authored-by: Kas-tle <26531652+Kas-tle@users.noreply.github.com>
2024-08-13 10:17:44 -07:00

88 lines
1.9 KiB
Markdown

---
title: Getting Started with the API
description: 'A primer on how to use the Geyser and Floodgate APIs.'
---
To start, add the Open Collaboration repository to your project:
**Maven**
```xml
<repository>
<id>opencollab-snapshot</id>
<url>https://repo.opencollab.dev/main/</url>
</repository>
```
The "main" repository contains both release and snapshot versions.
**Gradle**
```groovy
repositories {
maven {
url = uri("https://repo.opencollab.dev/main/")
}
}
```
## Using Geyser {#using-geyser}
Add Geyser's API codebase as a dependency:
**Maven**
```xml
<dependency>
<groupId>org.geysermc.geyser</groupId>
<artifactId>api</artifactId>
<version>2.4.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```
**Gradle**
```groovy
dependencies {
compileOnly('org.geysermc.geyser:api:2.4.2-SNAPSHOT')
}
```
To get a Geyser player, or check if a player is from Bedrock:
```java
GeyserConnection connection = GeyserApi.api().connectionByUuid(uuid);
```
`connection` can be null if such a player does not exist on Geyser.
`GeyserApi.api()` may be null until after the Geyser plugin enables.
For more information on the Geyser API, see [here](/wiki/geyser/api/).
## Using Floodgate {#using-floodgate}
This page has a very simple primer for the Floodgate API. For a full breakdown, see [here](/wiki/floodgate/api/).
Add Floodgate's API as a dependency:
**Maven**
```xml
<dependency>
<groupId>org.geysermc.floodgate</groupId>
<artifactId>api</artifactId>
<version>2.2.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```
**Gradle**
```groovy
dependencies {
compileOnly('org.geysermc.floodgate:api:2.2.3-SNAPSHOT')
}
```
Get the Floodgate API using:
```java
FloodgateApi api = FloodgateApi.getInstance();
api.isFloodgatePlayer(uuid);
```
For more information on the Floodgate API, see [here](/wiki/floodgate/api/).