Update for Floodgate 2.0

This commit is contained in:
Camotoy 2021-04-01 20:07:32 -04:00
parent 17e3895b82
commit 5418b9e263
5 changed files with 35 additions and 9 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:connector:1.2.0-SNAPSHOT'
shadow 'org.geysermc:connector:1.2.0-SNAPSHOT'
implementation 'org.geysermc:connector:1.3.0-SNAPSHOT'
shadow 'org.geysermc:connector:1.3.0-SNAPSHOT'
}
repositories {

View file

@ -6,7 +6,7 @@ minecraft_version=1.16.3
yarn_mappings=1.16.3+build.28
loader_version=0.10.1+build.209
# Mod Properties
mod_version=1.0-SNAPSHOT
mod_version=1.3.0-SNAPSHOT
maven_group=org.geysermc.platform
archives_base_name=Geyser-Fabric
# Dependencies

View file

@ -25,13 +25,28 @@
package org.geysermc.platform.fabric;
import com.fasterxml.jackson.annotation.JsonIgnore;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import org.geysermc.connector.FloodgateKeyLoader;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration;
import java.nio.file.Path;
import java.util.Optional;
public class GeyserFabricConfiguration extends GeyserJacksonConfiguration {
@JsonIgnore
private Path floodgateKeyPath;
public void loadFloodgate(GeyserFabricMod geyser, ModContainer floodgate) {
Path geyserDataFolder = geyser.getConfigFolder();
Path floodgateDataFolder = FabricLoader.getInstance().getConfigDir().resolve("floodgate");
floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgate, floodgateDataFolder, geyserDataFolder, geyser.getGeyserLogger());
}
@Override
public Path getFloodgateKeyPath() {
return null;
return floodgateKeyPath;
}
}

View file

@ -30,6 +30,7 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;
import org.apache.logging.log4j.LogManager;
@ -55,10 +56,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
@ -144,6 +142,19 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
geyserConfig.getBedrock().setPort(geyserConfig.getRemote().getPort());
}
Optional<ModContainer> floodgate = FabricLoader.getInstance().getModContainer("floodgate");
boolean floodgatePresent = floodgate.isPresent();
if (geyserConfig.getRemote().getAuthType().equals("floodgate") && !floodgatePresent) {
geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
return;
} else if (geyserConfig.isAutoconfiguredRemote() && floodgatePresent) {
// Floodgate installed means that the user wants Floodgate authentication
geyserLogger.debug("Auto-setting to Floodgate authentication.");
geyserConfig.getRemote().setAuthType("floodgate");
}
geyserConfig.loadFloodgate(this, floodgate.orElse(null));
this.connector = GeyserConnector.start(PlatformType.FABRIC, this);
this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(connector);

View file

@ -12,7 +12,7 @@
"repo": "https://github.com/GeyserMC/Geyser-Fabric"
},
"license": "MIT",
"icon": "assets/fabric/icon.png",
"icon": "assets/geyser-fabric/icon.png",
"environment": "*",
"entrypoints": {
"main": [