mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Re-added a way to send Floodgate data over the wire (for e.g. standalone)
This commit is contained in:
parent
dab61ac41a
commit
4a673b6879
2 changed files with 21 additions and 1 deletions
|
@ -67,6 +67,7 @@ import org.geysermc.geyser.extension.GeyserExtensionManager;
|
||||||
import org.geysermc.geyser.floodgate.FloodgateProvider;
|
import org.geysermc.geyser.floodgate.FloodgateProvider;
|
||||||
import org.geysermc.geyser.floodgate.IntegratedFloodgateProvider;
|
import org.geysermc.geyser.floodgate.IntegratedFloodgateProvider;
|
||||||
import org.geysermc.geyser.floodgate.NoFloodgateProvider;
|
import org.geysermc.geyser.floodgate.NoFloodgateProvider;
|
||||||
|
import org.geysermc.geyser.floodgate.ProxyFloodgateProvider;
|
||||||
import org.geysermc.geyser.level.WorldManager;
|
import org.geysermc.geyser.level.WorldManager;
|
||||||
import org.geysermc.geyser.network.netty.GeyserServer;
|
import org.geysermc.geyser.network.netty.GeyserServer;
|
||||||
import org.geysermc.geyser.registry.BlockRegistries;
|
import org.geysermc.geyser.registry.BlockRegistries;
|
||||||
|
@ -167,8 +168,12 @@ public class GeyserImpl implements GeyserApi {
|
||||||
// this.floodgatePlatform = floodgatePlatform.isProxy() ? new ProxyFloodgateProvider(floodgatePlatform) : new IntegratedFloodgateProvider(floodgatePlatform);
|
// this.floodgatePlatform = floodgatePlatform.isProxy() ? new ProxyFloodgateProvider(floodgatePlatform) : new IntegratedFloodgateProvider(floodgatePlatform);
|
||||||
this.floodgateProvider = new IntegratedFloodgateProvider(floodgatePlatform);
|
this.floodgateProvider = new IntegratedFloodgateProvider(floodgatePlatform);
|
||||||
// this.floodgateProvider = new ProxyFloodgateProvider(floodgatePlatform);
|
// this.floodgateProvider = new ProxyFloodgateProvider(floodgatePlatform);
|
||||||
|
} else {
|
||||||
|
if (bootstrap.getGeyserConfig().getRemote().authType() == AuthType.FLOODGATE) {
|
||||||
|
this.floodgateProvider = new ProxyFloodgateProvider(bootstrap.getConfigFolder());
|
||||||
} else {
|
} else {
|
||||||
this.floodgateProvider = new NoFloodgateProvider();
|
this.floodgateProvider = new NoFloodgateProvider();
|
||||||
|
}
|
||||||
Geyser.set(this);
|
Geyser.set(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,14 @@
|
||||||
package org.geysermc.geyser.floodgate;
|
package org.geysermc.geyser.floodgate;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.geysermc.floodgate.core.FloodgatePlatform;
|
import org.geysermc.floodgate.core.FloodgatePlatform;
|
||||||
|
import org.geysermc.floodgate.core.connection.standalone.codec.FloodgateConnectionCodec;
|
||||||
|
import org.geysermc.floodgate.core.crypto.DataCodecType;
|
||||||
import org.geysermc.floodgate.core.crypto.FloodgateDataCodec;
|
import org.geysermc.floodgate.core.crypto.FloodgateDataCodec;
|
||||||
|
import org.geysermc.floodgate.core.crypto.FloodgateFormatCodec;
|
||||||
|
import org.geysermc.floodgate.core.crypto.topping.Base64Topping;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
|
||||||
//todo Floodgate should be responsible for forwarding its messages
|
//todo Floodgate should be responsible for forwarding its messages
|
||||||
|
@ -38,6 +44,15 @@ public final class ProxyFloodgateProvider implements FloodgateProvider {
|
||||||
dataCodec = platform.getBean(FloodgateDataCodec.class);
|
dataCodec = platform.getBean(FloodgateDataCodec.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public ProxyFloodgateProvider(Path dataDirectory) {
|
||||||
|
//todo use what the platform provides without enabling Floodgate
|
||||||
|
dataCodec = new FloodgateDataCodec(
|
||||||
|
new FloodgateFormatCodec(DataCodecType.AES, new Base64Topping(), dataDirectory),
|
||||||
|
new FloodgateConnectionCodec()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSkinUpload(GeyserSession session, String value, String signature) {
|
public void onSkinUpload(GeyserSession session, String value, String signature) {
|
||||||
byte[] bytes = (value + '\0' + signature)
|
byte[] bytes = (value + '\0' + signature)
|
||||||
|
|
Loading…
Reference in a new issue