AchievementManager (API) 1.0

An easy API used to add custom achievements!

  1. LielAmar
    Tested Minecraft Versions:
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    Source Code:
    https://github.com/LielAmar/AchievementManager
    AchievementManager is an API you can use in order to create custom achievements​

    Usage:
    Add a dependency to your plugin.yml like this:
    Code (Text):
    depend: [AchievementManager]
    Adding a new achievement (within your code):
    Code (Text):

    List<String> description = new LinkedList<String>();
    description.add(ChatColor.GREEN + "Unlocked by logging in");
    description.add(ChatColor.GREEN + "to the server for the");
    description.add(ChatColor.GREEN + "very first time!");
    AchievementManagerAPI.addAchievement(new Achievement("First Login", description, 10));
     
    Example of PlayerAddCustomAchievementEvent:
    Code (Text):

    @EventHandler
    public void achievement(PlayerAddCustomAchievementEvent e) {
    Player p = Bukkit.getPlayer(e.getUUID());
    if(p == null) return;
    p.sendMessage("Unlocked achievement: " + ChatColor.GOLD + e.getAchievement().getName() + ChatColor.WHITE + "!");
    }
     
    Example of giving an achievement to a player:
    Code (Text):

        @EventHandler
        public void join(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            AchievementManagerAPI.addAchievementToPlayer(p.getUniqueId(), Main.getAchievementManager().getAchievementByName("First Login"));
        }
     
    Example of a command using the API:
    Code (Text):

    @Override
    public boolean onCommand(CommandSender cs, Command cmd, String cmdLabel, String[] args) {
    if(!(cs instanceof Player)) {
    cs.sendMessage(ChatColor.RED + "You must be a player to do that!");
    return false;
    }
    Player p = (Player) cs;
    if(cmd.getName().equalsIgnoreCase("achievements")) AchievementManagerAPI.openAchievementInventoryToPlayer(p);
    return false;
    }
     
    To-Do List:
    - Add MySQL support
    - Add a method within the API to get players' achievements points.