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


Java HangingPlaceEvent.getEntity方法代码示例

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


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

示例1: onPlayerLeashHitch

import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerLeashHitch(final HangingPlaceEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info("DEBUG: block placed " + e.getBlock().getType());
        plugin.getLogger().info("DEBUG: entity " + e.getEntity().getType());
    }
    if (Settings.allowAutoActivator && e.getPlayer().getName().equals("[CoFH]")) {
        return;
    }
    // plugin.getLogger().info(e.getEventName());
    if (Util.inWorld(e.getPlayer())) {
        if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
            if (!actionAllowed(e.getPlayer(), e.getBlock().getLocation(), SettingsFlag.LEASH)) {
                Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
                e.setCancelled(true);
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:21,代码来源:IslandGuard.java

示例2: onPlayerLeashHitch

import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerLeashHitch(final HangingPlaceEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info("DEBUG: block placed " + e.getBlock().getType());
        plugin.getLogger().info("DEBUG: entity " + e.getEntity().getType());
    }
    if (Settings.allowedFakePlayers.contains(e.getPlayer().getName())) return;

    // plugin.getLogger().info(e.getEventName());
    if (inWorld(e.getPlayer())) {
        if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
            if (!actionAllowed(e.getPlayer(), e.getBlock().getLocation(), SettingsFlag.LEASH)) {
                Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
                e.setCancelled(true);
                return;
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:21,代码来源:IslandGuard.java

示例3: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event)
{
    Hanging hanging = event.getEntity();
    HangingPlace action;
    if (hanging instanceof Painting)
    {
        action = this.newAction(PaintingPlace.class, hanging.getWorld());
        if (action != null)
        {
            ((PaintingPlace)action).art = ((Painting)hanging).getArt();
        }
    }
    else
    {
        action = this.newAction(HangingPlace.class, hanging.getWorld());
    }
    if (action != null)
    {
        action.setLocation(hanging.getLocation());
        action.setHanging(hanging);
        action.setPlayer(event.getPlayer());
        this.logAction(action);
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:26,代码来源:ListenerHanging.java

示例4: onHangingPlaceEvent

import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
/**
 * Event handler to watch whenever an itemframe is placed.
 * This will remove the cache of the hopper it was placed on.
 * 
 * @param event HangingPlaceEvent containing data about the item being hung. We care about an ItemFrame being placed.
 */
@EventHandler(ignoreCancelled=true)
public void onHangingPlaceEvent(HangingPlaceEvent event) {
    if (event.getEntity() instanceof ItemFrame) {
        if (event.getBlock().getType().equals(Material.HOPPER)) {
            Player player = event.getPlayer();
            if (!player.hasPermission("hopperfiltersimplified.build.place.itemframe")) {
                plugin.sendMessageInfo(player, "You do not have rights to place a hopper filter itemFrame.");
                event.setCancelled(true);
                return;
            }
            //debug if requested
            if (plugin.debugLevel_get() > 0) plugin.getLogger().info("ItemFrame placed at (" + event.getBlock().getLocation().toString() + ")");

            //Clear the cache from the hopper around the Hopper the itemFrame was placed on.
            plugin.knownHoppersCache_ClearAroundLocation(event.getBlock().getLocation());
        }
    }        
}
 
开发者ID:TheNut,项目名称:HopperFilterSimplified,代码行数:25,代码来源:HfsBlockListener.java

示例5: onHangingPlace

import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
/**
    * Handles hanging entity spawning
    *
    * @param e an event representing a hanging entity that has spawned
    * @see HangingPlaceEvent
    * @since 4.0.4
    */
@EventHandler(ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent e) {
	if (ArenaManager.getInstance().getArena(e.getPlayer()) == null)
		return;
	
	Entity entity = e.getEntity();
	Plot plot;
	if ((plot = Plot.getPlot(entity.getLocation())) != null) {
		if (!plot.addEntity(entity))
			e.setCancelled(true);
	} else
		e.setCancelled(true);
}
 
开发者ID:stefvanschie,项目名称:buildinggame,代码行数:21,代码来源:EntitySpawn.java

示例6: onHangingPlaceEvent

import org.bukkit.event.hanging.HangingPlaceEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.NORMAL )
   public void onHangingPlaceEvent(HangingPlaceEvent event) 
{
	System.out.println(" plugin:  onHangingPlace Event  ");
       if (event.getEntity() instanceof ItemFrame) 
       {
       	Player player = event.getPlayer();
       	System.out.println(" player:  "+player.getDisplayName() );
       	System.out.println(" event.getBlock().getType()  "+event.getBlock().getType() );  // auf was
       	plugin.itemFrame1 = (ItemFrame)event.getEntity();
       }
       System.out.println("  ");
}
 
开发者ID:Kryssi79,项目名称:RahmenTests,代码行数:14,代码来源:RahmenListener.java


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