EFFORTAPI This plugin helps you records players "efforts".
For example, the
amount of time a player has
mined a diamond ore, e.g 20 times. For each diamond ore mined by the player, the EffortAPI will call an event containing all necessary datas.
1. First, make a effort class to record diamond ores mined.
Code (Java):
publicclass MineDiamond
implements EffortEvent
{
@Override
public EffortType getEventType
(){ /* Event Type is BLOCK_BREAK because we want to check diamond ores mined */ return EffortType.
BLOCK_BREAK; }
@Override
publicboolean checkPlayer
(Event e
){ // Change Event to BlockBreakEvent BlockBreakEvent ev
=(BlockBreakEvent
) e
;
// Check if the Block Material is a Diamond Ore if(ev.
getBlock().
getType()!= XMaterial.
DIAMOND_ORE.
parseMaterial())returnfalse;
//Check if block break event is cancelled if(ev.
isCancelled())returnfalse;
// Player has broken a diamond ore, return true. returntrue; }
@Override
publicString getEffortID
(){ // Put in the ID of the effort. return"MINEDIAMOND"; }
2. Register the Effort Event for the API to start recording
Code (Java):
@Override
publicvoid onEnable
(){ // register the Event with EffortAPI.registerEvent on your onEnable() EffortAPI.
registerEvent(new MineDiamond
()); }
3. You are done! The API will now record diamond ores mined by the players!
4. Now that you are done, lets give players a reward for mining 100 diamond ores by listening to EffortBukkitEvent.java
Code (Java):
@EventHandler
publicvoid giveRewardForMiningDiamond
(EffortBukkitEvent e
) { // Check if the id is MINEDIAMOND if(e.
getEffortEvent().
getEffortID().
equalsIgnoreCase("MINEDIAMOND")){ // Give reward } }
Simple isn't it? You can also add other requirements like checking if the player
Mined Stone with Wooden PIckaxe, or
Killed Zombies with Raw Fish. etc
Remember to add
Code (YAML):
softdepend: Effort
in your plugin.yml
Auto save player data.
Easy to use API just access EffortAPI.java
More questions check discord
Built in command rewards
I first got the idea to make this plugin from a korean comic (manhwa). Where the main character kept repeating the same thing over and over again like Killing 1000 undead and he got the title "undead slayer" etc. You get the idea