Skip to content
This repository was archived by the owner on Aug 24, 2018. It is now read-only.

Commit

Permalink
Added materialsgit status -s!
Browse files Browse the repository at this point in the history
  • Loading branch information
casnix committed Jun 4, 2016
1 parent f8eeb15 commit 7f9cb6a
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@
<scope>provided</scope>
</dependency>
</dependencies>
<version>0.2.0</version>
<version>0.2.1</version>
</project>
27 changes: 20 additions & 7 deletions src/main/java/io/github/casnix/mcdropshop/Holograms.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ public void loadShop(JSONObject shopObj, JSONObject jsonObj){
String amount = (String) itemData.get("amount");
String price = (String) itemData.get("price");
String buyOrSell = (String) itemData.get("type");

if(itemData.get("durability") == null)
itemData.put("durability", "0");
short damage = (short) Integer.parseInt((String)itemData.get("durability"));

TextLine scrollLeft = hologram.appendTextLine(ConfigSys.variables.get("$(streamLineColor)")
+ ConfigSys.variables.get("$(streamLineTextLeft)")
Expand All @@ -166,7 +168,7 @@ public void loadShop(JSONObject shopObj, JSONObject jsonObj){
+ ConfigSys.variables.get("$(streamLineTextRight)"));


ItemLine itemLine1 = hologram.appendItemLine(new ItemStack(Material.getMaterial(iTD[0])));
ItemLine itemLine1 = hologram.appendItemLine(new ItemStack(Material.getMaterial(iTD[0]), 1, damage));

TextLine textLine4 = hologram.appendTextLine(ConfigSys.variables.get("$(textColor)")
+ "[" + buyOrSell + "]");
Expand Down Expand Up @@ -197,12 +199,15 @@ public void onTouch(Player player){
String amount = (String) itemData.get("amount");
String price = (String) itemData.get("price");
String buyOrSell = (String) itemData.get("type");
if(itemData.get("durability") == null)
itemData.put("durability", "0");
short damage = (short) Integer.parseInt((String)itemData.get("durability"));

holoClass.textLine3.setText(ConfigSys.variables.get("$(textColor)")
+ "(" + iIdx + ") " + amount + "x - $" + price);
holoClass.textLine4.setText(ConfigSys.variables.get("$(textColor)")
+ "[" + buyOrSell + "]");
holoClass.itemLine1.setItemStack(new ItemStack(Material.getMaterial(iTD[0])));
holoClass.itemLine1.setItemStack(new ItemStack(Material.getMaterial(iTD[0]), 1, damage));
}
});

Expand All @@ -224,12 +229,15 @@ public void onTouch(Player player){
String amount = (String) itemData.get("amount");
String price = (String) itemData.get("price");
String buyOrSell = (String) itemData.get("type");
if(itemData.get("durability") == null)
itemData.put("durability", "0");
short damage = (short) Integer.parseInt((String)itemData.get("durability"));

holoClass.textLine3.setText(ConfigSys.variables.get("$(textColor)")
+ "(" + iIdx + ") " + amount + "x - $" + price);
holoClass.textLine4.setText(ConfigSys.variables.get("$(textColor)")
+ "[" + buyOrSell + "]");
holoClass.itemLine1.setItemStack(new ItemStack(Material.getMaterial(iTD[0])));
holoClass.itemLine1.setItemStack(new ItemStack(Material.getMaterial(iTD[0]), 1, damage));
}
});

Expand Down Expand Up @@ -262,6 +270,9 @@ public void onTouch(Player player){
String amount = (String) itemData.get("amount");
String price = (String) itemData.get("price");
String buyOrSell = (String) itemData.get("type");
if(itemData.get("durability") == null)
itemData.put("durability", "0");
short damage = (short) Integer.parseInt((String)itemData.get("durability"));

if(buyOrSell.equals("buy")){
double playerBalance = econ.getBalance(player);
Expand All @@ -280,21 +291,23 @@ public void onTouch(Player player){
econ.withdrawPlayer(player, Double.parseDouble(price));
player.sendMessage("\u00a7a$" + price + " has been taken from your account.");

ItemStack boughtItems = new ItemStack(Material.getMaterial(iTD[0]), Integer.parseInt(amount));
ItemStack boughtItems = new ItemStack(Material.getMaterial(iTD[0]), Integer.parseInt(amount), damage);

player.getInventory().addItem(boughtItems);
}else{
// Player must be holding item in hand
String itemInHand = player.getItemInHand().getType().name();
int amountInHand = player.getItemInHand().getAmount();

if(itemInHand.equals(iTD[0]) && (Integer.parseInt(amount) == amountInHand)){
if(itemInHand.equals(iTD[0])
&& (Integer.parseInt(amount) == amountInHand)
&& player.getItemInHand().getDurability() == damage){
player.getInventory().removeItem(player.getInventory().getItemInHand());
econ.depositPlayer(player, Double.parseDouble(price));

player.sendMessage("\u00a7a$" + price + " has been deposited in your account.");
}else{
player.sendMessage("\u00a7cYou aren't holding " + amount + " of " + iTD[0] + "!");
player.sendMessage("\u00a7cYou aren't holding " + amount + " of " + iTD[0] + ":" + damage +"!");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/casnix/mcdropshop/Versioning.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package io.github.casnix.mcdropshop;

public class Versioning {
private final static String __currentPluginVersion = "0.2.0";
private final static String __currentPluginVersion = "0.2.1";

public static String CurrentVersion(){
String CPV = Versioning.__currentPluginVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,16 +444,17 @@ public final Shops addBuy(String shopName, String cost, Player player){

JSONArray shopItems = (JSONArray) shopObj.get("ShopItems");

shopItems.add(newItem + ":buy");
shopItems.add(newItem + ":buy:"+player.getItemInHand().getDurability());

shopObj.put("ShopItems", shopItems);

JSONObject itemStub = new JSONObject();
itemStub.put("amount", Integer.toString(player.getItemInHand().getAmount()));
itemStub.put("price", cost);
itemStub.put("type", "buy");
itemStub.put("durability", ""+player.getItemInHand().getDurability());

shopObj.put(newItem + ":buy", itemStub);
shopObj.put(newItem + ":buy:"+player.getItemInHand().getDurability(), itemStub);

jsonObj.put(shopName, shopObj);

Expand Down Expand Up @@ -506,16 +507,17 @@ public final Shops addSell(String shopName, String cost, Player player){

JSONArray shopItems = (JSONArray) shopObj.get("ShopItems");

shopItems.add(newItem + ":sell");
shopItems.add(newItem + ":sell:"+player.getItemInHand().getDurability());

shopObj.put("ShopItems", shopItems);

JSONObject itemStub = new JSONObject();
itemStub.put("amount", Integer.toString(player.getItemInHand().getAmount()));
itemStub.put("price", cost);
itemStub.put("type", "sell");
itemStub.put("durability", ""+player.getItemInHand().getDurability());

shopObj.put(newItem + ":sell", itemStub);
shopObj.put(newItem + ":sell:"+player.getItemInHand().getDurability(), itemStub);

jsonObj.put(shopName, shopObj);

Expand Down Expand Up @@ -696,16 +698,17 @@ public final Shops repBuy(String shopName, String cost, String index, Player pla

Bukkit.getLogger().info("Player \"" + player.getDisplayName() + "\" added " + newItem + " to shop " + shopName);

shopItems.add(Integer.parseInt(index), newItem + ":buy");
shopItems.add(Integer.parseInt(index), newItem + ":buy:"+player.getItemInHand().getDurability());

shopObj.put("ShopItems", shopItems);

JSONObject itemStub = new JSONObject();
itemStub.put("amount", Integer.toString(player.getItemInHand().getAmount()));
itemStub.put("price", cost);
itemStub.put("type", "buy");
itemStub.put("durability", ""+player.getItemInHand().getDurability());

shopObj.put(newItem + ":buy", itemStub);
shopObj.put(newItem + ":buy:"+player.getItemInHand().getDurability(), itemStub);

shopObj.put("ShopItems", shopItems);

Expand Down Expand Up @@ -770,16 +773,17 @@ public final Shops repSell(String shopName, String cost, String index, Player pl

Bukkit.getLogger().info("Player \"" + player.getDisplayName() + "\" added " + newItem + " to shop " + shopName);

shopItems.add(Integer.parseInt(index), newItem + ":sell");
shopItems.add(Integer.parseInt(index), newItem + ":sell:"+player.getItemInHand().getDurability());

shopObj.put("ShopItems", shopItems);

JSONObject itemStub = new JSONObject();
itemStub.put("amount", Integer.toString(player.getItemInHand().getAmount()));
itemStub.put("price", cost);
itemStub.put("type", "sell");
itemStub.put("durability", ""+player.getItemInHand().getDurability());

shopObj.put(newItem + ":sell", itemStub);
shopObj.put(newItem + ":sell:"+player.getItemInHand().getDurability(), itemStub);

shopObj.put("ShopItems", shopItems);

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mcDropShop
version: 0.2.0
version: 0.2.1
description: Open source replacement for HoloShop - bukkit interactive holographic shops
author: majikchicken

Expand Down
Binary file modified target/classes/io/github/casnix/mcdropshop/Holograms$1.class
Binary file not shown.
Binary file modified target/classes/io/github/casnix/mcdropshop/Holograms$2.class
Binary file not shown.
Binary file modified target/classes/io/github/casnix/mcdropshop/Holograms$3.class
Binary file not shown.
Binary file modified target/classes/io/github/casnix/mcdropshop/Holograms.class
Binary file not shown.
Binary file modified target/classes/io/github/casnix/mcdropshop/Versioning.class
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion target/classes/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mcDropShop
version: 0.2.0
version: 0.2.1
description: Open source replacement for HoloShop - bukkit interactive holographic shops
author: majikchicken

Expand Down
4 changes: 2 additions & 2 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Generated by Maven
#Fri Jun 03 19:08:34 CDT 2016
version=0.2.0
#Sat Jun 04 01:55:22 CDT 2016
version=0.2.1
groupId=io.github.casnix.mcdropshop
artifactId=mcDropShop
Binary file modified target/mcDropShop-0.2.0.jar
Binary file not shown.
Binary file added target/mcDropShop-0.2.1.jar
Binary file not shown.

0 comments on commit 7f9cb6a

Please sign in to comment.