本文整理汇总了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());
}
}
}
示例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();
}
}
}
}
示例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);
}
}
}