Changed prices to use double instead of int, this allows decimals in

prices.
This commit is contained in:
Boosik 2013-03-29 19:04:13 +01:00
parent 3646f78ad3
commit fbb90cec8f
6 changed files with 28 additions and 28 deletions

View File

@ -272,38 +272,38 @@ public class boosConfigManager {
"Price of &command& was %s and you now have %s");
}
public static int getPrice(String pre) {
int price = 0;
public static double getPrice(String pre) {
double price = 0.0;
pre = pre.toLowerCase();
price = conf.getInt("commands.prices.price." + pre, price);
price = conf.getDouble("commands.prices.price." + pre, price);
return price;
}
public static int getPrice2(String pre) {
int price = 0;
public static double getPrice2(String pre) {
double price = 0.0;
pre = pre.toLowerCase();
price = conf.getInt("commands.prices.price2." + pre, price);
price = conf.getDouble("commands.prices.price2." + pre, price);
return price;
}
public static int getPrice3(String pre) {
int price = 0;
public static double getPrice3(String pre) {
double price = 0.0;
pre = pre.toLowerCase();
price = conf.getInt("commands.prices.price3." + pre, price);
price = conf.getDouble("commands.prices.price3." + pre, price);
return price;
}
public static int getPrice4(String pre) {
int price = 0;
public static double getPrice4(String pre) {
double price = 0.0;
pre = pre.toLowerCase();
price = conf.getInt("commands.prices.price4." + pre, price);
price = conf.getDouble("commands.prices.price4." + pre, price);
return price;
}
public static int getPrice5(String pre) {
int price = 0;
public static double getPrice5(String pre) {
Double price = 0.0;
pre = pre.toLowerCase();
price = conf.getInt("commands.prices.price5." + pre, price);
price = conf.getDouble("commands.prices.price5." + pre, price);
return price;
}
@ -530,12 +530,12 @@ public class boosConfigManager {
conf.addDefault(
"commands.warmupPotionEffects.howto2",
"#After effect add @number, for example WEAKNESS@3 will apply weakness III to player for the duration of warmup.");
conf.addDefault("commands.prices.price./spawn", 10);
conf.addDefault("commands.prices.price./home", 20);
conf.addDefault("commands.prices.price2./home", 40);
conf.addDefault("commands.prices.price3./home", 90);
conf.addDefault("commands.prices.price4./home", 99);
conf.addDefault("commands.prices.price5./home", 542);
conf.addDefault("commands.prices.price./spawn", 10.0);
conf.addDefault("commands.prices.price./home", 20.0);
conf.addDefault("commands.prices.price2./home", 40.0);
conf.addDefault("commands.prices.price3./home", 90.0);
conf.addDefault("commands.prices.price4./home", 99.0);
conf.addDefault("commands.prices.price5./home", 542.0);
conf.addDefault("commands.limits.limit./example", 0);
conf.addDefault("commands.limits.limit2./example", 100);
conf.addDefault("commands.limits.limit3./command", 50);

View File

@ -77,7 +77,7 @@ public class boosCoolDownListener<a> implements Listener {
// Returns true if the command is on cooldown, false otherwise
private void checkCooldown(PlayerCommandPreprocessEvent event,
Player player, String pre, String message, int warmUpSeconds,
int price) {
double price) {
if (!blocked) {
if (warmUpSeconds > 0) {
if (!player.hasPermission("booscooldowns.nowarmup")
@ -158,7 +158,7 @@ public class boosCoolDownListener<a> implements Listener {
int preSubCheck = -1;
int preSubCheck2 = -1;
int preSubCheck3 = -1;
int price = 0;
double price = 0;
int limit = 0;
int cd = 0;
playerloc.put(player, player.getLocation());
@ -281,7 +281,7 @@ public class boosCoolDownListener<a> implements Listener {
private void onPlayerChat(AsyncPlayerChatEvent event) {
String chatMessage = event.getMessage();
String temp = "globalchat";
int price = 0;
double price = 0;
Player player = event.getPlayer();
if (chatMessage.startsWith("!")) {
if (!boosCoolDownManager.checkCoolDownOK(player, temp, chatMessage)) {
@ -299,7 +299,7 @@ public class boosCoolDownListener<a> implements Listener {
}
private void payForCommand(PlayerCommandPreprocessEvent event,
Player player, String pre, int price) {
Player player, String pre, double price) {
String name = player.getName();
if (price > 0) {
if (!player.hasPermission("booscooldowns.noprice")
@ -316,7 +316,7 @@ public class boosCoolDownListener<a> implements Listener {
}
private void payForCommand2(AsyncPlayerChatEvent event, Player player,
String pre, int price) {
String pre, double price) {
String name = player.getName();
if (price > 0) {
if (!player.hasPermission("booscooldowns.noprice")
@ -360,7 +360,7 @@ public class boosCoolDownListener<a> implements Listener {
}
}
private int prePriceCheck(Player player, String preSub) {
private double prePriceCheck(Player player, String preSub) {
if (player.hasPermission("booscooldowns.price2")) {
return boosConfigManager.getPrice2(preSub);
} else if (player.hasPermission("booscooldowns.price3")) {

View File

@ -10,7 +10,7 @@ import util.boosChat;
public class boosPriceManager {
private static Economy economy = boosCoolDown.getEconomy();
public static boolean payForCommand(Player player, String pre, int price,
public static boolean payForCommand(Player player, String pre, double price,
String name) {
if (economy == null) {
return true;