WorldData fails to construct on creating new worlds #1599

Closed
yueh opened this Issue Jun 15, 2015 · 7 comments

Comments

Projects
None yet
2 participants
@yueh
Member

yueh commented Jun 15, 2015

WorldData and corresponding classes like PlayerData are failing to construct when creating a new world.

This is caused by using PreConditions to enforcing the necessary folders and files to exist before these are actually created.

@yueh yueh added the type-bug label Jun 15, 2015

@thatsIch

This comment has been minimized.

Show comment
Hide comment
@thatsIch

thatsIch Jun 15, 2015

Member

on rv2 or rv3?

Member

thatsIch commented Jun 15, 2015

on rv2 or rv3?

@yueh

This comment has been minimized.

Show comment
Hide comment
@yueh

yueh Jun 15, 2015

Member

rv3 as #1526 is not part of rv2.

WorldData already enforce the world folder to exist, so we can already create the necessary folders and files with the constructor. File.mkdir() already returns a boolean, which could be used as PreConditions or assert. The settings file is a bit more complicated as File.createNewFile() throws checked exceptions.

Additionally we can then remove the creation and validation from WorldData.onServerStarting()

Member

yueh commented Jun 15, 2015

rv3 as #1526 is not part of rv2.

WorldData already enforce the world folder to exist, so we can already create the necessary folders and files with the constructor. File.mkdir() already returns a boolean, which could be used as PreConditions or assert. The settings file is a bit more complicated as File.createNewFile() throws checked exceptions.

Additionally we can then remove the creation and validation from WorldData.onServerStarting()

@thatsIch

This comment has been minimized.

Show comment
Hide comment
@thatsIch

thatsIch Jun 15, 2015

Member

meh obviously the API does not state that, it is not being created, when accessible

Member

thatsIch commented Jun 15, 2015

meh obviously the API does not state that, it is not being created, when accessible

@thatsIch

This comment has been minimized.

Show comment
Hide comment
@thatsIch

thatsIch Jun 15, 2015

Member

Also need to pay attention, cause it can also return null

Member

thatsIch commented Jun 15, 2015

Also need to pay attention, cause it can also return null

@yueh

This comment has been minimized.

Show comment
Hide comment
@yueh

yueh Jun 15, 2015

Member

The API for File?

Member

yueh commented Jun 15, 2015

The API for File?

@thatsIch

This comment has been minimized.

Show comment
Hide comment
@thatsIch

thatsIch Jun 15, 2015

Member

for DimensionManager

Member

thatsIch commented Jun 15, 2015

for DimensionManager

@yueh

This comment has been minimized.

Show comment
Hide comment
@yueh

yueh Jun 15, 2015

Member

Ah, ok. But we already ensure that this directoy is not null.
Not sure when it could return null, except maybe on client only. But then WorldData is only constructed on servers.

Member

yueh commented Jun 15, 2015

Ah, ok. But we already ensure that this directoy is not null.
Not sure when it could return null, except maybe on client only. But then WorldData is only constructed on servers.

@thatsIch thatsIch self-assigned this Jun 15, 2015

@thatsIch thatsIch added this to the rv3 - 1.7.10 milestone Jun 15, 2015

@thatsIch thatsIch closed this in db4a6c6 Jun 17, 2015

thatsIch added a commit that referenced this issue Jun 17, 2015

Merge pull request #1600 from thatsIch/b-1599-precondition-failing-of…
…-world-data


Fixes #1599: Removes preconditions for world data and children
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment