Looking to make an achievement plugin.

Discussion in 'Plugin Development' started by iCancer, Nov 14, 2016.

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

    iCancer

    I want to make a custom achievement plugin, but I can't figure out how to do it, or if it is even possible. If so, can you help me with the basis of making the achievement and giving it to a player using an event?
     
  2. Offline

    Zombie_Striker

    @iCancer
    As much as we would like to help you, we can't because your request is too vague. We have no idea what types of achievements you want (in-game, default achievements or new, custom achievements from your plugin), what specific things you need to check for, or even what the scale/scope of how large do you want this project to be (Will this by an API, or just one plugin? Will this affect other plugins?)

    If you can, please create a reply with a detailed description of what you want, what you currently have, and what you need help with.
     
    Last edited: Nov 15, 2016
    ChipDev likes this.
  3. Offline

    iCancer

    I don't want someone to make the plugin, I want someone to guide me when making the plugin. I want a way to make it, so that I can do all the coding myself. I know basic java syntax, so it shouldn't be a problem understanding anything. It's a custom achievements plugin that I am wanting to make.
     
  4. Online

    timtower Administrator Administrator Moderator

    @iCancer Without this we can't help in any way
     
  5. Offline

    iCancer

    I want to allow players to reach certain milestones, granting them an achievement. After a certain number of achievements, I want them to receive a designated item in the config.
     
  6. Offline

    Zombie_Striker

    @iCancer
    Since you still are not giving a detailed explanation of what you want, here is a general list of everything you need:
    • Create an object/enum that contains all the achievements.
    • Create a new class to store all the achievements a player has.
    • Create events, where if a player does ___, give them an achievements.
    • If the player has ___ many achievements, give them the designated item.
     
  7. Offline

    iCancer

    I'm not familiar with enumerations, RIP. I'm sorry, I just can't get the details, because I have no idea how to explain them.
     
  8. Offline

    Wispyy

    @iCancer, did you want it as a request, or were you going to code it yourself but needed a sense of direction because that's what it looks like from in here. See this about making custom achievements. For the event you'll want to implement Listener in the class, add @EventHandler to the method and then do what you want (Oh, and pick an event that you want to use. You can find them in the JavaDoc here). Here's an example class.

    Code:
    package me.wispyy.example;
    
    import org.bukkit.entity.Player;
    
    import org.bukkit.event.EventHandler;
    
    import org.bukkit.event.Listener;
    
    import org.bukkit.event.player.PlayerJoinEvent;
    
    
    
    public class Example extends CustomAchievement implements Listener {
    
    
    
           /*
    
           *
    
           * Code for the achievement here.
    
            *
    
            */
    
    
           @EventHandler
    
           public void onJoin(PlayerJoinEvent e) {
    
                  Player p = e.getPlayer();
    
                  // Give the player the achievement!
    
                  p.sendMessage("You got the achievement!");
    
           }
    
    
    }
    
     
  9. Offline

    iCancer

    I know all the event handling, but what I'm wanting is a tutorial on the CustomAchievement class extender, because I am fairly new to that.
     
  10. Offline

    jlin13

     
  11. Offline

    Wispyy

    @iCancer, read through the page. It has a model class that you can look through with annotations. You just add the CustomAchievements jar into the Build Path and then extend it in the class. The rest is pretty simple when you read through it.
     
  12. Offline

    iCancer

    The one problem I have, is that I want to know if there is a way to not have to use an external plugin to all custom achievements. Is there a way, with just basic Spigot or Bukkit to do so, or is it vital I use the CustomAchievements Jar?
     
  13. Offline

    jlin13

    Here's the source code to a plugin called Advanced Achievements that might help you, look at the method sendTitlePacket(). You'll have to be familiar with packets (Title), as well as how to work with NMS.

    Start out by learning packets through one of the many tutorials on the forums, look at other people's code, and try and understand why everything happens
     
  14. Offline

    ShaneCraftDev

    @iCancer
    Yes, of course there is. All the CustomAchievements library does is create a listview (gui with slots) containing ItemStack instances as identifiers for the created achievements and which players completed the achievement. However, you can program this yourself, you're not obligated to create such gui, you may also create a simple command which will list all of your custom achievements in the chat. I would choose to use a similar approach as the suggested library.
     
  15. Offline

    iCancer

    So, is there a CustomAchievement method I could use to make an achievement??
     
  16. @iCancer You said above you didn't want to use it so people linked you alternatives..

    Anyway, did you try actually looking or are you relying on us to look through? It would be quicker for you to just do it you know. The link posted by @Wispyy show and you exactly how to make them.

    EDIT: Also hit the "Tahg User" so we can actually see your replies.
     
  17. Offline

    ShaneCraftDev

    @iCancer
    There is no support to add custom achievements from within the Bukkit API, however, @Wispyy suggested you to checkout the CustomAchievement library, which does what you're trying to achieve. If this is not making much sense to you, you should consider to take some steps in learning java in general.
     
  18. Offline

    iCancer

    I know java -_- I'm just wondering if there was support to add Custom Achievements within java, and what the class, package, and methods to do so were.
     
  19. Offline

    Zombie_Striker

    @iCancer
    Have you actually checked the link @Wispyy posted? It is a tutorial showing you, step-by-step, how to use the Custom Achievements plugin. It even has sections of code as examples, And at the very bottom is a full class!
     
  20. Offline

    iCancer

    @Zombie_Striker

    Chill dude. I checked it out, but my point is that I don't want to have to use an external plugin for it.
     
  21. Offline

    Wispyy

    @iCancer, then go into the plugin, see how the code is made, and maybe modify it to fit your needs? A plugin like that shouldn't really be that bad to have to rely on.
     
    Last edited: Nov 18, 2016
  22. @iCancer Then don't ask for a method to use from it if you don't want to do it! And agin, alternatives were posted!
     
Thread Status:
Not open for further replies.

Share This Page