Package com.vk2gpz.autosell
Interface ISellHandler
public interface ISellHandler
This interface defines the methods for handling shops in the AutoSell plugin.
It includes methods for initializing shops, checking if a player can sell,
and selling items or inventory.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a shop.boolean
autoSell
(org.bukkit.entity.Player player, List<org.bukkit.inventory.ItemStack> itemStacks, org.bukkit.block.Block block) Execute automatic sell for the player.boolean
canSell
(org.bukkit.entity.Player player) Checks if the player can sell.void
Clears the shops.getHighestPriceShopFor
(org.bukkit.inventory.ItemStack itemStack) Finds a shop which sell the specified item at the highest price.Returns a map containing the itemstack and corresponding shop which sells the item at the highest price.static ISellHandler
Gets the instance of the ISellHandler.int
Gets the next shop priority.getPermShop
(org.bukkit.entity.Player player) Gets the shop for the player with the permission.Gets the shop by name.getShop
(org.bukkit.entity.Player player) Gets the shop for the player.getShop
(org.bukkit.entity.Player palyer, org.bukkit.block.Block block) Gets the shop for the player at the specified block.getShops()
Gets the shops.static double
getTotalMultiplier
(org.bukkit.entity.Player player, Shop shop) Calculate the total multiplier for the player and shop.static double
getTotalMultiplier
(org.bukkit.entity.Player player, Set<Shop> shops) Calculate the total multiplier for the player and shop.void
Initializes the shops.boolean
Checks if the shop name is valid.boolean
removeShop
(Shop shop) Removes a shop.sellInventory
(org.bukkit.entity.Player player, @NotNull Shop shop) Execute sell for the player from its inventorysellItems
(org.bukkit.entity.Player player, List<org.bukkit.inventory.ItemStack> itemStacks, @NotNull Shop shop) Execute sell for the player with the specified items
-
Method Details
-
initShops
void initShops()Initializes the shops. -
getShops
Gets the shops.- Returns:
- The shops.
-
canSell
boolean canSell(org.bukkit.entity.Player player) Checks if the player can sell.- Parameters:
player
- The player to check.- Returns:
- true if the player can sell, false otherwise.
-
clearShops
void clearShops()Clears the shops. -
getShop
Gets the shop for the player.- Parameters:
player
- The player to get the shop for.- Returns:
- The shop for the player.
-
getShop
Gets the shop by name.- Parameters:
shopName
- The name of the shop to get.- Returns:
- The shop with the specified name.
-
addShop
Adds a shop.- Parameters:
shop
- The shop to add.
-
removeShop
Removes a shop.- Parameters:
shop
- The shop to remove.- Returns:
- true if the shop was removed, false otherwise.
-
getNextShopPriority
int getNextShopPriority()Gets the next shop priority.- Returns:
- The next shop priority.
-
isShop
Checks if the shop name is valid.- Parameters:
shopName
- The name of the shop to check.- Returns:
- true if the shop name is valid, false otherwise.
-
getShop
Gets the shop for the player at the specified block.- Parameters:
palyer
- The player to get the shop for.block
- The block to locate the shop.- Returns:
- The shop for the player at the specified block.
-
getPermShop
Gets the shop for the player with the permission.- Parameters:
player
- The player to get the shop for.- Returns:
- The shop for the player with the permission.
-
autoSell
boolean autoSell(org.bukkit.entity.Player player, List<org.bukkit.inventory.ItemStack> itemStacks, org.bukkit.block.Block block) Execute automatic sell for the player.- Parameters:
player
- The player to execute the automatic sell for.itemStacks
- The list of item stacks to sell.block
- The block to sell at.- Returns:
- true if the automatic sell was executed, false otherwise.
-
sellItems
SellResponse sellItems(org.bukkit.entity.Player player, List<org.bukkit.inventory.ItemStack> itemStacks, @NotNull @NotNull Shop shop) Execute sell for the player with the specified items- Parameters:
player
- The player to execute the automatic sell for.itemStacks
- The list of item stacks to sell.shop
- The shop to sell at.- Returns:
- the result of sale.
-
sellInventory
Execute sell for the player from its inventory- Parameters:
player
- The player to execute the sell for.shop
- The shop to sell at.- Returns:
- the result of sale.
-
getHighestPriceShopFor
Finds a shop which sell the specified item at the highest price.- Parameters:
itemStack
- The item stack to find the shop for.- Returns:
- a shop which sells the specifieditem at the highest price.
-
getHighestPriceShops
Returns a map containing the itemstack and corresponding shop which sells the item at the highest price.- Returns:
- a map of item stacks and their corresponding shops which sells the specified item at the highest price.
-
getTotalMultiplier
Calculate the total multiplier for the player and shop.- Parameters:
player
- The player to calculate the multiplier for.shop
- The shop to calculate the multiplier for.- Returns:
- The total multiplier for the player and shop.
-
getTotalMultiplier
Calculate the total multiplier for the player and shop.- Parameters:
player
- The player to calculate the multiplier for.shops
- The shops to calculate the multiplier for.- Returns:
- The total multiplier for the player and shop.
-
getInstance
Gets the instance of the ISellHandler.- Returns:
- Gets the instance of the ISellHandler.
-