當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。