NeumimTo / Pl3xMap

Pl3xMap is a minimalistic and lightweight world map viewer for Paper servers using the vanilla Minecraft rendering style
MIT License
68 stars 7 forks source link

Settings, marker and player information is not updated #20

Open lmichaelis opened 2 years ago

lmichaelis commented 2 years ago

Hey there, we're trying out Pl3xMap on our server atm and I've noticed something strange: The plugin fails to update player and marker data as well as the world settings. After some digging I found the cause:

https://github.com/NeumimTo/Pl3xMap/blob/708cd08e1efe1b596f3cbc65fe9fcb909f749e0e/plugin/src/main/java/net/pl3x/map/plugin/util/FileUtil.java#L160-L168

For some reason the Runnable given to ForkJoinPool.execute is never actually run. I suspect that is is due to other plugins using the same pool an somehow blocking it. I don't know which one would cause this, however (I've included a plugin list below).

Because FileUtil.write is only ever called from BukkitRunnables I propose the following solution (if this is not caused by another plugin): Don't submit the task to a ForkJoinPool (or at least not the default commonPool), instead just call replaceFile directly.

Testing this, it does not seem to cause a meaningful MSPT increase (< 10 players online).

Plugin List

image

Pl3xMap Configuration

config.yml:

world-settings:
  default:
    map:
      enabled: true
      display-name: '{world}'
      order: 0
      icon: ''
      max-render-threads: 8
      iterate-up: false
      max-height: -1
      min-height: -64
      render-progress-interval: 1
      biomes:
        enabled: true
        blend-biomes: 4
      glass:
        clear: true
      lava:
        checkerboard: true
      water:
        clear-depth: true
        checkerboard: false
      zoom:
        maximum: 3
        default: 3
        extra: 2
      background-render:
        enabled: true
        max-chunks-per-interval: 1024
        interval-seconds: 15
        max-render-threads: -1
      fullrender-generate-new-chunks: false
      markers:
        update-interval-seconds: 5
        spawn-icon:
          enabled: true
          show-controls: true
          default-hidden: false
          layer-priority: 0
          z-index: 0
        world-border:
          enabled: true
          show-controls: true
          default-hidden: false
          layer-priority: 1
          z-index: 1
      visibility-limits:
      - type: world-border
        enabled: false
    player-tracker:
      enabled: true
      update-interval-seconds: 1
      show-controls: true
      default-hidden: false
      layer-priority: 2
      z-index: 2
      nameplate:
        enabled: true
        show-head: true
        heads-url: https://mc-heads.net/avatar/{uuid}/16
        show-armor: true
        show-health: true
      hide:
        invisible: true
        spectators: true
settings:
  language-file: lang-en.yml
  debug-mode: false
  web-address: https://map.*******.net
  web-directory:
    path: web
    auto-update: true
  image-quality:
    compress-images: 0.0
  internal-webserver:
    enabled: true
    bind: 0.0.0.0
    port: 8100
  ui:
    coordinates:
      enabled: true
    link:
      enabled: true
    sidebar:
      pinned: pinned
  commands:
    main-command-label: pl3xmap
    main-command-aliases:
    - map
config-version: 1

advanced.yml:

settings:
  event-listeners:
    BlockPlaceEvent: true
    BlockBreakEvent: true
    LeavesDecayEvent: true
    BlockBurnEvent: true
    BlockExplodeEvent: true
    BlockGrowEvent: true
    BlockFormEvent: true
    EntityBlockFormEvent: true
    BlockSpreadEvent: true
    FluidLevelChangeEvent: true
    EntityExplodeEvent: true
    EntityChangeBlockEvent: true
    StructureGrowEvent: true
    ChunkPopulateEvent: true
    BlockFromToEvent: false
    PlayerJoinEvent: false
    PlayerQuitEvent: false
    PlayerMoveEvent: false
    BlockPhysicsEvent: false
    BlockPistonExtendEvent: false
    BlockPistonRetractEvent: false
    ChunkLoadEvent: false
world-settings:
  default:
    iterate-up-base-blocks:
    - minecraft:netherrack
    - minecraft:glowstone
    - minecraft:soul_sand
    - minecraft:soul_soil
    - minecraft:gravel
    - minecraft:warped_nylium
    - minecraft:crimson_nylium
    - minecraft:nether_gold_ore
    - minecraft:ancient_debris
    - minecraft:nether_quartz_ore
    - minecraft:magma_block
    - minecraft:basalt
    invisible-blocks:
    - minecraft:tall_grass
    - minecraft:fern
    - minecraft:grass
    - minecraft:large_fern
    color-overrides:
      biomes:
        foliage:
          minecraft:jungle_hills: '#1f8907'
          minecraft:jungle: '#1f8907'
          minecraft:dark_forest: '#1c7b07'
          minecraft:jungle_edge: '#1f8907'
          minecraft:dark_forest_hills: '#1c7b07'
          minecraft:bamboo_jungle: '#1f8907'
          minecraft:bamboo_jungle_hills: '#1f8907'
        grass: {}
        water: {}
      blocks:
        minecraft:rose_bush: '#9B221A'
        minecraft:spruce_leaves: '#619961'
        minecraft:lilac: '#B66BB2'
        minecraft:cornflower: '#466AEB'
        minecraft:azure_bluet: '#F7F7F7'
        minecraft:lily_of_the_valley: '#FFFFFF'
        minecraft:poppy: '#ED302C'
        minecraft:white_tulip: '#D6E8E8'
        minecraft:wither_rose: '#211A16'
        minecraft:sunflower: '#FFEC4F'
        minecraft:blue_orchid: '#2ABFFD'
        minecraft:lava: '#EA5C0F'
        minecraft:red_tulip: '#9B221A'
        minecraft:allium: '#B878ED'
        minecraft:mycelium: '#6F6265'
        minecraft:lily_pad: '#208030'
        minecraft:oxeye_daisy: '#D6E8E8'
        minecraft:dandelion: '#FFEC4F'
        minecraft:glass: '#FFFFFF'
        minecraft:attached_melon_stem: '#E0C71C'
        minecraft:pink_tulip: '#EBC5FD'
        minecraft:terracotta: '#9E6246'
        minecraft:attached_pumpkin_stem: '#E0C71C'
        minecraft:orange_tulip: '#BD6A22'
        minecraft:birch_leaves: '#80A755'
        minecraft:peony: '#EBC5FD'
config-version: 1