• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EconomyAPI类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中me.onebone.economyapi.EconomyAPI的典型用法代码示例。如果您正苦于以下问题:Java EconomyAPI类的具体用法?Java EconomyAPI怎么用?Java EconomyAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EconomyAPI类属于me.onebone.economyapi包,在下文中一共展示了EconomyAPI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCustomName

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL,ignoreCancelled = true)
public void onCustomName(PlayerInteractEvent event){
    if(event.getBlock().getId() == Block.CHEST) {
        if (ChestLocker.getInstance().getCustomName().containsKey(event.getPlayer().getName())) {
            Block block = event.getBlock();
            BlockEntity chestP = event.getBlock().getLevel().getBlockEntity(block);
            if(chestP instanceof BlockEntityChest){
                BlockEntityChest chest = (BlockEntityChest)chestP;
                if(EconomyAPI.getInstance().myMoney(event.getPlayer()) >= 500) {
                    chest.setName(ChestLocker.getInstance().getCustomName().get(event.getPlayer().getName()));
                    event.getPlayer().sendMessage("设置成功");
                    ChestLocker.getInstance().getCustomName().remove(event.getPlayer().getName());
                    EconomyAPI.getInstance().reduceMoney(event.getPlayer(),500);
                }else{
                    event.getPlayer().sendMessage("你没有足够的金钱");
                    ChestLocker.getInstance().getCustomName().remove(event.getPlayer().getName());
                }
            }
        }
    }
}
 
开发者ID:zzz1999,项目名称:ChestLocker,代码行数:22,代码来源:EventListener.java


示例2: AutoSaveTask

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public AutoSaveTask(EconomyAPI owner){
	super(owner);
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:4,代码来源:AutoSaveTask.java


示例3: onRun

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public void onRun(int currentTick){
	((EconomyAPI)this.getOwner()).saveAll();
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:4,代码来源:AutoSaveTask.java


示例4: TakeMoneyCommand

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public TakeMoneyCommand(EconomyAPI plugin) {
	super("takemoney", "Takes money from player", "/takemoney <player> <amount>");
	
	this.plugin = plugin;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:6,代码来源:TakeMoneyCommand.java


示例5: execute

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
	if(!this.plugin.isEnabled()) return false;
	if(!sender.hasPermission("economyapi.command.takemoney")){
		sender.sendMessage(TextFormat.RED + "You don't have permission to use this command.");
		return false;
	}
	
	if(args.length < 2){
		sender.sendMessage(TextFormat.RED + "Usage: " + this.getUsage());
		return true;
	}
	String player = args[0];
	
	Player p = this.plugin.getServer().getPlayer(player);
	if(p != null){
		player = p.getName();
	}
	try{
		double amount = Double.parseDouble(args[1]);
		if(amount < 0){
			sender.sendMessage(this.plugin.getMessage("takemoney-invalid-number", sender));
			return true;
		}
		
		int result = this.plugin.reduceMoney(player, amount);
		switch(result){
		case EconomyAPI.RET_INVALID:
			sender.sendMessage(this.plugin.getMessage("takemoney-player-lack-of-money", new String[]{player, Double.toString(amount), Double.toString(this.plugin.myMoney(player))}, sender));
			return true;
		case EconomyAPI.RET_NO_ACCOUNT:
			sender.sendMessage(this.plugin.getMessage("player-never-connected", new String[]{player}, sender));
			return true;
		case EconomyAPI.RET_CANCELLED:
			sender.sendMessage(this.plugin.getMessage("takemoney-failed", new String[]{player}, sender));
			return true;
		case EconomyAPI.RET_SUCCESS:
			sender.sendMessage(this.plugin.getMessage("takemoney-took-money", new String[]{player, Double.toString(amount)}, sender));
			if(p instanceof Player){
				p.sendMessage(this.plugin.getMessage("takemoney-money-taken", new String[]{Double.toString(amount)}, sender));
			}
			return true;
		}
	}catch(NumberFormatException e){
		sender.sendMessage(this.plugin.getMessage("takemoney-must-be-number", sender));
	}
	return true;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:49,代码来源:TakeMoneyCommand.java


示例6: PayCommand

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public PayCommand(EconomyAPI plugin) {
	super("pay", "Pays to other player", "/pay <player> <amount>");

	this.plugin = plugin;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:6,代码来源:PayCommand.java


示例7: execute

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String label, String[] args){
	if(!this.plugin.isEnabled()) return false;
	if(!sender.hasPermission("economyapi.command.pay")){
		sender.sendMessage(TextFormat.RED + "You don't have permission to use this command.");
		return false;
	}
	
	if(!(sender instanceof Player)){
		sender.sendMessage(TextFormat.RED + "Please use this command in-game.");
		return true;
	}
	
	if(args.length < 2){
		sender.sendMessage(TextFormat.RED + "Usage: " + this.getUsage());
		return true;
	}
	String player = args[0];
	
	Player p = this.plugin.getServer().getPlayer(player);
	if(p != null){
		player = p.getName();
	}
	try{
		double amount = Double.parseDouble(args[1]);
		
		int result = this.plugin.reduceMoney((Player) sender, amount);
		switch(result){
		case EconomyAPI.RET_INVALID:
		case EconomyAPI.RET_CANCELLED:
			sender.sendMessage(this.plugin.getMessage("pay-failed", sender));
			return true;
		case EconomyAPI.RET_NO_ACCOUNT:
			sender.sendMessage(this.plugin.getMessage("player-never-connected", new String[]{player}, sender));
			return true;
		case EconomyAPI.RET_SUCCESS:
			this.plugin.addMoney(player, amount, true);
			
			sender.sendMessage(this.plugin.getMessage("pay-success", new String[]{Double.toString(amount), player}, sender));
			if(p instanceof Player){
				p.sendMessage(this.plugin.getMessage("money-paid", new String[]{sender.getName(), Double.toString(amount)}, sender));
			}
			return true;
		}
	}catch(NumberFormatException e){
		sender.sendMessage(this.plugin.getMessage("takemoney-must-be-number", sender));
	}
	return true;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:50,代码来源:PayCommand.java


示例8: SeeMoneyCommand

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public SeeMoneyCommand(EconomyAPI plugin){
	super("seemoney", "Show other players' money", "/seemoney <player>");
	
	this.plugin = plugin;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:6,代码来源:SeeMoneyCommand.java


示例9: MyMoneyCommand

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public MyMoneyCommand(EconomyAPI plugin) {
	super("mymoney", "Shows your money", "/mymoney");
	
	this.plugin = plugin;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:6,代码来源:MyMoneyCommand.java


示例10: GiveMoneyCommand

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public GiveMoneyCommand(EconomyAPI plugin) {
	super("givemoney", "Gives money to player", "/givemoney <player> <amount>");
	
	this.plugin = plugin;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:6,代码来源:GiveMoneyCommand.java


示例11: execute

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
	if(!this.plugin.isEnabled()) return false;
	if(!sender.hasPermission("economyapi.command.givemoney")){
		sender.sendMessage(TextFormat.RED + "You don't have permission to use this command.");
		return false;
	}
	
	if(args.length < 2){
		sender.sendMessage(TextFormat.RED + "Usage: " + this.getUsage());
		return true;
	}
	String player = args[0];
	
	Player p = this.plugin.getServer().getPlayer(player);
	if(p != null){
		player = p.getName();
	}
	try{
		double amount = Double.parseDouble(args[1]);
		if(amount < 0){
			sender.sendMessage(this.plugin.getMessage("givemoney-invalid-number", sender));
			return true;
		}
		
		int result = this.plugin.addMoney(player, amount);
		switch(result){
		case EconomyAPI.RET_INVALID:
			sender.sendMessage(this.plugin.getMessage("reached-max", new String[]{Double.toString(amount)}, sender));
			return true;
		case EconomyAPI.RET_NO_ACCOUNT:
			sender.sendMessage(this.plugin.getMessage("player-never-connected", new String[]{player}, sender));
			return true;
		case EconomyAPI.RET_SUCCESS:
			sender.sendMessage(this.plugin.getMessage("givemoney-gave-money", new String[]{Double.toString(amount), player}, sender));
			if(p instanceof Player){
				p.sendMessage(this.plugin.getMessage("givemoney-money-given", new String[]{Double.toString(amount)}, sender));
			}
			return true;
		}
	}catch(NumberFormatException e){
		sender.sendMessage(this.plugin.getMessage("givemoney-must-be-number", sender));
	}
	return true;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:46,代码来源:GiveMoneyCommand.java


示例12: TopMoneyCommand

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public TopMoneyCommand(EconomyAPI plugin) {
	super("topmoney", "Shows top money of this server", "/topmoney [page]");
	
	this.plugin = plugin;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:6,代码来源:TopMoneyCommand.java


示例13: SetMoneyCommand

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public SetMoneyCommand(EconomyAPI plugin) {
	super("setmoney", "Set money of player", "/setmoney <player> <amount>");
	
	this.plugin = plugin;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:6,代码来源:SetMoneyCommand.java


示例14: execute

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
	if(!this.plugin.isEnabled()) return false;
	if(!sender.hasPermission("economyapi.command.setmoney")){
		sender.sendMessage(TextFormat.RED + "You don't have permission to use this command.");
		return false;
	}
	
	if(args.length < 2){
		sender.sendMessage(TextFormat.RED + "Usage: " + this.getUsage());
		return true;
	}
	String player = args[0];
	
	Player p = this.plugin.getServer().getPlayer(player);
	if(p != null){
		player = p.getName();
	}
	try{
		double amount = Double.parseDouble(args[1]);
		if(amount < 0){
			sender.sendMessage(this.plugin.getMessage("setmoney-invalid-number", sender));
			return true;
		}
		
		int result = this.plugin.setMoney(player, amount);
		switch(result){
		case EconomyAPI.RET_NO_ACCOUNT:
			sender.sendMessage(this.plugin.getMessage("player-never-connected", new String[]{player}, sender));
			return true;
		case EconomyAPI.RET_CANCELLED:
			sender.sendMessage(this.plugin.getMessage("setmoney-failed", new String[]{player}, sender));
			return true;
		case EconomyAPI.RET_INVALID:
			sender.sendMessage(this.plugin.getMessage("reached-max", new String[]{Double.toString(amount)}, sender));
			return true;
		case EconomyAPI.RET_SUCCESS:
			sender.sendMessage(this.plugin.getMessage("setmoney-setmoney", new String[]{player, Double.toString(amount)}, sender));
			if(p instanceof Player){
				p.sendMessage(this.plugin.getMessage("setmoney-set", new String[]{Double.toString(amount)}, sender));
			}
			return true;
		}
	}catch(NumberFormatException e){
		sender.sendMessage(this.plugin.getMessage("setmoney-invalid-number", sender));
	}
	return true;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:49,代码来源:SetMoneyCommand.java


示例15: SetLangCommand

import me.onebone.economyapi.EconomyAPI; //导入依赖的package包/类
public SetLangCommand(EconomyAPI plugin) {
	super("setlang", "Sets your preferred language", "/setlang <ccTLD>");
	
	this.plugin = plugin;
}
 
开发者ID:EconomyS,项目名称:EconomyAPI,代码行数:6,代码来源:SetLangCommand.java



注:本文中的me.onebone.economyapi.EconomyAPI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RenderMapping类代码示例发布时间:2022-05-22
下一篇:
Java CompactionMetadata类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap