AchievementManager is an API you can use in order to create custom achievements
Usage:
Add a dependency to your plugin.yml like this:
depend: [AchievementManager]
Adding a new achievement (within your code):
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:
@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:
@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:
@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.
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta