本文整理匯總了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();
}
}
示例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();
}
}
示例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.
}
示例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);
}
}
}
示例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);
}
示例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());
}
}