本文整理匯總了Java中org.bukkit.event.entity.EntityExplodeEvent.blockList方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityExplodeEvent.blockList方法的具體用法?Java EntityExplodeEvent.blockList怎麽用?Java EntityExplodeEvent.blockList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.entity.EntityExplodeEvent
的用法示例。
在下文中一共展示了EntityExplodeEvent.blockList方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onTNTChain
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onTNTChain(EntityExplodeEvent event) {
if(!this.tracker.isEnabled(event.getEntity().getWorld())) return;
// Transfer ownership to chain-activated TNT
if(event.getEntity() instanceof TNTPrimed) {
Player owner = this.tracker.setOwner((TNTPrimed) event.getEntity(), null);
if(owner != null) {
for(Block block : event.blockList()) {
if(block.getType() == Material.TNT) {
this.tracker.setPlacer(block, owner);
}
}
}
}
}
示例2: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
if (event.getEntity() != null) {
if (event.getEntity().getType() == EntityType.PRIMED_TNT) {
for (Block block : event.blockList()) {
if (block.getType() == Material.TNT && getWhoPlaced(event.getEntity()) != null) {
Location location = block.getLocation();
tntPlaced.put(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ(), getWhoPlaced(event.getEntity()));
}
}
for (Entity entity : event.getEntity().getNearbyEntities(8, 8, 8)) {
// F.debug("Found tnt");
if (entity instanceof TNTPrimed) {
UUID playerUUID = getWhoPlaced(event.getEntity());
if(playerUUID != null) {
Dispenser dispenser;
// F.debug("found placer: " + Bukkit.getServer().getPlayer(playerUUID));
entity.setMetadata("source", new FixedMetadataValue(GamePlate.getInstance(), playerUUID));
}
}
}
}
}
}
示例3: onBlockDestroy
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockDestroy(EntityExplodeEvent event) {
try {
if (_config.RegenerateExplodedBlocks && _zone.isInside(event.getEntity().getLocation())) {
HashMap<Location, BlockContainer> _blocks = new HashMap<Location, BlockContainer>();
for (Block b : event.blockList()) {
BlockContainer bc = new BlockContainer();
bc.TypeId = b.getTypeId();
bc.TypeData = b.getData();
_blocks.put(b.getLocation(), bc);
}
BlockRestore restore = new BlockRestore(_world, _blocks);
Executors.newSingleThreadScheduledExecutor().schedule(restore, _config.DelayBeforeRegeneration, TimeUnit.MILLISECONDS);
}
}
catch (Exception ex) {
logger.info("onblock destroy in Infestation raised an exception, it's ok!");
}
}
示例4: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) {
for (Block block : new ArrayList<>(event.blockList())) {
if (block.getType().equals(Material.TNT)) {
continue;
}
boolean cancel = this.post(event,
block,
block.getState(),
this.applyAir(block),
null,
false);
if (cancel) {
event.blockList().remove(block);
}
}
}
示例5: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) {
List<Block> blocks = event.blockList();
if (!blocks.isEmpty()) {
World world = blocks.get(0).getWorld();
PluginConfig worldConfig = plugin.getConfig(world);
if (plugin.isEnabled(world) && worldConfig.getBoolean(Config.FEATURE_DUNGEONS_PROTECTED)) {
Iterator<Block> iterator = blocks.iterator();
while (iterator.hasNext()) {
Block block = iterator.next();
if (this.isProtected(block.getLocation())) {
iterator.remove();
}
}
}
}
}
示例6: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityExplode(EntityExplodeEvent event) {
if (!event.isCancelled()) {
Player player = TntTracker.getWhoPlaced(event.getEntity()) != null && Bukkit.getOfflinePlayer(TntTracker.getWhoPlaced(event.getEntity())).isOnline() ? Bukkit.getPlayer(TntTracker.getWhoPlaced(event.getEntity())) : null;
if (player != null) {
for (Block block : event.blockList()) {
if (filter == null || filter.evaluate(player, block).equals(FilterState.ALLOW)) {
if (region == null || region.contains(new BlockRegion(null, block.getLocation().toVector().add(new Vector(0.5, 0.5, 0.5))))) {
for (ItemStack drop : this.drops) {
GameHandler.getGameHandler().getMatchWorld().dropItemNaturally(block.getLocation(), drop);
}
if (this.experience != 0) {
ExperienceOrb xp = GameHandler.getGameHandler().getMatchWorld().spawn(block.getLocation(), ExperienceOrb.class);
xp.setExperience(this.experience);
}
block.setType(replace);
}
}
}
}
}
}
示例7: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityExplode(EntityExplodeEvent event) {
for (Block block : event.blockList()) {
for (Player player : Bukkit.getOnlinePlayers()) {
Location location = block.getLocation();
location.setY(location.getY() + 1);
Location playerLoc = player.getLocation();
if (playerLoc.getBlockX() == location.getBlockX() && playerLoc.getBlockY() == location.getBlockY() && playerLoc.getBlockZ() == location.getBlockZ()) {
Description description = null;
if (player.getLocation().add(new Vector(0, 1, 0)).getBlock().getType().equals(Material.LADDER)) {
description = Description.OFF_A_LADDER;
} else if (player.getLocation().add(new Vector(0, 1, 0)).getBlock().getType().equals(Material.VINE)) {
description = Description.OFF_A_VINE;
} else if (player.getLocation().getBlock().getType().equals(Material.WATER) || player.getLocation().getBlock().getType().equals(Material.STATIONARY_WATER)) {
description = Description.OUT_OF_THE_WATER;
} else if (player.getLocation().getBlock().getType().equals(Material.LAVA) || player.getLocation().getBlock().getType().equals(Material.STATIONARY_LAVA)) {
description = Description.OUT_OF_THE_LAVA;
}
OfflinePlayer damager = (TntTracker.getWhoPlaced(event.getEntity()) != null ? Bukkit.getOfflinePlayer(TntTracker.getWhoPlaced(event.getEntity())) : null);
Bukkit.getServer().getPluginManager().callEvent(new TrackerDamageEvent(player, damager, damager != null && damager.getPlayer() != null ? ((Player) damager).getItemInHand() : new ItemStack(Material.AIR), Cause.TNT, description, Type.SPLEEFED));
}
}
}
}
示例8: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onEntityExplode(EntityExplodeEvent e) {
if (e.isCancelled()){
return;
}
List<Block> toRemove = new ArrayList<>();
for (Block b:e.blockList()) {
Location l = b.getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
if (r == null && !RPConfig.getGlobalFlagBool(l.getWorld().getName()+".entity-block-damage")){
toRemove.add(b);
}
}
if (!toRemove.isEmpty()){
e.blockList().removeAll(toRemove);
}
}
示例9: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
Lot lot = this.module.getLotManager().getLot(event.getEntity().getLocation());
Town town = this.module.getLotManager().getTown(event.getEntity().getLocation());
if(lot != null || town != null) {
event.setYield(0);
event.setCancelled(true);
return;
}
for(Block block : event.blockList()) {
Lot l = this.module.getLotManager().getLot(block.getLocation());
Town t = this.module.getLotManager().getTown(block.getLocation());
if(l != null || t != null) {
event.setYield(0);
event.setCancelled(true);
break;
}
}
}
示例10: fragBallExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public void fragBallExplode(EntityExplodeEvent e) {
e.setCancelled(true);
for(Block block : e.blockList()) {
if(block.getRelative(BlockFace.UP).getType() == Material.AIR && block.getType().isSolid()) {
FallingBlock fallingBlock = block.getWorld().spawnFallingBlock(block.getLocation().add(0, 1, 0), block.getType(), block.getData());
double x = (block.getLocation().getX() - e.getLocation().getX()) / 3,
y = 1,
z = (block.getLocation().getZ() - e.getLocation().getZ()) / 3;
fallingBlock.setVelocity(new Vector(x, y, z).normalize());
fallingBlock.setMetadata("explode", new FixedMetadataValue(plugin, false));
fallingBlock.setDropItem(false);
e.setYield(0F);
}
}
}
示例11: onBlockExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockExplode(EntityExplodeEvent event) {
if(!event.isCancelled()) {
List<Block> blocks = event.blockList();
if(blocks.size() > 0) {
Location loc = blocks.get(0).getLocation();
for(Game game : gm.getGames()) {
for(Arena a : game.getArenas()) {
if(a.containsBlock(loc)) {
blocks.clear();
return;
}
}
}
}
}
}
示例12: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
/**
* Entity explode event handler<br>
* Make death chests explosion proof if chest-protection is enabled
* @param event
*/
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
// if chest-protection is not enabled in config, do nothing and return
if (!plugin.getConfig().getBoolean("chest-protection")) {
return;
}
// iterate through all blocks in explosion event and remove those that are DeathChestBlocks
ArrayList<Block> blocks = new ArrayList<Block>(event.blockList());
for (Block block : blocks) {
if (DeathChestBlock.isDeathChestBlock(block)) {
event.blockList().remove(block);
}
}
}
示例13: onExplosion
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler
public synchronized void onExplosion(EntityExplodeEvent event)
{
Plot p = plugin.getPlot(event.getLocation());
//if the plot is unclaimed or the town has destruction off, cancel the terrain damage.
if(p == null || !p.getTown().isDestructionOn())
{
event.blockList().clear();
return;
}
List<Block> blocklist = event.blockList();
for(int i = 0; i < blocklist.size(); i++)
{
Block b = blocklist.get(i);
//OPTION: Could be better if system check if the plot town is the besieged town.
//if the block's plot is unclaimed or the block is a container, exclude that block from terrain damage.
if(plugin.getPlot(new PlotLocation(b.getLocation())) == null || b.getState() instanceof InventoryHolder)
blocklist.remove(i--);
else blockBreak(p.getTown()); //increase restorefee
}
}
示例14: onEntityExplodeNormal
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityExplodeNormal(EntityExplodeEvent event) {
Map map = Rixor.getRotation().getSlot().getMap();
Client client = null;
if(event.getEntity() instanceof TNTPrimed) {
TNTPrimed tnt = (TNTPrimed) event.getEntity();
if(tnt.getSource() instanceof Player)
client = Client.getClient((Player) tnt.getSource());
}
for(Block block : event.blockList()) {
BlockState newState = block.getState();
newState.setData(new MaterialData(Material.AIR, (byte) 0));
BlockChangeEvent change = new BlockChangeEvent(event, map, client, block.getState(), newState);
Rixor.callEvent(change);
}
}
示例15: onEntityExplode
import org.bukkit.event.entity.EntityExplodeEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityExplode(EntityExplodeEvent event) {
if (!event.isCancelled()) {
Player player = TntTracker.getWhoPlaced(event.getEntity()) != null && Bukkit.getOfflinePlayer(TntTracker.getWhoPlaced(event.getEntity())).isOnline() ? Bukkit.getPlayer(TntTracker.getWhoPlaced(event.getEntity())) : null;
if (player != null) {
List<Block> toRemove = new ArrayList<>();
for (Block block : event.blockList()) {
if (filter == null || filter.evaluate(player, block, event).equals(FilterState.ALLOW)) {
if (region == null || region.contains(block.getLocation().toVector().add(new Vector(0.5, 0.5, 0.5)))) {
for (ItemStack drop : this.drops) {
GameHandler.getGameHandler().getMatchWorld().dropItemNaturally(block.getLocation(), drop);
}
if (this.experience != 0) {
ExperienceOrb xp = GameHandler.getGameHandler().getMatchWorld().spawn(block.getLocation(), ExperienceOrb.class);
xp.setExperience(this.experience);
}
toRemove.add(block);
block.setType(replaceType);
block.setData((byte) replaceDamage);
}
}
}
event.blockList().removeAll(toRemove);
}
}
}