Extensions have their own command

This commit is contained in:
Camotoy 2022-07-10 20:58:48 -04:00
parent 897c4dcfec
commit 83ba6b5ab5
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
16 changed files with 101 additions and 116 deletions

View file

@ -170,8 +170,8 @@ public class GeyserSpigotInjector extends GeyserInjector {
*/
private void workAroundWeirdBug(GeyserBootstrap bootstrap) {
MinecraftProtocol protocol = new MinecraftProtocol();
LocalSession session = new LocalSession(bootstrap.getGeyserConfig().getRemote().getAddress(),
bootstrap.getGeyserConfig().getRemote().getPort(), this.serverSocketAddress,
LocalSession session = new LocalSession(bootstrap.getGeyserConfig().getRemote().address(),
bootstrap.getGeyserConfig().getRemote().port(), this.serverSocketAddress,
InetAddress.getLoopbackAddress().getHostAddress(), protocol, protocol.createHelper());
session.connect();
}

View file

@ -43,7 +43,6 @@ import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
import org.geysermc.geyser.api.command.Command;
import org.geysermc.geyser.api.network.AuthType;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandManager;
import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.geyser.dump.BootstrapDumpInfo;
@ -125,7 +124,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
}
// By default this should be localhost but may need to be changed in some circumstances
if (this.geyserConfig.getRemote().getAddress().equalsIgnoreCase("auto")) {
if (this.geyserConfig.getRemote().address().equalsIgnoreCase("auto")) {
geyserConfig.setAutoconfiguredRemote(true);
// Don't use localhost if not listening on all interfaces
if (!Bukkit.getIp().equals("0.0.0.0") && !Bukkit.getIp().equals("")) {
@ -148,7 +147,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
return;
}
if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && Bukkit.getPluginManager().getPlugin("floodgate") == null) {
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE && Bukkit.getPluginManager().getPlugin("floodgate") == null) {
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
this.getPluginLoader().disablePlugin(this);
return;
@ -249,8 +248,10 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
geyserLogger.debug("Using default world manager: " + this.geyserWorldManager.getClass());
}
PluginCommand pluginCommand = this.getCommand("geyser");
pluginCommand.setExecutor(new GeyserSpigotCommandExecutor(geyser));
PluginCommand geyserCommand = this.getCommand("geyser");
geyserCommand.setExecutor(new GeyserSpigotCommandExecutor(geyser, geyserCommandManager.getCommands()));
PluginCommand geyserExtCommand = this.getCommand("geyserext");
geyserExtCommand.setExecutor(new GeyserSpigotCommandExecutor(geyser, geyserCommandManager.getCommands()));
if (!INITIALIZED) {
// Register permissions so they appear in, for example, LuckPerms' UI
@ -277,7 +278,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
boolean brigadierSupported = CommodoreProvider.isSupported();
geyserLogger.debug("Brigadier supported? " + brigadierSupported);
if (brigadierSupported) {
GeyserBrigadierSupport.loadBrigadier(this, pluginCommand);
GeyserBrigadierSupport.loadBrigadier(this, geyserCommand);
}
// Check to ensure the current setup can support the protocol version Geyser uses

View file

@ -38,11 +38,12 @@ import org.geysermc.geyser.text.GeyserLocale;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class GeyserSpigotCommandExecutor extends GeyserCommandExecutor implements TabExecutor {
public GeyserSpigotCommandExecutor(GeyserImpl geyser) {
super(geyser);
public GeyserSpigotCommandExecutor(GeyserImpl geyser, Map<String, org.geysermc.geyser.api.command.Command> commands) {
super(geyser, commands);
}
@Override

View file

@ -8,4 +8,7 @@ api-version: 1.13
commands:
geyser:
description: The main command for Geyser.
usage: /geyser <subcommand>
usage: /geyser <subcommand>
geyserext:
description: The command any extensions can register to.
usage: /geyserext <subcommand>