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("net.kyori")
|
||||||
platformRelocate("org.yaml")
|
platformRelocate("org.yaml")
|
||||||
platformRelocate("it.unimi.dsi.fastutil")
|
platformRelocate("it.unimi.dsi.fastutil")
|
||||||
platformRelocate("com.mojang")
|
|
||||||
platformRelocate("org.cloudburstmc.netty")
|
platformRelocate("org.cloudburstmc.netty")
|
||||||
|
|
||||||
// These dependencies are already present on the platform
|
// These dependencies are already present on the platform
|
||||||
|
@ -73,7 +73,7 @@ public class GeyserViaProxyBootstrap implements GeyserBootstrap {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.getRemote().setAuthType(Options.ONLINE_MODE ? AuthType.ONLINE : AuthType.OFFLINE);
|
config.getRemote().setAuthType(AuthType.OFFLINE);
|
||||||
GeyserConfiguration.checkGeyserConfiguration(this.config, this.logger);
|
GeyserConfiguration.checkGeyserConfiguration(this.config, this.logger);
|
||||||
|
|
||||||
this.geyser = GeyserImpl.load(PlatformType.VIAPROXY, this);
|
this.geyser = GeyserImpl.load(PlatformType.VIAPROXY, this);
|
||||||
|
@ -27,7 +27,6 @@ package org.geysermc.geyser.platform.viaproxy;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.raphimc.viaproxy.ViaProxy;
|
import net.raphimc.viaproxy.ViaProxy;
|
||||||
import net.raphimc.viaproxy.cli.options.Options;
|
import net.raphimc.viaproxy.cli.options.Options;
|
||||||
import net.raphimc.viaproxy.plugins.PluginManager;
|
|
||||||
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
|
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
|
||||||
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
import org.geysermc.geyser.dump.BootstrapDumpInfo;
|
||||||
import org.geysermc.geyser.text.AsteriskSerializer;
|
import org.geysermc.geyser.text.AsteriskSerializer;
|
||||||
@ -54,7 +53,7 @@ public class GeyserViaProxyDumpInfo extends BootstrapDumpInfo {
|
|||||||
this.serverPort = Options.BIND_PORT;
|
this.serverPort = Options.BIND_PORT;
|
||||||
this.plugins = new ArrayList<>();
|
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())));
|
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;
|
package org.geysermc.geyser.platform.viaproxy;
|
||||||
|
|
||||||
import net.lenni0451.lambdaevents.EventHandler;
|
import net.lenni0451.lambdaevents.EventHandler;
|
||||||
|
import net.raphimc.viaproxy.ViaProxy;
|
||||||
import net.raphimc.viaproxy.plugins.PluginManager;
|
import net.raphimc.viaproxy.plugins.PluginManager;
|
||||||
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
|
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
|
||||||
import net.raphimc.viaproxy.plugins.events.ConsoleCommandEvent;
|
import net.raphimc.viaproxy.plugins.events.ConsoleCommandEvent;
|
||||||
import net.raphimc.viaproxy.plugins.events.ProxyStartEvent;
|
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.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class GeyserViaProxyPlugin extends ViaProxyPlugin {
|
public class GeyserViaProxyPlugin extends ViaProxyPlugin {
|
||||||
|
|
||||||
@ -52,13 +55,12 @@ public class GeyserViaProxyPlugin extends ViaProxyPlugin {
|
|||||||
this.bootstrap = new GeyserViaProxyBootstrap(LOGGER, ROOT_FOLDER);
|
this.bootstrap = new GeyserViaProxyBootstrap(LOGGER, ROOT_FOLDER);
|
||||||
GeyserLocale.init(this.bootstrap);
|
GeyserLocale.init(this.bootstrap);
|
||||||
this.bootstrap.onEnable();
|
this.bootstrap.onEnable();
|
||||||
GeyserImpl.getInstance().shutdown();
|
|
||||||
|
|
||||||
PluginManager.EVENT_MANAGER.register(this);
|
ViaProxy.EVENT_MANAGER.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onConsoleCommand(final ConsoleCommandEvent event) {
|
private void onConsoleCommand(final ConsoleCommandEvent event) {
|
||||||
if (event.getCommand().equals("geyser") || event.getCommand().equals("/geyser")) {
|
if (event.getCommand().equals("geyser") || event.getCommand().equals("/geyser")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -66,17 +68,23 @@ public class GeyserViaProxyPlugin extends ViaProxyPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code below split apart from GeyserImpl.getInstance().reload();
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onProxyStart(final ProxyStartEvent event) {
|
private void onShouldVerifyOnlineModeEvent(final ShouldVerifyOnlineModeEvent event) {
|
||||||
GeyserImpl.getInstance().extensionManager().enableExtensions();
|
final UUID uuid = event.getProxyConnection().getGameProfile().getId();
|
||||||
this.bootstrap.onEnable();
|
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
|
@EventHandler
|
||||||
public void onProxyStop(final ProxyStopEvent event) {
|
private void onProxyStart(final ProxyStartEvent event) {
|
||||||
GeyserImpl.getInstance().shutdown();
|
GeyserImpl.getInstance().getSessionManager().disconnectAll("geyser.commands.reload.kick");
|
||||||
|
GeyserImpl.getInstance().reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,4 +2,4 @@ name: "${name}-ViaProxy"
|
|||||||
version: "${version}"
|
version: "${version}"
|
||||||
author: "${author}"
|
author: "${author}"
|
||||||
main: "org.geysermc.geyser.platform.viaproxy.GeyserViaProxyPlugin"
|
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"
|
commodore = "2.2"
|
||||||
bungeecord = "a7c6ede"
|
bungeecord = "a7c6ede"
|
||||||
velocity = "3.1.1"
|
velocity = "3.1.1"
|
||||||
viaproxy = "3.0.21"
|
viaproxy = "3.0.23-SNAPSHOT"
|
||||||
fabric-minecraft = "1.20.2"
|
fabric-minecraft = "1.20.2"
|
||||||
fabric-loader = "0.14.21"
|
fabric-loader = "0.14.21"
|
||||||
fabric-api = "0.89.0+1.20.2"
|
fabric-api = "0.89.0+1.20.2"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren