1.19.30 support probably

This commit is contained in:
Camotoy 2022-09-22 19:49:35 -04:00
parent c97ff4f612
commit b794569388
7 changed files with 29 additions and 26 deletions

View file

@ -27,8 +27,8 @@ dependencies {
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
implementation "org.geysermc:core:${project.mod_version}"
shadow("org.geysermc:core:${project.mod_version}") {
api "org.geysermc.geyser:core:${project.mod_version}"
shadow("org.geysermc.geyser:core:${project.mod_version}") {
exclude group: 'com.google.guava', module: "guava"
exclude group: 'com.google.code.gson', module: "gson"
exclude group: 'org.slf4j'

View file

@ -6,7 +6,7 @@ minecraft_version=1.19.1
yarn_mappings=1.19.1+build.1
loader_version=0.14.8
# Mod Properties
mod_version=2.0.7-SNAPSHOT
mod_version=2.1.0-SNAPSHOT
maven_group=org.geysermc.platform
archives_base_name=Geyser-Fabric
# Dependencies

View file

@ -37,11 +37,12 @@ import org.apache.logging.log4j.LogManager;
import org.geysermc.common.PlatformType;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.command.CommandManager;
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.dump.BootstrapDumpInfo;
import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
import org.geysermc.geyser.session.auth.AuthType;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.configuration.GeyserConfiguration;
@ -142,7 +143,7 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
public void startGeyser(MinecraftServer server) {
this.server = server;
if (this.geyserConfig.getRemote().getAddress().equalsIgnoreCase("auto")) {
if (this.geyserConfig.getRemote().address().equalsIgnoreCase("auto")) {
this.geyserConfig.setAutoconfiguredRemote(true);
String ip = server.getServerIp();
int port = ((GeyserServerPortGetter) server).geyser$getServerPort();
@ -153,12 +154,12 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
}
if (geyserConfig.getBedrock().isCloneRemotePort()) {
geyserConfig.getBedrock().setPort(geyserConfig.getRemote().getPort());
geyserConfig.getBedrock().setPort(geyserConfig.getRemote().port());
}
Optional<ModContainer> floodgate = FabricLoader.getInstance().getModContainer("floodgate");
boolean floodgatePresent = floodgate.isPresent();
if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && !floodgatePresent) {
if (geyserConfig.getRemote().authType() == AuthType.FLOODGATE && !floodgatePresent) {
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
return;
} else if (geyserConfig.isAutoconfiguredRemote() && floodgatePresent) {
@ -169,7 +170,8 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
geyserConfig.loadFloodgate(this, floodgate.orElse(null));
this.connector = GeyserImpl.start(PlatformType.FABRIC, this);
this.connector = GeyserImpl.load(PlatformType.FABRIC, this);
GeyserImpl.start(); // shrug
this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(connector);
@ -180,13 +182,13 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
// Start command building
// Set just "geyser" as the help command
GeyserFabricCommandExecutor helpExecutor = new GeyserFabricCommandExecutor(connector,
connector.getCommandManager().getCommands().get("help"), !playerCommands.contains("help"));
(GeyserCommand) connector.commandManager().getCommands().get("help"), !playerCommands.contains("help"));
commandExecutors.add(helpExecutor);
LiteralArgumentBuilder<ServerCommandSource> builder = net.minecraft.server.command.CommandManager.literal("geyser").executes(helpExecutor);
// Register all subcommands as valid
for (Map.Entry<String, GeyserCommand> command : connector.getCommandManager().getCommands().entrySet()) {
GeyserFabricCommandExecutor executor = new GeyserFabricCommandExecutor(connector, command.getValue(),
for (Map.Entry<String, Command> command : connector.commandManager().getCommands().entrySet()) {
GeyserFabricCommandExecutor executor = new GeyserFabricCommandExecutor(connector, (GeyserCommand) command.getValue(),
!playerCommands.contains(command.getKey()));
commandExecutors.add(executor);
builder.then(net.minecraft.server.command.CommandManager.literal(command.getKey()).executes(executor));
@ -216,7 +218,7 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
}
@Override
public CommandManager getGeyserCommandManager() {
public GeyserCommandManager getGeyserCommandManager() {
return geyserCommandManager;
}

View file

@ -29,11 +29,11 @@ import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.command.CommandSender;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.text.ChatColor;
import org.geysermc.platform.fabric.GeyserFabricMod;
public class FabricCommandSender implements CommandSender {
public class FabricCommandSender implements GeyserCommandSource {
private final ServerCommandSource source;
@ -66,7 +66,7 @@ public class FabricCommandSender implements CommandSender {
// Workaround for our commands because fabric doesn't have native permissions
for (GeyserFabricCommandExecutor executor : GeyserFabricMod.getInstance().getCommandExecutors()) {
if (executor.getCommand().getPermission().equals(s)) {
if (executor.getCommand().permission().equals(s)) {
return executor.canRun(source);
}
}

View file

@ -29,15 +29,17 @@ import com.mojang.brigadier.Command;
import com.mojang.brigadier.context.CommandContext;
import net.minecraft.server.command.ServerCommandSource;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.command.CommandExecutor;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandExecutor;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.ChatColor;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.platform.fabric.GeyserFabricMod;
import org.geysermc.platform.fabric.GeyserFabricPermissions;
public class GeyserFabricCommandExecutor extends CommandExecutor implements Command<ServerCommandSource> {
import java.util.Collections;
public class GeyserFabricCommandExecutor extends GeyserCommandExecutor implements Command<ServerCommandSource> {
private final GeyserCommand command;
/**
@ -46,7 +48,7 @@ public class GeyserFabricCommandExecutor extends CommandExecutor implements Comm
private final boolean requiresPermission;
public GeyserFabricCommandExecutor(GeyserImpl connector, GeyserCommand command, boolean requiresPermission) {
super(connector);
super(connector, Collections.singletonMap(command.name(), command));
this.command = command;
this.requiresPermission = requiresPermission;
}
@ -70,12 +72,12 @@ public class GeyserFabricCommandExecutor extends CommandExecutor implements Comm
sender.sendMessage(GeyserLocale.getLocaleStringLog("geyser.bootstrap.command.permission_fail"));
return 0;
}
if (this.command.getName().equals("reload")) {
if (this.command.name().equals("reload")) {
GeyserFabricMod.getInstance().setReloading(true);
}
if (command.isBedrockOnly() && session == null) {
sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale()));
sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.locale()));
return 0;
}
command.execute(session, sender, new String[0]);

View file

@ -26,16 +26,16 @@
package org.geysermc.platform.fabric.command;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.command.CommandManager;
import org.geysermc.geyser.command.GeyserCommandManager;
public class GeyserFabricCommandManager extends CommandManager {
public class GeyserFabricCommandManager extends GeyserCommandManager {
public GeyserFabricCommandManager(GeyserImpl connector) {
super(connector);
}
@Override
public String getDescription(String command) {
public String description(String command) {
return "";
}
}

View file

@ -124,10 +124,9 @@ public class GeyserFabricWorldManager extends GeyserWorldManager {
@Override
public boolean hasPermission(GeyserSession session, String permission) {
// Workaround for our commands because fabric doesn't have native permissions
for (GeyserFabricCommandExecutor executor : GeyserFabricMod.getInstance().getCommandExecutors()) {
if (executor.getCommand().getPermission().equals(permission)) {
if (executor.getCommand().permission().equals(permission)) {
return executor.canRun(getPlayer(session).getCommandSource());
}
}