use of com.nextplugins.economy.configuration.PurseValue in project NextEconomy by NextPlugins.
the class PurseAPI method updatePurse.
/**
* Change purse value with messages and calling event (Better way)
*
* @param newValue to purse
*/
public void updatePurse(int newValue) {
val lastNextUpdate = nextUpdate;
val duration = PurseValue.get(PurseValue::nextUpdate);
setNextUpdate(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(duration));
Bukkit.getScheduler().runTaskAsynchronously(NextEconomy.getInstance(), () -> {
val asyncPurseUpdateEvent = new AsyncPurseUpdateEvent(newValue, purse, lastNextUpdate);
PluginManager pluginManager = Bukkit.getPluginManager();
pluginManager.callEvent(asyncPurseUpdateEvent);
});
}
use of com.nextplugins.economy.configuration.PurseValue in project NextEconomy by NextPlugins.
the class CommandRegistry method register.
public void register() {
try {
BukkitFrame bukkitFrame = new BukkitFrame(plugin);
bukkitFrame.registerCommands(new MoneyCommand(plugin, plugin.getAccountStorage(), plugin.getLocationManager()), new NextEconomyCommand(plugin.getBackupManager(), plugin.getRankingStorage(), plugin.getAccountStorage(), plugin.getConversorManager()));
if (FeatureValue.get(FeatureValue::checkSystemEnabled)) {
bukkitFrame.registerCommands(new CheckCommand(plugin.getAccountStorage()));
}
if (PurseValue.get(PurseValue::enable)) {
bukkitFrame.registerCommands(new PurseCommand());
}
MessageHolder messageHolder = bukkitFrame.getMessageHolder();
messageHolder.setMessage(MessageType.ERROR, MessageValue.get(MessageValue::error));
messageHolder.setMessage(MessageType.INCORRECT_TARGET, MessageValue.get(MessageValue::incorrectTarget));
messageHolder.setMessage(MessageType.INCORRECT_USAGE, MessageValue.get(MessageValue::incorrectUsage));
messageHolder.setMessage(MessageType.NO_PERMISSION, MessageValue.get(MessageValue::noPermission));
plugin.getLogger().info("Comandos registrados com sucesso.");
} catch (Throwable t) {
t.printStackTrace();
plugin.getLogger().severe("Não foi possível registrar os comandos.");
}
}
Aggregations