Skip to content

Commit 7f0560d

Browse files
committed
2 parents 7b8c6fb + 210e1ac commit 7f0560d

File tree

5 files changed

+143
-8
lines changed

5 files changed

+143
-8
lines changed

.github/workflows/javadoc.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Deploy Javadoc
22

33
on:
4-
# push:
4+
push:
55
# branches:
66
# - master
77
# - main
@@ -12,12 +12,17 @@ jobs:
1212
permissions:
1313
contents: write # if you have a protection rule on your repository, you'll need to give write permission to the workflow.
1414
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup Java JDK
17+
uses: actions/[email protected]
18+
with:
19+
java-version: 21
20+
distribution: temurin
1521
- name: Create branch for Javadoc
1622
uses: MathieuSoysal/[email protected]
1723
with:
1824
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
javadoc-branch: javadoc
2025
java-version: 17
21-
target-folder: docs/javadoc # url will be https://<username>.github.io/<repo>/javadoc, This can be left as nothing to generate javadocs in the root folder.
22-
project: maven # or gradle
23-
# subdirectories: moduleA moduleB #for subdirectories support, needs to be run with custom command
26+
javadoc-branch: javadoc
27+
target-folder: docs/javadoc
28+
project: maven

docs/configs.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Configs
2+
3+
## READ ME FIRST
4+
If you'd like to make a config **without** having a template file in your resources folder (configs created at-runtime with changing filenames), use a `CaramelBlankConfig` instead of a `CaramelConfig` class!
5+
6+
## Creating one
7+
First, make a variable for it:
8+
```java
9+
CaramelConfig coolConfig;
10+
```
11+
12+
Then in your onEnable, initialize it:
13+
```java
14+
coolConfig = new CaramelConfig(this, "coolest-config.yml");
15+
// If using blank configs, use .saveBlankConfig() instead.
16+
coolConfig.saveDefaultConfig();
17+
```
18+
19+
And use it:
20+
```java
21+
coolConfig.getData() // returns a FileConfiguration
22+
coolConfig.getData().getString("my.path");
23+
coolConfig.getData().setString("my.path", "Setting!");
24+
```

docs/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ depend: [Caramel]
4040
## Features
4141
Caramel has a few main features.
4242
- [Commands](https://pages.klash.dev/Caramel/commands)
43-
- [Items](https://pages.klash.dev/Caramel/items) - Docs incomplete
43+
- [Items](https://pages.klash.dev/Caramel/items) (WIP Docs)
4444
- [Guis](https://pages.klash.dev/Caramel/guis)
4545
- [Currencies](https://pages.klash.dev/Caramel/currencies)
46-
- [Recipes](https://pages.klash.dev/Caramel/recipes) - Docs incomplete
47-
- [YAML Configs](https://pages.klash.dev/Caramel/configs) - Docs incomplete
46+
- [Recipes](https://pages.klash.dev/Caramel/recipes)
47+
- [YAML Configs](https://pages.klash.dev/Caramel/configs)
4848
- [SQL Configs](https://pages.klash.dev/Caramel/sql)

docs/items.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Items
2+
3+
The documentation for items are WIP, but here's a simple implementation while you wait:
4+
5+
```java
6+
public class MyItem implements CaramelItem {
7+
8+
@Override
9+
public CaramelItemDetail getDetails() {
10+
return CaramelItemDetail.builder()
11+
.id("item_identifier") // Required
12+
.defaultStack(1) // Required
13+
.modelData(0) // Optional - Custom Model Data
14+
.itemBase(Material.PAPER) // Required
15+
.itemName(CaramelUtility.colorcomp("<gold><bold>Supports miniMessage")) // Required
16+
.lore(Arrays.asList("Lore <red>is cool<yellow>!")) // Required
17+
.build();
18+
}
19+
20+
@Override
21+
public ItemStack modifyBeforeFinalizing(ItemStack item) {
22+
// You can add custom modifications (attributes) here.
23+
// Return the item back to keep it the same.
24+
return item;
25+
}
26+
27+
@Override
28+
public void onItemUse(ClickType type, ItemStack item, PlayerInteractEvent event) {
29+
// Handle interactions here.
30+
// ClickType is a dev.klash.caramel.items, not bukkit.
31+
event.getPlayer().sendMessage(CaramelUtility.colorcomp("Hello!"));
32+
}
33+
}
34+
```
35+
36+
Please see Commands for registering, but use `Caramel.getInstance().items` and define it as a `CaramelItem`.

docs/recipes.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Recipes
2+
3+
## Making each recipe
4+
First, get started by making a new class for your recipe, and implementing all the methods:
5+
```java
6+
public class MyFirstRecipe extends CaramelRecipe {
7+
public ItemStack getResult() {return ...;};
8+
public CaramelRecipeDetail getDetails() {return ...;};
9+
public NamespacedKey getKey() {return ...;};
10+
}
11+
```
12+
13+
Result needs to be an ItemStack to return as the output.
14+
15+
Key needs to be a NamespacedKey with your Plugin/Identifier and the recipe's identifier.
16+
17+
The details are where we define the actual recipe:
18+
```java
19+
CaramelRecipeDetail.of(
20+
new CaramelRecipeValue[] {},
21+
new String[] {
22+
" ",
23+
" ",
24+
" "
25+
}
26+
);
27+
```
28+
29+
The array of values are your mappings for your pattern. See the values section below.
30+
31+
The array of strings is your pattern, and should be 3x tripple-letter strings.
32+
33+
34+
<br/><br/>
35+
36+
37+
## Recipe Values
38+
A recipe value is a mapping of character <--> an itemstack or material to be used in the crafting grid.
39+
40+
You can create these by the `CaramelRecipeValueItem` and `CaramelRecipeValueMaterial` constructors:
41+
42+
```java
43+
// A material value is only the material.
44+
new CaramelRecipeValueMaterial('D', Material.DIAMOND)
45+
46+
// A item value is for more specific recipe values.
47+
new CaramelRecipeValueItem('D', new ItemStack(Material.DIAMOND))
48+
```
49+
50+
51+
<br/><br/>
52+
53+
54+
## Registering your recipes
55+
Recipes are registered through RecipeLists. You can create these directly from the instance of Caramel:
56+
57+
```java
58+
// Define your list in your class:
59+
CaramelRecipeList myRecipes;
60+
61+
// Inside your onEnable:
62+
recipeList = Caramel.createRecipeList(
63+
myFirstRecipe,
64+
mySecondRecipe
65+
);
66+
recipeList.registerAll();
67+
68+
// Inside your onDisable:
69+
recipeList.cleanup();
70+
```

0 commit comments

Comments
 (0)