Skip to content

Commit 14e20c0

Browse files
committed
Merge branch 'release/1.0.2.3'
2 parents 1ef9483 + 7b95060 commit 14e20c0

File tree

17 files changed

+449
-35
lines changed

17 files changed

+449
-35
lines changed

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,17 @@
2727
- [ ] Add a tool to transform ItemStack to base64 and vice versa. This tool can be used to all my plugins.
2828
- [ ] Fix the bug about the `clearInventory: true`. It does not restore inventory when the menu is closed.
2929
- [ ] Add the support for the `http://textures.minecraft.net/texture/e34969c2684e4f62d5f87875460441a9f849d296c01e4c621636bb6acda696f7` in the URL of a custom head.
30+
- [ ] Update pom.xml for add {projet.version} in plugin.yml
3031

3132
# Unreleased
3233

34+
# 1.0.2.3
35+
36+
- Fixed the pattern display, they will now appear first and let the more important buttons pass over
37+
- Fixed MenuItemStack build method, add boolean for use cache or not
38+
- Fixed PAPI use if player is null
39+
- Create new button type: JUMP [#34](https://github.com/Maxlego08/zMenu/pull/34)
40+
3341
# 1.0.2.2
3442

3543
- Added open menu with item interaction [#29](https://github.com/Maxlego08/zMenu/pull/29) by EnzoShoes

dependency-reduced-pom.xml

Lines changed: 13 additions & 2 deletions
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.2</version>
6+
<version>1.0.2.3</version>
77
<build>
88
<sourceDirectory>src</sourceDirectory>
99
<plugins>
@@ -62,6 +62,10 @@
6262
<pattern>com.tcoded.folialib</pattern>
6363
<shadedPattern>fr.maxlego08.menu.zcore.utils.folialib</shadedPattern>
6464
</relocation>
65+
<relocation>
66+
<pattern>de.tr7zw.changeme.nbtapi</pattern>
67+
<shadedPattern>fr.maxlego08.menu.zcore.utils.nbtapi</shadedPattern>
68+
</relocation>
6569
</relocations>
6670
</configuration>
6771
</execution>
@@ -70,6 +74,10 @@
7074
</plugins>
7175
</build>
7276
<repositories>
77+
<repository>
78+
<id>codemc-repo</id>
79+
<url>https://repo.codemc.io/repository/maven-public/</url>
80+
</repository>
7381
<repository>
7482
<id>xenondevs</id>
7583
<url>https://repo.xenondevs.xyz/releases</url>
@@ -204,8 +212,11 @@
204212
</dependency>
205213
</dependencies>
206214
<properties>
207-
<maven.compiler.target>8</maven.compiler.target>
215+
<xseries.version>9.4.0</xseries.version>
208216
<maven.compiler.source>8</maven.compiler.source>
217+
<folialib.version>0.2.5</folialib.version>
218+
<maven.compiler.target>8</maven.compiler.target>
219+
<item-nbt-api.version>2.12.2</item-nbt-api.version>
209220
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
210221
</properties>
211222
</project>

pom.xml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>fr.maxlego08</groupId>
55
<artifactId>zmenu</artifactId>
6-
<version>1.0.2.2</version>
6+
<version>1.0.2.3</version>
77
<properties>
88
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
99
<maven.compiler.source>8</maven.compiler.source>
1010
<maven.compiler.target>8</maven.compiler.target>
11+
<xseries.version>9.4.0</xseries.version>
12+
<folialib.version>0.2.5</folialib.version>
13+
<item-nbt-api.version>2.12.2</item-nbt-api.version>
1114
</properties>
1215
<build>
1316
<sourceDirectory>src</sourceDirectory>
@@ -68,6 +71,10 @@
6871
<pattern>com.tcoded.folialib</pattern>
6972
<shadedPattern>fr.maxlego08.menu.zcore.utils.folialib</shadedPattern>
7073
</relocation>
74+
<relocation>
75+
<pattern>de.tr7zw.changeme.nbtapi</pattern>
76+
<shadedPattern>fr.maxlego08.menu.zcore.utils.nbtapi</shadedPattern>
77+
</relocation>
7178
</relocations>
7279
</configuration>
7380
</execution>
@@ -76,6 +83,11 @@
7683
</plugins>
7784
</build>
7885
<repositories>
86+
<repository>
87+
<id>codemc-repo</id>
88+
<url>https://repo.codemc.io/repository/maven-public/</url>
89+
<layout>default</layout>
90+
</repository>
7991
<repository>
8092
<id>xenondevs</id>
8193
<url>https://repo.xenondevs.xyz/releases</url>
@@ -120,6 +132,8 @@
120132
<version>1.20.2-R0.1-SNAPSHOT</version>
121133
<scope>provided</scope>
122134
</dependency>
135+
136+
<!-- hooks -->
123137
<dependency>
124138
<groupId>xyz.xenondevs.nova</groupId>
125139
<artifactId>nova-api</artifactId>
@@ -165,14 +179,19 @@
165179
<dependency>
166180
<groupId>com.github.cryptomorin</groupId>
167181
<artifactId>XSeries</artifactId>
168-
<version>9.4.0</version>
182+
<version>${xseries.version}</version>
169183
</dependency>
170184
<dependency>
171185
<groupId>com.tcoded</groupId>
172186
<artifactId>FoliaLib</artifactId>
173-
<version>0.2.5</version>
187+
<version>${folialib.version}</version>
174188
<scope>compile</scope>
175189
</dependency>
190+
<dependency>
191+
<groupId>de.tr7zw</groupId>
192+
<artifactId>item-nbt-api</artifactId>
193+
<version>${item-nbt-api.version}</version>
194+
</dependency>
176195
<dependency>
177196
<groupId>com.github.oraxen</groupId>
178197
<artifactId>oraxen</artifactId>

src/fr/maxlego08/menu/MenuItemStack.java

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
import fr.maxlego08.menu.save.Config;
66
import fr.maxlego08.menu.zcore.logger.Logger;
77
import fr.maxlego08.menu.zcore.utils.Banner;
8-
import fr.maxlego08.menu.zcore.utils.ElapsedTime;
98
import fr.maxlego08.menu.zcore.utils.Firework;
109
import fr.maxlego08.menu.zcore.utils.LeatherArmor;
1110
import fr.maxlego08.menu.zcore.utils.Potion;
1211
import fr.maxlego08.menu.zcore.utils.ZUtils;
12+
import fr.maxlego08.menu.zcore.utils.attribute.AttributeApplier;
13+
import fr.maxlego08.menu.api.attribute.IAttribute;
1314
import fr.maxlego08.menu.zcore.utils.meta.Meta;
1415
import fr.maxlego08.menu.zcore.utils.nms.NMSUtils;
1516
import fr.maxlego08.menu.zcore.utils.nms.NmsVersion;
@@ -23,12 +24,7 @@
2324
import org.bukkit.inventory.meta.SkullMeta;
2425

2526
import javax.annotation.Nullable;
26-
import java.util.ArrayList;
27-
import java.util.HashMap;
28-
import java.util.List;
29-
import java.util.Map;
30-
import java.util.Objects;
31-
import java.util.Optional;
27+
import java.util.*;
3228

3329
public class MenuItemStack extends ZUtils {
3430

@@ -47,6 +43,7 @@ public class MenuItemStack extends ZUtils {
4743
private boolean isGlowing;
4844
private String modelID;
4945
private Map<Enchantment, Integer> enchantments = new HashMap<>();
46+
private List<IAttribute> attributes = new ArrayList<>();
5047
private Banner banner;
5148
private Firework firework;
5249
private LeatherArmor leatherArmor;
@@ -115,11 +112,14 @@ public InventoryManager getInventoryManager() {
115112
return inventoryManager;
116113
}
117114

118-
@SuppressWarnings("deprecation")
119115
public ItemStack build(Player player) {
116+
return build(player, true);
117+
}
118+
119+
public ItemStack build(Player player, boolean useCache) {
120120

121121
// If we don’t need PlaceHolderApi, then we use the cache
122-
if (!this.needPlaceholderAPI && this.cacheItemStack != null && Config.enableCacheItemStack) {
122+
if (!this.needPlaceholderAPI && this.cacheItemStack != null && Config.enableCacheItemStack && useCache) {
123123
return this.cacheItemStack;
124124
}
125125

@@ -242,10 +242,13 @@ public ItemStack build(Player player) {
242242
}
243243
});
244244

245-
this.flags.forEach(itemMeta::addItemFlags);
245+
this.flags.forEach(itemMeta::addItemFlags);
246246

247247
itemStack.setItemMeta(itemMeta);
248248

249+
AttributeApplier attributeApplier = new AttributeApplier(attributes);
250+
attributeApplier.apply(itemStack);
251+
249252
if (!needPlaceholderAPI && Config.enableCacheItemStack) this.cacheItemStack = itemStack;
250253
return itemStack;
251254
}
@@ -431,6 +434,20 @@ public void setEnchantments(Map<Enchantment, Integer> enchantments) {
431434
this.enchantments = enchantments;
432435
}
433436

437+
/**
438+
* @return the attributes
439+
*/
440+
public List<IAttribute> getAttributes() {
441+
return attributes;
442+
}
443+
444+
/**
445+
* @param attributes the attributes to set.
446+
*/
447+
public void setAttributes(List<IAttribute> attributes) {
448+
this.attributes = attributes;
449+
}
450+
434451
/**
435452
* @return the banner
436453
*/

src/fr/maxlego08/menu/ZInventoryManager.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@
1111
import fr.maxlego08.menu.api.loader.MaterialLoader;
1212
import fr.maxlego08.menu.api.utils.MetaUpdater;
1313
import fr.maxlego08.menu.button.buttons.ZNoneButton;
14-
import fr.maxlego08.menu.button.loader.BackLoader;
15-
import fr.maxlego08.menu.button.loader.HomeLoader;
16-
import fr.maxlego08.menu.button.loader.MainMenuLoader;
17-
import fr.maxlego08.menu.button.loader.NextLoader;
18-
import fr.maxlego08.menu.button.loader.NoneLoader;
19-
import fr.maxlego08.menu.button.loader.PreviousLoader;
14+
import fr.maxlego08.menu.button.loader.*;
2015
import fr.maxlego08.menu.exceptions.InventoryException;
2116
import fr.maxlego08.menu.exceptions.InventoryFileNotFound;
2217
import fr.maxlego08.menu.api.utils.OpenWithItem;
@@ -281,6 +276,7 @@ public void loadButtons() {
281276
buttonManager.register(new NextLoader(this.plugin, this));
282277
buttonManager.register(new PreviousLoader(this.plugin, this));
283278
buttonManager.register(new MainMenuLoader(this.plugin, this));
279+
buttonManager.register(new JumpLoader(this.plugin, this));
284280

285281
// Register ItemStackSimilar
286282
registerItemStackVerification(new FullSimilar());

0 commit comments

Comments
 (0)