mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-11 15:15:01 +00:00
add reset token
This commit is contained in:
@@ -100,6 +100,12 @@ public class TokenCrafting {
|
||||
flightTimeRecipe.setIngredient('F', Material.FEATHER);
|
||||
recipes.add(flightTimeRecipe);
|
||||
|
||||
NamespacedKey resetKey = new NamespacedKey(toolStats, "reset-token");
|
||||
ShapedRecipe resetRecipe = new ShapedRecipe(resetKey, toolStats.tokenItems.resetToken());
|
||||
resetRecipe.shape(" P ", "P P", " P ");
|
||||
resetRecipe.setIngredient('P', Material.PAPER);
|
||||
recipes.add(resetRecipe);
|
||||
|
||||
tokenTypes.add("crops-mined");
|
||||
tokenTypes.add("blocks-mined");
|
||||
tokenTypes.add("damage-taken");
|
||||
@@ -109,6 +115,7 @@ public class TokenCrafting {
|
||||
tokenTypes.add("sheep-sheared");
|
||||
tokenTypes.add("flight-time");
|
||||
tokenTypes.add("fish-caught");
|
||||
tokenTypes.add("reset");
|
||||
}
|
||||
|
||||
public Set<ShapedRecipe> getRecipes() {
|
||||
|
||||
@@ -215,4 +215,23 @@ public class TokenItems {
|
||||
token.setItemMeta(tokenMeta);
|
||||
return token;
|
||||
}
|
||||
public ItemStack resetToken() {
|
||||
// set up the item
|
||||
ItemStack token = new ItemStack(Material.PAPER);
|
||||
ItemMeta tokenMeta = token.getItemMeta();
|
||||
PersistentDataContainer tokenData = tokenMeta.getPersistentDataContainer();
|
||||
|
||||
// set the title and lore
|
||||
Component title = toolStats.configTools.format("tokens.data.reset.title");
|
||||
Component lore = toolStats.configTools.format("tokens.data.reset.lore");
|
||||
tokenMeta.displayName(title);
|
||||
List<Component> newLore = new ArrayList<>();
|
||||
newLore.add(lore);
|
||||
tokenMeta.lore(newLore);
|
||||
|
||||
// set the PDC
|
||||
tokenData.set(toolStats.tokenType, PersistentDataType.STRING, "reset");
|
||||
token.setItemMeta(tokenMeta);
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user