本文整理汇总了Java中org.bukkit.event.block.BlockSpreadEvent.getBlock方法的典型用法代码示例。如果您正苦于以下问题:Java BlockSpreadEvent.getBlock方法的具体用法?Java BlockSpreadEvent.getBlock怎么用?Java BlockSpreadEvent.getBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.block.BlockSpreadEvent
的用法示例。
在下文中一共展示了BlockSpreadEvent.getBlock方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onBlockSpread(final BlockSpreadEvent event) {
if (event.isCancelled())
return;
final Block block = event.getBlock();
// Ok so a frame block fire spreads
// Find the nearest gate!
final WorldCoord blockCoord = new WorldCoord(block);
final Gate nearestGate = Gates.gateFromFrameAndSurround(blockCoord);
if (nearestGate != null) {
event.setCancelled(true);
}
}
示例2: onSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpread(BlockSpreadEvent event)
{
if (event.getNewState().getType() == FIRE)
{
Block oldBlock = event.getBlock();
IgniteSpread action = this.newAction(IgniteSpread.class, oldBlock.getWorld());
if (action != null)
{
action.setOldBlock(oldBlock.getState());
action.setNewBlock(event.getNewState());
action.setLocation(oldBlock.getLocation());
action.setSource(event.getSource().getLocation());
this.logAction(action);
}
}
}
示例3: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent e) {
Block source = e.getSource();
WorldChunk sourceChunk = CropControl.getDAO().getChunk(source.getChunk());
int sourceX = source.getX();
int sourceY = source.getY();
int sourceZ = source.getZ();
Block block = e.getBlock();
WorldChunk chunk = CropControl.getDAO().getChunk(block.getChunk());
int x = block.getX();
int y = block.getY();
int z = block.getZ();
if (!harvestableCrops.containsKey(source.getType()) && source.getType() != Material.CHORUS_FLOWER
&& source.getType() != Material.CHORUS_PLANT && block.getType() != Material.CHORUS_FLOWER
&& block.getType() != Material.CHORUS_PLANT)
return;
Crop sourceCrop = sourceChunk.getCrop(sourceX, sourceY, sourceZ);
if (sourceCrop != null) {
UUID placerUUID = sourceCrop.getPlacer();
Crop.create(chunk, x, y, z, source.getType().toString(), null, placerUUID,
System.currentTimeMillis(), true);
return;
}
TreeComponent treeComponent = sourceChunk.getTreeComponent(sourceX, sourceY, sourceZ);
if (treeComponent != null) {
treeComponent.setHarvestable(true);
// TODO: should we differentiate between flower and plant here?
TreeComponent.create(treeComponent.getTreeID(), chunk, x, y, z, Material.CHORUS_PLANT.toString(),
treeComponent.getPlacer(), true);
}
}
示例4: onSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onSpread(BlockSpreadEvent spread) {
if (spread.getBlock() == null) {
return;
}
Game game =
BedwarsRel.getInstance().getGameManager()
.getGameByLocation(spread.getBlock().getLocation());
if (game == null) {
return;
}
if (game.getState() != GameState.RUNNING) {
return;
}
if (spread.getNewState() == null || spread.getSource() == null) {
return;
}
if (spread.getNewState().getType().equals(Material.FIRE)) {
spread.setCancelled(true);
return;
}
if (game.getRegion().isPlacedBlock(spread.getSource())) {
game.getRegion().addPlacedBlock(spread.getBlock(), spread.getBlock().getState());
} else {
game.getRegion().addPlacedUnbreakableBlock(spread.getBlock(), spread.getBlock().getState());
}
}
示例5: onFireSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler
public void onFireSpread(BlockSpreadEvent e){
RedProtect.get().logger.debug("RPBlockListener - Is BlockSpreadEvent event");
if (e.isCancelled()){
return;
}
Block bfrom = e.getSource();
Block bto = e.getBlock();
RedProtect.get().logger.debug("Is BlockSpreadEvent event, source is " + bfrom.getType().name());
Region rfrom = RedProtect.get().rm.getTopRegion(bfrom.getLocation());
Region rto = RedProtect.get().rm.getTopRegion(bto.getLocation());
if ((bfrom.getType().equals(Material.FIRE) || bfrom.getType().name().contains("LAVA")) && rfrom != null && !rfrom.canFire()){
e.setCancelled(true);
return;
}
//deny blocks spread in/out regions
if (rfrom != null && rto != null && rfrom != rto && !rfrom.sameLeaders(rto)){
e.setCancelled(true);
return;
}
if (rfrom == null && rto != null){
e.setCancelled(true);
return;
}
if (rfrom != null && rto == null){
e.setCancelled(true);
}
}
示例6: onBS
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBS(final BlockSpreadEvent e) {
final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.isPlotWorld(loc.getWorld())) {
if (MainUtil.isPlotRoad(loc)) {
e.setCancelled(true);
}
}
}
示例7: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent event) {
Block block = event.getBlock();
Location location = BukkitUtil.getLocation(block.getLocation());
if (location.isPlotRoad()) {
event.setCancelled(true);
return;
}
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Plot plot = area.getOwnedPlot(location);
if (plot == null) {
return;
}
switch (event.getSource().getType()) {
case GRASS:
if (Flags.GRASS_GROW.isFalse(plot)) {
event.setCancelled(true);
}
break;
case MYCEL:
if (Flags.MYCEL_GROW.isFalse(plot)) {
event.setCancelled(true);
}
break;
case VINE:
if (Flags.VINE_GROW.isFalse(plot)) {
event.setCancelled(true);
}
break;
}
}
示例8: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockSpread(BlockSpreadEvent event) {
Block source = event.getSource();
Block to = event.getBlock();
ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
// Block spreading out and into the arena
for(Arena arena : am.getArenas())
if(arena.isArenaCuboidSet())
if((arena.getArenaCuboid().isInsideCuboid(source) &&
!arena.getArenaCuboid().isInsideCuboid(to)) ||
(arena.getArenaCuboid().isInsideCuboid(to) &&
!arena.getArenaCuboid().isInsideCuboid(source)))
event.setCancelled(true);
}