Files
GeyserWebsite/_docs/geyser/getting-started-with-the-api.md
T
2f8c69185f API & extension docs & Geyser system property docs (#159)
* initial start on api docs

* oops

* oops #2

* oops #3

* move global api info to global-api.md page, fix typo

* Initial setup page

* the extensions template and list is now in the geysermc org

* add fabric event subscribe example

* fix outdated naming

* the extensions template and list is now in the geysermc org, and therefore official

* spigot/paper plugin geyser-api docs

* minor tweaks

* the setup guide should be in a separate PR, oops

* Updated docs for resource packs PR

* document system properties

* Apply suggestions from code review

Co-authored-by: Redned <redned235@gmail.com>

* move and shuffle pages, address review

* -DGeyser.BedrockNetworkThreads exists too, apparently

* turn notes into banners

* be more specific to indicate this to be advanced stuff

* adjust texts & address camotoy's review

* nms good dont disable

* add chapter on event priorities

* remove whitespace

* main instead of maven-snapshots; floodgate-api 2.2.2

* Move around pages in toc.yml, no need to fully copy event priorities

* Apply suggestions from code review

Co-authored-by: Tim203 <mctim203@gmail.com>

* apply command suggestion

Co-authored-by: Tim203 <mctim203@gmail.com>

* reduce command comments

* specify that this is the Geyser API

* Apply suggestions from code review

Co-authored-by: Redned <redned235@gmail.com>

* dont repeat that the bulk of code would go into a post init event; we already say that

* adress review

* extensions currently target Base API version

---------

Co-authored-by: JensC <jenscollaertyprive@hotmail.com>
Co-authored-by: Redned <redned235@gmail.com>
Co-authored-by: Tim203 <mctim203@gmail.com>
2023-07-09 10:49:13 -05:00

1.7 KiB

title
title
Getting Started with the API

To start, add the Open Collaboration repository to your project:

Maven

<repository>
    <id>opencollab-snapshot</id>
    <url>https://repo.opencollab.dev/main/</url>
</repository>

The "main" repository contains both release and snapshot versions.

Gradle

repositories {
    maven {
        url = uri("https://repo.opencollab.dev/main/")
    }
}

Using Geyser

Add Geyser's API codebase as a dependency:

Maven

<dependency>
    <groupId>org.geysermc.geyser</groupId>
    <artifactId>api</artifactId>
    <version>2.1.2-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>

Gradle

dependencies {
    compileOnly('org.geysermc.geyser:api:2.1.2-SNAPSHOT')
}

To get a Geyser player, or check if a player is from Bedrock:

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.

Using Floodgate

This page has a very simple primer for the Floodgate API. For a full breakdown, see here.

Add Floodgate's API as a dependency:

Maven

<dependency>
    <groupId>org.geysermc.floodgate</groupId>
    <artifactId>api</artifactId>
    <version>2.2.2-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>

Gradle

dependencies {
    compileOnly('org.geysermc.floodgate:api:2.2.2-SNAPSHOT')
}

Get the Floodgate API using:

FloodgateApi api = FloodgateApi.getInstance();
api.isFloodgatePlayer(uuid);

For more information on the Floodgate API, see here.