Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 22:40:18 +01:00
Updated ViaProxy API usage
Dieser Commit ist enthalten in:
Ursprung
2b5b91ad2c
Commit
1b855d687b
@ -11,7 +11,6 @@ dependencies {
|
||||
platformRelocate("net.kyori")
|
||||
platformRelocate("org.yaml")
|
||||
platformRelocate("it.unimi.dsi.fastutil")
|
||||
platformRelocate("com.mojang")
|
||||
platformRelocate("org.cloudburstmc.netty")
|
||||
|
||||
// These dependencies are already present on the platform
|
||||
|
@ -73,7 +73,7 @@ public class GeyserViaProxyBootstrap implements GeyserBootstrap {
|
||||
return;
|
||||
}
|
||||
|
||||
config.getRemote().setAuthType(Options.ONLINE_MODE ? AuthType.ONLINE : AuthType.OFFLINE);
|
||||
config.getRemote().setAuthType(AuthType.OFFLINE);
|
||||
GeyserConfiguration.checkGeyserConfiguration(this.config, this.logger);
|
||||
|
||||
this.geyser = GeyserImpl.load(PlatformType.VIAPROXY, this);
|
||||
|
@ -27,7 +27,6 @@ package org.geysermc.geyser.platform.viaproxy;
|
||||
import lombok.Getter;
|
||||
import net.raphimc.viaproxy.ViaProxy;
|
||||
import net.raphimc.viaproxy.cli.options.Options;
|
||||
import net.raphimc.viaproxy.plugins.PluginManager;
|
||||
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
|
||||
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
||||
import org.geysermc.geyser.text.AsteriskSerializer;
|
||||
@ -54,7 +53,7 @@ public class GeyserViaProxyDumpInfo extends BootstrapDumpInfo {
|
||||
this.serverPort = Options.BIND_PORT;
|
||||
this.plugins = new ArrayList<>();
|
||||
|
||||
for (ViaProxyPlugin plugin : PluginManager.getPlugins()) {
|
||||
for (ViaProxyPlugin plugin : ViaProxy.getPluginManager().getPlugins()) {
|
||||
this.plugins.add(new PluginInfo(true, plugin.getName(), plugin.getVersion(), "unknown", Collections.singletonList(plugin.getAuthor())));
|
||||
}
|
||||
}
|
||||
|
@ -26,17 +26,20 @@
|
||||
package org.geysermc.geyser.platform.viaproxy;
|
||||
|
||||
import net.lenni0451.lambdaevents.EventHandler;
|
||||
import net.raphimc.viaproxy.ViaProxy;
|
||||
import net.raphimc.viaproxy.plugins.PluginManager;
|
||||
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
|
||||
import net.raphimc.viaproxy.plugins.events.ConsoleCommandEvent;
|
||||
import net.raphimc.viaproxy.plugins.events.ProxyStartEvent;
|
||||
import net.raphimc.viaproxy.plugins.events.ProxyStopEvent;
|
||||
import net.raphimc.viaproxy.plugins.events.ShouldVerifyOnlineModeEvent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.text.GeyserLocale;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public class GeyserViaProxyPlugin extends ViaProxyPlugin {
|
||||
|
||||
@ -52,13 +55,12 @@ public class GeyserViaProxyPlugin extends ViaProxyPlugin {
|
||||
this.bootstrap = new GeyserViaProxyBootstrap(LOGGER, ROOT_FOLDER);
|
||||
GeyserLocale.init(this.bootstrap);
|
||||
this.bootstrap.onEnable();
|
||||
GeyserImpl.getInstance().shutdown();
|
||||
|
||||
PluginManager.EVENT_MANAGER.register(this);
|
||||
ViaProxy.EVENT_MANAGER.register(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onConsoleCommand(final ConsoleCommandEvent event) {
|
||||
private void onConsoleCommand(final ConsoleCommandEvent event) {
|
||||
if (event.getCommand().equals("geyser") || event.getCommand().equals("/geyser")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
@ -66,17 +68,23 @@ public class GeyserViaProxyPlugin extends ViaProxyPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
// Code below split apart from GeyserImpl.getInstance().reload();
|
||||
|
||||
@EventHandler
|
||||
public void onProxyStart(final ProxyStartEvent event) {
|
||||
GeyserImpl.getInstance().extensionManager().enableExtensions();
|
||||
this.bootstrap.onEnable();
|
||||
private void onShouldVerifyOnlineModeEvent(final ShouldVerifyOnlineModeEvent event) {
|
||||
final UUID uuid = event.getProxyConnection().getGameProfile().getId();
|
||||
if (uuid == null) return;
|
||||
|
||||
final GeyserSession connection = GeyserImpl.getInstance().onlineConnections().stream().filter(s -> s.javaUuid().equals(uuid)).findAny().orElse(null);
|
||||
if (connection == null) return;
|
||||
|
||||
if (connection.javaUsername().equals(event.getProxyConnection().getGameProfile().getName())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProxyStop(final ProxyStopEvent event) {
|
||||
GeyserImpl.getInstance().shutdown();
|
||||
private void onProxyStart(final ProxyStartEvent event) {
|
||||
GeyserImpl.getInstance().getSessionManager().disconnectAll("geyser.commands.reload.kick");
|
||||
GeyserImpl.getInstance().reload();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,4 +2,4 @@ name: "${name}-ViaProxy"
|
||||
version: "${version}"
|
||||
author: "${author}"
|
||||
main: "org.geysermc.geyser.platform.viaproxy.GeyserViaProxyPlugin"
|
||||
min-version: "3.0.21"
|
||||
min-version: "3.0.23"
|
||||
|
@ -28,7 +28,7 @@ adapters = "1.10-SNAPSHOT"
|
||||
commodore = "2.2"
|
||||
bungeecord = "a7c6ede"
|
||||
velocity = "3.1.1"
|
||||
viaproxy = "3.0.21"
|
||||
viaproxy = "3.0.23-SNAPSHOT"
|
||||
fabric-minecraft = "1.20.2"
|
||||
fabric-loader = "0.14.21"
|
||||
fabric-api = "0.89.0+1.20.2"
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren