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


Java PlayerInteractAtEntityEvent.isCancelled方法代码示例

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


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

示例1: onPlayerInteractAtEntity

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerInteractAtEntity(final PlayerInteractAtEntityEvent event) { // TEST
	try {
		if (event.getPlayer() == null || event.getRightClicked() == null) { return; }

		if (!this.entityHandlers.isEmpty() && !event.isCancelled()) {
			final Menu menu = new Menu("Kontextmen�: " + event.getRightClicked().getType());

			for (final BiConsumer<PlayerInteractEntityEvent, Menu> consumer : this.entityHandlers) {
				try { consumer.accept(event, menu); }
				catch (final Exception e) { CraftoMessenger.report(this.getClass(), "A playerinteractATentityevent consumer ("+consumer+") got an exception!", e); }
			}

			if (!menu.isEmpty()) {
				menu.show(event.getPlayer());
				event.setCancelled(true);
				event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.BLOCK_WOODEN_DOOR_OPEN, 1.0f, 2.0f);
			}
		}
	}
	catch (Exception outsideException) { CraftoMessenger.report(getClass(), "Failed to handle PlayerInteractEntityEvent!", outsideException); }
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:23,代码来源:ContextModule.java

示例2: onPlayerInteract

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerInteract(PlayerInteractAtEntityEvent e) {
	if (!e.isCancelled())
	if (e.getHand().equals(EquipmentSlot.HAND))
	if (e.getRightClicked().getUniqueId().equals(id)) {
		e.setCancelled(true);
		this.interact(e.getPlayer());
	}
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:10,代码来源:NPC.java

示例3: onAttemptInteractAS

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
 public void onAttemptInteractAS(PlayerInteractAtEntityEvent e) {
     if (e.isCancelled()) {
         return;
     }
     
     Entity ent = e.getRightClicked();
     Location l = ent.getLocation();
     Region r = RedProtect.get().rm.getTopRegion(l);
     Player p = e.getPlayer();
     if (r == null){
     	//global flags
     	if (ent instanceof ArmorStand) {
             if (!RPConfig.getGlobalFlagBool(l.getWorld().getName()+".build")) {
             	e.setCancelled(true);
                 return;
             }
         }
     	return;
     }
     
     if (ent instanceof ArmorStand) {
         if (r != null && !r.canBuild(p)) {
         	RPLang.sendMessage(p, "playerlistener.region.cantedit");
             e.setCancelled(true);
}
     }
 }
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:29,代码来源:RPMine18.java


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