Skip to content

Commit

Permalink
1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BenceX100 committed May 1, 2024
1 parent 349d1d2 commit ef42232
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 29 deletions.
23 changes: 9 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.artillexstudios</groupId>
<artifactId>AxRankMenu</artifactId>
<version>1.3.1</version>
<version>1.4.0</version>
<packaging>jar</packaging>

<name>AxRankMenu</name>
Expand All @@ -30,7 +30,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -52,7 +52,7 @@
<shadedPattern>com.artillexstudios.axrankmenu.libs.gui</shadedPattern>
</relocation>
<relocation>
<pattern>net.kyori.adventure</pattern>
<pattern>net.kyori</pattern>
<shadedPattern>com.artillexstudios.axrankmenu.libs.kyori</shadedPattern>
</relocation>
</relocations>
Expand Down Expand Up @@ -116,37 +116,32 @@
<dependency>
<groupId>com.artillexstudios.axapi</groupId>
<artifactId>axapi</artifactId>
<version>1.4.101</version>
<version>1.4.186</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dev.dejvokep</groupId>
<artifactId>boosted-yaml</artifactId>
<version>1.3</version>
<scope>provided</scope>
<classifier>all</classifier>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.0</version>
<version>4.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.14.0</version>
<version>4.16.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-legacy</artifactId>
<version>4.14.0</version>
<version>4.16.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.14.0</version>
<version>4.16.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public ConfigMigrator() {
for (String route : CONFIG.getSection("menu").getRoutesAsStrings(true)) {

if (!CONFIG.getStringList("menu." + route).isEmpty()) {
System.out.println(CONFIG.getStringList("menu." + route));
RANKS.set(route, CONFIG.getStringList("menu." + route));
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public Config getFile() {
}

protected ItemStack buildItem(@NotNull String key) {
return ItemBuilderUtil.newBuilder(file.getSection(key)).get();
return ItemBuilderUtil.newBuilder(file.getSection(key), player).get();
}

protected ItemStack buildItem(@NotNull String key, Map<String, String> replacements) {
return ItemBuilderUtil.newBuilder(file.getSection(key), replacements).get();
return ItemBuilderUtil.newBuilder(file.getSection(key), replacements, player).get();
}

protected void createItem(@NotNull String route) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import static com.artillexstudios.axrankmenu.AxRankMenu.CONFIG;
import static com.artillexstudios.axrankmenu.AxRankMenu.RANKS;

public class RankGui extends GuiFrame {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/artillexstudios/axrankmenu/rank/Rank.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.block.implementation.Section;
import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.settings.general.GeneralSettings;
import com.artillexstudios.axapi.scheduler.Scheduler;
import com.artillexstudios.axapi.utils.ItemBuilder;
import com.artillexstudios.axapi.utils.NumberUtils;
import com.artillexstudios.axapi.utils.StringUtils;
import com.artillexstudios.axrankmenu.hooks.HookManager;
Expand Down Expand Up @@ -85,7 +84,7 @@ public GuiItem getItem() {
}
}

final ItemStack it = ItemBuilderUtil.newBuilder(section.getSection("item")).setLore(lore).get();
final ItemStack it = ItemBuilderUtil.newBuilder(section.getSection("item"), requester).setLore(lore).get();

return new GuiItem(it, event -> {
final String cGroupName = luckPerms.getUserManager().getUser(requester.getUniqueId()).getPrimaryGroup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.block.implementation.Section;
import com.artillexstudios.axapi.utils.ClassUtils;
import com.artillexstudios.axapi.utils.ItemBuilder;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
Expand All @@ -12,25 +13,24 @@
public class ItemBuilderUtil {

@NotNull
@Contract("_ -> new")
public static ItemBuilder newBuilder(@NotNull Section section) {
return newBuilder(section, Map.of());
public static ItemBuilder newBuilder(@NotNull Section section, Player player) {
return newBuilder(section, Map.of(), player);
}

@NotNull
public static ItemBuilder newBuilder(@NotNull Section section, Map<String, String> replacements) {
public static ItemBuilder newBuilder(@NotNull Section section, Map<String, String> replacements, Player player) {
final ItemBuilder builder = new ItemBuilder(section);

section.getOptionalString("name").ifPresent((name) -> {
if (ClassUtils.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
name = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(null, name);
if (ClassUtils.INSTANCE.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
name = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, name);
}
builder.setName(name, replacements);
});

section.getOptionalStringList("lore").ifPresent((lore) -> {
if (ClassUtils.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
lore = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(null, lore);
if (ClassUtils.INSTANCE.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
lore = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, lore);
}
builder.setLore(lore, replacements);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static String parsePlaceholders(@NotNull Player player, @NotNull String s
final User user = lpApi.getUserManager().getUser(player.getUniqueId());
final Group playerRank = lpApi.getGroupManager().getGroup(user.getPrimaryGroup());

if (ClassUtils.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
if (ClassUtils.INSTANCE.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
string = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, string);
}

Expand Down

0 comments on commit ef42232

Please sign in to comment.