當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。