本文整理汇总了Java中org.bukkit.event.world.StructureGrowEvent.getBlocks方法的典型用法代码示例。如果您正苦于以下问题:Java StructureGrowEvent.getBlocks方法的具体用法?Java StructureGrowEvent.getBlocks怎么用?Java StructureGrowEvent.getBlocks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.world.StructureGrowEvent
的用法示例。
在下文中一共展示了StructureGrowEvent.getBlocks方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TreeGrowChecker
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void TreeGrowChecker(StructureGrowEvent event) {
if (ConfigPatch.safetyBonemeal) {
if(event.isFromBonemeal() == false) {
return;
}
List<BlockState> blocks = event.getBlocks();
int bs = blocks.size();
for(int i = 0;i<bs;i++){
Block block = blocks.get(i).getBlock();
if(block.getType() != Material.AIR && block.getType() != Material.SAPLING && block.getType() != event.getLocation().getBlock().getRelative(BlockFace.DOWN).getType()){
event.setCancelled(true);
if (event.getPlayer() != null) {
AzureAPI.log(event.getPlayer(), "§c这棵树生长区域有方块阻挡,请不要尝试利用骨粉BUG!");
return;
}
}
}
}
}
示例2: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
/**
* Converts trees to gravel and glowstone
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.netherTrees) {
return;
}
if (!Settings.netherGenerate || IslandWorld.getNetherWorld() == null) {
return;
}
// Check world
if (!e.getLocation().getWorld().equals(IslandWorld.getNetherWorld())) {
return;
}
for (BlockState b : e.getBlocks()) {
if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
b.setType(Material.GRAVEL);
} else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
b.setType(Material.GLOWSTONE);
}
}
}
示例3: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent e){
RedProtect.get().logger.debug("RPBlockListener - Is StructureGrowEvent event");
if (!RPConfig.getBool("deny-structure-bypass-regions")){
return;
}
Region rfrom = RedProtect.get().rm.getTopRegion(e.getLocation());
for (BlockState bstt:e.getBlocks()){
Region rto = RedProtect.get().rm.getTopRegion(bstt.getLocation());
Block bloc = bstt.getLocation().getBlock();
//deny blocks spread in/out regions
if (rfrom != null && rto != null && rfrom != rto && !rfrom.sameLeaders(rto)){
bstt.setType(bloc.getType());
}
if (rfrom == null && rto != null){
bstt.setType(bloc.getType());
}
if (rfrom != null && rto == null){
bstt.setType(bloc.getType());
}
bstt.update();
}
}
示例4: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
/**
* Prevent trees from growing above beacons
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG)
getLogger().info("DEBUG: " + e.getEventName());
World world = e.getLocation().getWorld();
if (!world.equals(getBeaconzWorld())) {
return;
}
for (BlockState b : e.getBlocks()) {
if (getRegister().isAboveBeacon(b.getLocation())) {
e.setCancelled(true);
break;
}
}
}
示例5: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onStructureGrow(final StructureGrowEvent e) {
if (!PlotSquared.isPlotWorld(e.getWorld().getName())) {
return;
}
final List<BlockState> blocks = e.getBlocks();
if (blocks.size() == 0) {
return;
}
Plot origin = MainUtil.getPlot(BukkitUtil.getLocation(blocks.get(0).getLocation()));
BlockState start = blocks.get(0);
for (int i = blocks.size() - 1; i >= 0; i--) {
final Location loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
final Plot plot = MainUtil.getPlot(loc);
if (!MainUtil.equals(plot, origin)) {
e.getBlocks().remove(i);
}
}
}
示例6: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
if (plugin.getChestSettings().allowDestroyBy(AttackType.SAPLING)) {
return;
}
// Check deleted blocks
List<BlockState> blocks = event.getBlocks();
for (Iterator<BlockState> it = blocks.iterator(); it.hasNext();) {
BlockState blockState = it.next();
if (blockState.getType() == Material.AIR) {
// Almost all replaced blocks are air, so this is a cheap,
// zero-allocation way out
continue;
}
if (isProtected(blockState.getBlock())) {
it.remove();
}
}
}
示例7: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
/**
* Converts trees to gravel and glowstone
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.netherTrees) {
return;
}
if (!Settings.createNether || ASkyBlock.getNetherWorld() == null) {
return;
}
// Check world
if (!e.getLocation().getWorld().equals(ASkyBlock.getNetherWorld())) {
return;
}
for (BlockState b : e.getBlocks()) {
if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
b.setType(Material.GRAVEL);
} else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
b.setType(Material.GLOWSTONE);
}
}
}
示例8: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onTreeGrow(StructureGrowEvent event)
{
if(this.rtCommand.GetPlayerSetting(event.getPlayer().getName()))
{
Material material = this.GetRndMaterial();
byte color = this.HandleWoolColor();
if(event.isFromBonemeal())
{
for(BlockState blockState : event.getBlocks())
{
if(blockState.getType() == Material.LEAVES)
{
this.HandleSpecialBlock(material, blockState, color);
}
}
}
}
}
示例9: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent event) throws InterruptedException {
if (disabling) { return; }
while (plugin.isUpdatingChecks) {
Thread.sleep(25);
}
for (BlockState blockState : event.getBlocks()) {
plugin.needsCheck.add(blockState.getBlock());
}
}
示例10: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent event) {
for(BlockState block : event.getBlocks()) {
BlockProtection blockProtection = this.module.getProtectManager().getBlockProtection(block.getBlock().getLocation());
if(blockProtection.exists()) {
event.setCancelled(true);
break;
}
}
}
示例11: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onStructureGrow(StructureGrowEvent e) {
for (BlockState state : e.getBlocks()) {
Block newBlock = state.getBlock();
if (shopUtils.isShop(newBlock.getLocation()) || shopUtils.isShop(newBlock.getRelative(BlockFace.DOWN).getLocation())) {
e.setCancelled(true);
}
}
}
示例12: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
/**
* Monitor StructureGrow events.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
if (!mcMMO.getPlaceStore().isTrue(event.getLocation().getBlock())) {
return;
}
for (BlockState blockState : event.getBlocks()) {
mcMMO.getPlaceStore().setFalse(blockState);
}
}
示例13: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
// Get the bounding box for all the blocks involved.
final List<BlockState> blocks = event.getBlocks();
Location[] cube = BlockUtils.getBounds(blocks);
// Now, see if any portals are involved.
final ArrayList<ABPortal> portals = plugin.getManager().getWithin(cube[0], cube[1]);
if ( portals == null || portals.size() == 0 )
return;
// See if any important frame blocks were affected. This is awful. A nested for loop.
// Thankfully it won't come up often. Use an iterator and remove the blocks that
// intersect with portal frames.
for(final Iterator<BlockState> it = blocks.iterator(); it.hasNext(); ) {
final BlockState bs = it.next();
final World world = bs.getWorld();
final int x = bs.getX(), y = bs.getY(), z = bs.getZ();
for(final ABPortal portal: portals) {
if ( portal.isInFrame(world, x, y, z) ) {
it.remove();
break;
}
}
}
// Did we remove everything?
if ( blocks.size() == 0 ) {
event.setCancelled(true);
return;
}
// After the block is gone, update all our portals.
if ( portals.size() > 0 )
plugin.getServer().getScheduler().runTask(plugin, new UpdatePortals(event, portals));
}