Skip to content

Commit fa54152

Browse files
committed
Merge branch 'release/1.0.3.0'
2 parents 8140b13 + 2f4a8f3 commit fa54152

31 files changed

+388
-84
lines changed

changelog.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,26 @@
3232
- [ ] Adding more logs on the errors that can occur with custom items like ItemAdder, this will cause an error but the user will not have the information of why, for example when the item does not exist.
3333
- [ ] Create a new class for loading buttons to add more elements, like a boolean to check if the button needs an itemstack
3434
- [ ] Can split a file into several and thus avoid having too large files
35-
- [ ] Add open link with a book
35+
- [x] Add open link with a book
3636
- [ ] Add slot type for create pattern (Allows to fill slot areas as do the outline of the inventory)
3737
- [ ] Be able to set default values for player data
38+
- [x] Create a command `/zm download <link>` to download a configuration from a link (Allows to simply share its configurations, from discord for example)
3839

3940
# Unreleased
4041

42+
# 1.0.3.0
43+
4144
- Create new placeholder ``%zmenu_player_next_page%``, return player next page
4245
- Create new placeholder ``%zmenu_player_previous_page%``, return player previous page
4346
- Create new requirement: ``playername``, Check if a text is a player nickname
4447
- Fixed the display of a button with a playerHead if the text is not a `playerHead`. This avoids server lag when opening inventory.
48+
- Fixed Numbers saved in PlayerData are not Numbers after a restart. [#59](https://github.com/Maxlego08/zMenu/issues/59)
49+
- Added Placeholder in head url [#58](https://github.com/Maxlego08/zMenu/issues/58)
50+
- Added Action - Data placeholder [#56](https://github.com/Maxlego08/zMenu/issues/56)
51+
- Expand player data commands with add & subtract [#46](https://github.com/Maxlego08/zMenu/issues/46)
52+
- New features for Commands (Perform action and Auto-completion) [#26](https://github.com/Maxlego08/zMenu/issues/26)
53+
- You can now open a book
54+
- Create ``/zm download <link>`` command. You can download configuration files from links, discord links for example.
4555

4656
# 1.0.2.9
4757

dependency-reduced-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>fr.maxlego08</groupId>
55
<artifactId>zmenu</artifactId>
6-
<version>1.0.2.9</version>
6+
<version>1.0.3.0</version>
77
<build>
88
<sourceDirectory>src</sourceDirectory>
99
<resources>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>fr.maxlego08</groupId>
55
<artifactId>zmenu</artifactId>
6-
<version>1.0.2.9</version>
6+
<version>1.0.3.0</version>
77
<properties>
88
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
99
<maven.compiler.source>8</maven.compiler.source>

src/fr/maxlego08/menu/MenuItemStack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public ItemStack build(Player player, boolean useCache, Placeholders placeholder
192192
}
193193

194194
if (this.url != null) {
195-
itemStack = this.createSkull(this.url);
195+
itemStack = this.createSkull(this.papi(this.url, player));
196196
}
197197

198198
if (this.potion != null) {

src/fr/maxlego08/menu/ZCommand.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import fr.maxlego08.menu.api.command.Command;
44
import fr.maxlego08.menu.api.command.CommandArgument;
5+
import fr.maxlego08.menu.api.requirement.Action;
56
import org.bukkit.plugin.Plugin;
67

78
import java.io.File;
@@ -16,30 +17,33 @@ public class ZCommand implements Command {
1617
private final String permission;
1718
private final String inventory;
1819
private final List<CommandArgument> arguments;
20+
private final List<Action> actions;
1921

2022
private final String path;
2123
private final File file;
2224

2325

2426
/**
25-
* @param plugin The plugin where the command comes from
26-
* @param command Main command
27-
* @param aliases List of aliases
27+
* @param plugin The plugin where the command comes from
28+
* @param command Main command
29+
* @param aliases List of aliases
2830
* @param permission Command Permission
29-
* @param inventory Inventory name
30-
* @param arguments List of arguments
31-
* @param path file path
32-
* @param file File
31+
* @param inventory Inventory name
32+
* @param arguments List of arguments
33+
* @param actions Actions
34+
* @param path file path
35+
* @param file File
3336
*/
3437
public ZCommand(Plugin plugin, String command, List<String> aliases, String permission, String inventory,
35-
List<CommandArgument> arguments, String path, File file) {
38+
List<CommandArgument> arguments, List<Action> actions, String path, File file) {
3639
super();
3740
this.plugin = plugin;
3841
this.command = command;
3942
this.aliases = aliases;
4043
this.permission = permission;
4144
this.inventory = inventory;
4245
this.arguments = arguments;
46+
this.actions = actions;
4347
this.path = path;
4448
this.file = file;
4549
}
@@ -100,6 +104,11 @@ public String getPath() {
100104
return path;
101105
}
102106

107+
@Override
108+
public List<Action> getActions() {
109+
return this.actions;
110+
}
111+
103112
@Override
104113
public File getFile() {
105114
return file;

src/fr/maxlego08/menu/ZCommandArgument.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,42 @@
11
package fr.maxlego08.menu;
22

33
import fr.maxlego08.menu.api.command.CommandArgument;
4+
import fr.maxlego08.menu.api.requirement.Action;
45

6+
import java.util.List;
57
import java.util.Optional;
68

79
public class ZCommandArgument implements CommandArgument {
810

911
private final String argument;
1012
private final String inventory;
1113
private final boolean isRequired;
14+
private final List<Action> actions;
15+
private final List<String> autoCompletion;
1216

13-
public ZCommandArgument(String argument, String inventory, boolean isRequired) {
17+
public ZCommandArgument(String argument, String inventory, boolean isRequired, List<Action> actions, List<String> autoCompletion) {
1418
this.argument = argument;
1519
this.inventory = inventory;
1620
this.isRequired = isRequired;
21+
this.actions = actions;
22+
this.autoCompletion = autoCompletion;
1723
}
1824

1925
@Override
2026
public boolean isRequired() {
2127
return isRequired;
2228
}
2329

30+
@Override
31+
public List<Action> getActions() {
32+
return this.actions;
33+
}
34+
35+
@Override
36+
public List<String> getAutoCompletion() {
37+
return this.autoCompletion;
38+
}
39+
2440
@Override
2541
public String getArgument() {
2642
return argument;

src/fr/maxlego08/menu/ZCommandManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void registerCommand(Command command) {
5252
VCommandManager manager = this.plugin.getVCommandManager();
5353
manager.registerCommand(command);
5454

55-
List<Command> commands = this.commands.getOrDefault(command.getPlugin().getName(), new ArrayList<Command>());
55+
List<Command> commands = this.commands.getOrDefault(command.getPlugin().getName(), new ArrayList<>());
5656
commands.add(command);
5757
this.commands.put(command.getPlugin().getName(), commands);
5858

@@ -147,7 +147,7 @@ private Object getCraftServerInstance() throws ClassNotFoundException, IllegalAc
147147
@Override
148148
public void loadCommand(Plugin plugin, File file) {
149149

150-
Loader<Command> loader = new CommandLoader(plugin);
150+
Loader<Command> loader = new CommandLoader(plugin, this.plugin);
151151
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
152152
if (!configuration.contains("commands") || !configuration.isConfigurationSection("commands.")) {
153153
return;
@@ -218,7 +218,7 @@ public boolean reload(Command command) {
218218
String path = command.getPath();
219219
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
220220

221-
Loader<Command> loader = new CommandLoader(this.plugin);
221+
Loader<Command> loader = new CommandLoader(this.plugin, this.plugin);
222222
try {
223223
Command newCommand = loader.load(configuration, path, file);
224224
this.registerCommand(newCommand);

src/fr/maxlego08/menu/ZInventoryManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import fr.maxlego08.menu.itemstack.NameSimilar;
3232
import fr.maxlego08.menu.loader.InventoryLoader;
3333
import fr.maxlego08.menu.loader.MenuItemStackLoader;
34+
import fr.maxlego08.menu.loader.actions.BookLoader;
3435
import fr.maxlego08.menu.loader.actions.BroadcastLoader;
3536
import fr.maxlego08.menu.loader.actions.BroadcastSoundLoader;
3637
import fr.maxlego08.menu.loader.actions.ChatLoader;
@@ -277,6 +278,7 @@ public void loadButtons() {
277278
// Load actions
278279
buttonManager.registerAction(new BroadcastLoader());
279280
buttonManager.registerAction(new MessageLoader());
281+
buttonManager.registerAction(new BookLoader());
280282
buttonManager.registerAction(new SoundLoader());
281283
buttonManager.registerAction(new BroadcastSoundLoader());
282284
buttonManager.registerAction(new CloseLoader());

src/fr/maxlego08/menu/api/command/Command.java

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

3+
import fr.maxlego08.menu.api.requirement.Action;
34
import org.bukkit.plugin.Plugin;
45

56
import java.io.File;
@@ -79,4 +80,6 @@ public interface Command {
7980
* @return The path of the command in the configuration file.
8081
*/
8182
String getPath();
83+
84+
List<Action> getActions();
8285
}

src/fr/maxlego08/menu/api/command/CommandArgument.java

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

3+
import fr.maxlego08.menu.api.requirement.Action;
4+
5+
import java.util.List;
36
import java.util.Optional;
47

58
/**
@@ -27,4 +30,8 @@ public interface CommandArgument {
2730
* @return {@code true} if the argument is required, otherwise {@code false}.
2831
*/
2932
boolean isRequired();
33+
34+
List<Action> getActions();
35+
36+
List<String> getAutoCompletion();
3037
}

0 commit comments

Comments
 (0)