Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow selling items to an shop. Checked full inventories. #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Zartec
Copy link

@Zartec Zartec commented May 15, 2016

Allows players to create shops on which items can be sold and bought.
Also shops which only sells or only buys are possible.

Also the inventories of the chest and the player are checked for free space, because sponge inserts the items to the armor slots if there is no more space.

Left click sells items if you are not the owner and you don`t have the destroy permission

The command is changed to:
[] -> required
<> -> optional
/spongychest setshop [sellprice] <[buyprice]>
/spongychest setshop <-s sellprice> <-b buyprice>
/spongychest setshop <--sell-price=sellprice> <--buy-price=buyprice>

@hsyyid
Copy link
Owner

hsyyid commented May 15, 2016

Nice work, I'll review this, test it, and merge 👍

public static final Key<Value<Boolean>> IS_SPONGY_CHEST = KeyFactory.makeSingleKey(Boolean.class, Value.class, DataQuery.of("IsSpongyChest"));
public static final Key<Value<UUID>> UUID_CHEST = KeyFactory.makeSingleKey(UUID.class, Value.class, DataQuery.of("UUIDChest"));
public static final Key<Value<ItemStackSnapshot>> ITEM_CHEST = KeyFactory.makeSingleKey(ItemStackSnapshot.class, Value.class, DataQuery.of("ItemChest"));
public static final Key<Value<Double>> PRICE_CHEST = KeyFactory.makeSingleKey(Double.class, Value.class, DataQuery.of("PriceChest"));
public static final Key<ListValue<Double>> PRICES_CHEST = KeyFactory.makeListKey(Double.class, DataQuery.of("PricesChest"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will break all previous SpongyChest shops.

@hsyyid
Copy link
Owner

hsyyid commented May 15, 2016

@Zartec Looking over this it seems like you made it so all shops are both buy and sell shops. What if users want to make a buy shop, or a sell shop, but not both?

@Zartec
Copy link
Author

Zartec commented May 15, 2016

This is possible over:
/spongychest setshop 100 -> sell shop
/spongychest -s 100 -> sell shop
/spongychest -sell-shop=100 -> sell shop
/spongychest -b 100 -> buy shop
/spongychest -buy-shop=100 -> buy shop

If the sell price is 0 the shop is not selling anything. Same for the buy price.

@Zartec
Copy link
Author

Zartec commented May 15, 2016

Reverted the dataquery key to the previous PriceChest for selling shops and added converter to the datamanipulator

@Zartec Zartec force-pushed the feature/AllowSelling branch from 70250e7 to 52ed976 Compare May 18, 2016 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants