SamB440 / ForcePack

Spigot/Velocity plugin to aid resource pack deployment and enforcement, among other utilities.
https://fortitude.islandearth.net/category/forcepack
GNU General Public License v3.0
51 stars 17 forks source link

1.20.3 & Self hosting #46

Closed SamB440 closed 9 months ago

SamB440 commented 10 months ago

This adds the ability to self-host the resource pack via a local web server and also adds support for 1.20.3. It also fixes various bugs.

One problem is the jar size is now massive because of the webserver, I don't know how to fix that.

ifacify commented 9 months ago

You may download and cache the required deps at runtime if needed.

SamB440 commented 9 months ago

You may download and cache the required deps at runtime if needed.

I am not aware of any solutions to do that though. You'd need it both on Spigot and Velocity and all the way back to 1.8.

ifacify commented 9 months ago

Download the dependency jar with any http client you prefer to a cache dir and then use java.net.URLClassLoader to load it in so that you don't have to shadow it in your project. You may also read the config first to determine if the jar should be loaded. A lot of plugins (even bengeecord itself) do this trick so you might be able to find some examples.

Edit: example

SamB440 commented 9 months ago

Download the dependency jar with any http client you prefer to a cache dir and then use java.net.URLClassLoader to load it in so that you don't have to shadow it in your project. You may also read the config first to determine if the jar should be loaded. A lot of plugins (even bengeecord itself) do this trick so you might be able to find some examples.

Edit: example

Thanks, using a combination of LuckPerm's URLClassLoaderAccess (which that link uses) and this which I found: https://github.com/Vankka/DependencyDownload, since I wanted hash validation too, it works now.

SamB440 commented 9 months ago

Tested on 1.20.2 paper server without proxy and 1.20.2 paper server behind proxy. Don't care enough to test other versions, this should be fine to merge now.

Summary of changes:

Not in this PR, but for 1.3.0:

Tobias123567 commented 9 months ago

global packs are not working anymore on velocity with this pull request

SamB440 commented 9 months ago

Try the new commit, also send the output of debug mode next time

Tobias123567 commented 9 months ago

Now it's working again, but when I switch downstream server the pack is always sent again, even though i am in 1.20.4

SamB440 commented 9 months ago

It seems velocity has not implemented getAppliedResourcePacks. I am going to have to track this myself...

SamB440 commented 9 months ago

Please try the latest commit

Tobias123567 commented 9 months ago

Yeah thanks, now everything works as intended

Tobias123567 commented 9 months ago

but now there is a error when joining with 1.20.1 and the pack is not applied too image

SamB440 commented 9 months ago

Should be fixed now.

SamB440 commented 9 months ago

AAAAAAAAAAAAAAAAAA.

Velocity hasn't implemented removeResourcePack(s) either!

SamB440 commented 9 months ago

I can't use packetevents on velocity either because it has issues with NBT data when switching worlds.

We have to wait for Velocity to update...

SamB440 commented 9 months ago

Alright, I've decided to implement it via reflection since the RemoveResourcePack packet class exists on velocity, the method just hasn't implemented it.

Everything should be good now.

Tobias123567 commented 9 months ago

yeah now everything works