mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-16 15:46:13 +01:00
Updates to the API
Added interface for a wrapped player and and for a flag
This commit is contained in:
parent
04b47e2bb0
commit
3c6127138f
@ -1,8 +1,10 @@
|
||||
package de.epiceric.shopchest.api;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import de.epiceric.shopchest.api.player.ShopPlayer;
|
||||
|
||||
/**
|
||||
* The plugin's main entry point
|
||||
*
|
||||
@ -18,13 +20,11 @@ public abstract class ShopChest extends JavaPlugin {
|
||||
public abstract ShopManager getShopManager();
|
||||
|
||||
/**
|
||||
* Gets the amount of shops the given player is allowed to have
|
||||
* <p>
|
||||
* If the player has no shop limit {@link Integer#MAX_VALUE} is returned.
|
||||
* Gets the wrapped {@link ShopPlayer} for the given player
|
||||
*
|
||||
* @param player the player
|
||||
* @return the shop limit
|
||||
* @return the wrapped player
|
||||
*/
|
||||
public abstract int getShopLimit(OfflinePlayer player);
|
||||
public abstract ShopPlayer wrapPlayer(Player player);
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package de.epiceric.shopchest.api.flag;
|
||||
|
||||
/**
|
||||
* Represents a flag a player can have
|
||||
*
|
||||
* @since 1.13
|
||||
*/
|
||||
public interface Flag {
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package de.epiceric.shopchest.api.player;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.epiceric.shopchest.api.ShopManager;
|
||||
import de.epiceric.shopchest.api.flag.Flag;
|
||||
import de.epiceric.shopchest.api.shop.Shop;
|
||||
|
||||
/**
|
||||
* A wrapper for a {@link Player} with additional functions
|
||||
*
|
||||
* @since 1.13
|
||||
*/
|
||||
public interface ShopPlayer {
|
||||
|
||||
/**
|
||||
* Gets the wrapped Bukkit player
|
||||
*
|
||||
* @return the wrapped player
|
||||
* @since 1.13
|
||||
*/
|
||||
Player getPlayer();
|
||||
|
||||
/**
|
||||
* Gets this player's flag
|
||||
*
|
||||
* @return the flag or {@code null} if the player does not have one
|
||||
* @since 1.13
|
||||
*/
|
||||
Flag getFlag();
|
||||
|
||||
/**
|
||||
* Sets this player's flag
|
||||
*
|
||||
* @param flag the flag
|
||||
* @since 1.13
|
||||
*/
|
||||
void setFlag(Flag flag);
|
||||
|
||||
/**
|
||||
* Gets whether this player has a flag
|
||||
*
|
||||
* @return whether this player has a flag
|
||||
* @since 1.13
|
||||
*/
|
||||
boolean hasFlag();
|
||||
|
||||
/**
|
||||
* Gets the amount of shops the given player is allowed to have
|
||||
* <p>
|
||||
* If the player has no shop limit {@link Integer#MAX_VALUE} is returned.
|
||||
*
|
||||
* @return the shop limit
|
||||
* @since 1.13
|
||||
*/
|
||||
int getShopLimit();
|
||||
|
||||
/**
|
||||
* Gets the shops this player owns
|
||||
*
|
||||
* @return a collection of shops
|
||||
* @since 1.13
|
||||
* @see ShopManager#getShops(org.bukkit.OfflinePlayer)
|
||||
*/
|
||||
Collection<Shop> getShops();
|
||||
|
||||
}
|
@ -26,9 +26,9 @@ public interface Shop {
|
||||
int getId();
|
||||
|
||||
/**
|
||||
* Gets the player who created this shop
|
||||
* Gets the player who owns this shop
|
||||
*
|
||||
* @return the vendor
|
||||
* @return the vendor or {@code null} if this shop is an admin shop
|
||||
* @since 1.13
|
||||
*/
|
||||
OfflinePlayer getVendor();
|
||||
@ -84,15 +84,9 @@ public interface Shop {
|
||||
* @return whether this shop is an admin shop
|
||||
* @since 1.13
|
||||
*/
|
||||
boolean isAdminShop();
|
||||
|
||||
/**
|
||||
* Sets whether this shop is an admin shop
|
||||
*
|
||||
* @param adminShop whether this shop should be an admin shop
|
||||
* @since 1.13
|
||||
*/
|
||||
void setAdminShop(boolean adminShop);
|
||||
default boolean isAdminShop() {
|
||||
return getVendor() == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the price for which a player can buy the product from this shop
|
||||
|
Loading…
Reference in New Issue
Block a user