Skip to content

Server Hosting

Cloudflare and Velocity Setup

Cloudflare

Performing the following makes it so normal HTTP pings to your subdomain return a Cloudflare IP, but when a TCP connection gets an SRV record back and parses it, ta da! This also allows for subdomain forwarding over a proxy like Velocity so you get all the benefits of that (one port open, fallback servers, etc.).

Cloudflare DNS records: A record for subdomain, SRV record for mc server.

Name: _minecraft._tcp.SUBDOMAINHERE
Priority: 0
Weight: 5
Port: obvious
Target: sub.domain.com

I have a small patch for Velocity to fix HostString forwarding because cloudflare junks it up. https://github.com/PaperMC/Velocity/pull/1497

Either build my branch or they'll have merged it in.

Velocity Setup + Config

These are the standard recommended velocity jvm arguments:

java -Xms512M -Xmx512M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar velocity-proxy-3.4.0-SNAPSHOT-all.jar

velocity.toml

player-info-forwarding-mode = "modern"
ping-passthrough = "all"
[servers]
lobby = "127.0.0.1:25571"
mymcserver = "127.0.0.1:25572"
try = [
    "lobby"
]
[forced-hosts]
# Configure your forced hosts here.
"mymcserver.proxius.net" = [
    "mymcserver",
    "lobby"
]
tcp-fast-open = true

Velocity Plugins

Server Software

Server Versions

The fork list goes like this: Vanilla->Bukkit->Spigot->Paper->Purpur

I do not use Folia at this time because I do not need to and it can be unstable.

Linux Server JVM Arguments

See

Executing Server

I wrote this script to neatly execute the above jvm block in "z.sh"

This force-sets the user as "mc" to keep me from making a mistake as root.

z.sh and zscreen.sh should be made executable and be placed in the same folder as the server jar.

zscreen.sh

#!/bin/bash

# Set CWD to where this shell script is located
cd "$(dirname "$0")"

# Define the screen command
COMMAND="screen -dmS newtecnerds ./z.sh"

# Check if the current user is 'mc'
if [ "$(whoami)" != "mc" ]; then
    # If not running as 'mc', use 'sudo' to run as 'mc'
    sudo -u mc $COMMAND
else
    # If running as 'mc', run directly without sudo
    $COMMAND
fi

Server Configuration

The following is for a cranked vanilla minecraft server running purpur and being proxied behind velocity.

server.properties

  • allow-flight: true
  • difficulty: hard
  • enforce-secure-profile: false
  • enforce-whitelist: true
  • motd: pick
  • online-mode: false
  • server-ip: 127.0.0.1
  • server-port: pick
  • simulation-distance: 32
  • spawn-protection: 1
  • view-distance: 32
  • white-list: true

leave sync-chunk-writes=true, I learned the hard way what off does. Massive corruption.

bukkit.yml

adjust mob caps here if you want

spigot.yml

  • settings
    • user-cache-size: 10000 //player UUID cache size
    • moved-wrongly-threshold / moved-too-quickly: I usually bump this up a few factors because why not
    • restart-on-crash: true
    • restart-script: ./zscreen.sh
    • netty-threads: 12
  • entity-activation-range: I recommend leaving this alone because it screws with farms
  • entity-tracking-range: the higher the better, I like making players match the server view distance so you can always see friends far away.
    • players: 512
    • animals: 96
    • monsters: 96
    • misc: 96

config/paper-global.yml

  • chunk-loading-advanced:
    • auto-config-send-distance: true
    • player-max-concurrent-chunk-generates: 10000
    • player-max-concurrent-chunk-loads: 10000
  • chunk-loading-basic:
    • player-max-chunk-generate-rate: -1.0
    • player-max-chunk-load-rate: 10000.0
    • player-max-chunk-send-rate: 3000.0
  • chunk-system: THE SECRET SAUCE WARNING: io-threads especially makes a HUGE performance impact, balance it out.
    • gen-parallelism: default
    • io-threads: 6
    • worker-threads: 32
  • packet-limiter:
    • max-packet-rate: 1000
  • proxies:
    • velocity:
      • enabled: true
      • online-mode: true
      • secret: PUT_SECRET_HERE

Plugins

Bluemap

Install mariaDB and use SQL as the storage type for bluemap. Install the brotli addon before rendering the map so the files are compressed with brotli Install the sign extractor addon

The dev should have added this at some point after writing this. I found that in TileManager.js if you crank the currentlyLoading threshold from 8 to ~256 you get massively accelerated loading since its not constantly popping into 1 second timeouts. he said he'd add it as a config setting in the world.conf

To install the brotli addon, download the jar and place it in your ROOTDIR/config/bluemap/packs folder if you're on forge

Route Bluemap over Caddy. Uses a huge amount of traffic so you're going to have to use Black Arts Reverse Tunneling here.

Caddy Config
bmap.secretdomain.net {
        header Access-Control-Allow-Origin *

        #our minecraft server subdomain
        handle_path /subdomain.proxius.net/* {
                header {
                        Access-Control-Allow-Origin *
                        Access-Control-Allow-Credentials true
                        Access-Control-Allow-Headers *
                        Access-Control-Allow-Methods *
                        defer
                }
                #bluemap address
                reverse_proxy 192.168.4.5:8100 {

                }
        }
}

Dynmap

Route Dynmap over Caddy. You can use the same A/CNAME record from your server since this is for HTTP traffic and not Minecraft TCP traffic!

grid lines fix

dump this into dynmap's index.html in the javascript block. dynmap seems to like to overwrite the index.html on every boot so disable write access to it. If you run the server as root it'll bypass read-only perms and write to the file so watch out. If its working you'll see dynmap cry about it in the startup log.

if (window?.chrome !== undefined) {
  const originalInitTile = L.GridLayer.prototype._initTile;

  L.GridLayer.include({
    _initTile: function (tile) {
      originalInitTile.call(this, tile);

      const tileSize = this.getTileSize();

      tile.style.width = `${tileSize.x + 1}px`;
      tile.style.height = `${tileSize.y + 1}px`;
    }
  });
}

CoreProtect

Devs are super cool and want people to pay to download precompiled jars.

https://gist.github.com/iamnotpayingforyourpatreon/20371ddfb318c49dda48fc537032d923

tl;dr

cd Desktop
git clone https://github.com/PlayPro/CoreProtect.git

src/main/resources/plugin.yml -> branch: development

mvn clean install
output located in target folder

LuckPerms

Sleep-Most

Minecraft's new sleep percentage gamerule doesn't seem to work, so I still use this tried and true plugin. I like to clean up the messages and settings a bit to make it behind the scenes and more vanilla-esque with some immersion. I've attached the configs I'm using at time of writing.

config.yml messages.yml

TabTPS

go to display-configs and disable everything but the tab-settings. set to enabled and enable-on-login.

Worldedit

Client Software and Setup

I use MultiMC as a launcher.

I host any and all packs using technic.

Windows Client JVM Arguments

On Windows -XX:+UseTransparentHugePages does not exist. Furthermore, Windows does not normally support large memory pages. "JVM cannot use large page memory because it does not have enough privilege to lock pages in memory". These JVM args were tested on a 5900x and a 4080 super and showed consistent working improvement. All garbage collector types and configurations as of Java 21 were tested.

Adjust/remove Xms Xmx and ConcGCThreads as needed.

-Xms10G -Xmx10G -XX:ConcGCThreads=24 -XX:ReservedCodeCacheSize=400M -XX:NonNMethodCodeHeapSize=12M -XX:NmethodSweepActivity=1 -XX:ProfiledCodeHeapSize=194M -XX:NonProfiledCodeHeapSize=194M -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:+UseZGC -XX:-ZProactive -XX:+ZGenerational -XX:AllocatePrefetchStyle=1 -XX:+AlwaysActAsServerClassMachine -XX:+UnlockExperimentalVMOptions -XX:+AlwaysPreTouch -XX:+UseStringDeduplication -XX:-OmitStackTraceInFastThrow -XX:+OptimizeStringConcat -XX:+UnlockDiagnosticVMOptions -XX:+DisableExplicitGC -XX:+UseNUMA -XX:-DontCompileHugeMethods -XX:+UseVectorCmov -XX:+PerfDisableSharedMem -XX:+UseFastUnorderedTimeStamps -XX:+AlignVector -XX:+OptoBundling -XX:+OptimizeFill -XX:+AlwaysCompileLoopMethods -XX:+EnableVectorAggressiveReboxing -XX:+EnableVectorSupport -XX:+OptoScheduling -XX:+UseCharacterCompareIntrinsics -XX:+UseCopySignIntrinsic -XX:+UseVectorStubs -XX:+UseCriticalJavaThreadPriority -XX:ThreadPriorityPolicy=1

Modded Minecraft

As of 1.18+ hybrid servers do not include server-side optimizations like paper does, so there's no point.

Start here:

https://github.com/TheUsefulLists/UsefulMods

Velocity player information forwarding for fabric and forge