Skip to content

Commit e56d2bf

Browse files
committed
Merge branch 'release/1.1.0.8'
2 parents 3ad6731 + 517ccce commit e56d2bf

607 files changed

Lines changed: 14294 additions & 2850 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ target
4848
target-api
4949
*.java~
5050
*.kts~
51+
52+
### OpenCode ###
53+
54+
/AGENTS.md
55+
56+
opencode.json
57+
CLAUDE.md

API/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ plugins {
22
id("re.alwyn974.groupez.publish") version "1.0.0"
33
}
44

5+
dependencies{
6+
implementation("net.kyori:adventure-api:4.25.0")
7+
}
8+
59
rootProject.extra.properties["sha"]?.let { sha ->
610
version = sha
711
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package fr.maxlego08.menu;
2+
3+
import fr.maxlego08.menu.api.MenuPlugin;
4+
import fr.maxlego08.menu.api.exceptions.ItemComponentAlreadyRegisterException;
5+
import fr.maxlego08.menu.api.loader.ItemComponentLoader;
6+
import org.jetbrains.annotations.NotNull;
7+
8+
import java.util.Optional;
9+
10+
public interface ComponentsManager {
11+
12+
void initializeDefaultComponents(MenuPlugin plugin);
13+
14+
/**
15+
* Register a new ItemComponentLoader.
16+
* @param loader The loader to register
17+
* @throws ItemComponentAlreadyRegisterException if a loader with the same name is already registered
18+
**/
19+
void registerComponent(@NotNull ItemComponentLoader loader) throws ItemComponentAlreadyRegisterException;
20+
21+
/**
22+
* Get an ItemComponentLoader by its name.
23+
* @param name The name of the loader
24+
* @return An Optional containing the loader if found, or empty if not found
25+
**/
26+
@NotNull
27+
Optional<ItemComponentLoader> getLoader(@NotNull String name);
28+
}

API/src/main/java/fr/maxlego08/menu/api/ButtonManager.java

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
import fr.maxlego08.menu.api.loader.ActionLoader;
66
import fr.maxlego08.menu.api.loader.ButtonLoader;
77
import fr.maxlego08.menu.api.loader.PermissibleLoader;
8+
import fr.maxlego08.menu.api.pattern.ActionPattern;
89
import fr.maxlego08.menu.api.requirement.Action;
910
import fr.maxlego08.menu.api.requirement.Permissible;
1011
import fr.maxlego08.menu.api.requirement.Requirement;
1112
import fr.maxlego08.menu.api.utils.Loader;
1213
import org.bukkit.configuration.file.YamlConfiguration;
1314
import org.bukkit.plugin.Plugin;
15+
import org.jetbrains.annotations.NotNull;
16+
import org.jetbrains.annotations.Nullable;
1417

1518
import java.io.File;
1619
import java.util.Collection;
@@ -34,27 +37,28 @@ public interface ButtonManager {
3437
*
3538
* @param button The {@link ButtonLoader} instance to register.
3639
*/
37-
void register(ButtonLoader button);
40+
void register(@NotNull ButtonLoader button);
3841

3942
/**
4043
* Unregisters an existing {@link ButtonLoader}, ceasing its button creation responsibilities.
4144
*
4245
* @param button The {@link ButtonLoader} instance to unregister.
4346
*/
44-
void unregister(ButtonLoader button);
47+
void unregister(@NotNull ButtonLoader button);
4548

4649
/**
4750
* Unregisters all {@link ButtonLoader} instances linked to a specific plugin.
4851
*
4952
* @param plugin The plugin whose loaders should be unregistered.
5053
*/
51-
void unregisters(Plugin plugin);
54+
void unregisters(@NotNull Plugin plugin);
5255

5356
/**
5457
* Retrieves all registered {@link ButtonLoader} instances.
5558
*
5659
* @return A collection containing all registered {@link ButtonLoader} instances.
5760
*/
61+
@NotNull
5862
Collection<ButtonLoader> getLoaders();
5963

6064
/**
@@ -63,28 +67,31 @@ public interface ButtonManager {
6367
* @param plugin The plugin whose loaders are to be retrieved.
6468
* @return A collection of {@link ButtonLoader} instances or an empty collection if none are found.
6569
*/
66-
Collection<ButtonLoader> getLoaders(Plugin plugin);
70+
@NotNull
71+
Collection<ButtonLoader> getLoaders(@NotNull Plugin plugin);
6772

6873
/**
6974
* Retrieves a {@link ButtonLoader} based on the name of the associated {@link Button}.
7075
*
7176
* @param name The name of the {@link ButtonLoader}.
7277
* @return An {@link Optional} containing the {@link ButtonLoader}, if found.
7378
*/
74-
Optional<ButtonLoader> getLoader(String name);
79+
@NotNull
80+
Optional<ButtonLoader> getLoader(@Nullable String name);
7581

7682
/**
7783
* Registers a new {@link PermissibleLoader} responsible for permissible creation.
7884
*
7985
* @param permissibleLoader The {@link PermissibleLoader} instance to register.
8086
*/
81-
void registerPermissible(PermissibleLoader permissibleLoader);
87+
void registerPermissible(@NotNull PermissibleLoader permissibleLoader);
8288

8389
/**
8490
* Retrieves a mapping of permissible keys to their associated {@link PermissibleLoader} instances.
8591
*
8692
* @return A map linking permissible keys to their corresponding {@link PermissibleLoader} instances.
8793
*/
94+
@NotNull
8895
Map<String, PermissibleLoader> getPermissibles();
8996

9097
/**
@@ -93,22 +100,24 @@ public interface ButtonManager {
93100
* @param key The key identifying the permissible.
94101
* @return An {@link Optional} containing the {@link PermissibleLoader}, if found.
95102
*/
96-
Optional<PermissibleLoader> getPermission(String key);
103+
@NotNull
104+
Optional<PermissibleLoader> getPermission(@NotNull String key);
97105

98106
/**
99107
* Registers a new {@link ActionLoader} responsible for action creation.
100108
*
101109
* @param actionLoader The {@link ActionLoader} instance to register.
102110
*/
103-
void registerAction(ActionLoader actionLoader);
111+
void registerAction(@NotNull ActionLoader actionLoader);
104112

105113
/**
106114
* Retrieves an {@link Optional} {@link ActionLoader} based on a specific action key.
107115
*
108116
* @param key The key identifying the action.
109117
* @return An {@link Optional} containing the {@link ActionLoader}, if found.
110118
*/
111-
Optional<ActionLoader> getActionLoader(String key);
119+
@NotNull
120+
Optional<ActionLoader> getActionLoader(@NotNull String key);
112121

113122
/**
114123
* Converts a list of map elements from a configuration file into a list of {@link Permissible} objects.
@@ -118,7 +127,8 @@ public interface ButtonManager {
118127
* @param file The configuration file in use.
119128
* @return A list of {@link Permissible} objects derived from the configuration.
120129
*/
121-
List<Permissible> loadPermissible(List<Map<String, Object>> elements, String path, File file);
130+
@NotNull
131+
List<@NotNull Permissible> loadPermissible(@NotNull List<@NotNull Map<String, Object>> elements,@NotNull String path,@NotNull File file);
122132

123133
/**
124134
* Converts a list of map elements from a configuration file into a list of {@link Permissible} objects.
@@ -128,7 +138,8 @@ public interface ButtonManager {
128138
* @param file The file where the configuration is located.
129139
* @return A list of {@link Permissible} objects derived from the configuration.
130140
*/
131-
List<Permissible> loadPermissible(YamlConfiguration configuration, String path, File file);
141+
@NotNull
142+
List<@NotNull Permissible> loadPermissible(@NotNull YamlConfiguration configuration,@NotNull String path,@NotNull File file);
132143

133144
/**
134145
* Converts a list of map elements from a configuration file into a list of {@link Action} objects.
@@ -140,7 +151,11 @@ public interface ButtonManager {
140151
* @param file The configuration file in use.
141152
* @return A list of {@link Action} objects derived from the configuration.
142153
*/
143-
List<Action> loadActions(List<Map<String, Object>> elements, String path, File file);
154+
@NotNull
155+
List<@NotNull Action> loadActions(@NotNull List<@NotNull Map<String, Object>> elements,@NotNull String path,@NotNull File file);
156+
157+
@NotNull
158+
List<@NotNull Action> loadActions(@NotNull List<Map<String, Object>> elements,@NotNull String path,@NotNull File file, @NotNull List<@NotNull ActionPattern> defaultActions, boolean useSuccess, boolean stopOnEmpty);
144159

145160
/**
146161
* Converts a list of map elements from a configuration file into a list of {@link Action} objects.
@@ -152,11 +167,17 @@ public interface ButtonManager {
152167
* @param file The configuration file in use.
153168
* @return A list of {@link Action} objects derived from the configuration.
154169
*/
155-
List<Action> loadActions(YamlConfiguration configuration, String path, File file);
170+
@NotNull
171+
List<@NotNull Action> loadActions(@NotNull YamlConfiguration configuration,@NotNull String path,@NotNull File file);
172+
173+
@NotNull
174+
List<@NotNull Action> loadActions(@NotNull YamlConfiguration configuration,@NotNull String path,@NotNull File file, @NotNull List<@NotNull ActionPattern> defaultActions, boolean useSuccess, boolean stopOnEmpty);
156175

157-
List<Requirement> loadRequirements(YamlConfiguration configuration, String path, File file) throws InventoryException;
176+
@NotNull
177+
List<Requirement> loadRequirements(@Nullable YamlConfiguration configuration,@NotNull String path,@NotNull File file) throws InventoryException;
158178

159-
Requirement loadRequirement(YamlConfiguration configuration, String path, File file) throws InventoryException;
179+
@NotNull
180+
Requirement loadRequirement(@NotNull YamlConfiguration configuration,@NotNull String path,@NotNull File file) throws InventoryException;
160181

161182
/**
162183
* Retrieves a list of all empty actions from the given configuration elements.
@@ -167,7 +188,8 @@ public interface ButtonManager {
167188
* @param elements The list of configuration items detailing an action's entire configuration.
168189
* @return A list of all empty actions from the given configuration elements.
169190
*/
170-
List<String> getEmptyActions(List<Map<String, Object>> elements);
191+
@NotNull
192+
List<String> getEmptyActions(@NotNull List<Map<String, Object>> elements);
171193

172194
/**
173195
* Retrieves a list of all empty permissibles from the given configuration elements.
@@ -178,18 +200,20 @@ public interface ButtonManager {
178200
* @param elements The list of configuration items detailing a permissible's entire configuration.
179201
* @return A list of all empty permissibles from the given configuration elements.
180202
*/
181-
List<String> getEmptyPermissible(List<Map<String, Object>> elements);
203+
@NotNull
204+
List<String> getEmptyPermissible(@NotNull List<Map<String, Object>> elements);
182205

183206
/**
184207
* Retrieves a {@link Loader} for a {@link Button} object based on the given parameters.
185208
*
186209
* <p>This method is used to create a loader for a button object, given the plugin instance, file, size, and matrix.</p>
187210
*
188211
* @param menuPlugin The plugin instance associated with the button loader.
189-
* @param file The file from which the button configuration is loaded.
190-
* @param size The size of the button.
191-
* @param matrix The matrix containing the button's configuration data.
212+
* @param file The file from which the button configuration is loaded.
213+
* @param size The size of the button.
214+
* @param matrix The matrix containing the button's configuration data.
192215
* @return A {@link Loader} for a {@link Button} object based on the given parameters.
193216
*/
194-
Loader<Button> getLoaderButton(MenuPlugin menuPlugin, File file, int size, Map<Character, List<Integer>> matrix);
217+
@NotNull
218+
Loader<Button> getLoaderButton(@NotNull MenuPlugin menuPlugin,@NotNull File file, int size,@NotNull Map<Character,@NotNull List<Integer>> matrix);
195219
}

API/src/main/java/fr/maxlego08/menu/api/DialogInventory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import fr.maxlego08.menu.api.utils.dialogs.record.ActionButtonRecord;
88
import fr.maxlego08.menu.api.utils.dialogs.record.ZDialogInventoryBuild;
99
import org.bukkit.entity.Player;
10+
import org.jetbrains.annotations.NotNull;
1011

1112
import java.io.File;
1213
import java.util.List;
@@ -135,7 +136,7 @@ public interface DialogInventory {
135136

136137
void setActionButtonServerLink(ActionButtonRecord actionButtonRecord);
137138

138-
ActionButtonRecord getActionButtonServerLink(Player player);
139+
ActionButtonRecord getActionButtonServerLink(@NotNull Player player);
139140

140141
ActionButtonRecord getActionButtonServerLink();
141142

API/src/main/java/fr/maxlego08/menu/api/Inventory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package fr.maxlego08.menu.api;
22

3+
import fr.maxlego08.menu.api.animation.TitleAnimation;
34
import fr.maxlego08.menu.api.button.Button;
45
import fr.maxlego08.menu.api.engine.InventoryEngine;
56
import fr.maxlego08.menu.api.engine.InventoryResult;
67
import fr.maxlego08.menu.api.pattern.Pattern;
8+
import fr.maxlego08.menu.api.requirement.Action;
79
import fr.maxlego08.menu.api.requirement.ConditionalName;
810
import fr.maxlego08.menu.api.requirement.Requirement;
911
import fr.maxlego08.menu.api.utils.OpenWithItem;
@@ -216,4 +218,12 @@ public interface Inventory {
216218
* @return The player name placeholder.
217219
*/
218220
String getTargetPlayerNamePlaceholder();
221+
222+
void setTitleAnimation(TitleAnimation load);
223+
224+
TitleAnimation getTitleAnimation();
225+
226+
List<Action> getOpenActions();
227+
228+
List<Action> getCloseActions();
219229
}

API/src/main/java/fr/maxlego08/menu/api/InventoryManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import fr.maxlego08.menu.api.loader.MaterialLoader;
1515
import fr.maxlego08.menu.api.utils.Message;
1616
import fr.maxlego08.menu.api.utils.MetaUpdater;
17+
import fr.maxlego08.menu.api.utils.Placeholders;
1718
import org.bukkit.OfflinePlayer;
1819
import org.bukkit.command.CommandSender;
1920
import org.bukkit.configuration.file.YamlConfiguration;
@@ -559,6 +560,8 @@ public interface InventoryManager extends Listener {
559560

560561
ItemStack postProcessSkullItemStack(ItemStack itemStack, Button button, Player player);
561562

563+
ItemStack postProcessSkullItemStack(ItemStack itemStack, Button button, Player player, Placeholders placeholders);
564+
562565
void sendMessage(CommandSender sender, Message message, Object... args);
563566

564567
void load();

API/src/main/java/fr/maxlego08/menu/api/ItemManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public interface ItemManager {
3434

3535
void registerMechanicFactory(MechanicFactory<?> factory);
3636

37+
Optional<MechanicFactory<?>> getMechanicFactory(String mechanicId);
38+
3739
void giveItem(Player player, String itemId);
3840

3941
void executeCheckInventoryItems(Player player);

0 commit comments

Comments
 (0)