Skip to content

Commit

Permalink
1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BenceX100 committed Jul 4, 2024
1 parent 19fbaa6 commit 824b46e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.artillexstudios</groupId>
<artifactId>AxVaults</artifactId>
<version>1.8.1</version>
<version>1.9.0</version>
<packaging>jar</packaging>

<name>AxVaults</name>
Expand Down Expand Up @@ -104,7 +104,7 @@
<dependency>
<groupId>com.artillexstudios.axapi</groupId>
<artifactId>axapi</artifactId>
<version>1.4.279</version>
<version>1.4.280</version>
<scope>compile</scope>
<classifier>all</classifier>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.artillexstudios.axvaults.guis;

import com.artillexstudios.axapi.reflection.ClassUtils;
import com.artillexstudios.axapi.utils.ItemBuilder;
import com.artillexstudios.axapi.utils.StringUtils;
import com.artillexstudios.axvaults.utils.SoundUtils;
Expand Down Expand Up @@ -29,8 +30,14 @@ public void open(@NotNull Player player, @NotNull Vault vault) {
public void open(@NotNull Player player, @NotNull Vault vault, int oldPage, int cPage) {
int rows = CONFIG.getInt("vault-selector-rows", 6);
int pageSize = rows * 9 - 9;

String title = MESSAGES.getString("guis.item-picker.title");
if (ClassUtils.INSTANCE.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
title = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, title);
}

final PaginatedGui gui = Gui.paginated()
.title(StringUtils.format(MESSAGES.getString("guis.item-picker.title")))
.title(StringUtils.format(title))
.rows(rows)
.pageSize(pageSize)
.disableAllInteractions()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.artillexstudios.axvaults.guis;

import com.artillexstudios.axapi.reflection.ClassUtils;
import com.artillexstudios.axapi.utils.ItemBuilder;
import com.artillexstudios.axapi.utils.StringUtils;
import com.artillexstudios.axvaults.vaults.Vault;
Expand Down Expand Up @@ -29,8 +30,14 @@ public void open(@NotNull Player player) {
public void open(@NotNull Player player, int page) {
int rows = CONFIG.getInt("vault-selector-rows", 6);
int pageSize = rows * 9 - 9;

String title = MESSAGES.getString("guis.selector.title");
if (ClassUtils.INSTANCE.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
title = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, title);
}

final PaginatedGui gui = Gui.paginated()
.title(StringUtils.format(MESSAGES.getString("guis.selector.title")))
.title(StringUtils.format(title))
.rows(rows)
.pageSize(pageSize)
.disableAllInteractions()
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/com/artillexstudios/axvaults/vaults/Vault.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.artillexstudios.axvaults.vaults;

import com.artillexstudios.axapi.reflection.ClassUtils;
import com.artillexstudios.axapi.utils.StringUtils;
import com.artillexstudios.axvaults.utils.SoundUtils;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -27,7 +28,13 @@ public class Vault {
public Vault(UUID uuid, int num, Material icon) {
this.uuid = uuid;
this.id = num;
this.storage = Bukkit.createInventory(null, VaultManager.getPlayer(uuid).getRows() * 9, StringUtils.formatToString(MESSAGES.getString("guis.vault.title").replace("%num%", "" + num)));

String title = MESSAGES.getString("guis.vault.title").replace("%num%", "" + num);
if (ClassUtils.INSTANCE.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
title = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(Bukkit.getOfflinePlayer(uuid), title);
}

this.storage = Bukkit.createInventory(null, VaultManager.getPlayer(uuid).getRows() * 9, StringUtils.formatToString(title));
this.icon = icon;
VaultManager.getVaults().add(this);
}
Expand Down Expand Up @@ -82,7 +89,12 @@ public void open(@NotNull Player player) {
}

public void reload() {
final Inventory newStorage = Bukkit.createInventory(null, VaultManager.getPlayer(uuid).getRows() * 9, StringUtils.formatToString(MESSAGES.getString("guis.vault.title").replace("%num%", "" + id)));
String title = MESSAGES.getString("guis.vault.title").replace("%num%", "" + id);
if (ClassUtils.INSTANCE.classExists("me.clip.placeholderapi.PlaceholderAPI")) {
title = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(Bukkit.getOfflinePlayer(uuid), title);
}

final Inventory newStorage = Bukkit.createInventory(null, VaultManager.getPlayer(uuid).getRows() * 9, StringUtils.formatToString(title));
final ItemStack[] contents = storage.getContents();

int n = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static VaultPlayer getPlayer(@NotNull UUID uuid) {

public static void removePlayer(@NotNull Player player) {
final VaultPlayer vaultPlayer = players.remove(player.getUniqueId());
if (vaultPlayer == null) return;
vaultPlayer.save();
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axvaults.html

prefix: "&#55ff00&lAxVaults &7» "

# this setting is not reloadable, you have to restart the server
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/messages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# DOCUMENTATION: https://docs.artillex-studios.com/axvaults.html
# ITEM BUILDER: https://docs.artillex-studios.com/item-builder.html

guis:
selector:
title: "&0My Vaults"
Expand All @@ -18,7 +21,7 @@ guis:
glow: false
lore:
- " "
- " &7- &fYou have not unlocked this vault yet!"
- " &7- &fYou have &#FF0000not unlocked &fthis vault yet!"
- " "
- "&#FF0000&l(!) &#FF0000Locked Vault"
item-picker:
Expand Down

0 comments on commit 824b46e

Please sign in to comment.