mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-28 05:35:45 +01:00
Add message for NPCPayListener
This commit is contained in:
parent
2fceea7d23
commit
e393f2d38b
@ -2,8 +2,11 @@ package net.citizensnpcs;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.event.PlayerCreateNPCEvent;
|
||||
import net.citizensnpcs.util.Messaging;
|
||||
import net.citizensnpcs.util.StringHelper;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
@ -21,7 +24,7 @@ public class NPCPayListener implements Listener {
|
||||
public void onPlayerCreateNPC(PlayerCreateNPCEvent event) {
|
||||
String name = event.getCreator().getName();
|
||||
boolean hasAccount = provider.hasAccount(name);
|
||||
if (!hasAccount)
|
||||
if (!hasAccount || event.getCreator().hasPermission("citizens.npc.ignore-cost"))
|
||||
return;
|
||||
double cost = Setting.NPC_COST.asDouble();
|
||||
boolean hasEnough = provider.has(name, cost);
|
||||
@ -31,5 +34,7 @@ public class NPCPayListener implements Listener {
|
||||
return;
|
||||
}
|
||||
provider.bankWithdraw(name, cost);
|
||||
Messaging.sendF(event.getCreator(), ChatColor.GREEN + "Withdrew %s for your NPC.",
|
||||
StringHelper.wrap(provider.format(cost)));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user