Home›Java›Mods›Effort API
Effort API
ModsJava

Effort API

Minecraft Java mod. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
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
Spoiler: Record Amount of Diamond Mined by Player
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

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
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Effort API is a free Minecraft Java mod. Downloaded 121 times (via Spigot). Download it and open it directly in the game.

Explore more