当前位置: 首页>>代码示例>>Java>>正文


Java BlockPistonRetractEvent.getBlocks方法代码示例

本文整理汇总了Java中org.bukkit.event.block.BlockPistonRetractEvent.getBlocks方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPistonRetractEvent.getBlocks方法的具体用法?Java BlockPistonRetractEvent.getBlocks怎么用?Java BlockPistonRetractEvent.getBlocks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.block.BlockPistonRetractEvent的用法示例。


在下文中一共展示了BlockPistonRetractEvent.getBlocks方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent event) {
    if (!event.isCancelled()) {
        FilterResult filterResult = evaluator.evaluate();
        if (filterResult == FilterResult.DENY) {
            for (Region region : regions) {
                if (region.contains(event.getBlock().getLocation().clone().add(event.getDirection().getOppositeFace().getModX(), event.getDirection().getOppositeFace().getModY(), event.getDirection().getOppositeFace().getModZ()))) {
                    event.setCancelled(true);
                    return;
                } else {
                    for (Block block : event.getBlocks()) {
                        if (region.contains(block.getLocation().clone().add(event.getDirection().getOppositeFace().getModX(), event.getDirection().getOppositeFace().getModY(), event.getDirection().getOppositeFace().getModZ()))) {
                            event.setCancelled(true);
                            return;
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:22,代码来源:BuildFilterType.java

示例2: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
/**
 * Should cover even more clever implementations involving sticky pistons to game things.
 * 
 * @param event
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPistonRetract(BlockPistonRetractEvent event) {
	if (!event.isSticky()) return; // only care about stick business.

	Block source = event.getBlock();
	debug("Piston event from {0}", source.getLocation());
	Block extension = event.getBlock().getRelative(event.getDirection());
	for (Block b : event.getBlocks()) {
		Block next = b.getRelative(event.getDirection());
		if (next.equals(source) || next.equals(extension)) {
			continue;
		}
		plugin.getTracking().trackBreak(next.getLocation());
	}
	plugin.getTracking().trackBreak(source.getLocation());
	if (!source.equals(extension)) {
		plugin.getTracking().trackBreak(extension.getLocation());
	}
}
 
开发者ID:DevotedMC,项目名称:HiddenOre,代码行数:25,代码来源:ExploitListener.java

示例3: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
/**
 * Filters BlockPistonRetractEvent.
 * <p>Will filter as block removing the old position, and placing a block in the new position.</p>
 *
 * <p>Applies to: block, block place and block break.<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
  Match match = Cardinal.getMatch(event.getWorld());
  if (match == null || !event.isSticky()) {
    return;
  }
  Collection<AppliedRegion> regions = get(match, ApplyType.BLOCK, ApplyType.BLOCK_PLACE, ApplyType.BLOCK_BREAK);

  for (Block block : event.getBlocks()) {
    if (!tryPistonMove(regions, block, event)) {
      event.setCancelled(true);
      return;
    }
  }
}
 
开发者ID:CardinalDevelopment,项目名称:Cardinal,代码行数:22,代码来源:AppliedModule.java

示例4: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    Lot from = this.module.getLotManager().getLot(event.getBlock().getLocation());
    Town fromTown = this.module.getLotManager().getTown(event.getBlock().getLocation());

    for(Block block : event.getBlocks()) {
        Block toBlock = block.getRelative(event.getDirection());

        Lot blockFrom = this.module.getLotManager().getLot(block.getLocation());
        Town blockFromTown = this.module.getLotManager().getTown(block.getLocation());
        Lot blockTo = this.module.getLotManager().getLot(toBlock.getLocation());
        Town blockToTown = this.module.getLotManager().getTown(toBlock.getLocation());
        if((from != null && blockTo == null) || (from == null && blockTo != null) || from != blockTo || (fromTown != null && blockToTown == null) || (fromTown == null && blockToTown != null) || fromTown != blockToTown || (blockFrom != null && blockTo == null) || (blockFrom == null && blockTo != null) || blockFrom != blockTo || (blockFromTown != null && blockToTown == null) || (blockFromTown == null && blockToTown != null) || blockFromTown != blockToTown) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:Steveice10,项目名称:Peacecraft,代码行数:18,代码来源:LotsListener.java

示例5: onEvent

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.LOW)
public void onEvent(BlockPistonRetractEvent event)
{
    if (!Settings.allowTNTPushing) {
        // Check world
        if (!inWorld(event.getBlock())) {
            return;
        }
        for (Block block: event.getBlocks()) {
            if (block.getType() == Material.TNT) {
                event.setCancelled(true);
                break;
            }
        }
    }
    /* JAVA 8
    if (event.getBlocks().stream().anyMatch(it->it.getType()==Material.TNT))
        event.setCancelled(true);
     */
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:21,代码来源:IslandGuard.java

示例6: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    BukkitWorld world = BukkitUtil.adapt(event.getBlock().getWorld());
    if (manager.isPlotWorld(world)) {
        List<Block> blocks = event.getBlocks();
        for (Block moved : blocks) {
            PlotId id = manager.getPlotId(new Location(world, BukkitUtil.locationToVector(moved.getLocation())));
            if (id == null) {
                event.setCancelled(true);
            } else {
                event.setCancelled(api.isPlotLocked(id));

            }
        }
    }
}
 
开发者ID:WorldCretornica,项目名称:PlotMe-Core,代码行数:17,代码来源:BukkitPlotListener.java

示例7: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPistonRetract(BlockPistonRetractEvent e) {
	//Check if there are cauldrons on activity on pushed blocks 
	for(Block block : e.getBlocks()) {
		Location loc = block.getLocation();
		for(UUID uuid : plugin.caulLoc.keySet()) {
			Location caul = plugin.caulLoc.get(uuid);
			if(caul.getBlock().getLocation().distance(loc) == 0) {
				e.setCancelled(true);
				return;
			}
		}
	}
}
 
开发者ID:Slaymd,项目名称:CaulCrafting,代码行数:15,代码来源:BlockPistonRetractListener.java

示例8: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent e) {
	if (e.isSticky()) {
		for (Block b : e.getBlocks()) {
			if (BlockStorage.hasBlockInfo(b)) {
				e.setCancelled(true);
				return;
			}
		}
	}
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:12,代码来源:BlockListener.java

示例9: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    for (Block block : event.getBlocks()) {
        if (block.getRelative(event.getDirection()).getY() >= height) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:Minehut,项目名称:GamePlate,代码行数:9,代码来源:BuildHeightModule.java

示例10: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    for (Block block : event.getBlocks()) {
        CuboidRegion oldRegion = regionHandler.getApplicableRegion(block.getLocation());
        CuboidRegion newRegion = regionHandler.getApplicableRegion(block.getRelative(event.getDirection()).getLocation());
        checkRetract(oldRegion, newRegion, event);
    }
}
 
开发者ID:redwallhp,项目名称:AthenaGM,代码行数:9,代码来源:PistonListener.java

示例11: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    RollbackAgent.checkBlockChange(event.getBlock().getLocation(), event.getBlock().getState(), event);
    for (Block b : event.getBlocks()) {
        RollbackAgent.checkBlockChange(b.getLocation(), b.getState(), event);
    }
    //TODO: some blocks probably won't be rolled back properly
}
 
开发者ID:caseif,项目名称:Steel,代码行数:9,代码来源:RollbackBlockListener.java

示例12: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    for (Block block : event.getBlocks()) {
        if (region.contains(block.getRelative(event.getDirection()).getLocation().toVector()) && filter.evaluate(block, event).equals(FilterState.DENY)) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:9,代码来源:BlockPlaceRegion.java

示例13: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPistonRetract(BlockPistonRetractEvent e) {
    for (Block RetractedBlock : e.getBlocks()) {
        if (!plugin.pm.isHidden(RetractedBlock.getLocation())) {
            e.setCancelled(true);
        }
    }
}
 
开发者ID:ddonofrio,项目名称:LibelulaProtectionBlocks,代码行数:9,代码来源:EventManager.java

示例14: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent e){
   	if (RedProtect.get().Mc && RPConfig.getBool("hooks.magiccarpet.fix-piston-getblocks")){	
   		List<Block> blocks = e.getBlocks();
   		for (Block block:blocks){
   			for (Carpet carpet:MagicCarpet.getCarpets().all()){
   				if (carpet != null && carpet.isVisible() && carpet.touches(e.getBlock())){
   					block.setType(Material.AIR);
   					RedProtect.get().logger.debug("Carpet touch block "+block.getType().name());
   					e.setCancelled(true);
   				}
   			}
   		}
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:16,代码来源:RPMine18.java

示例15: onPistonPull

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
/**
 * Prevents blocks from being pulled off beacons by sticky pistons
 * @param event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onPistonPull(BlockPistonRetractEvent event) {
    World world = event.getBlock().getWorld();
    if (!world.equals(getBeaconzWorld())) {
        return;
    }
    for (Block b : event.getBlocks()) {
        // If any block is part of a beacon cancel it
        if (getRegister().isBeacon(b)) {
            event.setCancelled(true);
            return;
        }
    }
}
 
开发者ID:tastybento,项目名称:beaconz,代码行数:19,代码来源:BeaconProtectionListener.java


注:本文中的org.bukkit.event.block.BlockPistonRetractEvent.getBlocks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。