本文整理匯總了Java中net.milkbowl.vault.economy.Economy類的典型用法代碼示例。如果您正苦於以下問題:Java Economy類的具體用法?Java Economy怎麽用?Java Economy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Economy類屬於net.milkbowl.vault.economy包,在下文中一共展示了Economy類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupEconomy
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
/**
* This method will test if Vault is installed and if there is a
* registered Economy Plugin. This method will only return true
* if there is an economy plugin that is registered and if Vault
* is installed and enabled.
*/
private boolean setupEconomy ()
{
if (null == getServer().getPluginManager ().getPlugin ("Vault"))
{
getLogger ().severe ("Vault is not Installed! Disabling Plugin");
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager ().getRegistration (Economy.class);
if (null == rsp)
{
getLogger ().severe ("No Economy Plugin Found! Disabling Plugin");
return false;
}
mEconomy = rsp.getProvider ();
return mEconomy != null;
}
示例2: pay
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
public boolean pay(Player player) {
double c = cost.resolve(player);
if (c > 0) {
Economy eco = EconomyManager.getEconomy();
if (eco == null) {
Uppercore.logger().severe("Cannot use economy: vault not found!");
return true;
}
EconomyResponse res = eco.withdrawPlayer(player, c);
if (!res.transactionSuccess()) {
noMoneyError.send(player);
if (noMoneySound != null)
noPermissionSound.play(player);
Uppercore.logger().log(Level.INFO, res.errorMessage);
return false;
} else return true;
}
return true;
}
示例3: onEnable
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
public void onEnable(){
instance = this;
manager = new Manager(instance);
manager.check();
files.setupFiles();
lang.setupLang();
registerEvents();
registerCommands();
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
vault = economyProvider.getProvider();
}
WCCore.getInstance().log("Pvpmanager ha sido cargado");
}
示例4: onEnable
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
public void onEnable() {
instance = this;
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
eco = economyProvider.getProvider();
} else {
getServer().getPluginManager().disablePlugin(this);
WCCore.getInstance().log(WCServer.Level.SEVERE, "No hay Vault");
return;
}
register();
files.setupFiles();
registerCommands();
registerEvents();
loadCasinos();
info.init();
mainRun.runTaskTimer(this, 0, 20);
WCCore.getInstance().log(WCServer.Level.INFO, "Survival activado");
}
示例5: setupEconomy
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null){
Log.debugLog("Oye, que el Economy es null 1");
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null){
Log.debugLog("Oye, que el Economy es null 2");
return false;
}
vault = rsp.getProvider();
Log.debugLog("Oye, que el Economy ha cargao mi arma");
return vault != null;
}
示例6: onEnable
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
public void onEnable(){
instance = this;
files.setupFiles();
registerEvents();
registerCommands();
pe.registerRecipe();
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
eco = economyProvider.getProvider();
}
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
if (plugin != null) {
wg = WGBukkit.getPlugin();
}
}
示例7: setupEconomy
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
/**
* Setup vault
*/
private boolean setupEconomy()
{
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null)
{
return false;
}
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null)
{
return false;
}
vault = rsp.getProvider();
return vault != null;
}
示例8: onEnable
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
public void onEnable()
{
this.DisabledPlayersHashMap = new HashMap<String, Boolean>();
this.DisabledEntitiesHashMap = new HashMap<Object, Boolean>();
this.MobsTimerHashMap = new HashMap<String, Integer>();
if ((Bukkit.getPluginManager().getPlugin("Vault") instanceof Vault))
{
RegisteredServiceProvider<Economy> service = Bukkit.getServicesManager().getRegistration(Economy.class);
if (service != null) {
eco = (Economy)service.getProvider();
}
}
else
{
System.out.print("[MobMoney] Error with Vault, it's necessary to starts this plugin.");
getServer().getPluginManager().disablePlugin(this);
}
onReloadConfig();
setConfig();
getServer().getPluginManager().registerEvents(this, this);
System.out.print("[MobMoney] Enabled correctly.");
}
示例9: onEnable
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
@Override
public void onEnable() {
if(this.getServer().getPluginManager().isPluginEnabled("Vault")) {
economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
}
fillTradeTable();
//_location = new Location(getServer().getWorld("world"), -163.0, 71.0, 145.0); // server test punisher
_location = new Location(getServer().getWorld("world"), 691.0,69.0,276.0); // shop village
_zone = new WorldZone(_location, 5);
//_zone = new WorldZone(getServer().getWorld("world"), "-167,140,-159,150,69,75");
_villager = (Villager)getServer().getWorld("world").spawnCreature(_location, EntityUtilities.getCreatureType("Villager"));
_location = _villager.getLocation();
getServer().getPluginManager().registerEvents(this, this);
getCommand("tv").setExecutor(this);
Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(this, 0, 100, TimeUnit.MILLISECONDS);
ZoneServer.getInstance().addListener(this);
}
示例10: onLoad
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
@Override
public void onLoad() {
pool = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>());
manager = new Manager(this);
getServer().getServicesManager().register(
MyEconomy.class,
manager,
this,
ServicePriority.Normal
);
Plugin vault = getServer().getPluginManager().getPlugin("Vault");
if (vault != null) {
getServer().getServicesManager().register(
Economy.class,
new VaultEconomy(this, manager),
this,
ServicePriority.Highest
);
getLogger().info("Hook to vault!!!");
}
}
示例11: setupEconomy
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
private boolean setupEconomy() {
if (!CubitBukkitPlugin.inst().getYamlManager().getSettings().landEnableEconomy) {
this.plugin.getLogger().info("Economy is in config disabled!");
return false;
}
if (plugin.getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
this.plugin.getLogger().info("No valid economy plugin found. Economy is disabled.");
return false;
}
econ = rsp.getProvider();
return econ != null;
}
示例12: setupEconomy
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
private boolean setupEconomy() {
econ = null;
//檢查設定
FileConfiguration config = KConfigManager.get("config");
//若無啟用經濟
if (!config.getBoolean("Economy.Enable", false)) {
return false;
}
//檢查Vault
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
//檢查經濟支援
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
示例13: setupEconomy
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") != null) {
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp != null) {
vaultEconomy = rsp.getProvider();
if (vaultEconomy != null) {
return true;
} else {
log.warning("Failed to get Vault economy; aborting Vault mode.");
}
} else {
log.warning("No provider for Vault; is a Vault-compatible economy plugin present? Aborting Vault mode.");
}
} else {
log.info("Vault not present; aborting Vault mode.");
}
return false;
}
示例14: serializeEconomy
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
public static JSONObject serializeEconomy(Player player, Economy econ) {
try {
JSONObject data = new JSONObject();
if (econ.bankBalance(player.getName()).transactionSuccess()) {
data.put("bank-balance", econ.bankBalance(player.getName()).balance);
}
data.put("balance", econ.getBalance(String.valueOf(player)));
return data;
} catch (JSONException ex) {
ex.printStackTrace();
return null;
}
}
示例15: onEnable
import net.milkbowl.vault.economy.Economy; //導入依賴的package包/類
@Override
public void onEnable()
{
ServicesManager sm = handler.getServer().getServicesManager();
RegisteredServiceProvider<Permission> permProvider = sm.getRegistration(Permission.class);
if (permProvider != null)
perm = permProvider.getProvider();
RegisteredServiceProvider<Economy> econProvider = sm.getRegistration(Economy.class);
if (econProvider != null)
econ = econProvider.getProvider();
RegisteredServiceProvider<Chat> chatProvider = sm.getRegistration(Chat.class);
if (chatProvider != null)
chat = chatProvider.getProvider();
}