mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-04 17:50:13 +01:00
d6bdb0486a
- Formatting - Warning about old Bukkit version - Renamed "TOWNY_CANNOT_CREATE_SHOP_HERE" to "CANNOT_CREATE_SHOP_HERE" to avoid confusion - Renamed "NOT_ENOUGH_LWC_PROTECTIONS" to "NOT_ENOUGH_PROTECTIONS" and changed its message - Fixed armour enchantments - Logging shop location - Fixed Heroes for the newest version - Removed redutant plugin object - Added dev-url for CraftBukkitUpToDate - Removed redutant plugins from softdepend - Fixed a bug when the player interacts with a shop with a sign in hand
30 lines
847 B
Java
30 lines
847 B
Java
package com.Acrobot.ChestShop.Config;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class MaxPrice {
|
|
public static boolean canCreate(float buyPrice, float sellPrice, Material mat) {
|
|
float bPrice = maxBuyPrice(mat.getId());
|
|
float sPrice = maxSellPrice(mat.getId());
|
|
|
|
return (bPrice == -1 || buyPrice <= maxBuyPrice(mat.getId()))
|
|
&& (sPrice == -1 || sellPrice <= maxSellPrice(mat.getId()));
|
|
}
|
|
|
|
public static float maxBuyPrice(int itemID) {
|
|
return getPrice("buy", itemID);
|
|
}
|
|
|
|
public static float maxSellPrice(int itemID) {
|
|
return getPrice("sell", itemID);
|
|
}
|
|
|
|
public static float getPrice(String value, int itemID) {
|
|
String node = "max-" + value + "-price-" + itemID;
|
|
return Config.exists(node) ? Config.getFloat(node) : -1;
|
|
}
|
|
}
|