当前位置: 首页>>代码示例>>Java>>正文


Java PlayerItemHeldEvent.getPlayer方法代码示例

本文整理汇总了Java中cn.nukkit.event.player.PlayerItemHeldEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerItemHeldEvent.getPlayer方法的具体用法?Java PlayerItemHeldEvent.getPlayer怎么用?Java PlayerItemHeldEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cn.nukkit.event.player.PlayerItemHeldEvent的用法示例。


在下文中一共展示了PlayerItemHeldEvent.getPlayer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: chin

import cn.nukkit.event.player.PlayerItemHeldEvent; //导入方法依赖的package包/类
@EventHandler
public void chin(PlayerItemHeldEvent event){
Player player = event.getPlayer();
Item item =event.getItem();
String iname =item.getCustomName();
Config gunlangjpn =Main.gunlangjpn;
if(gunlangjpn.exists(iname.trim())){
	int kindid = gunlangjpn.getInt(iname.trim());
	if(cgun.containsKey(player.getName()+"-"+kindid)){
		int c = cgun.get(player.getName()+"-"+kindid);
		player.sendPopup(lj.usebu_remaining+c);
	}

	if(kindid >1000){
		hgun.put(player.getName(),true);
	}else if(hgun.containsKey(player.getName())){
		hgun.remove(player.getName());
	}
}else{
	if(hgun.containsKey(player.getName())){
		hgun.remove(player.getName());
	}
}
}
 
开发者ID:haniokasai,项目名称:NuclearGunWars-plugin,代码行数:25,代码来源:gunsys.java

示例2: onEquipmentChange

import cn.nukkit.event.player.PlayerItemHeldEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEquipmentChange(PlayerItemHeldEvent event){
	Player player = event.getPlayer();
	Item item = event.getItem();
	
	if(this.status == STATUS_ONGOING){
		if(item.getId() == GUN_ITEM_ID){
			if(containers.containsKey(player.getName())){
				containers.get(player.getName()).startShoot();
			}
		}else{
			if(containers.containsKey(player.getName())){
				containers.get(player.getName()).stopShoot();
			}
		}
	}
}
 
开发者ID:onebone,项目名称:MineCombat-Nukkit,代码行数:18,代码来源:MineCombat.java

示例3: onPlayerItemHoldEvent

import cn.nukkit.event.player.PlayerItemHeldEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerItemHoldEvent(final PlayerItemHeldEvent event) {
    Player nukkitPlayer = event.getPlayer();
    if (nukkitPlayer.isSneaking()) {
        return;
    }
    FawePlayer<Object> fp = FawePlayer.wrap(nukkitPlayer);
    com.sk89q.worldedit.entity.Player player = fp.getPlayer();
    LocalSession session = fp.getSession();
    Tool tool = session.getTool(player);
    if (tool instanceof ScrollTool) {
        final int slot = event.getInventorySlot();
        final int oldSlot = event.getSlot();
        final int ri;
        if ((((slot - oldSlot) <= 4) && ((slot - oldSlot) > 0)) || (((slot - oldSlot) < -4))) {
            ri = 1;
        } else {
            ri = -1;
        }
        ScrollTool scrollable = (ScrollTool) tool;
        if (scrollable.increment(player, ri)) {
            final PlayerInventory inv = nukkitPlayer.getInventory();
            final Item item = inv.getItem(slot);
            final Item newItem = inv.getItem(oldSlot);
            inv.setItem(slot, newItem);
            inv.setItem(oldSlot, item);
            inv.sendContents(nukkitPlayer);
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:31,代码来源:BrushListener.java


注:本文中的cn.nukkit.event.player.PlayerItemHeldEvent.getPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。