TheRemote/Legendary-Java-Minecraft-Geyser-Floodgate

Stop ViaVersion from installing

spookyX01 opened this issue · 5 comments

I have a plugin that is incompatible with ViaVersion. Everytime I remove ViaVersion.jar and the config, the plugin reinstalls. Is there anyway I can stop it from installing?

It didn't used to but I added it for you. Pull the latest version of the container first and then use:

-e NoViaVersion=y

to disable it.

Hopefully that helps!

Thanks! How would I add this to docker compose?

I updated the docker-compose.yml example file in the main repository that shows how to do it in there. You'd just uncomment the line and that should take care of it!

Hey, I uncommented the line and would manually delete the ViaVersion.jar file in plugins folder, and I would get the following in console when I compose

md5sum: plugins/ViaVersion.jar: No such file or directory
Updating ViaVersion...

You need to update the container. That flag has only existed for a few hours. You almost certainly don't have the latest.

It's something like docker compose pull. If you don't know how to pull and enable the environment variables within docker-compose you should not be using it and should run it the normal way.

The new code skips that check entirely if you have the environment variable enabled.

There's nothing more I can do than add this feature. If it's still not working I'd try running it manually on the command line like the documentation shows or perhaps you will need a different container than this.

Here's what the new code looks like:

    if [ -z "$NoViaVersion" ]; then
        # Update ViaVersion if new version is available
        ViaVersionVersion=$(curl --no-progress-meter -k -L -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4.212 Safari/537.36" https://ci.viaversion.com/job/ViaVersion/lastBuild/artifact/build/libs/ | grep 'href="ViaVersion' | cut -d'"' -f2)
        if [ -n "$ViaVersionVersion" ]; then
            ViaVersionMD5=$(curl --no-progress-meter -k -L -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4.212 Safari/537.36" "https://ci.viaversion.com/job/ViaVersion/lastBuild/artifact/build/libs/$ViaVersionVersion/*fingerprint*/" | grep breadcrumbs | cut -d'_' -f24- | cut -d'<' -f1 | cut -d'>' -f2)
            if [ -n "$ViaVersionMD5" ]; then
                LocalMD5=$(md5sum plugins/ViaVersion.jar | cut -d' ' -f1)
                if [ -e /minecraft/plugins/ViaVersion.jar ] && [ "$LocalMD5" = "$ViaVersionMD5" ]; then
                    echo "ViaVersion is up to date"
                else
                    echo "Updating ViaVersion..."
                    if [ -z "$QuietCurl" ]; then
                        curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4.212 Safari/537.36" -o /minecraft/plugins/ViaVersion.jar "https://ci.viaversion.com/job/ViaVersion/lastBuild/artifact/build/libs/$ViaVersionVersion"
                    else
                        curl --no-progress-meter -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4.212 Safari/537.36" -o /minecraft/plugins/ViaVersion.jar "https://ci.viaversion.com/job/ViaVersion/lastBuild/artifact/build/libs/$ViaVersionVersion"
                    fi
                fi
            else
                echo "Unable to check for updates to ViaVersion!"
            fi
        fi
    else
        echo "ViaVersion is disabled -- skipping"
    fi

See how in the latest version if you have the environment variable NoViaVersion enabled then it doesn't even look. If you are getting those errors then you did not pull the latest version of the container.

It will not update on it's own (at least not any time soon). You have to pull it like I said in my original post. You need to tell it to update the container yourself manually.

Again, I'm puzzled why you are using docker-compose for this. That is meant for advanced users and if pulling the updated container / setting an environment variable is something you need to ask you really shouldn't be using docker-compose.

I don't mean to be mean/rude but so far you have asked how to set an environment variable in docker-compose and you don't seem to know how to force it to update to the latest version either. You're making things really hard for yourself here trying to use docker-compose for this without knowing the basics like pulling the latest and setting an environment variable.

I strongly suggest you try:

sudo docker pull 05jchambers/legendary-minecraft-geyser-floodgate:latest
docker run -it -v yourvolumename:/minecraft -p 25565:25565 -p 19132:19132/udp -p 19132:19132 -e NoViaVersion=y --restart unless-stopped 05jchambers/legendary-minecraft-geyser-floodgate:latest

That will start the container with automatic restarts when you reboot the machine. It's that easy to update it and run it (permanently) normally.

I literally just tried this (with the exact above lines) and got the following output:

Latest paperclip build found: 514
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 40.6M  100 40.6M    0     0  46.3M      0 --:--:-- --:--:-- --:--:-- 46.3M
Floodgate is up to date
Geyser is up to date
ViaVersion is disabled -- skipping

Therefore I am forced to conclude that you are either setting the environment variable incorrectly or that you have failed to pull the latest version of the container. No, docker-compose will not update it for you automatically (it actually won't do anything running it the normal way wouldn't, the --restart unless-stopped makes it restart itself on reboots just like docker-compose). You need to pull it or you won't have that environment variable as I just added it after you asked this.

YAML files (what docker-compose) uses are extremely sensitive. If you're positive you've pulled the latest version then it may be as simple as you need to move the uncommented line up with the other uncommented lines. It's extremely picky which is why only advanced users should really be messing with docker-compose. My money is on that nothing has been pulled here though and you're running whatever version of the container it downloaded when you very first ran the container.

People tend to vastly overestimate what docker-compose will do for them. Updating the container automatically is one of those things things people using it assume it can/does do but it actually doesn't do it at all, If you google how to make docker-compose automatically update containers you'll find you need a much, much more complex setup usually involving some additional installations such as "Watchtower" or other means. You will need to do it manually just like you would if you use the CLI commands to start the container.

Again, I'm sorry if this came off as harsh or rude. Any perceived irritation in my post should be considered to be more directed at docker-compose than yourself. I wish it actually did make this stuff a lot easier. I wish it did automatically update everything and didn't use YAML files that are so picky. Hopefully that helps you get it going here whether you manually pull it or try running via CLI!