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

Achievements don't work #6

Closed
Maxetto opened this issue Apr 24, 2016 · 11 comments
Closed

Achievements don't work #6

Maxetto opened this issue Apr 24, 2016 · 11 comments
Assignees
Labels
bug

Comments

@Maxetto
Copy link

@Maxetto Maxetto commented Apr 24, 2016

Seems like with both versions 2.8.4 and 2.8.5, that achievements doesn't work. Tried with OP aswell as User. Tried also with Italian and English Language (thought it could be some YAML problems with the translation).
There are no errors in Console.

./mh achievements shows "0 out of 49", but doesn't show anything after.

Here's my Config, I'm using MySQL: http://pastebin.com/AqKJB1jb

Infos:
Spigot 1.8.8
MobHunting 2.8.5 (tested also with 2.8.4)
Lib's Disguises 8.6.8
MobArena 0.97.1
BattleArena 3.9.10.13
Essentials(X) 2.0.1-b341
WorldGuard 6.1
Citizens 2.0.16-b1308

@Maxetto

This comment has been minimized.

Copy link
Author

@Maxetto Maxetto commented Apr 24, 2016

Someone did get an Achievement, however there's an error on the Broadcasting:
http://pastebin.com/cvyS3PxS

@Rocologo

This comment has been minimized.

Copy link
Owner

@Rocologo Rocologo commented Apr 25, 2016

Thank you this helps alot! I will release a new version where I hope this is fixed. unfortunately I cant test it now, because I dont have access to my PROD server where I use MySQL.

Please let me know if V2.8.6 fixed this issue.

@Maxetto

This comment has been minimized.

Copy link
Author

@Maxetto Maxetto commented Apr 25, 2016

No, they still don't work...

Still haven't had the chance to try if at least the broadcasting error was fixed

@Maxetto

This comment has been minimized.

Copy link
Author

@Maxetto Maxetto commented Apr 25, 2016

Ok. Seems like it works for players, however the Broadcast error is still there.

The achievement is considered even if not broadcaster and it gives money.

EDIT: Doesn't work if I set myself User (I'm not OP, neither if I'm Admin). Might be a problem only for the first entry in Database?

@Maxetto

This comment has been minimized.

Copy link
Author

@Maxetto Maxetto commented Apr 25, 2016

Found problem! Seems like '*' also give the permission "mobhunting.achievements.disabled", to disable the achievements.

Putting myself on the User group without reloading the plugin, still thinks I have disabled the achievements (since it puts "enableAchievements = false") into the PlayerStorage

A solution for this might be adding "mobhunting.achievements.disabled" to plugin.yml with "default: false"

For the error, it just blocks broadcasting message. The problem is in THIS function. I still not have much of knowledge to find where the problem is, but I think that function is quite messy...

@Rocologo

This comment has been minimized.

Copy link
Owner

@Rocologo Rocologo commented Apr 26, 2016

Thank you for your help and support to solve this problem. I have made two corrections

  1. I have changed the code in the function you mention to:
@SuppressWarnings({ "unchecked" })
    public Collection<Player> getOnlinePlayers() {
        Method method;
            try {
                method = Bukkit.class.getDeclaredMethod("getOnlinePlayers");
                Object players = method.invoke(null);
                Collection<Player> newPlayers = Collections.emptyList();
                if (players instanceof Player[]) {
                    Player[] oldPlayers = (Player[]) players;
                    for (int i = 0; i < oldPlayers.length; i++)
                        newPlayers.add(oldPlayers[i]);
                } else {
                    newPlayers = (Collection<Player>) players;
                }
                return newPlayers;
            } catch (Exception ex) {
                ex.printStackTrace();
            } 
            return Collections.emptyList();
    }
  1. and I when I test for ""mobhunting.achievements.disabled" I now test for
    if (!player.hasPermission("mobhunting.achievements.disabled")||player.hasPermission("*"))

I hope these two things will solve your problems.

@Rocologo Rocologo self-assigned this Apr 26, 2016
@Maxetto

This comment has been minimized.

Copy link
Author

@Maxetto Maxetto commented Apr 26, 2016

I don't think "player.hasPermission("*")" is a good way to solve the issue, as it's a PermissionsEx hack in order to get all possible permissions.

I'd rather try what I said and put "default: false" for "mobhunting.achievements.disabled" in the plugin.yml.

I'll try the new version anyway.

@Rocologo

This comment has been minimized.

Copy link
Owner

@Rocologo Rocologo commented Apr 26, 2016

But the error only occurs when a player has permission "*". Why is that a bad solution?

I have release V2.8.7 now, but I agree I should put in the permission in plugin.yml, so I will do that in next release. (I didnt do it because I was not 100% sure how to update plugin.yml)

@Rocologo

This comment has been minimized.

Copy link
Owner

@Rocologo Rocologo commented Apr 26, 2016

I have now added the code in plygin.yml

  mobhunting.achievements.disabled:
    description: Reject a player to get Achievements. 
    default: false

Link

@Rocologo Rocologo added the bug label Apr 26, 2016
@Maxetto

This comment has been minimized.

Copy link
Author

@Maxetto Maxetto commented Apr 26, 2016

Ok, Version 2.8.7 completely fixed the issue.

Thanks ;)

Error on broadcasting is still THERE.

@Rocologo

This comment has been minimized.

Copy link
Owner

@Rocologo Rocologo commented Apr 27, 2016

I dont understand why th ebroadcast fails, but I have made a change, where I now Iterate over all onlinePlayers. I hope this change fixes the problem. I close the incident now.

@Rocologo Rocologo closed this Apr 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.