### Install StrikePracticeAPI Dependency Source: https://github.com/toppev/strikepracticeapi/blob/master/README.md Instructions for downloading the API jar and configuring it in Maven or Gradle build files. ```shell wget https://strikepractice-api.toppe.dev/strikepractice-api.jar -P libs ``` ```xml ga.strikepractice strikepractice-api ${project.basedir}/libs/strikepractice-api.jar ``` ```kotlin repositories { flatDir { dirs("libs") } } dependencies { compileOnly("ga.strikepractice:strikepractice-api") } ``` -------------------------------- ### Customize Kit Knockback Source: https://github.com/toppev/strikepracticeapi/blob/master/README.md Example of using the KitSelectEvent to apply custom knockback profiles to specific kits. ```java @EventHandler public void onKitSelect(KitSelectEvent event) { String kit = event.getKit().getName(); Knockback kb = getKnockback(kit); event.getPlayer().setKnockback(kb == null ? getKnockback("default") : kb); } private KnockBack getKnockback(String key) { return ... } ``` -------------------------------- ### Interact with Duel Opponents Source: https://github.com/toppev/strikepracticeapi/blob/master/README.md Example of retrieving a player's current duel opponent and sending them a message. ```java Player player = ... Player opponent = api.getDuelOpponent(player); if (opponent != null) { opponent.sendMessage("Hello opponent!"); } ``` -------------------------------- ### Initialize StrikePracticeAPI Instance Source: https://context7.com/toppev/strikepracticeapi/llms.txt Demonstrates how to retrieve the main API instance from the StrikePractice plugin. This instance serves as the entry point for all available API methods. ```java import ga.strikepractice.api.StrikePracticeAPI; import ga.strikepractice.StrikePractice; StrikePracticeAPI api = StrikePractice.getAPI(); ``` -------------------------------- ### Implement Custom ELO Calculator Source: https://context7.com/toppev/strikepracticeapi/llms.txt Shows how to replace the default ELO calculation logic with a custom algorithm based on skill differences between players. ```java import ga.strikepractice.api.StrikePracticeAPI; import ga.strikepractice.StrikePractice; public void setupCustomEloCalculator() { StrikePracticeAPI api = StrikePractice.getAPI(); api.setEloCalculator(elos -> { int diff = elos.getWinnerOldElo() - elos.getLoserOldElo(); if (diff > 20) { elos.setLoserNewElo(elos.getLoserOldElo() - 50); elos.setWinnerNewElo(elos.getWinnerOldElo() + 50); } else if (diff > 10) { elos.setLoserNewElo(elos.getLoserOldElo() - 20); elos.setWinnerNewElo(elos.getWinnerOldElo() + 20); } else { elos.setLoserNewElo(elos.getLoserOldElo() - 100); elos.setWinnerNewElo(elos.getWinnerOldElo() + 100); } }); } ``` -------------------------------- ### Configure StrikePracticeAPI Dependencies Source: https://context7.com/toppev/strikepracticeapi/llms.txt Instructions for adding the StrikePracticeAPI to your project using shell commands, Maven, or Gradle. This ensures the API library is available for compilation in your Minecraft plugin. ```shell wget https://strikepractice-api.toppe.dev/strikepractice-api.jar -P libs ``` ```xml ga.strikepractice strikepractice-api ${project.basedir}/libs/strikepractice-api.jar ``` ```kotlin repositories { flatDir { dirs("libs") } } dependencies { compileOnly("ga.strikepractice:strikepractice-api") } ``` -------------------------------- ### Handle Duel Events Source: https://github.com/toppev/strikepracticeapi/blob/master/README.md Demonstrates how to listen for duel end events to perform actions like displaying player statistics. ```java @EventHandler public void onFightEnd(DuelEndEvent event) { Player p = event.getWinner(); if(event.getFight().getKit().isElo()) { PlayerStats stats = StrikePractice.getAPI().getPlayerStats(p); int globalElo = stats.getGlobalElo(); p.sendMessage("Your global elo is now " + globalElo); } } ``` -------------------------------- ### Handle Kit Selection and Deselection Events Source: https://context7.com/toppev/strikepracticeapi/llms.txt Demonstrates how to listen for KitSelectEvent to apply custom knockback profiles and KitDeselectEvent to reset player state. These listeners follow standard Bukkit event patterns. ```java import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import ga.strikepractice.events.KitSelectEvent; import ga.strikepractice.events.KitDeselectEvent; public class KitListener implements Listener { @EventHandler public void onKitSelect(KitSelectEvent event) { String kitName = event.getKit().getName(); Knockback kb = getKnockback(kitName); if (kb != null) { event.getPlayer().setKnockback(kb); } else { event.getPlayer().setKnockback(getKnockback("default")); } } @EventHandler public void onKitDeselect(KitDeselectEvent event) { event.getPlayer().setKnockback(getKnockback("default")); } } ``` -------------------------------- ### Access StrikePracticeAPI Instance Source: https://github.com/toppev/strikepracticeapi/blob/master/README.md How to retrieve the main API instance to access plugin functionality. ```java StrikePracticeAPI api = StrikePractice.getAPI(); ``` -------------------------------- ### Customize ELO Calculations Source: https://github.com/toppev/strikepracticeapi/blob/master/README.md Demonstrates how to override or modify the default ELO calculation logic using the API. ```java StrikePracticeAPI api = StrikePractice.getAPI(); api.setEloCalculator(elos -> { int diff = elos.getWinnerOldElo() - elos.getLoserOldElo(); if (diff > 10) { elos.setLoserNewElo(elos.getLoserOldElo() - 20); elos.setWinnerNewElo(elos.getWinnerOldElo() + 20); } }); EloCalculator defaltCalc = api.getEloCalculator(); api.setEloCalculator(elos -> { defaltCalc.calculateElo(elos); elos.setWinnerNewElo(elos.getWinnerNewElo() * 2); elos.setLoserNewElo(elos.getLoserNewElo() * 2); }); ``` -------------------------------- ### Retrieve Duel Opponent Information Source: https://context7.com/toppev/strikepracticeapi/llms.txt Shows how to identify a player's current opponent during an active duel. It returns the opponent player object or null if the player is not currently dueling. ```java public void notifyOpponent(Player player) { StrikePracticeAPI api = StrikePractice.getAPI(); Player opponent = api.getDuelOpponent(player); if (opponent != null) { opponent.sendMessage("Hello opponent!"); player.sendMessage("Message sent to " + opponent.getName()); } else { player.sendMessage("You are not in a duel!"); } } ``` -------------------------------- ### Handle Duel Completion Events Source: https://context7.com/toppev/strikepracticeapi/llms.txt Implements a Bukkit listener to react to the DuelEndEvent. This allows developers to execute custom logic, such as updating stats or sending messages, immediately after a fight concludes. ```java public class DuelListener implements Listener { @EventHandler public void onFightEnd(DuelEndEvent event) { Player winner = event.getWinner(); if (event.getFight().getKit().isElo()) { PlayerStats stats = StrikePractice.getAPI().getPlayerStats(winner); int globalElo = stats.getGlobalElo(); winner.sendMessage("Congratulations! Your global ELO is now " + globalElo); } } } ``` -------------------------------- ### Access Player Statistics Source: https://context7.com/toppev/strikepracticeapi/llms.txt Retrieves comprehensive statistics for a specific player, such as their global ELO rating. This is useful for building leaderboards or performance tracking features. ```java public void displayPlayerStats(Player player) { StrikePracticeAPI api = StrikePractice.getAPI(); PlayerStats stats = api.getPlayerStats(player); int globalElo = stats.getGlobalElo(); player.sendMessage("Your global ELO rating: " + globalElo); } ``` -------------------------------- ### Modify Default ELO Calculator Source: https://context7.com/toppev/strikepracticeapi/llms.txt Demonstrates the modifier pattern to wrap the existing default ELO calculator, allowing for multipliers or additional adjustments to the calculated results. ```java import ga.strikepractice.api.StrikePracticeAPI; import ga.strikepractice.StrikePractice; import ga.strikepractice.api.EloCalculator; public void setupModifiedEloCalculator() { StrikePracticeAPI api = StrikePractice.getAPI(); EloCalculator defaultCalc = api.getEloCalculator(); api.setEloCalculator(elos -> { defaultCalc.calculateElo(elos); elos.setWinnerNewElo(elos.getWinnerNewElo() * 2); elos.setLoserNewElo(elos.getLoserNewElo() * 2); }); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.