Rocologo / MobHunting

Mob hunting plugin for Minecraft Servers
24 stars 22 forks source link

Achievements count on leaderboard #233

Closed vilgrar closed 7 years ago

vilgrar commented 7 years ago

Hi,

I set up a leaderboard on achievements but it won't update. I'm not sure if the leaderboard shows only fully complete achievements, but I did a few part achievements.

Creeper, Spider, Zombie and Skeleton are well past 100+ kills, so I was rewarded once each for completing them.

Rocologo commented 7 years ago

Its very long time since I have tested this, so I will have to test it (again) on my test server and see whats going on. The leaderboards was developed by the first developer, before I foke over two years ago.I have only made smaller updates, and fixed some bugs. So Icant remember what it actually counts

Rocologo commented 7 years ago

I agree... It is strange how the Achievements is counted... I have create a achievement leaderboard on my server and I see no connections between /mh achievements and the leaderboard. But It actually looks like I am missing the completed achievements, and only see the ongoing...

Rocologo commented 7 years ago

If you type /mh achievements nogui you will see all the completed achievements and the match the number on the leaderboard, but I dont see these in the gui if i type /mh leaderboard gui

vilgrar commented 7 years ago

I guess at some point that old code stopped working. Well, I'm confident you'll figure it out =) This might be the last bug report I'll post, simply because there are no bugs left, hehe.

Rocologo commented 7 years ago

please test build 379 or newer https://fractal.lindegaard.one:8181/job/MobHunting/

I have made some improvements to the "/mh achievements gui". The GUI now show all Completed (and started) achivements. Also I change the Item to a mob head, and added a number (2,3,4...) for the "Hunter Level achievements"

Also I checked that my leaderboard updated after: 1) data has been saved AND 2) Leaderboard updated. If you enable /mh debug you will be able to see when data is saved and when the leader board is updated.

[15:28:21 INFO]: [MobHunting][Debug] Saving PlayerStats to Database. [15:28:21 INFO]: [MobHunting][Debug] Saved. [15:28:23 INFO]: [MobHunting][Debug] Refreshed 17 leaderboards. [15:28:28 INFO]: [MobHunting][Debug] Refreshed 14 MasterMobHunters

Depending on your settings it can take some time before the leaderboard is updated. (>10 min)

vilgrar commented 7 years ago

[http://picpaste.com/2017-05-25_21.11.07-0J0oRTtK.png] /mh kills looks better than ever!

[http://picpaste.com/pics/2017-05-25_21.11.18-xqkavrEN.1495739606.png] The leaderboard signs don't think I'm a cow killing god.

Edit: Amature is a typo. Correct spelling is 'amateur'.

Rocologo commented 7 years ago

Are you able to open the database and check the mh_achievements table? Completex tasks should have the counter set to -1, but I have seen that the counter sometimes is a number close to the target. For the cow it is 100, so maybe it is aet to 97 i nsted of -1. This could make problems....on the leaderboards. I will see if i can fix this tomorrow

Rocologo commented 7 years ago

By the way, if you set

hunting_level1_cow: 2

It is easier and faster to test the completed progress achievements. Then it will be 2 5 10 25 ....

vilgrar commented 7 years ago

Unfortunately my test server does not connect to a database. I can bring you a picture from my real server's database if you like, but it's not running the development version.

[http://picpaste.com/2017-05-26_07.35.00-R76l0MN8.png] Achievements look a bit messy and won't fit on a single "page". I like the icons and the numbers, but maybe they should be restricted to one icon per achievement. Just update each icon to add the number for the current stage.

I did some very thorough testing on the achievements as well and discovered not all are working.

Achievements not working:
bat chicken horse llama mule mushroom-cow ocelot pig rabbit sheep snowman squid villager <--- achievement doesn't make sense? all villager types are included already cartographer <-- librarian and cartographer shares the same profession. [http://minecraft.gamepedia.com/Villager#Professions_and_careers]

1.12 Untested: illusioner parrot

And as usual, the leaderboard signs didn't update although the debug told me they did.

Rocologo commented 7 years ago

Yes it does :-) If you dont specify MySql it uses Sqlite. If you send me the file I can check the problem my self. The filename is mobhunting.db

It is strange that you say chicken did not work for you. Because I tested on chicken and it works fine on mine...

This morning while testing, I found a bug in my code when running the code on mc1.12-pre5. (/mh achievements rocologo) does not work from the console.

Rocologo commented 7 years ago

I will focus on find the bug first, afterwards Im ready to optimize the look :-) but I have now idea how I could make it look better.... and yes if/when the player complete more that 54 achievements, I have a problems showing the rest. The current code cant handle that. But now one has reported this problem (yet)

vilgrar commented 7 years ago

[07:58:08 INFO]: [MobHunting][Debug] ======================== New kill ========================== [07:58:08 INFO]: [MobHunting][Debug] vilgrar killed a Chicken (Minecraft) [07:58:08 INFO]: [MobHunting][Debug] Basic Prize=$0 for killing a Chicken [07:58:08 INFO]: [MobHunting][Debug] vilgrar has no Rank Multiplier [07:58:08 INFO]: [MobHunting][Debug] Multiplier: Sneaky! = 2.0 [07:58:08 INFO]: [MobHunting][Debug] Multiplier: Difficulty = 0.75 [07:58:08 INFO]: [MobHunting][Debug] Killstreak=0, level=0, multiplier=1.0 [07:58:08 INFO]: [MobHunting][Debug] KillBlocked vilgrar: Reward was less than 0.01 (Bonuses=x1.5 Sneaky! Difficulty) [07:58:08 INFO]: [MobHunting][Debug] ======================= kill ended (36)=====================

I'm not getting any clues why chicken wouldn't work.

My suggestion is to use only one icon per mob type, and change that number on the icon according to what stage you're on (so add a 1 if you're on stage 1, 2 when you completed the first achievement and so on). It still doesn't fix the 54 slot problem but should work for the time being.

vilgrar commented 7 years ago

[http://ebonheart.se/mobhunting.zip]

This is my test server's database.

Rocologo commented 7 years ago

Thank you. I found the bug in your database too. Which means that the achievements for the cow is not counted correct. I need to find at solution for that (and this is not easy :-( so it will take some time) I want to make a solution which fixes the error in the database.

I think the reason why its not counted is that the prize for your chicken is 0. I'm pretty sure that it is made so that kills with a price of 0 is not counted as an achievement and not as a kill on the leaderboards.

vilgrar commented 7 years ago

Confirmed! Increasing prize made the chicken achievement work!

All the not working achievements I mentioned earlier were set at 0, so hopefully all of them do work.

Rocologo commented 7 years ago

is so hard to hold all the combinations in.... I realize that you could argue what I wrote. My guess is that you have something in your chicken_run_cmd?

The questions is if it should be counted as an achievement then? hmmm....

vilgrar commented 7 years ago

I guess I'll bump the '0' prizes to 0.1 or something to activate the missing achievements. Easy fix, but not an obvious one. Is there a way to make achievements work even when payment is 0?

Rocologo commented 7 years ago

Yes but the "problem" is that some of my users don't want kills and achievements to count when price is 0. I think I have made a setting for this in config.yml (so we may have found another bug)...

Anyway I have to find a solution to the bug in the database first.... It the data is wrong the result will be wrong too :-)

Rocologo commented 7 years ago

Now I am ready with a new snapshot to test the achievements / leaderboard.

Before you install this snapshot please make a backup of your mobhunting.db file so you can do a rollback or redo the database fixing.

First time you run start the server and logon. You will see something like this:

[09:39:59 INFO]: [MobHunting][Debug] Loading Rocologo's Achievements [09:39:59 INFO]: [MobHunting][Debug] Loaded 48 Achievements. [09:39:59 INFO]: [MobHunting][Debug] Error in mh_Achievements: hunting-level2-zombiepigman=248 (next=hunting-level3-zombiepigman) Changing status to completed. [09:39:59 INFO]: [MobHunting][Debug] Error in mh_Achievements: hunting-level3-zombiepigman=496 (next=hunting-level4-zombiepigman) Changing status to completed.

In my case I had two Progress Achivements with a wrong status. You will have some other errors.

Second time you logon (after the data has been saved to disk - there is a delay ) there will be fixed at you will not see any errors.

When you run "/mh achievements" you will now see three Inventories (Completed, Onging, Not Started). This will postpone the "problem" with a "full inventory" when the player has done more than 54 achievements.

The Inventory with the completed achievements should now show the same number of as the the leaderboard. (It does on my test server).

I have not had time to look at the "prize = 0" problem. So the logic is still the same....

Please test build 380 or newer https://fractal.lindegaard.one:8181/job/MobHunting/

Rocologo commented 7 years ago

If you want to help me fix the problem with the rewards with a prize = 0 $ but still having a reward (mob_run_cmd) then it would be nice if you created a new issue so we can discuss the solution and not mix it with this thread.

vilgrar commented 7 years ago

Error message and correction seemed to work. I have three separate inventories like you said. Still looks messy, though. Small suggestion: Start over at page 1 when you click on page 3, instead of closing the inventory. [http://picpaste.com/2017-05-27_10.24.52-oZfG9o2g.png}

I'm not having luck with the leaderboards, though. [http://picpaste.com/2017-05-27_10.41.02-3GTEGn3p.png] Left one isn't updating it's stats when leaderboard refreshes. Restarting the server updates that leaderboard. Right one shouldn't be blank.

I suspected all my tampering with the config file messed up the plugin, so I deleted the entire MobHunting folder and started from scratch.

Encountered a Java error I'd never seen before: https://pastebin.com/zFuvksRa My best guess is it's related to killing too many mobs at once (slaughtered cows about ten at a time). Killing cows one at a time did not produce errors.

Total kills leaderboard updated once more, but achievement count does not. I completed Beginner Cow Hunter so there should be something on that sign.

Rocologo commented 7 years ago

1) Messy: What would be the right order? (Currently they are sorted in kind of alphabetic order... ) 2) I will check the leaderboard again. Did you test on a mob with prize>0 ? 3) They error in your console Caused by: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener is related to ProtocolLib. Which version do you use? If any? 4) I notice you have already filled up your completed Inventory, so I guess I have to look at this, and find a solution.

vilgrar commented 7 years ago
  1. I suggest that you use only one icon per mob, as opposed to one icon per achievement tier (per mob type). In other words, go back to the old system but keep the amount number inside the slot (and the fancy icons too, of course). The icon's amount number would be based on your latest (highest tier) achievement.

Example: Beginner Cow Hunter - add '1' as the amount number of the cow icon. This means you completed one cow achievement. Amateur Cow Hunter - add '2' instead. Because you completed two cow achievements. and so on. I believe it'll look very tidy and easy to overview.

  1. Yes, I was awarded for completing the cow (and chicken) first tier achievements.

  2. Ah, my test server doesn't use ProtocolLib (my real server does). It's supposed to be optional, right?

  3. Yes, filling up 54 slots would take a huge number of different kills, but it's not impossible.

Rocologo commented 7 years ago

1) It is easy to change the symbol for the achievement The old ways All beginners was "coal", all amateurs was Iron_igot, and so on, but I didnt like that because there was so much coal, which I thought was messy. As it is now, you can easily find the chicken tier (1,2,3,4...) So I like it better now. Any way, it would not be hard to make a setting in the config.yml "achievement_symbol_type: HEAD/ITEM and then let you choose your self. But I dont know how to describe the difference between the two settings short in config.yml

'# Description '# '# achievement_symbol_type: HEAD/ITEM 'achievement_symbol_type: HEAD

2) I will investigate...

3) Yes it is optional, so I will disable ProtocolLib on my test server and test. I don't understand why you get this error, because I don't think I have changed anything which should affect ProtocolLib. I'll get back

4) You did it on your screen shot : http://picpaste.com/2017-05-27_10.24.52-oZfG9o2g.png

Rocologo commented 7 years ago

I check in my code if ProtocolLib is installed, and for some reason it say that it is installed??? Could you please check that it is not?????

And please check what the log says when you start your test server?

[10:31:28 INFO]: [MobHunting] Enabling compatibility with Essentials (2.0.1-b468) [10:31:28 INFO]: [MobHunting] Enabling compatibility with WorldEdit (6.1.7-SNAPSHOT;3682-41de204) [10:31:28 INFO]: [MobHunting] Enabling compatibility with WorldGuard (6.2.1-SNAPSHOT;9e88d1a) [10:31:28 INFO]: [MobHunting] Enabling Compatibility with McMMO (1.5.07-SNAPSHOT) [10:31:28 INFO]: [MobHunting] McMMO XP rewards is enabled [10:31:28 INFO]: [MobHunting] Enabling compatibility with ProtocolLib (4.2.1). [10:31:28 INFO]: [MobHunting] Enabling compatibility with MyPet (2.3.0) [10:31:28 INFO]: [MobHunting] Enabling compatibility with BossShop (2.7.4). [10:31:28 INFO]: [MobHunting] Enabling compatibility with BarAPI (3.5) [10:31:28 INFO]: [MobHunting] Enabling compatibility with TitleManager (2.0.6) [10:31:28 INFO]: [MobHunting] Enabling compatibility with PlaceholderAPI (2.7.1). [10:31:28 INFO]: [MobHunting] Enabling Compatibility with MythicMobs (4.1.0-SNAPSHOT)

vilgrar commented 7 years ago
  1. It's exactly because of that screenshot in 4. that I don't like the current setup. Up to seven heads for each mob will make it look very messy (and fill up 54 slots quickly) when the achievements start rolling in. It's not terrible, but if I could choose to see only one head per mob type then I would.

  2. For testing purposes. I cheated of course =)

[14:26:31 INFO]: [MobHunting] Enabling MobHunting v4.9.3-SNAPSHOT-B380 [14:26:31 INFO]: [MobHunting] Sorted en_US.lang translation [14:26:32 INFO]: [MobHunting][Debug] bStat is enabled [14:26:32 INFO]: [MobHunting][Debug] Loading WorldGroups [14:26:32 INFO]: [MobHunting] Database version 4 detected. [14:26:32 INFO]: [MobHunting][Debug] MobHunting V4 Database created. [14:26:32 INFO]: [MobHunting][Debug] Database trigger updated. [14:26:32 INFO]: [MobHunting] Enabling compatibility with Essentials (2.0.1-b472) [14:26:32 INFO]: [MobHunting] Enabling Compatibility with McMMO (1.5.07-SNAPSHOT) [14:26:32 INFO]: [MobHunting] McMMO XP rewards is enabled [14:26:32 INFO]: [MobHunting] Enabling compatibility with MyPet (2.3.5) [14:26:32 INFO]: [MobHunting][Debug] 63 mobs was loaded into memory. Total mobs=63 [14:26:32 INFO]: [MobHunting][Debug] 2 Leaderboards in 'world' loaded from file: plugins\MobHunting! [14:26:32 INFO]: [MobHunting][Debug] Metrics started

No mention of ProtocolLib. I checked the old logs and still no mention of ProtocolLib.

Rocologo commented 7 years ago

1) Im not sure I understood this???

Example: Beginner Cow Hunter - add '1' as the amount number of the cow icon. Amateur Cow Hunter - add '2' instead. and so on. I believe it'll look very tidy and easy to overview.

I cant just write a number, and Minecraft does not show '1' if there only is one item in the slot. (Im not able to change this)

Rocologo commented 7 years ago

2) Update leaderboard. Im having a problem too...

vilgrar commented 7 years ago

Ah, ok. So 1 as an amount (to display a number, that is) is out of the question, which is still fine.

I'm unable to replicate the ProtocolLib error. I've restarted the server plenty of times and killed mobs but everything works fine with no errors.

Edit: For testing purposes I did add ProtocolLib now. Console tells me that compatibility was added. Still no errors from several restart attempts.

Rocologo commented 7 years ago

Hi again. Im sorry for delay, but I have been busy with the new job!

I have good and bad news. I found the bug and the reason why the leaderboard did not update. Again I was surprised. This error was introduced when I changed the database in V4.0.0!

The good news is that I found the bug and fixed it. Your leaderboard will update now.

The bad news is that I can fix the error in the database. Meaning: new achievements will add +1 to the counter on the leaderboard, but already missing achivements will unfortunately not be added. At least not in next release.

The problem is that mh_Achievements and mh_Daily got out of syncronisation. Before I found the bug new achivements was added to mh_Achievements. (This is where /mh achivements looks). But new achievements was not added to mh_Daily (where the leaderboard looks).

Going forward new achievements will be added to both tables.

Another problem I found was that assisted kills didnt work either. I you had created a leaderboard showing assisted kills, you would have reported the same problem to me :-)

This is also fixed i newest snapshot, but it made me realize that I need to work more on the assisted kills. The problems is that I dont have a clear definition of the "assisted kill". There are many combinations and Its hard to tell which situations should be counted as an assisted kill. I will properly need to make a matrix to make sure that I know which combinations is an assisted kill.

The entities are: 1) The player, 2) A second player, 3) a Mypet, 4) a tamed wolf. The other dimension is: 1-4) is the FIRST attacker, 1-4) is the killer,

'1+2. player can get ½ money rewards, but how will get the mob_run_cmd reward? The heads? And where do I drop the reward??? '---------------------------------------------------------------------------------------- '|-----------------| Player | 2. Player | MyPet | Tamed wolf | '---------------------------------------------------------------------------------------- '|First attacker|??????????|??????????|??????????|????????????| '---------------------------------------------------------------------------------------- '|Killer |??????????|??????????|??????????|????????????| '----------------------------------------------------------------------------------------

I think I will release V4.9.3 before I make more changes in the assisted kill.

SO please go ahead and test the Achievements now. Build 381 is ready for you https://fractal.lindegaard.one:8181/job/MobHunting/

I have not changed the Achievement "symbols" - I didnt fully understand your suggestion?

vilgrar commented 7 years ago

Leaderboard's working (partially), just like you said.

I'll try to explain once more about the achievement symbols. =)

There are LOTS of mobs to hunt, and every mob has 7 different achievements, ranging from Beginner Hunter to President Master hunter. So in theory, 50'ish mobs may use 7 icons each at /mh kills Completed list. That's a lot of icons and definitely won't fit a single page or two.

My suggestion is to use only one achievement icon per mob type and only show the highest achievement of that mob type and hide the rest.

Examples: Completed only Beginner Cow Hunter, then show that icon Completed Beginner and Amateur Cow Hunter, show Amateur icon and hide Beginner icon Completed Beginner, Amateur and Apprentice, show Apprentice and hide Amateur and Beginner icons etc

That way, it'll be much harder to run out of GUI space. At most, only two Completed pages would be needed, as opposed to the current 350+ icons on 7 different pages.

Rocologo commented 7 years ago

Hmm 7 pages, I never did that calculation.... Ok I try to will remove the "lower progress achievements"

Rocologo commented 7 years ago

Ok, I changed this in build 382 https://fractal.lindegaard.one:8181/job/MobHunting/

Rocologo commented 7 years ago

Ok, I changed this in build 382 https://fractal.lindegaard.one:8181/job/MobHunting/

Rocologo commented 7 years ago

I you are happy now :-) I will make a release?

vilgrar commented 7 years ago

Testing now.

vilgrar commented 7 years ago

Perfect!

I guess we couldn't solve the ProtocolLib error, but it's been reported on a separate issue. There's also the prize-money-0-no-achievement issue, but that can be reported separately as well.

I think we are done here.

Rocologo commented 7 years ago

V4.9.3 released.

I close this ticket now, and then let continue on some new ones :-)

Thank you VERY much for your help with the testing and input. It helps me a lot!