RealIP icon indicating copy to clipboard operation
RealIP copied to clipboard

TCPShield Fabric support (1.16.5 through 1.18.2)

Open Draylar opened this issue 3 years ago • 3 comments

Hi! This is an updated version of the Fabric Loader support introduced on the 2.5 branch of RealIP. We have been using the 2.5 Fabric version internally for a while (with success), and I have also verified the new 2.6 rendition works as well.

A few notes about the PR:

  1. I'm currently building off Fabric 1.16.5 w/Loom 0.6 to support Java 8. I suspect this will break on 1.19 due to LiteralText API changes impacting FabricPlayer#disconnect (+ 1.19 requires JDK17), so I'll need to figure out a better way to support all versions in the future. This jar will support versions 1.16.5 through 1.18.2. I'll probably end up using reflection to call Text methods based on game version to allow for both to exist at the same time.
  2. My configuration implementation relies on a budget YAML parser. I would be happy to switch this to GSON or another external library if needed - Fabric does not ship a default configuration system.

Let me know if you have any questions or change requests. Thank you!

Demo Images

Without RealIP jar on server:

image

With RealIP jar on server:

image

Draylar avatar Oct 07 '22 20:10 Draylar

Hi, I've made a PR to this PR for 1.21 support if anyone wants it. Note there are a few improvements to be still made, but it works:

  • It seems like the disconnect message doesn't work like on Paper; it just says 'Disconnected'
  • The RealIP options aren't in their own folder in the server's config
  • The way the logging is formatted is a bit barebones
  • Pre 1.19 support probably doesn't work now
Logging example

Aug 01, 2024 3:25:24 PM net.tcpshield.tcpshield.fabric.TCPShieldFabric onInitializeServer
INFO: TCPShield has been loaded.

Instead of...

[15:25:24] [main/INFO]: TCPShield 2.8.1 has been loaded.

You can build it from my fork: https://github.com/he3als/RealIP/tree/fabric

he3als avatar Aug 01 '24 14:08 he3als

Hi, I've made a PR to this PR for 1.21 support if anyone wants it. Note there are a few improvements to be still made, but it works:

  • It seems like the disconnect message doesn't work like on Paper; it just says 'Disconnected'
  • The RealIP options aren't in their own folder in the server's config
  • The way the logging is formatted is a bit barebones
  • Pre 1.19 support probably doesn't work now

Logging example You can build it from my fork: https://github.com/he3als/RealIP/tree/fabric

Hey there, this slipped through the cracks a couple years back, I'm definitely interested in getting this merged if you can get yours merged into the original PR. Worse cast scenario, you can fork their fork and we can merge from there if the original author isn't looking to continue with this.

DylanKeir avatar Aug 04 '24 12:08 DylanKeir

Hi, I've made a PR to this PR for 1.21 support if anyone wants it. Note there are a few improvements to be still made, but it works:

  • It seems like the disconnect message doesn't work like on Paper; it just says 'Disconnected'
  • The RealIP options aren't in their own folder in the server's config
  • The way the logging is formatted is a bit barebones
  • Pre 1.19 support probably doesn't work now

Logging example You can build it from my fork: he3als/RealIP@fabric

Hey there, this slipped through the cracks a couple years back, I'm definitely interested in getting this merged if you can get yours merged into the original PR. Worse cast scenario, you can fork their fork and we can merge from there if the original author isn't looking to continue with this.

I'm not sure if it should be merged yet due to its limited range of support:

  • https://github.com/Draylar/RealIP/pull/1/commits/59ab9890a8d5f17fa0257a36d90d4be76aabb963 is 1.19+ only (LiteralText)
  • https://github.com/Draylar/RealIP/pull/1/commits/eeedfe6c72b63f63ca2a4914cdcd92579f572040 is 1.21+ only (to my knowledge)

As the original author said, implementing reflection for LiteralText and making the HandshakeC2SPacketAccessor conditional would be ideal. However, I don't know Java, so I'm likely unable to implement this myself. :/

I mostly made my PR as a temporary solution for people wanting to use TCPShield on modern Fabric versions and to spark some activity to finish the pull request. However, I presume there isn't too much work left, so if you or anyone else has the time to look, it would be helpful. :)

he3als avatar Aug 06 '24 15:08 he3als