mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Extensions have their own command
This commit is contained in:
parent
897c4dcfec
commit
83ba6b5ab5
16 changed files with 101 additions and 116 deletions
|
@ -86,7 +86,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
|
|||
InetSocketAddress javaAddr = listener.getHost();
|
||||
|
||||
// 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")) {
|
||||
this.geyserConfig.setAutoconfiguredRemote(true);
|
||||
// Don't use localhost if not listening on all interfaces
|
||||
if (!javaAddr.getHostString().equals("0.0.0.0") && !javaAddr.getHostString().equals("")) {
|
||||
|
@ -109,7 +109,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
|
|||
return;
|
||||
}
|
||||
|
||||
if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && getProxy().getPluginManager().getPlugin("floodgate") == null) {
|
||||
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE && getProxy().getPluginManager().getPlugin("floodgate") == null) {
|
||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
||||
return;
|
||||
} else if (geyserConfig.isAutoconfiguredRemote() && getProxy().getPluginManager().getPlugin("floodgate") != null) {
|
||||
|
@ -134,7 +134,8 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
|
|||
this.geyserBungeePingPassthrough = new GeyserBungeePingPassthrough(getProxy());
|
||||
}
|
||||
|
||||
this.getProxy().getPluginManager().registerCommand(this, new GeyserBungeeCommandExecutor(geyser));
|
||||
this.getProxy().getPluginManager().registerCommand(this, new GeyserBungeeCommandExecutor("geyser", geyser, geyserCommandManager.getCommands()));
|
||||
this.getProxy().getPluginManager().registerCommand(this, new GeyserBungeeCommandExecutor("geyserext", geyser, geyserCommandManager.commands()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,14 +37,15 @@ import org.geysermc.geyser.text.GeyserLocale;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
public class GeyserBungeeCommandExecutor extends Command implements TabExecutor {
|
||||
private final GeyserCommandExecutor commandExecutor;
|
||||
|
||||
public GeyserBungeeCommandExecutor(GeyserImpl geyser) {
|
||||
super("geyser");
|
||||
public GeyserBungeeCommandExecutor(String name, GeyserImpl geyser, Map<String, org.geysermc.geyser.api.command.Command> commands) {
|
||||
super(name);
|
||||
|
||||
this.commandExecutor = new GeyserCommandExecutor(geyser);
|
||||
this.commandExecutor = new GeyserCommandExecutor(geyser, commands);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
|
@ -99,14 +99,14 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
|
|||
|
||||
// Don't change the ip if its listening on all interfaces
|
||||
// By default this should be 127.0.0.1 but may need to be changed in some circumstances
|
||||
if (this.geyserConfig.getRemote().getAddress().equalsIgnoreCase("auto")) {
|
||||
if (this.geyserConfig.getRemote().address().equalsIgnoreCase("auto")) {
|
||||
this.geyserConfig.setAutoconfiguredRemote(true);
|
||||
geyserConfig.getRemote().setPort(javaAddr.getPort());
|
||||
}
|
||||
}
|
||||
|
||||
if (geyserConfig.getBedrock().isCloneRemotePort()) {
|
||||
geyserConfig.getBedrock().setPort(geyserConfig.getRemote().getPort());
|
||||
geyserConfig.getBedrock().setPort(geyserConfig.getRemote().port());
|
||||
}
|
||||
|
||||
this.geyserLogger = new GeyserSpongeLogger(logger, geyserConfig.isDebugMode());
|
||||
|
@ -121,7 +121,8 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
|
|||
|
||||
this.geyserCommandManager = new GeyserSpongeCommandManager(Sponge.getCommandManager(), geyser);
|
||||
this.geyserCommandManager.init();
|
||||
Sponge.getCommandManager().register(this, new GeyserSpongeCommandExecutor(geyser), "geyser");
|
||||
Sponge.getCommandManager().register(this, new GeyserSpongeCommandExecutor(geyser, geyserCommandManager.getCommands()), "geyser");
|
||||
Sponge.getCommandManager().register(this, new GeyserSpongeCommandExecutor(geyser, geyserCommandManager.commands()), "geyserext");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
package org.geysermc.geyser.platform.sponge.command;
|
||||
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.command.Command;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.command.GeyserCommandExecutor;
|
||||
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||
|
@ -40,15 +41,12 @@ import org.spongepowered.api.world.Location;
|
|||
import org.spongepowered.api.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
public class GeyserSpongeCommandExecutor extends GeyserCommandExecutor implements CommandCallable {
|
||||
|
||||
public GeyserSpongeCommandExecutor(GeyserImpl geyser) {
|
||||
super(geyser);
|
||||
public GeyserSpongeCommandExecutor(GeyserImpl geyser, Map<String, Command> commands) {
|
||||
super(geyser, commands);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -102,7 +102,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
|||
InetSocketAddress javaAddr = proxyServer.getBoundAddress();
|
||||
|
||||
// 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")) {
|
||||
this.geyserConfig.setAutoconfiguredRemote(true);
|
||||
// Don't use localhost if not listening on all interfaces
|
||||
if (!javaAddr.getHostString().equals("0.0.0.0") && !javaAddr.getHostString().equals("")) {
|
||||
|
@ -128,7 +128,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
|||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
|
||||
if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && proxyServer.getPluginManager().getPlugin("floodgate").isEmpty()) {
|
||||
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE && proxyServer.getPluginManager().getPlugin("floodgate").isEmpty()) {
|
||||
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " "
|
||||
+ GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
|
||||
return;
|
||||
|
@ -148,7 +148,8 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
|
|||
this.geyserCommandManager = new GeyserVelocityCommandManager(geyser);
|
||||
this.geyserCommandManager.init();
|
||||
|
||||
this.commandManager.register("geyser", new GeyserVelocityCommandExecutor(geyser));
|
||||
this.commandManager.register("geyser", new GeyserVelocityCommandExecutor(geyser, geyserCommandManager.getCommands()));
|
||||
this.commandManager.register("geyserext", new GeyserVelocityCommandExecutor(geyser, geyserCommandManager.commands()));
|
||||
if (geyserConfig.isLegacyPingPassthrough()) {
|
||||
this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(geyser);
|
||||
} else {
|
||||
|
|
|
@ -27,6 +27,7 @@ package org.geysermc.geyser.platform.velocity.command;
|
|||
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.command.Command;
|
||||
import org.geysermc.geyser.command.GeyserCommand;
|
||||
import org.geysermc.geyser.command.GeyserCommandExecutor;
|
||||
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||
|
@ -37,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 GeyserVelocityCommandExecutor extends GeyserCommandExecutor implements SimpleCommand {
|
||||
|
||||
public GeyserVelocityCommandExecutor(GeyserImpl geyser) {
|
||||
super(geyser);
|
||||
public GeyserVelocityCommandExecutor(GeyserImpl geyser, Map<String, Command> commands) {
|
||||
super(geyser, commands);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue