2021-12-12 14:16:38 +00:00
|
|
|
---
|
|
|
|
|
layout: page
|
2022-02-22 08:07:56 +00:00
|
|
|
title: Using Geyser or Floodgate as a dependency
|
2021-12-12 14:20:23 +00:00
|
|
|
permalink: /geyser/using-geyser-or-floodgate-as-a-dependency/
|
2021-12-12 14:16:38 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
To start, add the Open Collaboration repository to your project:
|
|
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<repository>
|
|
|
|
|
<id>opencollab-snapshot-repo</id>
|
2022-10-07 19:11:56 -04:00
|
|
|
<url>https://repo.opencollab.dev/main/</url>
|
2021-12-12 14:16:38 +00:00
|
|
|
</repository>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Using Geyser
|
|
|
|
|
|
2022-10-07 19:11:56 -04:00
|
|
|
Add Geyser's API codebase as a dependency:
|
2021-12-12 14:16:38 +00:00
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<dependency>
|
2022-10-07 19:11:56 -04:00
|
|
|
<groupId>org.geysermc.geyser</groupId>
|
|
|
|
|
<artifactId>api</artifactId>
|
|
|
|
|
<version>2.1.0-SNAPSHOT</version>
|
2021-12-12 14:16:38 +00:00
|
|
|
<scope>provided</scope>
|
|
|
|
|
</dependency>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
To get a Geyser player, or check if a player is from Bedrock:
|
|
|
|
|
|
|
|
|
|
```java
|
2022-10-07 19:11:56 -04:00
|
|
|
GeyserConnection connection = GeyserApi.api().connectionByUuid(uuid);
|
2021-12-12 14:16:38 +00:00
|
|
|
```
|
|
|
|
|
|
2022-10-07 19:11:56 -04:00
|
|
|
`connection` can be null if such a player does not exist on Geyser.
|
2021-12-12 14:16:38 +00:00
|
|
|
|
2022-10-07 19:11:56 -04:00
|
|
|
`GeyserApi.api()` may be null until after the Geyser plugin enables.
|
2021-12-12 14:16:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Using Floodgate
|
|
|
|
|
|
2022-02-20 12:51:51 +00:00
|
|
|
This page has a very simple primer for the Floodgate API. For a full breakdown, see [here](/floodgate/api/).
|
2021-12-12 14:16:38 +00:00
|
|
|
|
|
|
|
|
Add Floodgate's API as a dependency:
|
|
|
|
|
```xml
|
|
|
|
|
<dependency>
|
|
|
|
|
<groupId>org.geysermc.floodgate</groupId>
|
|
|
|
|
<artifactId>api</artifactId>
|
|
|
|
|
<version>2.0-SNAPSHOT</version>
|
|
|
|
|
<scope>provided</scope>
|
|
|
|
|
</dependency>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Get the Floodgate API using:
|
|
|
|
|
```java
|
|
|
|
|
FloodgateApi api = FloodgateApi.getInstance();
|
|
|
|
|
api.isFloodgatePlayer(uuid);
|
2021-12-12 14:22:07 +00:00
|
|
|
```
|