mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-09-26 21:52:57 +02:00
parent
4a71af39af
commit
e672dc5e22
@ -30,8 +30,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import static com.Acrobot.Breeze.Utils.BlockUtil.isChest;
|
import static com.Acrobot.Breeze.Utils.BlockUtil.isChest;
|
||||||
import static com.Acrobot.Breeze.Utils.BlockUtil.isSign;
|
import static com.Acrobot.Breeze.Utils.BlockUtil.isSign;
|
||||||
import static com.Acrobot.ChestShop.Events.TransactionEvent.TransactionType;
|
import static com.Acrobot.ChestShop.Events.TransactionEvent.TransactionType;
|
||||||
@ -117,19 +115,25 @@ public class PlayerInteract implements Listener {
|
|||||||
if (account == null)
|
if (account == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
OfflinePlayer owner = account.getUuid().version() != 4 // it seems to forget the username when getting by the offline UUID
|
boolean adminShop = ChestShopSign.isAdminShop(sign);
|
||||||
? Bukkit.getOfflinePlayer(account.getName()) // so we get the OfflinePlayer directly by the name in this case
|
|
||||||
|
// It seems to forget the username when getting by the offline UUID
|
||||||
|
// so we get the OfflinePlayer directly by the name in this case.
|
||||||
|
// We're also getting the OfflinePlayer of the admin shop by its
|
||||||
|
// name, because it will be also sometimes forgotten.
|
||||||
|
OfflinePlayer owner = account.getUuid().version() != 4 || adminShop
|
||||||
|
? Bukkit.getOfflinePlayer(account.getName())
|
||||||
: Bukkit.getOfflinePlayer(account.getUuid());
|
: Bukkit.getOfflinePlayer(account.getUuid());
|
||||||
|
|
||||||
// check if player exists in economy
|
// check if player exists in economy
|
||||||
if(!ChestShopSign.isAdminShop(sign) && (owner == null || owner.getName() == null || !VaultListener.getProvider().hasAccount(owner)))
|
if(!adminShop && (owner == null || owner.getName() == null || !VaultListener.getProvider().hasAccount(owner)))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
|
Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
|
||||||
double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));
|
double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));
|
||||||
|
|
||||||
Chest chest = uBlock.findConnectedChest(sign);
|
Chest chest = uBlock.findConnectedChest(sign);
|
||||||
Inventory ownerInventory = (ChestShopSign.isAdminShop(sign) ? new AdminInventory() : chest != null ? chest.getInventory() : null);
|
Inventory ownerInventory = (adminShop ? new AdminInventory() : chest != null ? chest.getInventory() : null);
|
||||||
|
|
||||||
ItemStack item = MaterialUtil.getItem(material);
|
ItemStack item = MaterialUtil.getItem(material);
|
||||||
if (item == null || !NumberUtil.isInteger(quantity)) {
|
if (item == null || !NumberUtil.isInteger(quantity)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user