Skip to content

Commit

Permalink
Use even less reflection on Velocity and fixed artifact location
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed May 13, 2024
1 parent 1a07026 commit 9746632
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: success()
with:
name: Floodgate Bungee
path: bungee/build/libs/floodgate-bungee.jar
path: bungee/isolated/build/libs/floodgate-bungee.jar
if-no-files-found: error

- name: Archive artifacts (Floodgate Spigot)
Expand All @@ -53,7 +53,7 @@ jobs:
if: success()
with:
name: Floodgate Spigot
path: spigot/build/libs/floodgate-spigot.jar
path: spigot/isolated/build/libs/floodgate-spigot.jar
if-no-files-found: error

- name: Archive artifacts (Floodgate Velocity)
Expand All @@ -62,7 +62,7 @@ jobs:
if: success()
with:
name: Floodgate Velocity
path: velocity/build/libs/floodgate-velocity.jar
path: velocity/isolated/build/libs/floodgate-velocity.jar
if-no-files-found: error

- name: Publish to Maven Repository
Expand All @@ -83,9 +83,9 @@ jobs:
appID: ${{ secrets.RELEASE_APP_ID }}
appPrivateKey: ${{ secrets.RELEASE_APP_PK }}
files: |
bungee:bungee/build/libs/floodgate-bungee.jar
spigot:spigot/build/libs/floodgate-spigot.jar
velocity:velocity/build/libs/floodgate-velocity.jar
bungee:bungee/isolated/build/libs/floodgate-bungee.jar
spigot:spigot/isolated/build/libs/floodgate-spigot.jar
velocity:velocity/isolated/build/libs/floodgate-velocity.jar
releaseEnabled: false
saveMetadata: true

Expand Down Expand Up @@ -118,9 +118,9 @@ jobs:
# Create the build folder
ssh -o StrictHostKeyChecking=no -i id_ecdsa $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP mkdir -p "~/uploads/$PROJECT/$GITHUB_RUN_NUMBER/"
# Copy over artifacts
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" bungee/build/libs/floodgate-bungee.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$GITHUB_RUN_NUMBER/
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" spigot/build/libs/floodgate-spigot.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$GITHUB_RUN_NUMBER/
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" velocity/build/libs/floodgate-velocity.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$GITHUB_RUN_NUMBER/
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" bungee/isolated/build/libs/floodgate-bungee.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$GITHUB_RUN_NUMBER/
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" spigot/isolated/build/libs/floodgate-spigot.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$GITHUB_RUN_NUMBER/
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" velocity/isolated/build/libs/floodgate-velocity.jar $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$GITHUB_RUN_NUMBER/
# Run the build script
rsync -P -e "ssh -o StrictHostKeyChecking=no -i id_ecdsa" metadata.json $DOWNLOADS_USERNAME@$DOWNLOADS_SERVER_IP:~/uploads/$PROJECT/$GITHUB_RUN_NUMBER/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import io.micronaut.inject.qualifiers.Qualifiers;
import java.nio.file.Path;
import org.geysermc.floodgate.core.FloodgatePlatform;
import org.geysermc.floodgate.core.util.ReflectionUtils;
import org.geysermc.floodgate.isolation.library.LibraryManager;
import org.slf4j.Logger;

Expand All @@ -50,7 +49,6 @@ public class VelocityPlatform extends FloodgatePlatform {
@Inject
public VelocityPlatform(LibraryManager manager) {
super(manager);
ReflectionUtils.setPrefix("com.velocitypowered.proxy");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import static java.util.Objects.requireNonNull;
import static org.geysermc.floodgate.core.util.ReflectionUtils.getField;
import static org.geysermc.floodgate.core.util.ReflectionUtils.getPrefixedClass;
import static org.geysermc.floodgate.core.util.ReflectionUtils.setValue;

import com.velocitypowered.proxy.connection.MinecraftConnection;
Expand All @@ -50,20 +49,14 @@

public final class VelocityProxyDataHandler extends CommonNettyDataHandler {
private static final Field REMOTE_ADDRESS;

private static final Class<?> INITIAL_LOGIN_SESSION_HANDLER;
private static final Field FORCE_KEY_AUTHENTICATION;

static {
Class<?> minecraftConnection = getPrefixedClass("connection.MinecraftConnection");
REMOTE_ADDRESS = getField(minecraftConnection, "remoteAddress");
REMOTE_ADDRESS = getField(MinecraftConnection.class, "remoteAddress");
requireNonNull(REMOTE_ADDRESS, "remoteAddress cannot be null");

INITIAL_LOGIN_SESSION_HANDLER = getPrefixedClass("connection.client.InitialLoginSessionHandler");
requireNonNull(INITIAL_LOGIN_SESSION_HANDLER, "InitialLoginSessionHandler cannot be null");

// allowed to be null if it's an old Velocity version
FORCE_KEY_AUTHENTICATION = getField(INITIAL_LOGIN_SESSION_HANDLER, "forceKeyAuthentication");
FORCE_KEY_AUTHENTICATION = getField(InitialLoginSessionHandler.class, "forceKeyAuthentication");
requireNonNull(FORCE_KEY_AUTHENTICATION, "forceKeyAuthentication cannot be null");
}

private final FloodgateLogger logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package org.geysermc.floodgate.velocity.player;

import static org.geysermc.floodgate.core.util.ReflectionUtils.getField;
import static org.geysermc.floodgate.core.util.ReflectionUtils.getPrefixedClass;
import static org.geysermc.floodgate.core.util.ReflectionUtils.getValue;

import com.velocitypowered.proxy.connection.MinecraftConnection;
Expand All @@ -44,7 +43,6 @@

@Singleton
public class VelocityConnectionManager extends ConnectionManager {
private static final Class<?> LOGIN_INBOUND_CONNECTION;
private static final Field INITIAL_CONNECTION_DELEGATE;

@Inject
Expand Down Expand Up @@ -84,7 +82,6 @@ public Channel channelFor(Object input) {
}

static {
LOGIN_INBOUND_CONNECTION = getPrefixedClass("connection.client.LoginInboundConnection");
INITIAL_CONNECTION_DELEGATE = getField(LOGIN_INBOUND_CONNECTION, "delegate");
INITIAL_CONNECTION_DELEGATE = getField(LoginInboundConnection.class, "delegate");
}
}

0 comments on commit 9746632

Please sign in to comment.