Skip to content

World Storage and more

Latest
Compare
Choose a tag to compare
@LemmaEOF LemmaEOF released this 12 May 10:35
· 35 commits to master since this release
  • Consolidate all commands under the /script command, now as /script run, /script engines, and /script tag.
  • Change the /script argument types so that a vanilla client can connect to a Cotton Scripting server without being kicked for not having the necessary argument type registered.
  • Rename ScriptContext to CottonScriptContext to avoid confusion with the javax ScriptContext.
  • Pass a copy of CottonScriptContext as cotton_context on script evaluation, alongside the fresh copies of the context passed to all functions.
    • This allows you to mutate the original CottonScriptContext while still retaining the original accessible in functions.
  • Add a method to run scripts as the server. It will likely be moved into a class in the API package soon.
  • Add a mutative method to CottonScriptContext to change the context's command source.
  • Add methods to ScriptTools to obtain command sources for the server and for players.
  • Change the internal ScriptCommandExecutor to be passed a World instead of a ServerCommandSource.
  • Register default script tags for cotton:tick, cotton:load, and cotton:world_storage_listeners
    • cotton:tick and cotton:load will be changed to the minecraft: namespace upon next release.
    • There is currently an unresolved issue preventing script tags from properly loading. This will hopefully be fixed by next release.
  • Add a World Storage system for reading and writing persistent data without the use of the Scoreboard.
    • WorldStorage comprises of one manager class and two PersistentStates.
    • EntityWorldStorage stores data associated with individual identities similar to the Scoreboard, GlobalWorldStorage stores data associated with the world itself.
    • Both EntityWorldStorage and GlobalWorldStorage can have booleans, integers, floats, doubles, and strings written and read, with support for dynamic typing.
    • Whenever either WorldStorage is written to, all the scripts in the cotton:world_storage_listeners tag will be evaluated.