Skip to content

Commit

Permalink
Re-added a way to send Floodgate data over the wire (for e.g. standal…
Browse files Browse the repository at this point in the history
…one)
  • Loading branch information
Tim203 committed Oct 13, 2023
1 parent dab61ac commit 4a673b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/main/java/org/geysermc/geyser/GeyserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.geysermc.geyser.floodgate.FloodgateProvider;
import org.geysermc.geyser.floodgate.IntegratedFloodgateProvider;
import org.geysermc.geyser.floodgate.NoFloodgateProvider;
import org.geysermc.geyser.floodgate.ProxyFloodgateProvider;
import org.geysermc.geyser.level.WorldManager;
import org.geysermc.geyser.network.netty.GeyserServer;
import org.geysermc.geyser.registry.BlockRegistries;
Expand Down Expand Up @@ -168,7 +169,11 @@ private GeyserImpl(PlatformType platformType, GeyserBootstrap bootstrap, Floodga
this.floodgateProvider = new IntegratedFloodgateProvider(floodgatePlatform);
// this.floodgateProvider = new ProxyFloodgateProvider(floodgatePlatform);
} else {
this.floodgateProvider = new NoFloodgateProvider();
if (bootstrap.getGeyserConfig().getRemote().authType() == AuthType.FLOODGATE) {
this.floodgateProvider = new ProxyFloodgateProvider(bootstrap.getConfigFolder());
} else {
this.floodgateProvider = new NoFloodgateProvider();
}
Geyser.set(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@
package org.geysermc.geyser.floodgate;

import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import lombok.SneakyThrows;
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.FloodgateFormatCodec;
import org.geysermc.floodgate.core.crypto.topping.Base64Topping;
import org.geysermc.geyser.session.GeyserSession;

//todo Floodgate should be responsible for forwarding its messages
Expand All @@ -38,6 +44,15 @@ public ProxyFloodgateProvider(FloodgatePlatform platform) {
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
public void onSkinUpload(GeyserSession session, String value, String signature) {
byte[] bytes = (value + '\0' + signature)
Expand Down

0 comments on commit 4a673b6

Please sign in to comment.