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


Java BlockPistonRetractEvent.isSticky方法代码示例

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


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

示例1: 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

示例2: 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

示例3: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
/**
 * Monitor BlockPistonRetract events.
 *
 * @param event The event to watch
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    if (!EventUtils.shouldProcessEvent(event.getBlock(), false)) {
        return;
    }

    if (!event.isSticky()) {
        return;
    }

    Block movedBlock = event.getRetractLocation().getBlock();

    // Needed only because under some circumstances Minecraft doesn't move the block
    new StickyPistonTrackerTask(event.getDirection(), event.getBlock(), movedBlock).runTaskLater(plugin, 2);
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:21,代码来源:BlockListener.java

示例4: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onPistonRetract(BlockPistonRetractEvent e) {
    // Workaround start - BlockPistonEvent's are sometime called multiple times
    if(!pistonUtil.canRetract(e.getBlock())) {
        return;
    }
    pistonUtil.retract(e.getBlock());
    // Workaround end

    Block blockMoving = e.getRetractLocation().getBlock();
    if(!e.isSticky() || !plugin.isWhitelisted(blockMoving.getType()) || !plugin.isWorldWhitelisted(e.getBlock().getWorld())) {
        return;
    }

    plugin.unBlackList(blockMoving);
    plugin.blackList(blockMoving.getRelative(e.getDirection().getOppositeFace()));
}
 
开发者ID:bendem,项目名称:OreBroadcast,代码行数:18,代码来源:PistonListener.java

示例5: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onPistonRetract(final BlockPistonRetractEvent event) {
    if (!reinforcementManager.isWorldActive(event.getBlock().getLocation().getWorld().getName())) {
        return;
    }

    if (!event.isSticky()) {
        return;
    }

    final BlockFace direction = event.getDirection();
    final Block block = event.getBlock().getRelative(direction, 2);
    Location location = block.getLocation();

    if (!reinforcementManager.isReinforced(block.getLocation())) {
        return;
    }

    if (!pistonsMoveReinforcedBlocks) {
        event.setCancelled(true);
        return;
    }

    reinforcementManager.moveReinforcement(location, direction.getOppositeFace());
}
 
开发者ID:MinerAp,项目名称:block-saver,代码行数:26,代码来源:GeneralListener.java

示例6: oreGinPistonPull

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
/**
 * Stop Piston from pulling an OreGin or it's light
 */
@EventHandler
public void oreGinPistonPull(BlockPistonRetractEvent event)
{
	MaterialData materialData = event.getBlock().getState().getData();
	BlockFace blockFace;
	Block movedBlock;

	if (materialData instanceof PistonBaseMaterial) 
	{
		blockFace = ((PistonBaseMaterial) materialData).getFacing();
		movedBlock = event.getBlock().getRelative(blockFace, 2);
		
		if (event.isSticky() && movedBlock != null)
		{
			if (oreGinMan.machineExistsAt(movedBlock.getLocation())
					|| oreGinMan.oreGinLightExistsAt(movedBlock.getLocation()))
			{
				event.setCancelled(true);
			}
		}
	}
}
 
开发者ID:MrTwiggy,项目名称:MachineFactory,代码行数:26,代码来源:OreGinListener.java

示例7: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    if(!this.tracker.isEnabled(event.getBlock().getWorld())) return;

    if(event.isSticky()) {
        Block newBlock = event.getBlock().getRelative(event.getDirection());
        Block oldBlock = newBlock.getRelative(event.getDirection());
        Player player = this.tracker.getPlacer(oldBlock);
        if(player != null) {
            this.tracker.setPlacer(oldBlock, null);
            this.tracker.setPlacer(newBlock, player);
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:15,代码来源:ExplosiveListener.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(ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
    if (plugin.getChestSettings().allowDestroyBy(AttackType.PISTON)) {
        return;
    }
    if (event.isSticky() && isProtected(event.getBlock())) {
        event.setCancelled(true);
    }
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:10,代码来源:BlockDestroyListener.java

示例10: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onPistonRetract(final BlockPistonRetractEvent event) {
    if (!event.isSticky())
        return;

    // TODO: piston detection
}
 
开发者ID:david50407,项目名称:TreeLogging,代码行数:8,代码来源:PistonListener.java

示例11: pistonRetractCheck

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler
public void pistonRetractCheck(BlockPistonRetractEvent event) {
	if (!event.isSticky()) return;
	Block item = event.getRetractLocation().getBlock();
	if (item.getType() == Material.EMERALD_BLOCK ||
	    item.getType() == Material.DIAMOND_BLOCK) {
		event.setCancelled(true);
	}
}
 
开发者ID:monofuel,项目名称:MonoMods,代码行数:10,代码来源:TribeProtectListener.java

示例12: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPistonRetract(final BlockPistonRetractEvent event)
{
    if (this.isActive(BlockShift.class, event.getBlock().getWorld()))
    {
        BlockState retractedBlock = event.getRetractLocation().getBlock().getState();
        BlockState pistonHead = event.getBlock().getRelative(event.getDirection()).getState();

        BlockState newPistonHead = pistonHead.getBlock().getState();
        if (retractedBlock.getType().isSolid())
        {
            newPistonHead.setType(retractedBlock.getType());
            newPistonHead.setData(retractedBlock.getData());
        }
        else
        {
            newPistonHead.setType(AIR);
        }

        BlockShift action = this.set(BlockShift.class, pistonHead, newPistonHead);
        action.setRetract();
        this.logAction(action);

        if (event.isSticky() && retractedBlock.getType().isSolid()) // TODO missing retractable blocks?
        {
            action = this.set(BlockShift.class, retractedBlock, null);
            action.setNewBlock(AIR);
            action.setRetract();
            this.logAction(action);
        }
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:33,代码来源:ListenerBlock.java

示例13: onPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPistonRetract(BlockPistonRetractEvent event) {
    if (event.isSticky()) {
        for (Block block : event.getBlocks()) {
            if (core.contains(block) && partOfObjective(block)) {
                event.setCancelled(true);
            }
        }
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:11,代码来源:CoreObjective.java

示例14: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler (ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
	if (event.isSticky()) {
		Location loc = event.getRetractLocation();
		if (! loc.getBlock().isEmpty() && Util.getQuadtree(loc).contains(loc)) {
			event.setCancelled(true);
			return;
		}
	}
}
 
开发者ID:catageek,项目名称:BCProtect,代码行数:11,代码来源:PistonListener.java

示例15: onBlockPistonRetract

import org.bukkit.event.block.BlockPistonRetractEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPistonRetract(final BlockPistonRetractEvent event)
{
	if (!event.isSticky())
	{
		return;
	}
	final Block block = event.getRetractLocation().getBlock();
	if (antib.getSettings().getData().getBlacklist().getPiston(block.getType()))
	{
		event.setCancelled(true);
	}
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:14,代码来源:EssentialsAntiBuildListener.java


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