PlayerAchievmentAwarded?

Discussion in 'Plugin Development' started by Condolent, Feb 4, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Condolent

    So, I tried making an event with PlayerAchievmentAwardedEvent, and when I loaded the plugin, it gave me an error in server console that it couldn't find the event? Has it been renamed or something? Couldn't find a solution on a quick-search.
     
  2. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Make sure you're running on the latest dev build
     
  3. Offline

    Staartvin

  4. Offline

    Condolent

    So I take it as I have to type in the achievment? Is it a way to make an event if a player gets any achievment??

    bump

    FYI: I'm using the latest dev build.
    Still says that it couldn't find that event.

    It says: Plugin has failed to register events for class me.condolent.event because org/bukkit/event/player/PlayerAchievementAwardedEvent does not exist.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  5. Offline

    Condolent

    bump again.. would be great to fix this!
    My code:
    Code:java
    1. @EventHandler
    2. public void onAchiev(PlayerAchievementAwardedEvent e) {
    3. Player p = e.getPlayer();
    4.  
    5. p.sendMessage(ChatColor.GREEN + "******* > Achievement Unlocked! < *******");
    6. p.sendMessage(ChatColor.YELLOW + " §lUnlocked Achievement " + e.getAchievement());
    7. p.sendMessage(ChatColor.GREEN + "*****************************************");
    8. }
     
  6. Offline

    L33m4n123

    Are you using the newest craftbukkit dev. built on your server aswell?
     
  7. Offline

    Condolent

    L33m4n123 ah thanks for reminding me! It was just too obvious for me so I couldn't see it ;)

    Next question: I have e.getAchievement in the code, what's the code to get the achievement name? Cause all I get is like the code-name for it. For example: BUILD_PICKAXE
     
  8. Offline

    L33m4n123


    try e.getAchievement().toString() maybe? Otherwise you would need to do something like

    Code:
    switch(e.getAchivement):
    case BUILD_PICKAXE:
    String name = "Created Pickaxe"
    break;
    case AND_SO_ON:
    String name ="And so on"
    break;
    
     
  9. Offline

    Condolent

    L33m4n123 toString() didn't work, sadly. And the second code will be my absolute plan B.. Seems like a real pain in the a*s to paste that code for every achievement xD
     
  10. Offline

    L33m4n123

    what returns e.getAchievement().name() ?
     
  11. Offline

    Condolent

    L33m4n123 that's what I thought first would do the trick, but it still returned as the code-name (Don't actually know what it's called so I'm gonna go with code-name for now)
     
  12. Offline

    L33m4n123

    Well then I think the only way to achieve it would be by replacing manually each name^^
     
Thread Status:
Not open for further replies.

Share This Page