Skip to content

Commit

Permalink
Fixed bug where mini shop prices were not shown for potions or monster
Browse files Browse the repository at this point in the history
eggs.
  • Loading branch information
tastybento committed Mar 9, 2016
1 parent a57b07a commit f9200f0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,5 @@
<url>http://maven.sk89q.com/repo/</url>
</repository>
</repositories>
<version>3.0.0</version>
<version>3.0.0.1</version>
</project>
47 changes: 24 additions & 23 deletions src/com/wasteofplastic/askyblock/panels/MiniShopItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,7 @@ public MiniShopItem(Material material, String extra, int slot, String descriptio
quantity = 1;
}
item.setAmount(quantity);
// Set the description and price
ItemMeta meta = item.getItemMeta();
// Split up the description
List<String> desc = new ArrayList<String>(Arrays.asList(description.split("\\|")));
meta.setDisplayName(desc.get(0));
ArrayList<String> buyAndSell = new ArrayList<String>();
if (desc.size() > 1) {
desc.remove(0);// Remove the name
buyAndSell.addAll(desc); // Add the rest to the description
}
// Create prices for buying and selling
if (price > 0D) {
buyAndSell.add(ASkyBlock.getPlugin().myLocale().minishopBuy + " " + quantity + " @ " + VaultHelper.econ.format(price));
}
if (sellPrice > 0D) {
buyAndSell.add(ASkyBlock.getPlugin().myLocale().minishopSell + " " + quantity + " @ " + VaultHelper.econ.format(sellPrice));
}
if (price < 0D && sellPrice < 0D) {
buyAndSell.add(ASkyBlock.getPlugin().myLocale().minishopOutOfStock);
}
meta.setLore(buyAndSell);
item.setItemMeta(meta);
// Deal with extras
// Deal with extras
if (!extra.isEmpty()) {
// plugin.getLogger().info("DEBUG: extra is not empty");
// If it not a potion, then the extras should just be durability
Expand Down Expand Up @@ -191,6 +169,29 @@ public MiniShopItem(Material material, String extra, int slot, String descriptio
}
}
}
// Set the description and price
ItemMeta meta = item.getItemMeta();
// Split up the description
List<String> desc = new ArrayList<String>(Arrays.asList(description.split("\\|")));
meta.setDisplayName(desc.get(0));
ArrayList<String> buyAndSell = new ArrayList<String>();
if (desc.size() > 1) {
desc.remove(0);// Remove the name
buyAndSell.addAll(desc); // Add the rest to the description
}
// Create prices for buying and selling
if (price > 0D) {
buyAndSell.add(ASkyBlock.getPlugin().myLocale().minishopBuy + " " + quantity + " @ " + VaultHelper.econ.format(price));
}
if (sellPrice > 0D) {
buyAndSell.add(ASkyBlock.getPlugin().myLocale().minishopSell + " " + quantity + " @ " + VaultHelper.econ.format(sellPrice));
}
if (price < 0D && sellPrice < 0D) {
buyAndSell.add(ASkyBlock.getPlugin().myLocale().minishopOutOfStock);
}
meta.setLore(buyAndSell);
item.setItemMeta(meta);

} catch (Exception ex) {
ASkyBlock.getPlugin().getLogger().severe("Problem parsing shop item from minishop.yml so skipping it: " + material);
ASkyBlock.getPlugin().getLogger().severe("Error is : " + ex.getMessage());
Expand Down

0 comments on commit f9200f0

Please sign in to comment.