#how to read, write, and modify the server's data

36 messages · Page 1 of 1 (latest)

dusk girder
#

inside the save file there is a level.dat. i want to read, write, and modify the data in there

winged locustBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

final sparrow
#

uh

#

so

#

you cant*

dusk girder
#

bruh

final sparrow
#

in any meaningful way

#

You can read it, then write to it

dusk girder
#

then how do i store variables to the server

final sparrow
#

but only while the server is running

dusk girder
#

so that they dont get reset on /reload

final sparrow
#

...

#

??xy

open zenithBOT
# final sparrow ??xy

The XY problem is when you really want to do X, and you think that Y can achieve X. However, you can't get Y to work, and so ask for help exclusively about Y.

This can lead to a lot of confusion from the people trying to help you, as Y can seem like a very random thing to want to do, and a lot of the time isn't the best way to achieve X anyway.

Its fine to ask about Y, just always include some context about X so you can be put on the right track if Y won't do X well, or there is an easier way to do X.

final sparrow
#

THIS IS WHY THIS EXISTS

#

anyway

#

event.server.persistentData

#

thats an object you can store pretty much anything in

#

and it is persistent

dusk girder
#

i want to do a few things, mainly make a counter for how many times a thing happened

final sparrow
#

what thing

dusk girder
#

how many a command has been run

final sparrow
#

does it care about being per player who ran it

dusk girder
#

no

#

and how many times the server has restarted

#

/ticked

#

basically the tick count of the server

#

whcih is Time in the level.dat

final sparrow
#

...

#

that variable is available in code

#

i cant remember exactly what its caled tho

dusk girder
#

gettickcount

#

sound it

#

found

final sparrow
#

yep

dusk girder
#

thx