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