Skip to content

Commit

Permalink
1.0.9: fixed webstore module
Browse files Browse the repository at this point in the history
  • Loading branch information
benfiratkaya committed May 1, 2024
1 parent 523466a commit da69b00
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ public static int getDurability(ItemStack item, int maxDurability) {
ItemMeta meta = result.getItemMeta();
meta.setLore(lore);
meta.setDisplayName(name);
if (XMaterial.supports(14) && modelId > 0)
if (XMaterial.supports(14) && modelId > 0) {
meta.setCustomModelData(modelId);
}
result.setItemMeta(meta);
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import net.leaderos.plugin.helpers.ChatUtil;
import net.leaderos.plugin.helpers.MDChat.MDChatAPI;
import net.leaderos.plugin.modules.cache.model.User;
import net.leaderos.shared.Shared;
import net.leaderos.shared.error.Error;
import net.leaderos.shared.helpers.DebugAPI;
import net.leaderos.shared.helpers.RequestUtil;
import net.leaderos.shared.model.Response;
import net.leaderos.shared.model.request.GetRequest;
Expand Down Expand Up @@ -105,7 +107,9 @@ public static List<Category> getCategories(String username) {
response.getJSONArray("categories").forEach(jsonObj -> {
categories.add(new Category((JSONObject) jsonObj));
});
} catch (Exception ignore) {}
} catch (Exception e) {
Shared.getDebugAPI().send(e.getMessage(), true);
}

return categories;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

/**
* Categories of web-store
Expand Down Expand Up @@ -114,9 +115,9 @@ public Category(@NotNull JSONObject category) {
if (material == null || !material.isSupported())
this.material = XMaterial.matchXMaterial(Bukkit.getInstance().getModulesFile().getWebStore().getGui().getCategoryDefaultMaterial()).orElse(XMaterial.CHEST);

String modelId = category.getString("minecraftItemModelID");
if (modelId != null && !modelId.isEmpty())
this.modelId = Integer.parseInt(modelId);
Optional.ofNullable(category.optString("minecraftItemModelID", null))
.filter(id -> !id.isEmpty() && !id.equals("0"))
.ifPresent(modelId -> this.modelId = Integer.parseInt(modelId));

// products
JSONArray products = category.getJSONArray("products");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ public Product(@NotNull JSONObject product) {
if (material == null || !material.isSupported())
this.material = XMaterial.matchXMaterial(Bukkit.getInstance().getModulesFile().getWebStore().getGui().getProductDefaultMaterial()).orElse(XMaterial.DIAMOND);

String modelId = product.getString("minecraftItemModelID");
if (modelId != null && !modelId.isEmpty())
this.modelId = Integer.parseInt(modelId);
Optional.ofNullable(product.optString("minecraftItemModelID", null))
.filter(id -> !id.isEmpty() && !id.equals("0"))
.ifPresent(modelId -> this.modelId = Integer.parseInt(modelId));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<shared.version>1.0.8</shared.version>
<shared.version>1.0.9</shared.version>
</properties>

<!-- Dependencies -->
Expand Down
4 changes: 2 additions & 2 deletions velocity/src/main/java/net/leaderos/velocity/Velocity.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@Plugin(
id = "leaderos",
name = "LeaderOS",
version = "1.0.8",
version = "1.0.9",
url = "https://leaderos.net",
description = "LeaderOS Plugin for Velocity",
authors = {"leaderos"}
Expand Down Expand Up @@ -209,7 +209,7 @@ public void setupFiles() {

public void checkUpdate() {
Velocity.getInstance().getServer().getScheduler().buildTask(Velocity.getInstance(), () -> {
PluginUpdater updater = new PluginUpdater("1.0.8");
PluginUpdater updater = new PluginUpdater("1.0.9");
try {
if (updater.checkForUpdates()) {
Component msg = ChatUtil.replacePlaceholders(
Expand Down

0 comments on commit da69b00

Please sign in to comment.