Solved Should I really be doing this?

Discussion in 'Plugin Development' started by Tecno_Wizard, Jul 11, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    Tecno_Wizard

    I am developing a plugin where things could go catastrophically wrong if parts of the world are changed while the plugin is disabled. There is a specific setting that changes the type of a monitored block in game, and if it is changed the user must be prepared to lose all of their data for the plugin. However, if I simply "pause" the plugin for confirmation, any changes to the world could potentially cause breaking behavior. To me, the best option seems to be to shut down the server and tell the server owner to manually delete all of the plugin data as a way of confirmation. I'm concerned people will just say the plugin is broken when I am protecting them from making a mistake that would require deleting all of the plugin data to fix.

    TL;DR, is shutting down the server as a way of protecting a server owner from their own stupidity (and refusal to read warnings) a good/acceptable idea?
     
  2. Offline

    Zombie_Striker

    @Tecno_Wizard
    Well, what type of data will be lost? Is it all data, or some data? Is there a way of localizing the damage to a small area or file? Are you sure you can't just create back-up files?

    Although you can't expect things to not break, you should focus on making sure things can't go "catastrophically wrong" that often.
     
  3. Offline

    Tecno_Wizard

    @Zombie_Striker, a database of warp blocks players have placed. If they are broken, the warps no longer have a corresponding block and they cannot be deleted. The only localized damage I can fix is checking if the block is still there, which isn't a great solution either because any warp block that was placed while the plugin was inactive is now a normal one, and that I can't monitor. Getting the warp blocks ain't cheap either.

    The option that I need to confirm is switching the plugin from warp mode to respawn mode. In warp mode, the player can warp to any of their blocks at any time given that someone doesn't break it. In respawn mode, you can only have one and the only way to warp to it is to die. If the setting is changed, the plugin needs a completely different set of data, meaning the existing warp blocks cannot be used. If the mod didn't intend on doing that, I can't just wipe all of their data.
     
    Last edited: Jul 12, 2016
  4. Offline

    I Al Istannen

    @Tecno_Wizard
    I would go with Zombie and instead of deleting them make a backup dir, where all current warp blocks will be saved to. Then add an info file stating what block was used as the warp block at this time and what else you need. On the next switch, ask if they want to restore the old data (and maybe default to yes) and reset all the things in the info file (warp block material) and save the now old warps in another directory.

    This will essentially allow them to have both modes and switch between them, keeping their data for the next switch. They will still be able to destroy it, but that would be an impressive feat (or them tempering with the info or other files).

    Maybe I have overlooked something critical though, so take it with a grain of salt.
     
  5. Offline

    Tecno_Wizard

    @I Al Istannen, there is one missing detail. If the block the insertion is attached to in the world is broken, you now have an immutable insertion when you switch back to the other mode.

    I found another way though. If the field is changed in the config, the save data file (I have multiple data files here. One for each mode and one general + the config) will still have it recorded that the last engaged mode was the other one, and the plugin will revert itself to the previous mode unless the clear insertions command is run to remove all existing insertions. Only when there are no insertions will the plugin actually allow you to change the mode, or if you were dumb and edited the general save data file.
     
Thread Status:
Not open for further replies.

Share This Page