Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 182: Leaderboard changes #194

Merged
merged 15 commits into from Apr 11, 2019

Conversation

@woosle1234
Copy link
Contributor

commented Mar 26, 2019

This pull request for Issue 182:

  • Currently, the layout of the leaderboard has changed to show new values, and set up to retrieve the new user stats

  • Stats placed in private variables of the Gameobject which is then set and retrieved from the event and listeners for each new userstat

  • Added set and get double for userstats to later incorporate time

  • Added the events to Cubot plugin for death even and walking event

Working on:

  • Still trying to figure out how to get time and set it up

  • Also wondering if current configuration and logic works in order to get walk distance and death count

Copy link
Owner

left a comment

I wrote some comments, let me know if you have any questions.

Edit: I'll let you know how you can get the execution time from the CPU when I get home
Good job!

@woosle1234

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2019

Walking and death counter now works:

  1. Upon refresh or server restart the walk distance resets to 0

  2. Upon death the walk distance counter resets to 0

  3. Walk distance is only set if user achieves a higher walk distance than previously achieved

Learderboard currently has set values for testing but the logic of code works. Currently facing error when trying to retrieve int value and store within arraylist. Line 41 replicates error: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Integer

Time still need to be set however listener and event setup with proper logic with leaderboard

@kevinramharak

This comment has been minimized.

Copy link
Contributor

commented on no in 47b37fb Mar 28, 2019

Can you remove this file from the git history?

@woosle1234

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2019

Can you remove this file from the git history?

Removed

@kevinramharak

This comment has been minimized.

Copy link
Contributor

commented Mar 28, 2019

@woosle1234

Walking and death counter now works:

  1. Upon refresh or server restart the walk distance resets to 0
  2. Upon death the walk distance counter resets to 0
  3. Walk distance is only set if user achieves a higher walk distance than previously achieved

Learderboard currently has set values for testing but the logic of code works. Currently facing error when trying to retrieve int value and store within arraylist. Line 41 replicates error: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Integer

Time still need to be set however listener and event setup with proper logic with leaderboard

I am fairly sure that your cast error has something to do with https://github.com/simon987/Much-Assembly-Required/blob/master/Server/src/main/java/net/simon987/server/user/UserStatsHelper.java#L60.

It seems that in the getTopNSetLength (or whatever its name is) function there is a fallback value for if a stat does not exist. Not sure what its purpose is, but the function seems to operate on the same MongoCollection<Document> as the getTopN function.

Maybe this is a result of your previous code where you were using the old function to retrieve those stat properties and this line set its default value to an empty ArrayList. Then these values where written back to the database. You could confirm by clearing the database of the stored documents.

@woosle1234

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2019

@woosle1234

Walking and death counter now works:

  1. Upon refresh or server restart the walk distance resets to 0
  2. Upon death the walk distance counter resets to 0
  3. Walk distance is only set if user achieves a higher walk distance than previously achieved

Learderboard currently has set values for testing but the logic of code works. Currently facing error when trying to retrieve int value and store within arraylist. Line 41 replicates error: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Integer
Time still need to be set however listener and event setup with proper logic with leaderboard

I am fairly sure that your cast error has something to do with https://github.com/simon987/Much-Assembly-Required/blob/master/Server/src/main/java/net/simon987/server/user/UserStatsHelper.java#L60.

It seems that in the getTopNSetLength (or whatever its name is) function there is a fallback value for if a stat does not exist. Not sure what its purpose is, but the function seems to operate on the same MongoCollection<Document> as the getTopN function.

Maybe this is a result of your previous code where you were using the old function to retrieve those stat properties and this line set its default value to an empty ArrayList. Then these values where written back to the database. You could confirm by clearing the database of the stored documents.

I'll have to test what your saying but it makes sense, either way it should be setup now so that if the stat doesn't exist it should set the integer to 0.

@simon987

This comment has been minimized.

Copy link
Owner

commented Mar 28, 2019

Note that the stats are only saved to disk on save ticks (every X ticks the server saves)

@woosle1234

This comment has been minimized.

Copy link
Contributor Author

commented Mar 29, 2019

Everything should be working now and implemented:

  1. Added a new java file for a Real Life Timer that is constructed at cubot construction

  2. I'm basing execution time based on any time where status is not IDLE then adding it to the total execution time of cubot

  3. I had a lot of trouble trying to get the execution time from the cpu memory so using the timer function was the best idea I could come up with

I noticed I should place the execution time event after the walking action in update
@simon987 simon987 force-pushed the simon987:master branch 3 times, most recently from 76edb73 to e378016 Apr 3, 2019
Copy link
Owner

left a comment

Hi @woosle1234. I'm very sorry for the delay,
You did a very good job overall. there's just some tweaks I'd like you to make
If you need more info just let me know

Thank you!

@woosle1234

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2019

Hi @woosle1234. I'm very sorry for the delay,
You did a very good job overall. there's just some tweaks I'd like you to make
If you need more info just let me know

Thank you!

No problem!
I took your comments and made changes to the code please let me know if I need to change anything

Copy link
Contributor Author

left a comment

Changes have been made

@simon987 simon987 merged commit f99f327 into simon987:master Apr 11, 2019
1 check passed
1 check passed
CodeFactor No issues found.
Details
@simon987

This comment has been minimized.

Copy link
Owner

commented Apr 11, 2019

thank you

@woosle1234

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2019

thank you

No problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.