Jikoo / Regionerator

A Bukkit plugin for gradually deleting unused area.
Creative Commons Attribution Share Alike 4.0 International
54 stars 18 forks source link

Using command to edit permanent chunk does not work properly #217

Closed KBVsent closed 8 months ago

KBVsent commented 10 months ago

When I use the /regionerator flag command to mark a permanent chunk, and then use the /regionerator check command to check the chunk, sometimes the result is permanent and sometimes it is visited.And when I directly run the plugin to delete chunk according to the wiki, the chunk deletion function works fine. However, after I enter the game and use the "/regionerator check" command, all the blocks that I previously marked as permanent become "visited" instead of permanent.All operations have no error messages, when I set the debug-level in config.yml to MEDIUM. My game environment: game version :1.19.2-java edition server version :paper-1.19.2

Jikoo commented 9 months ago

Hey, sorry it took me so long to get back to you. I'm not able to reproduce this. Are you sure you're checking within the correct chunk? Note that the flag command takes chunk coordinates, not block coordinates.

KBVsent commented 8 months ago

I am using the same command in the same place, but I get different results.

Jikoo commented 8 months ago

You should only be seeing other values if you're freshly flagging a chunk and seeing a cached protection value (they're a bit expensive to calculate). Could you post the output of /regionerator check for one of these chunks? Also would be helpful to have a copy of your config.

KBVsent commented 8 months ago

Sorry for not replying in time.

# This is the Regionerator configuration file.
# For more information about options, please see the wiki:
#   https://github.com/Jikoo/Regionerator/wiki/Configuration
#

# Every x seconds, chunks around each player online are flagged.
# Flags prevent deletion for a configurable amount of time, allowing
# players to prevent areas from being deleted simply by being active.
#
# Default values cause a 9x9 chunk (144x144 blocks) around players to be
# flagged every 10 seconds. This means that unless players exceed a travel
# speed of 14.4 m/s chunks will be continuously flagged as they pass.
# For more information on travel speeds, please check the Minecraft wiki.
# https://minecraft.gamepedia.com/Transportation#Methods
flagging:
  seconds-per-flag: 10
  # Square around each player's current chunk to flag. 0 = current chunk only.
  chunk-flag-radius: 4
  # Chunks are automatically flagged as visited when generated.
  # If true, the flag is set to a special value that will be overwritten once
  # a player actually visits the area. This allows you to reduce load by
  # pre-generating area for exploration and not deleting unvisited areas.
  # Note that flagging must be enabled in worlds (days-till-flag-expires > 0).
  flag-generated-chunks-until-visited: true

# Don't mess with the cache settings unless you know what you're doing and
# are having problems. Larger servers may want to tweak these values to reduce
# GC churn or memory usage.
cache:
  # Seconds between expiration. Longer reduces churn but decreases accuracy of other cache settings.
  minimum-expiration-frequency: 10
  # Minutes to cache values for. Increase to reduce churn, decrease to reduce memory usage.
  retention: 10
  # Maximum number of entries per batch update.
  maximum-batch-size: 1024
  # Milliseconds between batch updates.
  batch-delay: 500
  # Maximum number of cached entries. Increase to reduce churn, decrease to reduce memory usage.
  max-cache-size: 640000

deletion:
  # Recovery time in milliseconds between expensive operations.
  # Recovery time is always waited between region checks.
  deletion-recovery-time: 250
  # Number of chunks with expensive checks between recovery delays.
  # Values >= 1024 cause no additional recovery time.
  expensive-checks-between-recovery: 128
  # Hours between deletion cycles
  hours-between-cycles: 12
  # Whether or not to remember time for next cycle on plugin load
  remember-next-cycle-time: false

# Worlds the plugin is able to delete regions in
worlds:
  # "default" applies to all worlds not specified.
  default:
    # Flags older than x days can be ignored and the region deleted.
    # Set to -1 to disable Regionerator in a world.
    # To disable flagging, set this to 0.
    # days-till-flag-expires must be greater than 0 to be used with delete-new-unvisited-chunks
    days-till-flag-expires: 3

# Hooks to attempt to check for protections from.
# If your protection plugin of choice isn't here, ask!
hooks:
  BentoBox: true
  Civs: true
  ClaimChunk: true
  Factions: true
  GriefDefender: true
  GriefPrevention: true
  Lands: true
  PlotSquared: true
  PreciousStones: true
  RedProtect: true
  Residence: true
  Towny: true
  WorldGuard: true
  VanillaSpawnProtection: true

# Debug-level enables more and more verbose logging of actions as increased.
# OFF - no debug messages
# LOW - Minimal debug messages, periodic deletion reports
# MEDIUM - More debug messages. Causes lots of spam but can help you resolve startup issues.
# HIGH - Lots of debug messages. Don't enable this unless you have a serious issue - excessive logging causes lag.
debug-level: MEDIUM

# Please don't mess with this, you may lose settings. Controls automatic updates to config layout.
config-version: 1
[23:03:24 INFO]: Vsent issued server command: /regionerator flag
[23:03:47 INFO]: Vsent issued server command: /regionerator check
[23:03:50 INFO]: Vsent issued server command: /regionerator check
[23:03:51 INFO]: Vsent issued server command: /regionerator check

This is my configuration file. I do not receive any error messages when using the relevant commands, but there may be different outputs when using the /regionerator check command at the same location, which makes me unsure whether the chunk has been permanently marked. The following is a screenshot of the results I obtained using the same command at the same location (same coordinates). e47071a5612c7c3aa955ae12a04136b0 fced71004837326f0f37ee992610e77e

Jikoo commented 8 months ago

Okay, I think that is a caching error. The end result should still be that the chunk is protected, but the information presented is not correct. Internally, when Regionerator submits data to the database, the database keeps the highest protection duration value. However, when submitting new values, if the value is not already in the cache, Regionerator inserts the newly-set value into the cache even if it is not accurate to what the database will keep.

Easiest way for you to verify is to check chunk states with no players around while in spectate, which is also the main difference between our tests. This looks like the chunk flagger re-added the chunks to the cache with inaccurate values while doing visitation processing.