mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Move PlatformType to API and expose it for extensions (#3798)
* Move PlatformType to API and expose it for extensions * Move to a record
This commit is contained in:
parent
8d068ee28f
commit
f272ed9383
24 changed files with 52 additions and 41 deletions
|
@ -35,6 +35,7 @@ import org.geysermc.geyser.api.event.EventRegistrar;
|
|||
import org.geysermc.geyser.api.extension.ExtensionManager;
|
||||
import org.geysermc.geyser.api.network.BedrockListener;
|
||||
import org.geysermc.geyser.api.network.RemoteServer;
|
||||
import org.geysermc.geyser.api.util.PlatformType;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
@ -124,6 +125,14 @@ public interface GeyserApi extends GeyserApiBase {
|
|||
@NonNull
|
||||
Path packDirectory();
|
||||
|
||||
/**
|
||||
* Gets {@link PlatformType} the extension is running on
|
||||
*
|
||||
* @return type of platform
|
||||
*/
|
||||
@NonNull
|
||||
PlatformType platformType();
|
||||
|
||||
/**
|
||||
* Gets the current {@link GeyserApiBase} instance.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.api.util;
|
||||
|
||||
/**
|
||||
* Represents the platform Geyser is running on.
|
||||
*/
|
||||
public record PlatformType(String platformName) {
|
||||
public static PlatformType ANDROID = new PlatformType("Android");
|
||||
public static PlatformType BUNGEECORD = new PlatformType("BungeeCord");
|
||||
public static PlatformType FABRIC = new PlatformType("Fabric");
|
||||
public static PlatformType SPIGOT = new PlatformType("Spigot");
|
||||
public static PlatformType SPONGE = new PlatformType("Sponge");
|
||||
public static PlatformType STANDALONE = new PlatformType("Standalone");
|
||||
public static PlatformType VELOCITY = new PlatformType("Velocity");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue