mirror of
https://github.com/LordBoos/boosCooldowns.git
synced 2024-11-26 04:25:20 +01:00
Added possibility to charge players for using ChatManager globachat.
This commit is contained in:
parent
495bc4aace
commit
38d59884a2
@ -330,7 +330,7 @@ public class boosCoolDownListener<a> implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
payForCommand(event, player, pre, message, price);
|
payForCommand(event, player, pre, price);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -346,8 +346,27 @@ public class boosCoolDownListener<a> implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void payForCommand(PlayerCommandPreprocessEvent event,
|
public void payForCommand(PlayerCommandPreprocessEvent event,
|
||||||
Player player, String pre, String message, int price) {
|
Player player, String pre, int price) {
|
||||||
|
String name = player.getName();
|
||||||
|
if (price > 0) {
|
||||||
|
if (!player.hasPermission(
|
||||||
|
"booscooldowns.noprice")
|
||||||
|
&& !player.hasPermission(
|
||||||
|
"booscooldowns.noprice." + pre)) {
|
||||||
|
if (boosPriceManager.payForCommand(player, pre, price, name)) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
boosCoolDownManager.cancelCooldown(player, pre);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void payForCommand2(AsyncPlayerChatEvent event,
|
||||||
|
Player player, String pre, int price) {
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
if (price > 0) {
|
if (price > 0) {
|
||||||
if (!player.hasPermission(
|
if (!player.hasPermission(
|
||||||
@ -597,20 +616,22 @@ public class boosCoolDownListener<a> implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||||
String chatMessage = event.getMessage();
|
String chatMessage = event.getMessage();
|
||||||
|
String temp = "globalchat";
|
||||||
|
int price = 0;
|
||||||
|
Player player = event.getPlayer();
|
||||||
if (chatMessage.startsWith("!")) {
|
if (chatMessage.startsWith("!")) {
|
||||||
String temp = "globalchat";
|
if (!boosCoolDownManager.checkCoolDownOK(player, temp,
|
||||||
if (!boosCoolDownManager.checkCoolDownOK(event.getPlayer(), temp,
|
|
||||||
chatMessage)) {
|
chatMessage)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (boosCoolDownManager.coolDown(event.getPlayer(), temp)) {
|
if (boosCoolDownManager.coolDown(player, temp)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
price = prePriceCheck(player, temp);
|
||||||
|
payForCommand2(event, player, temp, price);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user