當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityChangeBlockEvent類代碼示例

本文整理匯總了Java中org.bukkit.event.entity.EntityChangeBlockEvent的典型用法代碼示例。如果您正苦於以下問題:Java EntityChangeBlockEvent類的具體用法?Java EntityChangeBlockEvent怎麽用?Java EntityChangeBlockEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EntityChangeBlockEvent類屬於org.bukkit.event.entity包,在下文中一共展示了EntityChangeBlockEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onEndermanGrief

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
/**
 * Allows or prevents enderman griefing
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanGrief(final EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!(e.getEntity() instanceof Enderman)) {
        return;
    }
    if (!Util.inWorld(e.getEntity())) {
        return;
    }
    // Prevent Enderman griefing at spawn
    if (plugin.getIslands() != null && plugin.getIslands().isAtSpawn(e.getEntity().getLocation())) {
        e.setCancelled(true);
    }
    if (Settings.allowEndermanGriefing)
        return;
    // Stop the Enderman from griefing
    // plugin.getLogger().info("Enderman stopped from griefing);
    e.setCancelled(true);
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:25,代碼來源:IslandGuard.java

示例2: WitherChangeBlocks

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
/**
 * Withers change blocks to air after they are hit (don't know why)
 * This prevents this when the wither has been spawned by a visitor
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void WitherChangeBlocks(EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Only cover withers in the island world
    if (e.getEntityType() != EntityType.WITHER || !Util.inWorld(e.getEntity()) ) {
        return;
    }
    if (mobSpawnInfo.containsKey(e.getEntity())) {
        // We know about this wither
        if (DEBUG) {
            plugin.getLogger().info("DEBUG: We know about this wither");
        }
        if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) {
            // Cancel the block changes
            if (DEBUG) {
                plugin.getLogger().info("DEBUG: cancelled wither block change");
            }
            e.setCancelled(true);
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:29,代碼來源:FlyingMobEvents.java

示例3: onEntityChangeBlock

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler(priority=EventPriority.LOWEST)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
	if (e.getEntity() instanceof FallingBlock) {
		if (Variables.blocks.contains(e.getEntity().getUniqueId())) {
			e.setCancelled(true);
			e.getEntity().remove();
		}
	}
	else if (e.getEntity() instanceof Wither) {
		SlimefunItem item = BlockStorage.check(e.getBlock());
		if (item != null) {
			if (item.getName().equals("WITHER_PROOF_OBSIDIAN")) e.setCancelled(true);
			if (item.getName().equals("WITHER_PROOF_GLASS")) e.setCancelled(true);
		}
	}
}
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:17,代碼來源:ItemListener.java

示例4: onFallingThings

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
/**
 * Prevent gaming by dropping sand/gravel/gravity blocks
 * 
 * @param event
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onFallingThings(EntityChangeBlockEvent event) {
	Material from = event.getBlock().getType();
	if (!event.getBlock().isEmpty() && !event.getBlock().isLiquid()) {
		if (!from.hasGravity()) return;
		if (!from.isBlock()) return;
		// At this point we've confirmed that the FROM used to be a block, that is now falling.
		debug("Block about to fall from {0}, was a {1}", event.getBlock().getLocation(), from);
	} else {
		// if (event.getBlock().isEmpty() || event.getBlock().isLiquid()) {
		// At this point we've confirmed that the FROM is air or liquid e.g. this is a block
		// that is done falling and wants to be a block again.
		if (EntityType.FALLING_BLOCK != event.getEntityType()) return;
		debug("Block has fallen to {0}, was a {1}", event.getBlock().getLocation(), from);
	}
	// track a break at FROM and TO, so you can't game sand/gravel by dropping it into a chunk.
	plugin.getTracking().trackBreak(event.getBlock().getLocation());
}
 
開發者ID:DevotedMC,項目名稱:HiddenOre,代碼行數:24,代碼來源:ExploitListener.java

示例5: onEntityChangeBLock

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityChangeBLock(EntityChangeBlockEvent event)
{
	if(!GriefPrevention.instance.config_endermenMoveBlocks && event.getEntityType() == EntityType.ENDERMAN)
	{
		event.setCancelled(true);
	}
	
	else if(!GriefPrevention.instance.config_silverfishBreakBlocks && event.getEntityType() == EntityType.SILVERFISH)
	{
		event.setCancelled(true);
	}
	
	//don't allow the wither to break blocks, when the wither is determined, too expensive to constantly check for claimed blocks
	else if(event.getEntityType() == EntityType.WITHER && GriefPrevention.instance.config_claims_worldModes.get(event.getBlock().getWorld()) != ClaimsMode.Disabled)
	{
		event.setCancelled(true);
	}
}
 
開發者ID:john01dav,項目名稱:GriefPreventionPlus,代碼行數:20,代碼來源:EntityEventHandler.java

示例6: onEntityPickup

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityPickup(EntityChangeBlockEvent event)
{
	//FEATURE: endermen don't steal claimed blocks
	
	//if its an enderman
	if(event.getEntity() instanceof Enderman)
	{
		//and the block is claimed
		if(this.dataStore.getClaimAt(event.getBlock().getLocation(), false, null) != null)
		{
			//he doesn't get to steal it
			event.setCancelled(true);
		}
	}
}
 
開發者ID:john01dav,項目名稱:GriefPreventionPlus,代碼行數:17,代碼來源:EntityEventHandler.java

示例7: onChangeBlock

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler
public void onChangeBlock(EntityChangeBlockEvent e){	
	if (e.isCancelled()){
		return;
	}
	
	if (e.getEntity() instanceof Player){
		Player p = (Player) e.getEntity();    	
    	Block b = e.getBlock();
    	Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
   		if (r != null && !r.canBuild(p)){
   			RPLang.sendMessage(p, "blocklistener.region.cantbreak");
       		e.setCancelled(true);
   		}
   	}
}
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:17,代碼來源:RPMine19.java

示例8: WitherBlockBreak

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler
public void WitherBlockBreak(EntityChangeBlockEvent event) {
	RedProtect.get().logger.debug("RPEntityListener - Is EntityChangeBlockEvent");
	if (event.isCancelled()) {
        return;
    }
	Entity e = event.getEntity();    	
	if (e instanceof Monster) {
        Region r = RedProtect.get().rm.getTopRegion(event.getBlock().getLocation());
        if (!cont.canWorldBreak(event.getBlock())){        		        		
    		event.setCancelled(true);
    		return;
    	} 
        if (r != null && !r.canMobLoot()){
     	   event.setCancelled(true);
        }
	}
}
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:19,代碼來源:RPEntityListener.java

示例9: MonsterBlockBreak

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler
 public void MonsterBlockBreak(EntityChangeBlockEvent event) {
 	Entity e = event.getEntity();    	
 	Block b = event.getBlock();
 	Region r = RedProtect.get().rm.getTopRegion(event.getBlock().getLocation());
 	if (r != null){
   	   return;
     }
 	
 	if (b != null){
 		RedProtect.get().logger.debug("RPGlobalListener - Is EntityChangeBlockEvent event. Block: "+b.getType().name());
 	}
 	
 	if (e instanceof Monster) {
         if (!RPConfig.getGlobalFlagBool(e.getWorld().getName()+".entity-block-damage")){
         	event.setCancelled(true);
         }
 	}
 	if (e instanceof Player){
 		Player p = (Player) e;
 		if (!bypassBuild(p, b, 2)){
 			event.setCancelled(true);
}
 	}
 }
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:26,代碼來源:RPGlobalListener.java

示例10: onEntityFall

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler(ignoreCancelled=true, priority=EventPriority.HIGHEST)
public void onEntityFall(EntityChangeBlockEvent event) {
    if (event.getEntityType() != EntityType.FALLING_BLOCK) {
        return;
    }
    Block block = event.getBlock();
    World world = block.getWorld();
    String worldname = world.getName();
    if (!PlotSquared.isPlotWorld(worldname)) {
        return;
    }
    Location loc = BukkitUtil.getLocation(block.getLocation());
    Plot plot = MainUtil.getPlot(loc);
    if (plot == null) {
        return;
    }
    if (FlagManager.isPlotFlagTrue(plot, "disable-physics")) {
        event.setCancelled(true);
    }
}
 
開發者ID:Mayomi,項目名稱:PlotSquared-Chinese,代碼行數:21,代碼來源:PlayerEvents.java

示例11: onEntityBlockChange

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onEntityBlockChange(EntityChangeBlockEvent event) {
	bcoord.setFromLocation(event.getBlock().getLocation());

	StructureBlock sb = CivGlobal.getStructureBlock(bcoord);
	if (sb != null) {
		event.setCancelled(true);
		return;
	}

	RoadBlock rb = CivGlobal.getRoadBlock(bcoord);
	if (rb != null) {
		event.setCancelled(true);
		return;
	}

	CampBlock cb = CivGlobal.getCampBlock(bcoord);
	if (cb != null) {
		event.setCancelled(true);
		return;
	}

	return;
}
 
開發者ID:netizen539,項目名稱:civcraft,代碼行數:25,代碼來源:BlockListener.java

示例12: onEntityChangeBlock

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
@EventHandler(priority=EventPriority.LOWEST)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
	if (e.getEntity() instanceof FallingBlock) {
		if (Variables.blocks.contains(e.getEntity().getUniqueId())) {
			e.setCancelled(true);
			e.getEntity().remove();
		}
	}
	else if (e.getEntity() instanceof Wither) {
		SlimefunItem item = BlockStorage.check(e.getBlock());
		if (item != null) {
			if (item.getID().equals("WITHER_PROOF_OBSIDIAN")) e.setCancelled(true);
			if (item.getID().equals("WITHER_PROOF_GLASS")) e.setCancelled(true);
		}
	}
}
 
開發者ID:TheBusyBiscuit,項目名稱:Slimefun4,代碼行數:17,代碼來源:ItemListener.java

示例13: onEndermanGrief

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
/**
 * Allows or prevents enderman griefing
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEndermanGrief(final EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!(e.getEntity() instanceof Enderman)) {
        return;
    }
    if (!inWorld(e.getEntity())) {
        return;
    }
    // Prevent Enderman griefing at spawn
    if (plugin.getGrid() != null && plugin.getGrid().isAtSpawn(e.getEntity().getLocation())) {
        e.setCancelled(true);
    }
    if (Settings.allowEndermanGriefing)
        return;
    // Stop the Enderman from griefing
    // plugin.getLogger().info("Enderman stopped from griefing);
    e.setCancelled(true);
}
 
開發者ID:tastybento,項目名稱:acidisland,代碼行數:25,代碼來源:IslandGuard.java

示例14: WitherChangeBlocks

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
/**
 * Withers change blocks to air after they are hit (don't know why)
 * This prevents this when the wither has been spawned by a visitor
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void WitherChangeBlocks(EntityChangeBlockEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Only cover withers in the island world
    if (e.getEntityType() != EntityType.WITHER || !IslandGuard.inWorld(e.getEntity()) ) {
        return;
    }
    if (mobSpawnInfo.containsKey(e.getEntity())) {
        // We know about this wither
        if (DEBUG) {
            plugin.getLogger().info("DEBUG: We know about this wither");
        }
        if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) {
            // Cancel the block changes
            if (DEBUG) {
                plugin.getLogger().info("DEBUG: cancelled wither block change");
            }
            e.setCancelled(true);
        }
    }
}
 
開發者ID:tastybento,項目名稱:acidisland,代碼行數:29,代碼來源:FlyingMobEvents.java

示例15: onEntityChangeBlock

import org.bukkit.event.entity.EntityChangeBlockEvent; //導入依賴的package包/類
/**
   * On entity change block.
   *
   * @param event the event
   */
  @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
  public void onEntityChangeBlock(EntityChangeBlockEvent event) {

      // Crop trample
IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
		event.getBlock().getLocation());
      Material matFrom = event.getBlock().getType();
      Material matTo = event.getTo();
Player player;

if(event.getEntity() instanceof Player
		&& playerConf.get(player = (Player) event.getEntity()) != null // Citizens bugfix
&& ((land instanceof ILand && ((ILand) land).isBanned(player))
		|| (matFrom == Material.SOIL
		&& matTo == Material.DIRT
		&& !checkPermission(land, player,
				PermissionList.CROP_TRAMPLE.getPermissionType())))) {
	event.setCancelled(true);
}
  }
 
開發者ID:Tabinol,項目名稱:Factoid,代碼行數:26,代碼來源:PlayerListener.java


注:本文中的org.bukkit.event.entity.EntityChangeBlockEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。