mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-26 04:12:22 +00:00
Players should be able to open their sell-only shops
Also, they should be able to open shops even when they don't have permission to buy something
This commit is contained in:
parent
1666051eb8
commit
f155b67f4c
@ -4,7 +4,6 @@ import com.griefcraft.lwc.LWC;
|
|||||||
import com.griefcraft.model.Protection;
|
import com.griefcraft.model.Protection;
|
||||||
import de.epiceric.shopchest.ShopChest;
|
import de.epiceric.shopchest.ShopChest;
|
||||||
import de.epiceric.shopchest.config.Config;
|
import de.epiceric.shopchest.config.Config;
|
||||||
import de.epiceric.shopchest.utils.Utils;
|
|
||||||
import de.epiceric.shopchest.shop.Shop;
|
import de.epiceric.shopchest.shop.Shop;
|
||||||
import de.epiceric.shopchest.shop.Shop.ShopType;
|
import de.epiceric.shopchest.shop.Shop.ShopType;
|
||||||
import de.epiceric.shopchest.sql.Database;
|
import de.epiceric.shopchest.sql.Database;
|
||||||
@ -155,21 +154,18 @@ public class InteractShop implements Listener {
|
|||||||
e.setCancelled(false);
|
e.setCancelled(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (shop.getShopType() == ShopType.ADMIN || !shop.getVendor().getUniqueId().equals(p.getUniqueId())) {
|
||||||
if (shop.getBuyPrice() > 0) {
|
if (shop.getBuyPrice() > 0) {
|
||||||
if (perm.has(p, "shopchest.buy")) {
|
if (perm.has(p, "shopchest.buy")) {
|
||||||
if (shop.getShopType() == ShopType.ADMIN) {
|
if (shop.getShopType() == ShopType.ADMIN) {
|
||||||
buy(p, shop);
|
buy(p, shop);
|
||||||
} else {
|
} else {
|
||||||
if (!shop.getVendor().getUniqueId().equals(p.getUniqueId())) {
|
|
||||||
Chest c = (Chest) b.getState();
|
Chest c = (Chest) b.getState();
|
||||||
if (Utils.getAmount(c.getInventory(), shop.getProduct()) >= shop.getProduct().getAmount()) {
|
if (Utils.getAmount(c.getInventory(), shop.getProduct()) >= shop.getProduct().getAmount()) {
|
||||||
buy(p, shop);
|
buy(p, shop);
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Config.out_of_stock());
|
p.sendMessage(Config.out_of_stock());
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
e.setCancelled(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Config.noPermission_buy());
|
p.sendMessage(Config.noPermission_buy());
|
||||||
@ -177,8 +173,10 @@ public class InteractShop implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
p.sendMessage(Config.buying_disabled());
|
p.sendMessage(Config.buying_disabled());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
e.setCancelled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -190,24 +188,23 @@ public class InteractShop implements Listener {
|
|||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Shop shop = ShopUtils.getShop(b.getLocation());
|
Shop shop = ShopUtils.getShop(b.getLocation());
|
||||||
|
|
||||||
|
if ((shop.getShopType() == ShopType.ADMIN) || (!shop.getVendor().getUniqueId().equals(p.getUniqueId()))) {
|
||||||
if (shop.getSellPrice() > 0) {
|
if (shop.getSellPrice() > 0) {
|
||||||
if (perm.has(p, "shopchest.sell")) {
|
if (perm.has(p, "shopchest.sell")) {
|
||||||
if ((shop.getShopType() == ShopType.ADMIN) || (!shop.getVendor().getUniqueId().equals(p.getUniqueId()))) {
|
|
||||||
if (Utils.getAmount(p.getInventory(), shop.getProduct()) >= shop.getProduct().getAmount()) {
|
if (Utils.getAmount(p.getInventory(), shop.getProduct()) >= shop.getProduct().getAmount()) {
|
||||||
sell(p, shop);
|
sell(p, shop);
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Config.not_enough_items());
|
p.sendMessage(Config.not_enough_items());
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
e.setCancelled(false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Config.noPermission_sell());
|
p.sendMessage(Config.noPermission_sell());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Config.selling_disabled());
|
p.sendMessage(Config.selling_disabled());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
e.setCancelled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user