-
Notifications
You must be signed in to change notification settings - Fork 0
Developer API
ProfitMultiplier ships a small, stable API in the package
me.docdrewskii.profitmultiplier.api. It depends only on Bukkit/Spigot/Paper, so it is safe
to compile against from any plugin.
repositories {
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.DevDocDrewskii:ProfitMultiplier:1.1.0")
}Maven:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.DevDocDrewskii</groupId>
<artifactId>ProfitMultiplier</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>In your own plugin.yml:
softdepend: [ProfitMultiplier]if (ProfitMultiplierProvider.isAvailable()) {
ProfitMultiplierAPI api = ProfitMultiplierProvider.get();
long sold = api.getSold(player.getUniqueId(), Material.DIAMOND);
double mult = api.getMultiplier(player.getUniqueId(), Material.DIAMOND);
}Or via the services manager:
ProfitMultiplierAPI api = Bukkit.getServicesManager().load(ProfitMultiplierAPI.class);@EventHandler
public void onBoost(MultiplierApplyEvent event) {
if (event.getPlayer().hasPermission("myplugin.doubleboost")) {
event.setBoostedPrice(event.getBoostedPrice() * 2);
}
// event.setCancelled(true); // veto the boost
}GUIShop commits its price at quote time, so its sales do not fire the cancellable
MultiplierApplyEvent. All other shops do.
| Event | When |
|---|---|
MultiplierApplyEvent |
Before a boosted price is committed (cancellable, settable). |
ThresholdReachedEvent |
A sale pushes the player into a new tier. |
PlayerDataResetEvent |
One player's data is reset (getCause()). |
ServerDataResetEvent |
All data is reset. |
ResetCause values: COMMAND, AUTOMATIC, API, UNKNOWN.
getSold, getTotalSold, getAllSold, getMultiplier, getMultiplierAt,
getActiveThreshold, getNextThreshold, getRemainingToNextThreshold, getBonusTotal,
getLastBonus, addSold, setSold, addBonus, resetPlayer, resetAll, getLastReset,
calculateSaleValue.
The complete developer guide ships in the repository as DEVELOPERS.md.
ProfitMultiplier by DocDrewskii - Repository - Issues - Developer API
Getting started
Configuration
- Overview
- Items
- Groups
- Stacking Multipliers
- Custom Currencies
- Milestones & Discord
- Auto-Reset
- Messages (lang.yml)
Shops
Menus (GUI)
Placeholders
Developers
Help