Skip to content

Commit 6fff551

Browse files
author
Jan Kluka
committed
1.3
Implemented pickaxe skins api
1 parent 7e11823 commit 6fff551

3 files changed

Lines changed: 129 additions & 0 deletions

File tree

src/main/java/dev/drawethree/xprison/api/XPrisonAPI.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import dev.drawethree.xprison.api.miningstats.XPrisonMiningStatsAPI;
1212
import dev.drawethree.xprison.api.multipliers.XPrisonMultipliersAPI;
1313
import dev.drawethree.xprison.api.pickaxelevels.XPrisonPickaxeLevelsAPI;
14+
import dev.drawethree.xprison.api.pickaxeskins.XPrisonPickaxeSkinsAPI;
1415
import dev.drawethree.xprison.api.prestiges.XPrisonPrestigesAPI;
1516
import dev.drawethree.xprison.api.ranks.XPrisonRanksAPI;
1617
import org.jetbrains.annotations.NotNull;
@@ -124,6 +125,14 @@ public interface XPrisonAPI {
124125
@NotNull
125126
XPrisonMiningStatsAPI getMiningStatsApi();
126127

128+
/**
129+
* Gets the pickaxe skins API
130+
*
131+
* @return the Pickaxe Skins API instance
132+
*/
133+
@NotNull
134+
XPrisonPickaxeSkinsAPI getPickaxeSkinsApi();
135+
127136
/**
128137
* Gets the singleton instance of the XPrisonAPI.
129138
*
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package dev.drawethree.xprison.api.pickaxeskins;
2+
3+
import dev.drawethree.xprison.api.pickaxeskins.model.PickaxeSkin;
4+
import org.bukkit.entity.Player;
5+
import org.bukkit.inventory.ItemStack;
6+
7+
import java.util.Optional;
8+
9+
/**
10+
* API for managing pickaxe skins in XPrison.
11+
* <p>
12+
* This interface allows external plugins to retrieve, apply, or manipulate
13+
* cosmetic pickaxe skins which may provide gameplay multipliers (money, tokens, gems).
14+
*/
15+
public interface XPrisonPickaxeSkinsAPI {
16+
17+
/**
18+
* Retrieves the {@link PickaxeSkin} applied to the given pickaxe item.
19+
* <p>
20+
* This checks for skin metadata (e.g., via CustomModelData or NBT tags) stored in the item.
21+
*
22+
* @param item the ItemStack representing the pickaxe
23+
* @return an {@link Optional} containing the PickaxeSkin if one is applied; otherwise, empty
24+
*/
25+
Optional<PickaxeSkin> getPickaxeSkin(ItemStack item);
26+
27+
/**
28+
* Retrieves the {@link PickaxeSkin} currently applied to the item the player is holding.
29+
*
30+
* @param player the player whose held item will be checked
31+
* @return an {@link Optional} containing the PickaxeSkin if found; otherwise, empty
32+
*/
33+
Optional<PickaxeSkin> getPickaxeSkin(Player player);
34+
35+
/**
36+
* Retrieves a {@link PickaxeSkin} by its unique identifier.
37+
* <p>
38+
* Skin IDs correspond to the keys defined in your configuration (e.g., "legendary", "neon").
39+
*
40+
* @param id the ID of the skin to fetch
41+
* @return an {@link Optional} containing the PickaxeSkin if it exists; otherwise, empty
42+
*/
43+
Optional<PickaxeSkin> getPickaxeSkin(String id);
44+
45+
/**
46+
* Applies a {@link PickaxeSkin} to a given item for a specific player.
47+
* <p>
48+
* This typically modifies the item's CustomModelData or NBT to reflect the skin.
49+
*
50+
* @param player the player applying the skin
51+
* @param item the ItemStack to modify (must be a valid pickaxe)
52+
* @param skin the PickaxeSkin to apply to the item
53+
*/
54+
void setPickaxeSkin(Player player, ItemStack item, PickaxeSkin skin);
55+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package dev.drawethree.xprison.api.pickaxeskins.model;
2+
3+
import java.util.Map;
4+
5+
/**
6+
* Represents a customizable pickaxe skin used within the XPrison system.
7+
* Each skin has a unique ID, display name, custom model data (for resource packs),
8+
* and a set of currency multipliers that affect gameplay (e.g., tokens, money, gems).
9+
*
10+
* This interface provides access to all properties of a skin,
11+
* and allows multiplier lookups by currency name.
12+
*/
13+
public interface PickaxeSkin {
14+
15+
/**
16+
* Gets the unique identifier for this skin.
17+
*
18+
* @return the internal ID of the skin (e.g., "legendary", "neon")
19+
*/
20+
String getId();
21+
22+
/**
23+
* Gets the display name of this skin, usually with color codes.
24+
*
25+
* @return the name shown to players (e.g., "§6Legendary Skin")
26+
*/
27+
String getName();
28+
29+
/**
30+
* Gets the description of this skin, usually with color codes.
31+
*
32+
* @return the description shown to players
33+
*/
34+
String getDescription();
35+
36+
/**
37+
* Gets the custom model data value used for applying the resource pack model.
38+
*
39+
* @return the CustomModelData integer for this skin
40+
*/
41+
int getCustomModelData();
42+
43+
/**
44+
* Gets the map of multipliers applied by this skin.
45+
* Each entry maps a currency (e.g., "tokens") to a multiplier value.
46+
*
47+
* @return a map of currency multipliers
48+
*/
49+
Map<String, Double> getMultipliers();
50+
51+
/**
52+
* Gets the permission string required to use or unlock this skin.
53+
*
54+
* @return the permission node (e.g., "pickaxeskins.skin.legendary")
55+
*/
56+
String getPermission();
57+
58+
/**
59+
* Gets the multiplier for the specified currency.
60+
*
61+
* @param currencyName the currency to get the multiplier for (e.g., "tokens", "money")
62+
* @return the multiplier for the currency, or 0.0 if not defined
63+
*/
64+
double getMultiplier(String currencyName);
65+
}

0 commit comments

Comments
 (0)