3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

1.19.30 support probably

Dieser Commit ist enthalten in:
Camotoy 2022-09-22 19:49:35 -04:00
Ursprung c97ff4f612
Commit b794569388
7 geänderte Dateien mit 29 neuen und 26 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -26,16 +26,16 @@
package org.geysermc.platform.fabric.command; package org.geysermc.platform.fabric.command;
import org.geysermc.geyser.GeyserImpl; 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) { public GeyserFabricCommandManager(GeyserImpl connector) {
super(connector); super(connector);
} }
@Override @Override
public String getDescription(String command) { public String description(String command) {
return ""; return "";
} }
} }

Datei anzeigen

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