Skip to content

Commit

Permalink
version 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
RoboMWM committed Jun 15, 2019
1 parent 027628d commit 776bf27
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.robomwm</groupId>
<artifactId>PrettySimpleShop</artifactId>
<version>1.4.2</version>
<version>1.5</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/robomwm/prettysimpleshop/shop/ShopAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ private boolean setName(Container actualContainer, String name)

/**
* Removes items from the shop - performs the transaction
* @param item
* @param requestedItem
* @param price
* @return amount sold
*/
public ItemStack performTransaction(Container container, ItemStack item, double price)
public ItemStack performTransaction(Container container, ItemStack requestedItem, double price)
{
//Verify price
PrettySimpleShop.debug(Double.toString(getPrice(container)) + " " + price);
Expand All @@ -247,14 +247,15 @@ public ItemStack performTransaction(Container container, ItemStack item, double
PrettySimpleShop.debug("price validated");
//Verify item type
ItemStack shopItem = getItemStack(container);
if (!isSimilar(item, shopItem))
if (!isSimilar(requestedItem, shopItem))
return null;
PrettySimpleShop.debug(shopItem.toString() + item.toString());
PrettySimpleShop.debug(shopItem.toString() + requestedItem.toString());
PrettySimpleShop.debug("item validated");
//Verify stock - cap to max stock remaining
//We use and return the shopItem since this is already a cloned ItemStack (instead of also cloning item)
if (item.getAmount() < shopItem.getAmount())
shopItem.setAmount(item.getAmount());
//(This is why we're modifying `shopItem` to the request amount, unless it is larger.
if (requestedItem.getAmount() < shopItem.getAmount())
shopItem.setAmount(requestedItem.getAmount());

//Update statistics/revenue first, otherwise will overwrite inventory changes
String[] name = getName(container).split(" ");
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: ${project.version}
website: http://robomwm.com
author: RoboMWM
main: com.robomwm.prettysimpleshop.PrettySimpleShop
api-version: 1.13
api-version: '1.14'
softdepend:
- Multiverse-Core
- Essentials
Expand Down

0 comments on commit 776bf27

Please sign in to comment.