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


Java EntityExplodeEvent.getLocation方法代碼示例

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


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

示例1: onExplosion

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
/**
 * Prevent the Nether spawn from being blown up
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onExplosion(final EntityExplodeEvent e) {
    if (Settings.netherIslands) {
        // Not used in the new nether
        return;
    }
    // Find out what is exploding
    Entity expl = e.getEntity();
    if (expl == null) {
        return;
    }
    // Check world
    if (!e.getEntity().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
            || e.getEntity().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
        return;
    }
    Location spawn = e.getLocation().getWorld().getSpawnLocation();
    Location loc = e.getLocation();
    if (spawn.distance(loc) < Settings.netherSpawnRadius) {
        e.blockList().clear();
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:28,代碼來源:NetherEvents.java

示例2: onExplosion

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
/**
 * Prevent the Nether spawn from being blown up
 * 
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onExplosion(final EntityExplodeEvent e) {
    if (Settings.newNether) {
        // Not used in the new nether
        return;
    }
    // Find out what is exploding
    Entity expl = e.getEntity();
    if (expl == null) {
        return;
    }
    // Check world
    if (!e.getEntity().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
            || e.getEntity().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
        return;
    }
    Location spawn = e.getLocation().getWorld().getSpawnLocation();
    Location loc = e.getLocation();
    if (spawn.distance(loc) < Settings.netherSpawnRadius) {
        e.blockList().clear();
    }
}
 
開發者ID:tastybento,項目名稱:acidisland,代碼行數:28,代碼來源:NetherPortals.java

示例3: onEntityExplode

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent explodeEvent) {
    Location location = explodeEvent.getLocation();

    //if it's NOT in the managed world, let it splode (or let other plugins worry about it)
    Region region = Region.fromLocation(location);
    if (region == null)
        return;

    //otherwise if it's close to a region post
    Location regionCenter = region.getCenter();
    regionCenter.setY(ConfigData.managedWorld.getHighestBlockYAt(regionCenter));
    if (regionCenter.distanceSquared(location) < 225)  //225 = 15 * 15
        explodeEvent.blockList().clear(); //All the noise and terror, none of the destruction (whew!).

    //NOTE!  Why not distance?  Because distance squared is cheaper and will be good enough for this.
}
 
開發者ID:RoyalDev,項目名稱:PopulationDensity,代碼行數:18,代碼來源:EntityEventHandler.java

示例4: onEntityExplode

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onEntityExplode(EntityExplodeEvent event) 
{
	Entity ent = event.getEntity();
	if( (ent != null && ent instanceof TNTPrimed) )
	{
		if( event.getLocation() != null )
		{
			if( NavyCraft.shotTNTList.containsKey(ent.getUniqueId()) )
			{
				Craft checkCraft;
				checkCraft = structureUpdate(event.getLocation(), NavyCraft.shotTNTList.get(ent.getUniqueId()));
				if( checkCraft == null ) {
					checkCraft = structureUpdate(event.getLocation().getBlock().getRelative(4,4,4).getLocation(), NavyCraft.shotTNTList.get(ent.getUniqueId()));
					if( checkCraft == null ) {
						checkCraft = structureUpdate(event.getLocation().getBlock().getRelative(-4,-4,-4).getLocation(), NavyCraft.shotTNTList.get(ent.getUniqueId()));
						if( checkCraft == null ) {
							checkCraft = structureUpdate(event.getLocation().getBlock().getRelative(2,-2,-2).getLocation(), NavyCraft.shotTNTList.get(ent.getUniqueId()));
							if( checkCraft == null ) {
								checkCraft = structureUpdate(event.getLocation().getBlock().getRelative(-2,2,2).getLocation(), NavyCraft.shotTNTList.get(ent.getUniqueId()));
							}
						}
					}
				}
				NavyCraft.shotTNTList.remove(ent.getUniqueId());
			}
			else
				structureUpdate(event.getLocation(), null);
		}
	}
 
}
 
開發者ID:Maximuspayne,項目名稱:NavyCraft2-Lite,代碼行數:33,代碼來源:MoveCraft_EntityListener.java

示例5: onEntityExplode

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void onEntityExplode(EntityExplodeEvent event)
{
	event.setCancelled(true);
	Location loc = event.getLocation();
	World world = loc.getWorld();
	world.createExplosion(loc.getX(), loc.getY(), loc.getZ(), event.getYield(), false, false);
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:9,代碼來源:PlayerInteractListener.java

示例6: onExplosion

import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void onExplosion(EntityExplodeEvent event) {
	Location loc = event.getLocation();
	NovaRegion region = RegionManager.get(loc);

	if(region != null) {
		for(Block block : new ArrayList<>(event.blockList())) {
			if(plugin.getGuildManager().isVaultBlock(block) && !region.getGuild().isRaid()) {
				event.blockList().remove(block);
			}
		}

		Message.CHAT_GUILD_EXPLOSIONATREGION.broadcast(region.getGuild());
	}
}
 
開發者ID:MarcinWieczorek,項目名稱:NovaGuilds,代碼行數:16,代碼來源:RegionInteractListener.java


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