squaremap

squaremap

1.9k Downloads

A couple of TODOs for satisfying static mode support

andrejcremoznik opened this issue ยท 0 comments

commented

None of the issues here can not be worked around, so they aren't pressing, but I thought I'd write them down if somebody else wants to use squaremap like I do.

Basically, my goal is to render a static map and copy the files to a different server to host. Without real-time updates or player tracking, just the map.

The flow is:

  1. have the plugin as idle as possible (see my config below)
  2. execute /map fullrender <world> in a cronjob periodically (daily in my case)
    1. I'm running the server using systemd service and minecraftd script from https://github.com/Edenhofer/minecraft-server this allows me to easily script things and/or run them with cron 5 3 * * * minecraftd command /map fullrender minecraft:overworld
  3. execute rsync to copy the generated map to the remote server after the render

Thanks to #393 this is achievable with a couple of caveats.

The issues

  1. there doesn't seem to be a config.yml option for configuring static mode. Workaround is to add static to the web/tiles/settings.json file yourself and exclude it from being synced to the server:
    {
      // ...other settings
      "static": true
    }
  2. even though player-tracker is disabled, the web/tiles/players.json will contain an array of logged-on users that only have { world, name, uuid } values, no x and z. This causes Squaremap.toLatLng method to do math on undefined. I think the players array should just always be empty when tracking is disabled. Stack trace:
    Error: Invalid LatLng object: (NaN, NaN)
        at new Z (leaflet-src.js:1473:11)
        at Object.S [as latLng] (leaflet-src.js:1577:11)
        at gs.toLatLng (Squaremap.js:117:18)
        at new is (Player.js:45:34)
        at ns.updatePlayerList (PlayerList.js:129:26)
        at a (PlayerList.js:32:18)
        at PlayerList.js:55:40
        at PlayerList.js:46:21
        at Squaremap.js:159:20
    

Right now, if these 2 json files are ignored from automatically syncing to the web server, so as not to override customizations, the map works flawlessly. Here's the config.yml I'm currently using.

config-version: 2
settings:
    language-file: lang-en.yml
    update-checker: false
    web-address: https://my.sever
    web-directory:
        path: web
        auto-update: true
    image-quality:
        compress-images:
            enabled: true
            value: 0.5
    internal-webserver:
        enabled: false
    ui:
        coordinates:
            enabled: true
        link:
            enabled: true
        sidebar:
            pinned: pinned
    render-progress-logging:
        enabled: false
world-settings:
    default:
        map:
            enabled: true
            background-render:
                enabled: false
            markers:
                update-interval-seconds: 3600
                spawn-icon:
                    enabled: true
                world-border:
                    enabled: false
                    show-controls: false
            visibility-limits:
                - type: world-border
                  enabled: false
        player-tracker:
            enabled: false
            update-interval-seconds: 3600
            show-controls: false
    minecraft:overworld:
        map:
            display-name: Overworld
    minecraft:the_nether:
        map:
            display-name: Nether
            iterate-up: true
    minecraft:the_end:
        map:
            display-name: End

Thanks for the plugin, it's great!