Skip to content

Commit

Permalink
Move from Plugin to Extension
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 7758500
Author: bundabrg <bundabrg@grieve.com.au>
Date:   Sun Aug 30 13:27:42 2020 +0800

    Update Build

commit 9c8b0e8
Author: bundabrg <bundabrg@grieve.com.au>
Date:   Sun Aug 30 13:16:09 2020 +0800

    Move from GeyserPlugin to GeyserExtension
  • Loading branch information
bundabrg committed Aug 30, 2020
1 parent 9aba8b1 commit 1489543
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ jobs:
# Set Maven Version
mvn -B versions:set -DnewVersion=${MAVEN_VERSION}
# Set Plugin Version
sed -i "/version = .*/ s/version = \"[^\"]*\"/version = \"${MAVEN_VERSION}\"/" geyser-reversion/src/main/java/au/com/grieve/geyser/reversion/GeyserReversionPlugin.java
# Set Extension Version
sed -i "/version = .*/ s/version = \"[^\"]*\"/version = \"${MAVEN_VERSION}\"/" geyser-reversion/src/main/java/au/com/grieve/geyser/reversion/GeyserReversionExtension.java
- name: Update Version for Developmental Build
if: "!startsWith(github.ref,'refs/tags/v')"
run: |
sed -i "/version = .*/ s/-dev/-b${GITHUB_RUN_NUMBER}/" geyser-reversion/src/main/java/au/com/grieve/geyser/reversion/GeyserReversionPlugin.java
sed -i "/version = .*/ s/-dev/-b${GITHUB_RUN_NUMBER}/" geyser-reversion/src/main/java/au/com/grieve/geyser/reversion/GeyserReversionExtension.java
- name: Build with Maven
run: |
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

---

GeyserReversion is a Geyser Plugin that provides protocol level support for MultiVersion in Geyser and will eventually
GeyserReversion is a Geyser Extension that provides protocol level support for MultiVersion in Geyser and will eventually
allow any supported version to connect to any supported Geyser.

## Features
Expand All @@ -46,11 +46,11 @@ allow any supported version to connect to any supported Geyser.

## Quick Start

1. Make sure you are running a build of Geyser that supports native plugins. You can find a prebuilt one [here](https://github.com/bundabrg/Geyser/releases).
1. Make sure you are running a build of Geyser that supports native extensions. You can find a prebuilt one [here](https://github.com/bundabrg/Geyser/releases).

2. Down the latest [GeyserReversion](https://github.com/bundabrg/GeyserReversion/releases) and place it inside your Geyser plugins folder. Note this is
a folder 'plugins' underneath your Geyser folder. If you are running a plugin version of Geyser (Spigot/Bungeecord/Velocity) then
make sure to place it inside the `plugins/Geyser/plugins` folder. Standalone verison of Geyser will be a `plugins` folder
2. Down the latest [GeyserReversion](https://github.com/bundabrg/GeyserReversion/releases) and place it inside your Geyser extensions folder. Note this is
a folder 'extensions' underneath your Geyser folder. If you are running a extension version of Geyser (Spigot/Bungeecord/Velocity) then
make sure to place it inside the `extensions/Geyser/extensions` folder. Standalone verison of Geyser will be a `extensions` folder
where your Geyser.jar file is located.

3. Start Geyser. It should show some indication that GeyserReversion is running. For example:
Expand Down
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Logo](img/title.png)

GeyserReversion is a Geyser Plugin that provides protocol level support for MultiVersion in Geyser and will eventually
GeyserReversion is a Geyser Extension that provides protocol level support for MultiVersion in Geyser and will eventually
allow any supported version to connect to any supported Geyser.

## Features
Expand All @@ -24,11 +24,11 @@ allow any supported version to connect to any supported Geyser.

## Quick Start

1. Make sure you are running a build of Geyser that supports native plugins. You can find a prebuilt one [here](https://github.com/bundabrg/Geyser/releases).
1. Make sure you are running a build of Geyser that supports native extensions. You can find a prebuilt one [here](https://github.com/bundabrg/Geyser/releases).

2. Down the latest [GeyserReversion](https://github.com/bundabrg/GeyserReversion/releases) and place it inside your Geyser plugins folder. Note this is
a folder 'plugins' underneath your Geyser folder. If you are running a plugin version of Geyser (Spigot/Bungeecord/Velocity) then
make sure to place it inside the `plugins/Geyser/plugins` folder. Standalone verison of Geyser will be a `plugins` folder
2. Down the latest [GeyserReversion](https://github.com/bundabrg/GeyserReversion/releases) and place it inside your Geyser extensions folder. Note this is
a folder 'extensions' underneath your Geyser folder. If you are running a extension version of Geyser (Spigot/Bungeecord/Velocity) then
make sure to place it inside the `extensions/Geyser/extensions` folder. Standalone verison of Geyser will be a `extensions` folder
where your Geyser.jar file is located.

3. Start Geyser. It should show some indication that GeyserReversion is running. For example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
import org.geysermc.connector.event.annotations.GeyserEventHandler;
import org.geysermc.connector.event.events.geyser.GeyserStartEvent;
import org.geysermc.connector.event.handlers.EventHandler;
import org.geysermc.connector.plugin.GeyserPlugin;
import org.geysermc.connector.plugin.PluginClassLoader;
import org.geysermc.connector.plugin.PluginManager;
import org.geysermc.connector.plugin.annotations.Plugin;
import org.geysermc.connector.extension.ExtensionClassLoader;
import org.geysermc.connector.extension.ExtensionManager;
import org.geysermc.connector.extension.GeyserExtension;
import org.geysermc.connector.extension.annotations.Extension;
import org.geysermc.connector.utils.LanguageUtils;

import java.io.File;
Expand All @@ -52,24 +52,24 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;

@Plugin(
@Extension(
name = "GeyserReversion",
version = "1.1.0-dev",
authors = {"bundabrg"},
description = "Provides multiversion protocol support for Geyser"
)
@Getter
public class GeyserReversionPlugin extends GeyserPlugin {
public class GeyserReversionExtension extends GeyserExtension {
@Getter
private static GeyserReversionPlugin instance;
private static GeyserReversionExtension instance;

private final Map<String, Edition> registeredEditions = new HashMap<>();
private final List<RegisteredTranslator> registeredTranslators = new ArrayList<>();

private Configuration config;

public GeyserReversionPlugin(PluginManager pluginManager, PluginClassLoader pluginClassLoader) {
super(pluginManager, pluginClassLoader);
public GeyserReversionExtension(ExtensionManager extensionManager, ExtensionClassLoader extensionClassLoader) {
super(extensionManager, extensionClassLoader);
instance = this;

loadConfig();
Expand Down Expand Up @@ -140,7 +140,7 @@ public void onGeyserStart(GeyserStartEvent event) {
Edition edition = registeredEditions.get(config.getEdition());

if (edition == null) {
getLogger().error(String.format("Invalid Edition '%s'. Plugin disabled.", config.getEdition()));
getLogger().error(String.format("Invalid Edition '%s'. Extension disabled.", config.getEdition()));
return;
}

Expand All @@ -160,7 +160,7 @@ public void onGeyserStart(GeyserStartEvent event) {
bedrockServer.set(GeyserConnector.getInstance(), server);

} catch (NoSuchFieldException | IllegalAccessException e) {
getLogger().error(String.format("Unable to set Edition '%s'. Plugin disabled.", config.getEdition()), e);
getLogger().error(String.format("Unable to set Edition '%s'. Extension disabled.", config.getEdition()), e);
}

// Give the old BedrockServer time to close down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
import au.com.grieve.reversion.editions.bedrock.BedrockReversionServer;
import lombok.RequiredArgsConstructor;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.extension.GeyserExtension;
import org.geysermc.connector.network.BedrockProtocol;
import org.geysermc.connector.plugin.GeyserPlugin;

import java.net.InetSocketAddress;

@RequiredArgsConstructor
public class BedrockEdition implements Edition {
private final GeyserPlugin plugin;
private final GeyserExtension extension;

@Override
public ReversionServer createReversionServer(InetSocketAddress address) {
plugin.getLogger().info("BedrockServer listening on " + address.toString());
extension.getLogger().info("BedrockServer listening on " + address.toString());
ReversionServer server = new BedrockReversionServer("bedrock", BedrockProtocol.DEFAULT_BEDROCK_CODEC, address);
server.setHandler(new BedrockServerEventHandler(GeyserConnector.getInstance()));
return server;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.event.annotations.GeyserEventHandler;
import org.geysermc.connector.event.events.geyser.GeyserStartEvent;
import org.geysermc.connector.extension.GeyserExtension;
import org.geysermc.connector.network.BedrockProtocol;
import org.geysermc.connector.plugin.GeyserPlugin;

import java.io.File;
import java.net.InetSocketAddress;

@Getter
public class EducationEdition implements Edition {
private final GeyserPlugin plugin;
private final GeyserExtension extension;
private final TokenManager tokenManager;

public EducationEdition(GeyserPlugin plugin) {
this.plugin = plugin;
public EducationEdition(GeyserExtension extension) {
this.extension = extension;

this.tokenManager = new TokenManager(new File(plugin.getDataFolder(), "tokens.yml"));
this.tokenManager = new TokenManager(new File(extension.getDataFolder(), "tokens.yml"));

// Register Events
plugin.registerEvents(this);
extension.registerEvents(this);
}

@GeyserEventHandler
Expand All @@ -57,7 +57,7 @@ public void onGeyserStart(GeyserStartEvent event) {

@Override
public ReversionServer createReversionServer(InetSocketAddress address) {
plugin.getLogger().info("EducationServer listening on " + address.toString());
extension.getLogger().info("EducationServer listening on " + address.toString());
ReversionServer server = new EducationReversionServer("bedrock", BedrockProtocol.DEFAULT_BEDROCK_CODEC, tokenManager, address);
server.setHandler(new BedrockServerEventHandler(GeyserConnector.getInstance()));
return server;
Expand Down

0 comments on commit 1489543

Please sign in to comment.