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


Java PlayerInteractAtEntityEvent类代码示例

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


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

示例1: onPlayerInteract

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
 * Handle interaction with armor stands V1.8
 * Note - some armor stand protection is done in IslandGuard.java, e.g. against projectiles.
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onPlayerInteract(final PlayerInteractAtEntityEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("1.8 " + e.getEventName());
    }
    if (!Util.inWorld(e.getPlayer())) {
        return;
    }
    if (e.getRightClicked() != null && e.getRightClicked().getType().equals(EntityType.ARMOR_STAND)) {
        if (actionAllowed(e.getPlayer(), e.getRightClicked().getLocation(), SettingsFlag.ARMOR_STAND)) {
            return;
        }
        e.setCancelled(true);
        Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:23,代码来源:IslandGuard1_8.java

示例2: EntityClick

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
	Player p = e.getPlayer();
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			for(Rollercoaster att : Main.r.Attracties.values()){
				if(att.getSeats().contains(clickedA)){
					if(att.allowSit != false){
						e.setCancelled(true);
						p.teleport(clickedA);
						clickedA.setPassenger(p);
						att.addPassagier(p, clickedA);
					}
					return;
				}
			}
		}
	}
}
 
开发者ID:LimitedDani,项目名称:Achtbaan,代码行数:22,代码来源:EntityClick_Listener.java

示例3: EntityClick

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
	Player p = e.getPlayer();
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			for(attractie att : Main.r.Attracties.values()){
				if(att.getSeats().contains(clickedA)){
					if(att.allowSit == true){
						e.setCancelled(true);
						p.teleport(clickedA);
						clickedA.setPassenger(p);
						att.addPassagier(p, clickedA);
					}
					return;
				}
			}
		}
	}
}
 
开发者ID:LimitedDani,项目名称:Achtbaan,代码行数:22,代码来源:EntityClick_Listener.java

示例4: onPlayerInteractAtEntity

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
    Player player = event.getPlayer();
    Entity entity = event.getRightClicked();

    if (entity.getCustomName() != null && entity.getCustomName().toLowerCase().contains("join deathswap")) {
        if (GameState.isGameState(GameState.LOBBY)) {
            if (DeathSwap.getInstance().isInQueue(player)) {
                player.sendMessage(ChatUtil.formatWithPrefix("You're already in the DeathSwap queue!"));
                return;
            }
            player.sendMessage(ChatUtil.formatWithPrefix("You're in the DeathSwap queue."));
            DeathSwap.getInstance().joinQueue(player);
            player.closeInventory();
            event.setCancelled(true);
        }
    }

}
 
开发者ID:ShadowTechnicalSystems,项目名称:MCDeathSwap,代码行数:20,代码来源:PlayerInteract.java

示例5: onPlayerInteract

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
 * Handle interaction with armor stands V1.8
 * Note - some armor stand protection is done in IslandGuard.java, e.g. against projectiles.
 * 
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onPlayerInteract(final PlayerInteractAtEntityEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("1.8 " + e.getEventName());
    }
    if (!IslandGuard.inWorld(e.getPlayer())) {
        return;
    }
    if (e.getRightClicked() != null && e.getRightClicked().getType().equals(EntityType.ARMOR_STAND)) {
        if (actionAllowed(e.getPlayer(), e.getRightClicked().getLocation(), SettingsFlag.ARMOR_STAND)) {
            return;
        }
        e.setCancelled(true);
        Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:23,代码来源:IslandGuard1_8.java

示例6: 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

示例7: onHitEndCrystal

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
 * Handle interaction with end crystals 1.9
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onHitEndCrystal(final PlayerInteractAtEntityEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("1.9 " +e.getEventName());
    }
    if (!Util.inWorld(e.getPlayer())) {
        return;
    }
    if (e.getPlayer().isOp()) {
        return;
    }
    // This permission bypasses protection
    if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
        return;
    }
    if (e.getRightClicked() != null && e.getRightClicked().getType().equals(EntityType.ENDER_CRYSTAL)) {
        // Check island
        Island island = plugin.getIslands().getIslandAt(e.getRightClicked().getLocation());
        if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
            return;
        }
        if (island !=null) {
            if (island.getMembers().contains(e.getPlayer().getUniqueId()) || island.getFlag(SettingsFlag.BREAK_BLOCKS)) {
                return;
            }
        }
        e.setCancelled(true);
        Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:36,代码来源:IslandGuard1_9.java

示例8: onPlayerInteractEntity

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
 * Prevents lobby players from interacting in the world.
 *
 * @param event The event
 */
@EventHandler
public void onPlayerInteractEntity(final PlayerInteractAtEntityEvent event) {
  if (event.getPlayer().getLocation().getWorld().equals(world)) {
    event.setCancelled(true);
  }
}
 
开发者ID:twizmwazin,项目名称:OpenUHC,代码行数:12,代码来源:LobbyModule.java

示例9: entityRightClickEvent

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler
public void entityRightClickEvent(final PlayerInteractAtEntityEvent event) {
    if (this.isBall(event.getRightClicked())) {
        if (Config.getInstance().isUseEngineV2()) {
            final Ball ball = this.getBall(event.getRightClicked());
            ball.pass(event.getPlayer());
        }
        event.setCancelled(true);
    } else if (this.isDeadBall(event.getRightClicked())) {
        event.setCancelled(true);
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:13,代码来源:BallListener.java

示例10: EntityClick

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
	Player p = e.getPlayer();
	if(e.getRightClicked() instanceof ArmorStand){
		ArmorStand clickedA = (ArmorStand) e.getRightClicked();
		if(clickedA.getPassenger() == null){
			for(attractie att : Main.r.Attracties.values()){
				for(ArmorStand a : att.getSeats())
				{
					if(a.getLocation().getX() == clickedA.getLocation().getX() && 
							a.getLocation().getY() == clickedA.getLocation().getY() && 
							a.getLocation().getZ() == clickedA.getLocation().getZ())
					{
						if(att.allowSit == true){
							e.setCancelled(true);
							p.teleport(clickedA);
							clickedA.setPassenger(p);
							att.addPassagier(p, clickedA);
						}
						return;
					}
				}
			}
		}
	}
}
 
开发者ID:LimitedDani,项目名称:Achtbaan,代码行数:28,代码来源:EntityClick_Listener.java

示例11: onPlayerInteractAtEntity

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
 * Prevents a player that can't interact from interacting with an entity.
 *
 * @param event The event.
 */
@EventHandler(ignoreCancelled = true)
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
  if (!canInteract(event.getActor())) {
    event.setCancelled(true);
  }
}
 
开发者ID:CardinalDevelopment,项目名称:Cardinal,代码行数:12,代码来源:InteractModule.java

示例12: 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

示例13: onInteract

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
 * Catches a player's interaction and sees if it's the one we've been waiting for
 */
@EventHandler
public void onInteract(PlayerInteractAtEntityEvent e) {
	
	if (state) {
		HandlerList.unregisterAll(this);
		return;
	}

	if (QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getWorlds()
			.contains(e.getPlayer().getPlayer().getWorld().getName())) {
		for (QuestPlayer qp : participants.getParticipants()) {
			if (qp.getPlayer().isOnline() && qp.getPlayer().getPlayer().getUniqueId()
					.equals(e.getPlayer().getUniqueId())) {
				//one of our participants
				//actually check interaction now
				if (e.getRightClicked().equals(npc.getEntity())) {
					//cancel and interact
					e.setCancelled(true);
					this.state = true;
					HandlerList.unregisterAll(this);
					updateQuest();
					
					menu.show(e.getPlayer(), getGoal().getQuest());
				}
			}
		}
	}
	
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:33,代码来源:TalkRequirement.java

示例14: 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

示例15: onArmorStandInteract

import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler
public void onArmorStandInteract(PlayerInteractAtEntityEvent event) {
    if (event.getRightClicked().getUniqueId().equals(armorStand.getUniqueId())) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + "Can't manipulate this Armor Stand! " + ChatColor.GOLD + player.getName() + ChatColor.RED + " is currently editing it!");
    }
}
 
开发者ID:Phoenix616,项目名称:EditArmorStands,代码行数:8,代码来源:ArmorStandGui.java


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