Java Code Examples for org.bukkit.event.block.BlockRedstoneEvent#setNewCurrent()
The following examples show how to use
org.bukkit.event.block.BlockRedstoneEvent#setNewCurrent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LWCBlockListener.java From Modern-LWC with MIT License | 6 votes |
@EventHandler public void onBlockRedstoneChange(BlockRedstoneEvent event) { if (!LWC.ENABLED) { return; } LWC lwc = plugin.getLWC(); Block block = event.getBlock(); if (block == null) { return; } Protection protection = lwc.findProtection(block.getLocation()); if (protection == null) { return; } LWCRedstoneEvent evt = new LWCRedstoneEvent(event, protection); lwc.getModuleLoader().dispatchEvent(evt); if (evt.isCancelled()) { event.setNewCurrent(event.getOldCurrent()); } }
Example 2
Source File: BlockListener.java From civcraft with GNU General Public License v2.0 | 6 votes |
@EventHandler(priority = EventPriority.NORMAL) public void onBlockRedstoneEvent(BlockRedstoneEvent event) { bcoord.setFromLocation(event.getBlock().getLocation()); CampBlock cb = CivGlobal.getCampBlock(bcoord); if (cb != null) { if (ItemManager.getId(event.getBlock()) == CivData.WOOD_DOOR || ItemManager.getId(event.getBlock()) == CivData.IRON_DOOR) { event.setNewCurrent(0); return; } } if (War.isWarTime()) { event.setNewCurrent(0); return; } }
Example 3
Source File: IslandGuard.java From askyblock with GNU General Public License v2.0 | 6 votes |
/** * Stop redstone if team members are offline and disableOfflineRedstone is TRUE. * @param e - event */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onBlockRedstone(final BlockRedstoneEvent e){ if(Settings.disableOfflineRedstone) { // Check world if (!inWorld(e.getBlock())) { return; } // Check if this is on an island Island island = plugin.getGrid().getIslandAt(e.getBlock().getLocation()); if (island == null || island.isSpawn()) { return; } for(UUID member : island.getMembers()){ if(plugin.getServer().getPlayer(member) != null) return; } e.setNewCurrent(0); } }
Example 4
Source File: RedstoneControlListener.java From NyaaUtils with MIT License | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onBlockRedstoneEvent(BlockRedstoneEvent event) { if (!plugin.cfg.redstoneControl) { return; } Block block = event.getBlock(); Lightable blockData = redstoneTorch.getIfPresent(block.getLocation()); if (blockData != null) { if (block.getBlockData().getClass() != blockData.getClass()) return; event.setNewCurrent(blockData.isLit() ? 15 : 0); } }
Example 5
Source File: WorldFreeze.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onBlockRedstone(BlockRedstoneEvent event) { if (!match.isRunning()) { event.setNewCurrent(event.getOldCurrent()); } }