1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Removed some todos

This commit is contained in:
Tim203
2020-12-25 01:34:43 +01:00
parent 317aa64269
commit e5f7b169cf
12 changed files with 17 additions and 44 deletions

View File

@@ -149,8 +149,6 @@ public final class BungeeDataHandler {
InetSocketAddress correctAddress = player.getProperty(PropertyKey.SOCKET_ADDRESS);
ReflectionUtils.setValue(channelWrapper, PLAYER_REMOTE_ADDRESS, correctAddress);
channel.attr(playerAttribute).set(player);
event.completeIntent(plugin);
});
}

View File

@@ -32,7 +32,6 @@ import javassist.CtClass;
import javassist.CtField;
import javassist.CtMethod;
import javassist.Modifier;
import javax.naming.OperationNotSupportedException;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.geysermc.floodgate.api.logger.FloodgateLogger;
@@ -89,10 +88,9 @@ public final class BungeeInjector extends CommonPlatformInjector {
}
@Override
public boolean removeInjection() throws Exception {
//todo implement injection removal support
throw new OperationNotSupportedException(
"Floodgate cannot remove the Bungee injection at the moment");
public boolean removeInjection() {
logger.error("Floodgate cannot remove itself from Bungee without a reboot");
return false;
}
public void injectClient(Channel channel, boolean clientToProxy) {

View File

@@ -84,7 +84,6 @@ public final class BungeeListener implements Listener {
if (config.isSendFloodgateData()) {
pluginMessageHandler.sendSkinRequest(event.getServer(), player.getRawSkin());
} else {
//todo also a Proxy SkinHandler to keep stuff clean?
skinHandler.handleSkinUploadFor(player, null);
}
}

View File

@@ -45,11 +45,6 @@
<artifactId>cumulus</artifactId>
<version>${cumulus.version}</version>
</dependency>
<!-- <dependency> todo -->
<!-- <groupId>com.mojang</groupId>-->
<!-- <artifactId>brigadier</artifactId>-->
<!-- <version>1.0.17</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>

View File

@@ -29,6 +29,7 @@ import static org.geysermc.floodgate.util.BedrockData.EXPECTED_LENGTH;
import com.google.common.base.Charsets;
import io.netty.channel.Channel;
import io.netty.util.AttributeKey;
import java.net.InetSocketAddress;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
@@ -51,6 +52,7 @@ public final class HandshakeHandler {
private final SimpleFloodgateApi api;
private final FloodgateCipher cipher;
private final FloodgateConfigHolder configHolder;
private final AttributeKey<FloodgatePlayer> playerAttribute;
public HandshakeResult handle(Channel channel, @NonNull String handshakeData) {
try {
@@ -103,6 +105,8 @@ public final class HandshakeHandler {
FloodgatePlayer player = FloodgatePlayerImpl.from(bedrockData, rawSkin, configHolder);
api.addPlayer(player.getJavaUniqueId(), player);
channel.attr(playerAttribute).set(player);
int port = ((InetSocketAddress) channel.remoteAddress()).getPort();
InetSocketAddress socketAddress = new InetSocketAddress(bedrockData.getIp(), port);
player.addProperty(PropertyKey.SOCKET_ADDRESS, socketAddress);

View File

@@ -49,17 +49,6 @@ public final class LinkAccountCommand implements Command {
@Inject private FloodgateApi api;
@Inject private CommandUtil commandUtil;
// @Override todo impl this
// public <T> LiteralCommandNode<T> commandNode(T source, CommandUtil commandUtil) {
// return literal(getName())
// .then(
// argument("gamertag", word())
// .executes(cmd -> {
// return 0;
// })
// ).build();
// }
@Override
public void execute(Object player, UUID uuid, String username, String locale, String[] args) {
PlayerLink link = api.getPlayerLink();

View File

@@ -123,8 +123,9 @@ public class CommonModule extends AbstractModule {
@Provides
@Singleton
public HandshakeHandler handshakeHandler(SimpleFloodgateApi api, FloodgateCipher cipher,
FloodgateConfigHolder configHolder) {
return new HandshakeHandler(api, cipher, configHolder);
FloodgateConfigHolder configHolder,
AttributeKey<FloodgatePlayer> playerAttribute) {
return new HandshakeHandler(api, cipher, configHolder, playerAttribute);
}
@Provides

View File

@@ -36,7 +36,6 @@ import static org.geysermc.floodgate.util.ReflectionUtils.setValue;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.AttributeKey;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -158,7 +157,6 @@ public final class SpigotDataHandler extends SimpleChannelInboundHandler<Object>
/* per player stuff */
private final FloodgateConfig config;
private final HandshakeHandler handshakeHandler;
private final AttributeKey<FloodgatePlayer> playerAttribute;
private final FloodgateLogger logger;
private Object networkManager;
private FloodgatePlayer fPlayer;
@@ -197,9 +195,6 @@ public final class SpigotDataHandler extends SimpleChannelInboundHandler<Object>
return;
}
// todo move this to HandshakeHandler?
ctx.channel().attr(playerAttribute).set(result.getFloodgatePlayer());
fPlayer = result.getFloodgatePlayer();
BedrockData bedrockData = result.getBedrockData();

View File

@@ -105,11 +105,6 @@ public final class VelocityProxyDataHandler extends SimpleChannelInboundHandler<
FloodgatePlayer player = result.getFloodgatePlayer();
// we can't rely on Velocity when it comes to kicking the old players, so with this
// system we only have to check if the connection (which is already closed at that time)
// has the FloodgatePlayer attribute
ctx.channel().attr(playerAttribute).set(player);
logger.info("Floodgate player who is logged in as {} {} joined",
player.getCorrectUsername(), player.getCorrectUniqueId());
}

View File

@@ -34,14 +34,15 @@ import com.velocitypowered.api.proxy.ProxyServer;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import java.lang.reflect.Method;
import javax.naming.OperationNotSupportedException;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.geysermc.floodgate.api.logger.FloodgateLogger;
import org.geysermc.floodgate.inject.CommonPlatformInjector;
@RequiredArgsConstructor
public final class VelocityInjector extends CommonPlatformInjector {
private final ProxyServer server;
private final FloodgateLogger logger;
@Getter private boolean injected = false;
@@ -74,10 +75,9 @@ public final class VelocityInjector extends CommonPlatformInjector {
}
@Override
public boolean removeInjection() throws Exception {
//todo implement injection removal support
throw new OperationNotSupportedException(
"Floodgate cannot remove the Velocity injection at the moment");
public boolean removeInjection() {
logger.error("Floodgate cannot remove itself from Bungee without a reboot");
return false;
}
@RequiredArgsConstructor

View File

@@ -160,7 +160,6 @@ public final class VelocityListener {
if (config.isSendFloodgateData()) {
pluginMessageHandler.sendSkinRequest(player.getCorrectUniqueId(), player.getRawSkin());
} else {
//todo also a Proxy SkinHandler to keep stuff clean?
skinHandler.handleSkinUploadFor(player, null);
}
}

View File

@@ -108,8 +108,8 @@ public final class VelocityPlatformModule extends AbstractModule {
@Provides
@Singleton
public CommonPlatformInjector platformInjector(ProxyServer server) {
return new VelocityInjector(server);
public CommonPlatformInjector platformInjector(ProxyServer server, FloodgateLogger logger) {
return new VelocityInjector(server, logger);
}
@Provides