Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-16 04:50:07 +01:00
Isolated Velocity
Dieser Commit ist enthalten in:
Ursprung
bc301fba60
Commit
d44b523acb
@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id("geyser.publish-conventions")
|
||||
id("geyser.shadow-conventions")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -55,12 +55,24 @@ public final class ClientEmoteEvent extends ConnectionEvent implements Cancellab
|
||||
* event is cancelled, but other Bedrock players will not see.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
public boolean cancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
public void cancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isCancelled() {
|
||||
return cancelled();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setCancelled(boolean cancelled) {
|
||||
cancelled(cancelled);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public final class SessionLoginEvent extends ConnectionEvent implements Cancella
|
||||
* @return The cancel status of the event.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
public boolean cancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@ -64,10 +64,11 @@ public final class SessionLoginEvent extends ConnectionEvent implements Cancella
|
||||
* @param cancelled If the login event should be cancelled.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
public void cancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cancels the login event, and disconnects the player with the specified reason.
|
||||
* If cancelled, the player disconnects without connecting to the remote server.
|
||||
@ -75,11 +76,28 @@ public final class SessionLoginEvent extends ConnectionEvent implements Cancella
|
||||
* @param cancelled If the login event should be cancelled.
|
||||
* @param disconnectReason The reason for the cancellation.
|
||||
*/
|
||||
public void setCancelled(boolean cancelled, @NonNull String disconnectReason) {
|
||||
public void cancelled(boolean cancelled, @NonNull String disconnectReason) {
|
||||
this.cancelled = cancelled;
|
||||
this.disconnectReason = disconnectReason;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isCancelled() {
|
||||
return cancelled();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setCancelled(boolean cancelled) {
|
||||
cancelled(cancelled);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setCancelled(boolean cancelled, @NonNull String disconnectReason) {
|
||||
cancelled(cancelled, disconnectReason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reason for the cancellation, or null if there is no reason given.
|
||||
*
|
||||
|
@ -58,15 +58,27 @@ public class ServerDefineCommandsEvent extends ConnectionEvent implements Cancel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
public boolean cancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
public void cancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isCancelled() {
|
||||
return cancelled();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setCancelled(boolean cancelled) {
|
||||
cancelled(cancelled);
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public interface CommandInfo {
|
||||
/**
|
||||
|
@ -58,15 +58,27 @@ public class ServerDefineCommandsEvent extends ConnectionEvent implements Cancel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
public boolean cancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
public void cancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isCancelled() {
|
||||
return cancelled();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setCancelled(boolean cancelled) {
|
||||
cancelled(cancelled);
|
||||
}
|
||||
|
||||
public interface CommandInfo {
|
||||
/**
|
||||
* Gets the name of the command.
|
||||
|
@ -1,3 +1,7 @@
|
||||
plugins {
|
||||
id("geyser.publish-conventions")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(projects.core)
|
||||
|
||||
@ -15,10 +19,6 @@ platformRelocate("org.yaml") // Broken as of 1.20
|
||||
// These dependencies are already present on the platform
|
||||
provided(libs.bungeecord.proxy)
|
||||
|
||||
application {
|
||||
mainClass.set("org.geysermc.geyser.platform.bungeecord.GeyserBungeeMain")
|
||||
}
|
||||
|
||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||
archiveBaseName.set("Geyser-BungeeCord")
|
||||
|
||||
|
35
bootstrap/bungeecord/isolated/build.gradle.kts
Normale Datei
35
bootstrap/bungeecord/isolated/build.gradle.kts
Normale Datei
@ -0,0 +1,35 @@
|
||||
plugins {
|
||||
java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(projects.isolation)
|
||||
compileOnlyApi(libs.velocity.api)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("org.geysermc.geyser.platform.bungeecord.BungeeMain")
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
dependsOn(":bungeecord-base:build", configurations.runtimeClasspath)
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
|
||||
|
||||
archiveBaseName = "geyser-${project.name}"
|
||||
archiveVersion = ""
|
||||
archiveClassifier = ""
|
||||
|
||||
val libsDir = project.projects
|
||||
.bungeecordBase.dependencyProject
|
||||
.layout.buildDirectory.dir("libs")
|
||||
|
||||
from(libsDir) {
|
||||
include("Geyser-BungeeCord.jar")
|
||||
rename("Geyser-BungeeCord.jar", "platform-base.jar")
|
||||
into("bundled/")
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
org.geysermc.geyser.platform.bungeecord.GeyserBungeePlatform
|
@ -1,3 +1,7 @@
|
||||
plugins {
|
||||
id("geyser.publish-conventions")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(projects.core)
|
||||
api(libs.erosion.bukkit.common) {
|
||||
@ -30,10 +34,6 @@ platformRelocate("org.yaml") // Broken as of 1.20
|
||||
provided(libs.viaversion)
|
||||
provided("com.mojang", "authlib", "1.5.21")
|
||||
|
||||
application {
|
||||
mainClass.set("org.geysermc.geyser.platform.spigot.GeyserSpigotMain")
|
||||
}
|
||||
|
||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||
archiveBaseName.set("Geyser-Spigot")
|
||||
|
||||
|
35
bootstrap/spigot/isolated/build.gradle.kts
Normale Datei
35
bootstrap/spigot/isolated/build.gradle.kts
Normale Datei
@ -0,0 +1,35 @@
|
||||
plugins {
|
||||
java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(projects.isolation)
|
||||
compileOnlyApi(libs.velocity.api)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("org.geysermc.geyser.platform.spigot.SpigotMain")
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
dependsOn(":spigot-base:build", configurations.runtimeClasspath)
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
|
||||
|
||||
archiveBaseName = "geyser-${project.name}"
|
||||
archiveVersion = ""
|
||||
archiveClassifier = ""
|
||||
|
||||
val libsDir = project.projects
|
||||
.spigotBase.dependencyProject
|
||||
.layout.buildDirectory.dir("libs")
|
||||
|
||||
from(libsDir) {
|
||||
include("Geyser-Spigot.jar")
|
||||
rename("Geyser-Spigot.jar", "platform-base.jar")
|
||||
into("bundled/")
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
org.geysermc.geyser.platform.spigot.GeyserSpigotPlatform
|
@ -4,6 +4,7 @@ val terminalConsoleVersion = "1.2.0"
|
||||
val jlineVersion = "3.21.0"
|
||||
|
||||
dependencies {
|
||||
api(projects.api)
|
||||
api(projects.core)
|
||||
|
||||
implementation(libs.terminalconsoleappender) {
|
||||
|
@ -1,5 +1,8 @@
|
||||
plugins {
|
||||
id("geyser.publish-conventions")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
annotationProcessor(libs.velocity.api)
|
||||
implementation(libs.floodgate.velocity)
|
||||
api(projects.core)
|
||||
|
||||
@ -38,10 +41,6 @@ exclude("net.kyori:adventure-text-serializer-gson:*")
|
||||
exclude("net.kyori:adventure-text-serializer-legacy:*")
|
||||
exclude("net.kyori:adventure-nbt:*")
|
||||
|
||||
application {
|
||||
mainClass.set("org.geysermc.geyser.platform.velocity.GeyserVelocityMain")
|
||||
}
|
||||
|
||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||
archiveBaseName.set("Geyser-Velocity")
|
||||
|
||||
|
@ -44,7 +44,7 @@ public final class GeyserVelocityConfiguration extends GeyserJacksonConfiguratio
|
||||
@JsonIgnore
|
||||
private Path floodgateKeyPath;
|
||||
|
||||
public void loadFloodgate(GeyserVelocityPlugin plugin, ProxyServer proxyServer, File dataFolder) {
|
||||
public void loadFloodgate(GeyserVelocityPlatform plugin, ProxyServer proxyServer, File dataFolder) {
|
||||
Optional<PluginContainer> floodgate = proxyServer.getPluginManager().getPlugin("floodgate");
|
||||
Path floodgateDataPath = floodgate.isPresent() ? Paths.get("plugins/floodgate/") : null;
|
||||
floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgateDataPath, dataFolder.toPath(), plugin.getGeyserLogger());
|
||||
|
@ -28,18 +28,22 @@ package org.geysermc.geyser.platform.velocity;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.velocitypowered.api.command.CommandManager;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ListenerBoundEvent;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
|
||||
import com.velocitypowered.api.network.ListenerType;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.floodgate.core.FloodgatePlatform;
|
||||
import org.geysermc.floodgate.isolation.IsolatedPlatform;
|
||||
import org.geysermc.floodgate.isolation.library.LibraryManager;
|
||||
import org.geysermc.floodgate.velocity.VelocityPlatform;
|
||||
import org.geysermc.geyser.GeyserBootstrap;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
@ -54,21 +58,11 @@ import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
|
||||
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
||||
import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandExecutor;
|
||||
import org.geysermc.geyser.platform.velocity.floodgate.FloodgateModule;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
import org.geysermc.geyser.util.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Plugin(id = "geyser", name = GeyserImpl.NAME + "-Velocity", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC")
|
||||
public class GeyserVelocityPlugin implements GeyserBootstrap {
|
||||
public class GeyserVelocityPlatform implements GeyserBootstrap, IsolatedPlatform {
|
||||
@Inject
|
||||
private Logger logger;
|
||||
|
||||
@ -87,10 +81,12 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
||||
private GeyserImpl geyser;
|
||||
|
||||
@Getter
|
||||
private final Path configFolder = Paths.get("plugins/" + GeyserImpl.NAME + "-Velocity/");
|
||||
private final Path configFolder = Paths.get("plugins/" + GeyserImpl.NAME + "-Velocity/"); //todo remove
|
||||
|
||||
@Inject
|
||||
private Injector guice;
|
||||
@Inject Injector guice;
|
||||
@Inject LibraryManager manager; // don't remove! We don't need it in Geyser, but in Floodgate. Weird Guice stuff
|
||||
|
||||
@Inject PluginContainer container;
|
||||
|
||||
@Override
|
||||
public void onGeyserInitialize() {
|
||||
@ -114,7 +110,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
||||
|
||||
FloodgatePlatform platform = null;
|
||||
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE) {
|
||||
platform = guice.createChildInjector(new FloodgateModule(configFolder)).getInstance(VelocityPlatform.class);
|
||||
platform = guice.getInstance(VelocityPlatform.class);
|
||||
}
|
||||
|
||||
this.geyser = GeyserImpl.load(PlatformType.VELOCITY, this, platform);
|
||||
@ -157,7 +153,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
||||
this.commandManager.register(entry.getKey().description().id(), new GeyserVelocityCommandExecutor(this.geyser, commands));
|
||||
}
|
||||
|
||||
proxyServer.getEventManager().register(this, new GeyserVelocityUpdateListener());
|
||||
proxyServer.getEventManager().register(container, new GeyserVelocityUpdateListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -197,29 +193,6 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
||||
return geyserPingPassthrough;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onInit(ProxyInitializeEvent event) {
|
||||
this.onGeyserInitialize();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onShutdown(ProxyShutdownEvent event) {
|
||||
this.onGeyserShutdown();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyBound(ListenerBoundEvent event) {
|
||||
if (event.getListenerType() == ListenerType.MINECRAFT) {
|
||||
// Once listener is bound, do our startup process
|
||||
this.onGeyserEnable();
|
||||
|
||||
if (geyserInjector != null) {
|
||||
// After this bound, we know that the channel initializer cannot change without it being ineffective for Velocity, too
|
||||
geyserInjector.initializeLocalChannel(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BootstrapDumpInfo getDumpInfo() {
|
||||
return new GeyserVelocityDumpInfo(proxyServer);
|
||||
@ -268,4 +241,24 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
this.onGeyserInitialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
this.onGeyserEnable();
|
||||
|
||||
if (geyserInjector != null) {
|
||||
// After this bound, we know that the channel initializer cannot change without it being ineffective for Velocity, too
|
||||
geyserInjector.initializeLocalChannel(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
this.onGeyserDisable();
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 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.platform.velocity.floodgate;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import java.nio.file.Path;
|
||||
import org.geysermc.floodgate.isolation.library.LibraryManager;
|
||||
|
||||
public class FloodgateModule extends AbstractModule {
|
||||
private final Path dataDirectory;
|
||||
|
||||
public FloodgateModule(Path dataDirectory) {
|
||||
this.dataDirectory = dataDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
var libsDirectory = dataDirectory.resolve("libs");
|
||||
bind(LibraryManager.class).toInstance(new LibraryManager(getClass().getClassLoader(), libsDirectory, true));
|
||||
}
|
||||
}
|
35
bootstrap/velocity/isolated/build.gradle.kts
Normale Datei
35
bootstrap/velocity/isolated/build.gradle.kts
Normale Datei
@ -0,0 +1,35 @@
|
||||
plugins {
|
||||
java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(projects.isolation)
|
||||
compileOnlyApi(libs.velocity.api)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("org.geysermc.geyser.platform.velocity.VelocityMain")
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
dependsOn(":velocity-base:build", configurations.runtimeClasspath)
|
||||
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
|
||||
|
||||
archiveBaseName = "geyser-${project.name}"
|
||||
archiveVersion = ""
|
||||
archiveClassifier = ""
|
||||
|
||||
val libsDir = project.projects
|
||||
.velocityBase.dependencyProject
|
||||
.layout.buildDirectory.dir("libs")
|
||||
|
||||
from(libsDir) {
|
||||
include("Geyser-Velocity.jar")
|
||||
rename("Geyser-Velocity.jar", "platform-base.jar")
|
||||
into("bundled/")
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2024 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.platform.velocity;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ListenerBoundEvent;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
|
||||
import com.velocitypowered.api.network.ListenerType;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import java.nio.file.Path;
|
||||
import org.geysermc.floodgate.isolation.library.LibraryManager;
|
||||
import org.geysermc.floodgate.isolation.loader.PlatformHolder;
|
||||
import org.geysermc.floodgate.isolation.loader.PlatformLoader;
|
||||
|
||||
public final class IsolatedVelocityPlugin {
|
||||
private final PlatformHolder holder;
|
||||
|
||||
@Inject
|
||||
public IsolatedVelocityPlugin(Injector guice, @DataDirectory Path dataDirectory) {
|
||||
try {
|
||||
var libsDirectory = dataDirectory.resolve("libs");
|
||||
|
||||
holder = PlatformLoader.loadDefault(getClass().getClassLoader(), libsDirectory);
|
||||
Injector child = guice.createChildInjector(new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(LibraryManager.class).toInstance(holder.manager());
|
||||
}
|
||||
});
|
||||
|
||||
holder.platformInstance(child.getInstance(holder.platformClass()));
|
||||
} catch (Exception exception) {
|
||||
throw new RuntimeException("Failed to load Floodgate", exception);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onInit(ProxyInitializeEvent event) {
|
||||
holder.load();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onShutdown(ProxyShutdownEvent event) {
|
||||
holder.disable();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyBound(ListenerBoundEvent event) {
|
||||
if (event.getListenerType() == ListenerType.MINECRAFT) {
|
||||
// Once listener is bound, do our startup process
|
||||
holder.enable();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2024 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
|
||||
@ -27,10 +27,9 @@ package org.geysermc.geyser.platform.velocity;
|
||||
|
||||
import org.geysermc.geyser.GeyserMain;
|
||||
|
||||
public class GeyserVelocityMain extends GeyserMain {
|
||||
|
||||
public class VelocityMain extends GeyserMain {
|
||||
public static void main(String[] args) {
|
||||
new GeyserVelocityMain().displayMessage();
|
||||
new VelocityMain().displayMessage();
|
||||
}
|
||||
|
||||
public String getPluginType() {
|
||||
@ -40,4 +39,4 @@ public class GeyserVelocityMain extends GeyserMain {
|
||||
public String getPluginFolder() {
|
||||
return "plugins";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
org.geysermc.geyser.platform.velocity.GeyserVelocityPlatform
|
@ -0,0 +1 @@
|
||||
{"id": "${id}", "name": "${name}", "version": "${version}", "description": "${description}", "url": "${url}", "authors": ["${author}"], "main": "org.geysermc.geyser.platform.velocity.IsolatedVelocityPlugin"}
|
@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
// Ensure AP works in eclipse (no effect on other IDEs)
|
||||
`eclipse`
|
||||
eclipse
|
||||
id("geyser.build-logic")
|
||||
id("io.freefair.lombok") version "8.3" apply false
|
||||
}
|
||||
@ -21,12 +21,9 @@ java {
|
||||
val platforms = setOf(
|
||||
projects.fabric,
|
||||
projects.bungeecord,
|
||||
projects.bungeecordBase,
|
||||
projects.spigot,
|
||||
projects.spigotBase,
|
||||
projects.standalone,
|
||||
projects.velocity,
|
||||
projects.velocityBase
|
||||
).map { it.dependencyProject }
|
||||
|
||||
subprojects {
|
||||
|
@ -8,9 +8,8 @@ plugins {
|
||||
|
||||
dependencies {
|
||||
api(libs.floodgate.core)
|
||||
api(libs.floodgate.isolation)
|
||||
annotationProcessor(libs.floodgate.core)
|
||||
api(projects.api)
|
||||
compileOnlyApi(libs.base.api)
|
||||
compileOnlyApi(projects.isolation)
|
||||
|
||||
// Jackson JSON and YAML serialization
|
||||
api(libs.bundles.jackson)
|
||||
|
@ -929,7 +929,7 @@ public class GeyserSession extends FloodgateConnection implements GeyserConnecti
|
||||
private void connectDownstream() {
|
||||
SessionLoginEvent loginEvent = new SessionLoginEvent(this, remoteServer);
|
||||
GeyserImpl.getInstance().eventBus().fire(loginEvent);
|
||||
if (loginEvent.isCancelled()) {
|
||||
if (loginEvent.cancelled()) {
|
||||
String disconnectReason = loginEvent.disconnectReason() == null ?
|
||||
BedrockDisconnectReasons.DISCONNECTED : loginEvent.disconnectReason();
|
||||
disconnect(disconnectReason);
|
||||
|
@ -51,7 +51,7 @@ public class BedrockEmoteTranslator extends PacketTranslator<EmotePacket> {
|
||||
// For the future: could have a method that exposes which players will see the emote
|
||||
ClientEmoteEvent event = new ClientEmoteEvent(session, packet.getEmoteId());
|
||||
session.getGeyser().eventBus().fire(event);
|
||||
if (event.isCancelled()) {
|
||||
if (event.cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -152,13 +152,13 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
||||
|
||||
var event = new ServerDefineCommandsEvent(session, commands.keySet());
|
||||
eventBus.fire(event);
|
||||
if (event.isCancelled()) {
|
||||
if (event.cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var oldEvent = new org.geysermc.geyser.api.event.downstream.ServerDefineCommandsEvent(session, commands.keySet());
|
||||
eventBus.fire(oldEvent);
|
||||
if (oldEvent.isCancelled()) {
|
||||
if (oldEvent.cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
# Don't remove this, it's copied from Floodgate-Core.
|
||||
# Without this file only ReactorConverterRegistrar would be in it for whatever reason, resulting in content type is null
|
||||
io.micronaut.reactor.convert.ReactorConverterRegistrar
|
||||
io.micronaut.http.client.loadbalance.LoadBalancerConverters
|
||||
io.micronaut.http.HttpTypeConverterRegistrar
|
||||
io.micronaut.http.converters.SharedHttpConvertersRegistrar
|
||||
io.micronaut.runtime.converters.time.TimeConverterRegistrar
|
||||
io.micronaut.logging.LoggingConverterRegistrar
|
||||
io.micronaut.inject.annotation.AnnotationConvertersRegistrar
|
||||
io.micronaut.core.async.converters.ReactiveTypeConverterRegistrar
|
@ -7,5 +7,5 @@ org.gradle.vfs.watch=false
|
||||
|
||||
group=org.geysermc
|
||||
id=geyser
|
||||
version=3.0.2-SNAPSHOT
|
||||
version=3.0.0-SNAPSHOT
|
||||
description=Allows for players from Minecraft: Bedrock Edition to join Minecraft: Java Edition servers.
|
@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
base-api = "feature-floodgate-merge-1.0.0-SNAPSHOT"
|
||||
base-api = "feature-floodgate-merge-1.1.0-SNAPSHOT"
|
||||
floodgate = "development-2.2.2-SNAPSHOT"
|
||||
cumulus = "1.1.2"
|
||||
erosion = "1.0-20230406.174837-8"
|
||||
|
8
isolation/build.gradle.kts
Normale Datei
8
isolation/build.gradle.kts
Normale Datei
@ -0,0 +1,8 @@
|
||||
plugins {
|
||||
id("geyser.base-conventions")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(libs.floodgate.isolation)
|
||||
api(projects.api)
|
||||
}
|
@ -59,6 +59,7 @@ rootProject.name = "geyser-parent"
|
||||
|
||||
include(":ap")
|
||||
include(":api")
|
||||
include(":isolation")
|
||||
include(":fabric")
|
||||
include(":standalone")
|
||||
include(":core")
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren