diff --git a/bukkit/src/main/java/net/leaderos/plugin/helpers/ItemUtil.java b/bukkit/src/main/java/net/leaderos/plugin/helpers/ItemUtil.java index f37e49f38..fd6f176b9 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/helpers/ItemUtil.java +++ b/bukkit/src/main/java/net/leaderos/plugin/helpers/ItemUtil.java @@ -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; } diff --git a/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/helpers/WebStoreHelper.java b/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/helpers/WebStoreHelper.java index b91b4282b..823f96944 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/helpers/WebStoreHelper.java +++ b/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/helpers/WebStoreHelper.java @@ -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; @@ -105,7 +107,9 @@ public static List 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; } diff --git a/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Category.java b/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Category.java index b1d94ee74..8d387c7b1 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Category.java +++ b/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Category.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Optional; /** * Categories of web-store @@ -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"); diff --git a/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Product.java b/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Product.java index a56654757..11dcd400d 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Product.java +++ b/bukkit/src/main/java/net/leaderos/plugin/modules/webstore/model/Product.java @@ -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)); } /** diff --git a/pom.xml b/pom.xml index 18d0304a4..d2d16bdc7 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 8 8 UTF-8 - 1.0.8 + 1.0.9 diff --git a/velocity/src/main/java/net/leaderos/velocity/Velocity.java b/velocity/src/main/java/net/leaderos/velocity/Velocity.java index 1e5f4c7be..b1c5e9d46 100644 --- a/velocity/src/main/java/net/leaderos/velocity/Velocity.java +++ b/velocity/src/main/java/net/leaderos/velocity/Velocity.java @@ -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"} @@ -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(