3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 08:30:12 +01:00

Remove GeyserPluginBootstrap as it's no longer necessary

Dieser Commit ist enthalten in:
Camotoy 2024-09-22 13:05:33 -04:00
Ursprung 5551169c4c
Commit 45f8baf49e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
11 geänderte Dateien mit 27 neuen und 61 gelöschten Zeilen

Datei anzeigen

@ -40,8 +40,8 @@ import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.netty.PipelineUtils;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.network.netty.GeyserInjector;
import org.geysermc.geyser.network.netty.LocalServerChannelWrapper;
import org.geysermc.geyser.network.netty.LocalSession;
@ -67,7 +67,7 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener {
@Override
@SuppressWarnings("unchecked")
protected void initializeLocalChannel0(GeyserPluginBootstrap bootstrap) throws Exception {
protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception {
// TODO - allow Geyser to specify its own listener info properties
if (proxy.getConfig().getListeners().size() != 1) {
throw new UnsupportedOperationException("Geyser does not currently support multiple listeners with injection! " +
@ -191,7 +191,7 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener {
this.bungeeChannels = null;
if (this.localChannel != null) {
shutdown();
initializeLocalChannel((GeyserPluginBootstrap) GeyserImpl.getInstance().getBootstrap());
initializeLocalChannel(GeyserImpl.getInstance().getBootstrap());
}
}
}

Datei anzeigen

@ -34,8 +34,8 @@ import net.md_5.bungee.protocol.ProtocolConstants;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.geysermc.geyser.FloodgateKeyLoader;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.api.util.PlatformType;
import org.geysermc.geyser.command.CommandRegistry;
import org.geysermc.geyser.command.CommandSourceConverter;
@ -62,7 +62,7 @@ import java.util.Collection;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
public class GeyserBungeePlugin extends Plugin implements GeyserPluginBootstrap {
public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
private CommandRegistry commandRegistry;
private GeyserPluginConfig geyserConfig;

Datei anzeigen

@ -32,9 +32,9 @@ import net.minecraft.server.MinecraftServer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.geysermc.geyser.FloodgateKeyLoader;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.api.util.PlatformType;
import org.geysermc.geyser.command.CommandRegistry;
import org.geysermc.geyser.configuration.ConfigLoader;
@ -52,7 +52,7 @@ import java.net.SocketAddress;
import java.nio.file.Path;
@RequiredArgsConstructor
public abstract class GeyserModBootstrap implements GeyserPluginBootstrap {
public abstract class GeyserModBootstrap implements GeyserBootstrap {
@Getter
private static GeyserModBootstrap instance;

Datei anzeigen

@ -38,7 +38,6 @@ import net.minecraft.server.network.ServerConnectionListener;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.network.netty.GeyserInjector;
import org.geysermc.geyser.network.netty.LocalServerChannelWrapper;
import org.geysermc.geyser.platform.mod.platform.GeyserModPlatform;
@ -64,7 +63,7 @@ public class GeyserModInjector extends GeyserInjector {
}
@Override
protected void initializeLocalChannel0(GeyserPluginBootstrap bootstrap) throws Exception {
protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception {
ServerConnectionListener connection = this.server.getConnection();
// Find the channel that Minecraft uses to listen to connections

Datei anzeigen

@ -25,11 +25,13 @@
package org.geysermc.geyser.platform.spigot;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.local.LocalAddress;
import io.netty.util.concurrent.DefaultThreadFactory;
import org.bukkit.Bukkit;
@ -38,6 +40,7 @@ import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.network.netty.GeyserInjector;
import org.geysermc.geyser.network.netty.LocalServerChannelWrapper;
import org.geysermc.geyser.network.netty.LocalSession;
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@ -61,7 +64,7 @@ public class GeyserSpigotInjector extends GeyserInjector {
@Override
@SuppressWarnings("unchecked")
protected void initializeLocalChannel0(GeyserPluginBootstrap bootstrap) throws Exception {
protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception {
Class<?> serverClazz;
try {
serverClazz = Class.forName("net.minecraft.server.MinecraftServer");

Datei anzeigen

@ -43,8 +43,8 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.FloodgateKeyLoader;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.adapters.paper.PaperAdapters;
import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
import org.geysermc.geyser.api.event.lifecycle.GeyserRegisterPermissionsEvent;
@ -77,7 +77,7 @@ import java.nio.file.Path;
import java.util.List;
import java.util.Objects;
public class GeyserSpigotPlugin extends JavaPlugin implements GeyserPluginBootstrap {
public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
private CommandRegistry commandRegistry;
private GeyserPluginConfig geyserConfig;

Datei anzeigen

@ -35,7 +35,7 @@ import io.netty.channel.EventLoopGroup;
import io.netty.channel.WriteBufferWaterMark;
import io.netty.channel.local.LocalAddress;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.network.netty.GeyserInjector;
import org.geysermc.geyser.network.netty.LocalServerChannelWrapper;
@ -52,7 +52,7 @@ public class GeyserVelocityInjector extends GeyserInjector {
@Override
@SuppressWarnings("unchecked")
protected void initializeLocalChannel0(GeyserPluginBootstrap bootstrap) throws Exception {
protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception {
Field cm = proxy.getClass().getDeclaredField("cm");
cm.setAccessible(true);
Object connectionManager = cm.get(proxy);

Datei anzeigen

@ -40,8 +40,8 @@ import lombok.Getter;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.geysermc.geyser.FloodgateKeyLoader;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.api.util.PlatformType;
import org.geysermc.geyser.command.CommandRegistry;
import org.geysermc.geyser.command.CommandSourceConverter;
@ -67,7 +67,7 @@ import java.nio.file.Paths;
import java.util.Optional;
@Plugin(id = "geyser", name = GeyserImpl.NAME + "-Velocity", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC")
public class GeyserVelocityPlugin implements GeyserPluginBootstrap {
public class GeyserVelocityPlugin implements GeyserBootstrap {
private final ProxyServer proxyServer;
private final PluginContainer container;

Datei anzeigen

@ -36,9 +36,9 @@ import net.raphimc.viaproxy.plugins.events.ShouldVerifyOnlineModeEvent;
import net.raphimc.viaproxy.protocoltranslator.viaproxy.ViaProxyConfig;
import org.apache.logging.log4j.LogManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.api.event.EventRegistrar;
import org.geysermc.geyser.api.network.AuthType;
import org.geysermc.geyser.api.util.PlatformType;
@ -61,7 +61,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.UUID;
public class GeyserViaProxyPlugin extends ViaProxyPlugin implements GeyserPluginBootstrap, EventRegistrar {
public class GeyserViaProxyPlugin extends ViaProxyPlugin implements GeyserBootstrap, EventRegistrar {
private static final File ROOT_FOLDER = new File(PluginManager.PLUGINS_DIR, "Geyser");

Datei anzeigen

@ -1,36 +0,0 @@
/*
* Copyright (c) 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;
import org.geysermc.geyser.configuration.GeyserPluginConfig;
/**
* Used in any instance where Geyser is directly attached to a server instance of some sort.
*/
public interface GeyserPluginBootstrap extends GeyserBootstrap {
@Override
GeyserPluginConfig config();
}

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.geyser.network.netty;
import io.netty.channel.ChannelFuture;
import lombok.Getter;
import org.geysermc.geyser.GeyserPluginBootstrap;
import org.geysermc.geyser.GeyserBootstrap;
import java.net.SocketAddress;
@ -49,7 +49,7 @@ public abstract class GeyserInjector {
/**
* @param bootstrap the bootstrap of the Geyser instance.
*/
public void initializeLocalChannel(GeyserPluginBootstrap bootstrap) {
public void initializeLocalChannel(GeyserBootstrap bootstrap) {
if (!bootstrap.config().advanced().useDirectConnection()) {
bootstrap.getGeyserLogger().debug("Disabling direct injection!");
return;
@ -71,9 +71,9 @@ public abstract class GeyserInjector {
}
/**
* The method to implement that is called by {@link #initializeLocalChannel(GeyserPluginBootstrap)} wrapped around a try/catch.
* The method to implement that is called by {@link #initializeLocalChannel(GeyserBootstrap)} wrapped around a try/catch.
*/
protected abstract void initializeLocalChannel0(GeyserPluginBootstrap bootstrap) throws Exception;
protected abstract void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception;
public void shutdown() {
if (localChannel != null && localChannel.channel().isOpen()) {