Effort API icon

Effort API -----

Easy to access API records players' efforts.



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.
[​IMG]

upload_2022-12-19_17-18-32.png
1. First, make a effort class to record diamond ores mined.

Code (Java):
public class 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
    public boolean 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 ( ) ) return false ;

//Check if block break event is cancelled
        if (ev. isCancelled ( ) ) return false ;

// Player has broken a diamond ore, return true.
        return true ;
    }

    @Override
    public String getEffortID ( ) {
// Put in the ID of the effort.
        return "MINEDIAMOND" ;
    }

    @Override
    public String getDisplayName ( ) {
// Optional
        return "Diamond Ores Mined" ;
    }

}
2. Register the Effort Event for the API to start recording
Code (Java):
    @Override
    public void 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
    public void 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
Resource Information
Author:
----------
Total Downloads: 105
First Release: Dec 18, 2022
Last Update: Dec 20, 2022
Category: ---------------
All-Time Rating:
0 ratings
Find more info at discord.com...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings