mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Cleanup codes
Former-commit-id: 2a2c1c67055d96eb4334acb3ea83ebe94206816c [formerly 36c870c2f0a62ef9c73a64521f9f97f5d886806c] Former-commit-id: 8f6db869ac11b9ea49b49838325f0c8349ecf275
This commit is contained in:
1 parent
16ab8ec327
commit
0ff3f84cf3
3 files changed
+46
-48
No files matched your search
@@ -42,7 +42,7 @@ public class Info {
|
||||
* @param shop, The need checked with this shop.
|
||||
* @return hasChanged
|
||||
*/
|
||||
public boolean hasChanged(@NotNull Shop shop) {
|
||||
boolean hasChanged(@NotNull Shop shop) {
|
||||
if (this.shop.isUnlimited() != shop.isUnlimited())
|
||||
return true;
|
||||
if (this.shop.getShopType() != shop.getShopType())
|
||||
@@ -53,9 +53,7 @@ public class Info {
|
||||
return true;
|
||||
if (!this.shop.getLocation().equals(shop.getLocation()))
|
||||
return true;
|
||||
if (!this.shop.matches(shop.getItem()))
|
||||
return true;
|
||||
return false;
|
||||
return !this.shop.matches(shop.getItem());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +89,7 @@ public class Info {
|
||||
/**
|
||||
* @return Block signBlock, Get block of shop's sign, may return the null.
|
||||
*/
|
||||
public Block getSignBlock() {
|
||||
Block getSignBlock() {
|
||||
return this.last;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class RealDisplayItem implements DisplayItem {
|
||||
*
|
||||
* @param shop The shop (See Shop)
|
||||
*/
|
||||
public RealDisplayItem(@NotNull Shop shop) {
|
||||
RealDisplayItem(@NotNull Shop shop) {
|
||||
this.shop = shop;
|
||||
this.originalItemStack = shop.getItem().clone();
|
||||
|
||||
|
||||
@@ -10,254 +10,254 @@ import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public abstract interface Shop {
|
||||
public interface Shop {
|
||||
/**
|
||||
* Clone new shop object.
|
||||
* Not a deep clone.
|
||||
*
|
||||
* @return New shop object
|
||||
*/
|
||||
public abstract Shop clone();
|
||||
Shop clone();
|
||||
|
||||
/**
|
||||
* Check the display location, and teleport, respawn if needs.
|
||||
*/
|
||||
public abstract void checkDisplay();
|
||||
void checkDisplay();
|
||||
|
||||
/**
|
||||
* Get shop remaining stock.
|
||||
* @return Remaining stock.
|
||||
*/
|
||||
public abstract int getRemainingStock();
|
||||
int getRemainingStock();
|
||||
|
||||
/**
|
||||
* Get shop remaining space.
|
||||
* @return Remaining space.
|
||||
*/
|
||||
public abstract int getRemainingSpace();
|
||||
int getRemainingSpace();
|
||||
|
||||
/**
|
||||
* Check the target ItemStack is matches with this shop's item.
|
||||
* @param paramItemStack Target ItemStack.
|
||||
* @return Matches
|
||||
*/
|
||||
public abstract boolean matches(ItemStack paramItemStack);
|
||||
boolean matches(ItemStack paramItemStack);
|
||||
|
||||
/**
|
||||
* Get shop's location
|
||||
* @return Shop's location
|
||||
*/
|
||||
public abstract Location getLocation();
|
||||
Location getLocation();
|
||||
|
||||
/**
|
||||
* Get shop's price
|
||||
* @return Price
|
||||
*/
|
||||
public abstract double getPrice();
|
||||
double getPrice();
|
||||
|
||||
/**
|
||||
* Set shop's new price
|
||||
* @param paramDouble New price
|
||||
*/
|
||||
public abstract void setPrice(double paramDouble);
|
||||
void setPrice(double paramDouble);
|
||||
|
||||
/**
|
||||
* Update shop data to database
|
||||
*/
|
||||
public abstract void update();
|
||||
void update();
|
||||
|
||||
/**
|
||||
* Get shop's item durability, if have.
|
||||
* @return Shop's item durability
|
||||
*/
|
||||
public abstract short getDurability();
|
||||
short getDurability();
|
||||
|
||||
/**
|
||||
* Get shop's owner UUID
|
||||
* @return Shop's owner UUID, can use Bukkit.getOfflinePlayer to convert to the OfflinePlayer.
|
||||
*/
|
||||
public abstract UUID getOwner();
|
||||
UUID getOwner();
|
||||
|
||||
/**
|
||||
* Get shop item's ItemStack
|
||||
* @return The shop's ItemStack
|
||||
*/
|
||||
public abstract ItemStack getItem();
|
||||
ItemStack getItem();
|
||||
|
||||
/**
|
||||
* Remove x ItemStack from the shop inventory
|
||||
* @param paramItemStack Want removed ItemStack
|
||||
* @param paramInt Want remove how many
|
||||
*/
|
||||
public abstract void remove(ItemStack paramItemStack, int paramInt);
|
||||
void remove(ItemStack paramItemStack, int paramInt);
|
||||
|
||||
/**
|
||||
* Add x ItemStack to the shop inventory
|
||||
* @param paramItemStack The ItemStack you want add
|
||||
* @param paramInt How many you want add
|
||||
*/
|
||||
public abstract void add(ItemStack paramItemStack, int paramInt);
|
||||
void add(ItemStack paramItemStack, int paramInt);
|
||||
|
||||
/**
|
||||
* Execute sell action for player with x items.
|
||||
* @param paramPlayer Target player
|
||||
* @param paramInt How many sold?
|
||||
*/
|
||||
public abstract void sell(Player paramPlayer, int paramInt);
|
||||
void sell(Player paramPlayer, int paramInt);
|
||||
|
||||
/**
|
||||
* Execute buy action for player with x items.
|
||||
* @param paramPlayer Target player
|
||||
* @param paramInt How many buyed?
|
||||
*/
|
||||
public abstract void buy(Player paramPlayer, int paramInt);
|
||||
void buy(Player paramPlayer, int paramInt);
|
||||
|
||||
/**
|
||||
* Set new owner to the shop's owner
|
||||
* @param paramString New owner UUID
|
||||
*/
|
||||
public abstract void setOwner(UUID paramString);
|
||||
void setOwner(UUID paramString);
|
||||
|
||||
/**
|
||||
* Set shop is or not Unlimited Mode (Admin Shop)
|
||||
* @param paramBoolean status
|
||||
*/
|
||||
public abstract void setUnlimited(boolean paramBoolean);
|
||||
void setUnlimited(boolean paramBoolean);
|
||||
|
||||
/**
|
||||
* Get shop is or not in Unlimited Mode (Admin Shop)
|
||||
* @return yes or not
|
||||
*/
|
||||
public abstract boolean isUnlimited();
|
||||
boolean isUnlimited();
|
||||
|
||||
/**
|
||||
* Get shop type
|
||||
* @return shop type
|
||||
*/
|
||||
public abstract ShopType getShopType();
|
||||
ShopType getShopType();
|
||||
|
||||
/**
|
||||
* Get shop is or not in buying mode
|
||||
* @return yes or no
|
||||
*/
|
||||
public abstract boolean isBuying();
|
||||
boolean isBuying();
|
||||
|
||||
/**
|
||||
* Get shop is or not in selling mode
|
||||
* @return yes or no
|
||||
*/
|
||||
public abstract boolean isSelling();
|
||||
boolean isSelling();
|
||||
|
||||
/**
|
||||
* Set new shop type for this shop
|
||||
* @param paramShopType New shop type
|
||||
*/
|
||||
public abstract void setShopType(ShopType paramShopType);
|
||||
void setShopType(ShopType paramShopType);
|
||||
|
||||
/**
|
||||
* Generate new sign texts on shop's sign.
|
||||
*/
|
||||
public abstract void setSignText();
|
||||
void setSignText();
|
||||
|
||||
/**
|
||||
* Set texts on shop's sign
|
||||
* @param paramArrayOfString The texts you want set
|
||||
*/
|
||||
public abstract void setSignText(String[] paramArrayOfString);
|
||||
void setSignText(String[] paramArrayOfString);
|
||||
|
||||
/**
|
||||
* Get shop signs, may have multi signs
|
||||
* @return Signs for the shop
|
||||
*/
|
||||
public abstract List<Sign> getSigns();
|
||||
List<Sign> getSigns();
|
||||
|
||||
/**
|
||||
* Check shop is or not attacked the target block
|
||||
* @param paramBlock Target block
|
||||
* @return isAttached
|
||||
*/
|
||||
public abstract boolean isAttached(Block paramBlock);
|
||||
boolean isAttached(Block paramBlock);
|
||||
|
||||
/**
|
||||
* Delete shop from ram, and database.
|
||||
*/
|
||||
public abstract void delete();
|
||||
void delete();
|
||||
|
||||
/**
|
||||
* Delete shop from ram or ram and database
|
||||
* @param paramBoolean true = only delete from ram, false = delete from both ram and database
|
||||
*/
|
||||
public abstract void delete(boolean paramBoolean);
|
||||
void delete(boolean paramBoolean);
|
||||
|
||||
/**
|
||||
* Shop is valid
|
||||
* @return status
|
||||
*/
|
||||
public abstract boolean isValid();
|
||||
boolean isValid();
|
||||
|
||||
/**
|
||||
* Unload shop from world
|
||||
*/
|
||||
public abstract void onUnload();
|
||||
void onUnload();
|
||||
|
||||
/**
|
||||
* Load shop to the world
|
||||
*/
|
||||
public abstract void onLoad();
|
||||
void onLoad();
|
||||
|
||||
/**
|
||||
* Execute codes when player click the shop will did things
|
||||
*/
|
||||
public abstract void onClick();
|
||||
void onClick();
|
||||
|
||||
/**
|
||||
* Get shop's owner name, it will return owner name or Admin Shop(i18n) when it is unlimited
|
||||
* @return owner name
|
||||
*/
|
||||
public abstract String ownerName();
|
||||
String ownerName();
|
||||
|
||||
/**
|
||||
* Return this shop's moderators
|
||||
* @return Shop moderators
|
||||
*/
|
||||
public abstract ShopModerator getModerator();
|
||||
ShopModerator getModerator();
|
||||
|
||||
/**
|
||||
* Set new shop's moderators
|
||||
* @param shopModerator New moderators team you want set
|
||||
*/
|
||||
public abstract void setModerator(ShopModerator shopModerator);
|
||||
void setModerator(ShopModerator shopModerator);
|
||||
|
||||
/**
|
||||
* Add new staff to the moderators
|
||||
* @param player New staff
|
||||
* @return Success
|
||||
*/
|
||||
public abstract boolean addStaff(UUID player);
|
||||
boolean addStaff(UUID player);
|
||||
|
||||
/**
|
||||
* Remove a staff from moderators
|
||||
* @param player Staff
|
||||
* @return Success
|
||||
*/
|
||||
public abstract boolean delStaff(UUID player);
|
||||
boolean delStaff(UUID player);
|
||||
|
||||
/**
|
||||
* Empty moderators team.
|
||||
*/
|
||||
public abstract void clearStaffs();
|
||||
void clearStaffs();
|
||||
|
||||
/**
|
||||
* Get this container shop is loaded or unloaded.
|
||||
* @return Loaded
|
||||
*/
|
||||
public abstract boolean isLoaded();
|
||||
boolean isLoaded();
|
||||
|
||||
/**
|
||||
* Directly get all staffs.
|
||||
* @return staffs
|
||||
*/
|
||||
public abstract ArrayList<UUID> getStaffs();
|
||||
ArrayList<UUID> getStaffs();
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user