mirror of
https://github.com/LordBoos/boosCooldowns.git
synced 2024-11-26 04:25:20 +01:00
Changed prices to use double instead of int, this allows decimals in
prices.
This commit is contained in:
parent
3646f78ad3
commit
fbb90cec8f
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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);
|
||||
|
@ -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")) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user