AuthMeReloaded icon indicating copy to clipboard operation
AuthMeReloaded copied to clipboard

Store player's Location on single column

Open DNx5 opened this issue 10 years ago • 13 comments

I don't know what's the point to have separated column for player's location. Also, it doesn't save player's yaw & pitch. Would be better if we could save it in single column, like: world,x,y,z,yaw,pitch and then we could add new column for server name to be used on Bungeecord auto join feature.

DNx5 avatar Jun 28 '16 15:06 DNx5

+1

sgdc3 avatar Jun 28 '16 15:06 sgdc3

-1

https://en.wikipedia.org/wiki/First_normal_form It doesn't match the first NF. It would be no longer atomic.

It's a common practise to keep it at least in the third normalization form.

TuxCoding avatar Jun 28 '16 15:06 TuxCoding

should we stick with current format and add 2 more colums, or move it to a new table?

DNx5 avatar Jun 28 '16 15:06 DNx5

As it's a 1-to-1 relationship, it could be stored in a single table with the two additional column, but maybe we should separate it in order to have a better overview or to keep it empty if it's disabled (dev bukkit comment).

TuxCoding avatar Jun 28 '16 15:06 TuxCoding

+1 for one field. We are never interested in a single field only so it would make sense to just store it as a serialized string. I don't see the benefit of an additional table.

ljacqu avatar Jun 28 '16 16:06 ljacqu

A few more thoughts:

  • I think conceptually one field with serialized data would not be so bad since we only want to deal with the location in its entirety outside of PlayerAuth. In regards to 1NF we could argue that this represents one item. (This is wrong, I know :wink:)
  • I feel that AuthMe requiring only one table to store all its data is a big plus that speaks for us; I'd be sad to lose that because of how one location is being stored
  • It would be nice to be able to reduce location columns from 4 (or 6 with yaw & pitch) to 1 if we start adding more columns. @DNx5 mentions server name for Bungeecord. We have some other stories where a new column is being discussed (2F auth -> hash algorithm, sessions -> expiration, temp ban -> account locking).

However:

  • Migrating existing data will have to be done carefully. Especially since x/y/z/world columns might have custom names but we will want to delete the settings for those column names. Need to migrate location data before deleting the properties from the config.
  • To construct a Bukkit Location object we require the actual World object, not just the world's name. We shouldn't interact with the Bukkit API inside of PlayerAuth. Either we need to offer getPositionX() etc. as we do now and have e.g. BukkitService construct a Location then, or we create our own AuthLocation class with just the world name that can be converted to a Bukkit Location.

@games647 Thoughts?

ljacqu avatar Jul 03 '16 09:07 ljacqu

I think conceptually one field with serialized data would not be so bad since we only want to deal with the location in its entirety outside of PlayerAuth. In regards to 1NF we could argue that this represents one item. (This is wrong, I know :wink:)

I agree as it would reduce the load of columns, but I don't like the idea of having serialized data in one column. So I'd rather would extract it in an extra table. See below.

If we don't make an extra table, I could completely understand this decision.

I feel that AuthMe requiring only one table to store all its data is a big plus that speaks for us; I'd be sad to lose that because of how one location is being stored

I think an extra table wouldn't be so bad, because the user can just use a join and then sees all columns within a single request. Moreover location data might be not so important.

It would be nice to be able to reduce location columns from 4 (or 6 with yaw & pitch) to 1 if we start adding more columns. @DNx5 mentions server name for Bungeecord. We have some other stories where a new column is being discussed (2F auth -> hash algorithm, sessions -> expiration, temp ban -> account locking).

I aggree. What about the idea that save the location data in the player.dat file.Then we don't need to store the location data (6 columns) and the bungeecord servername.

TuxCoding avatar Jul 03 '16 11:07 TuxCoding

What about the idea that save the location data in the player.dat file.Then we don't need to store the location data (6 columns) and the bungeecord servername.

that would require us to use NMS code. and we still need the servername to tp player to his last joined server.

DNx5 avatar Jul 03 '16 11:07 DNx5

and we still need the servername to tp player to his last joined server.

BungeeCord does that.

EDIT: See the location file. Or do you mean to redirect the player after authentication on a lobby server.

TuxCoding avatar Jul 03 '16 11:07 TuxCoding

Thanks for the reply @games647; you raise some good points. I could live with a second table or just keeping the single columns. For the record, if you disable SaveQuitLocation in the config it will still teleport to the last location (from LimboPlayer). It works quite well.

ljacqu avatar Jul 03 '16 11:07 ljacqu

@games647 yes, that what i mean.

@ljacqu should we rename the jsoncache thing into userdata or something like that? because it doesn't looks like cache. just to avoid confusion.

DNx5 avatar Jul 03 '16 12:07 DNx5

@DNx5 That would be great! So will you do that and I'll do what you wrote in https://github.com/Xephi/AuthMeReloaded/issues/815#issuecomment-230149888 ? Division of work :smile:

ljacqu avatar Jul 03 '16 12:07 ljacqu

Given the comment thread, closing this as a wontfix

ljacqu avatar Apr 29 '17 07:04 ljacqu