Java Code Examples for org.spongepowered.api.block.BlockTypes#FIRE
The following examples show how to use
org.spongepowered.api.block.BlockTypes#FIRE .
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: GlobalListener.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@Listener(order = Order.FIRST, beforeModifications = true) public void onFireSpread(ChangeBlockEvent.Place e, @First LocatableBlock locatable) { RedProtect.get().logger.debug(LogLevel.BLOCKS, "GlobalListener - Is onFireSpread event!"); BlockState sourceState = locatable.getBlockState(); if (e.getTransactions().get(0).getFinal().getState().getType().equals(BlockTypes.FIRE) && (sourceState.getType() == BlockTypes.FIRE || sourceState.getType() == BlockTypes.LAVA || sourceState.getType() == BlockTypes.FLOWING_LAVA)) { boolean fireDamage = RedProtect.get().config.globalFlagsRoot().worlds.get(locatable.getLocation().getExtent().getName()).fire_spread; if (!fireDamage) { Region r = RedProtect.get().rm.getTopRegion(e.getTransactions().get(0).getOriginal().getLocation().get(), this.getClass().getName()); if (r == null) { RedProtect.get().logger.debug(LogLevel.BLOCKS, "Tryed to PLACE FIRE!"); e.setCancelled(true); } } } }
Example 2
Source File: GlobalListener.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@Listener(order = Order.FIRST, beforeModifications = true) public void onFireSpread(ChangeBlockEvent.Break e, @First LocatableBlock locatable) { RedProtect.get().logger.debug(LogLevel.BLOCKS, "GlobalListener - Is onBlockBreakGeneric event"); BlockState sourceState = locatable.getBlockState(); if (sourceState.getType() == BlockTypes.FIRE) { BlockSnapshot b = e.getTransactions().get(0).getOriginal(); boolean fireDamage = RedProtect.get().config.globalFlagsRoot().worlds.get(locatable.getLocation().getExtent().getName()).fire_block_damage; if (!fireDamage && b.getState().getType() != BlockTypes.FIRE) { Region r = RedProtect.get().rm.getTopRegion(b.getLocation().get(), this.getClass().getName()); if (r == null) { RedProtect.get().logger.debug(LogLevel.BLOCKS, "Tryed to break from FIRE!"); e.setCancelled(true); } } } }
Example 3
Source File: BlockListener.java From RedProtect with GNU General Public License v3.0 | 5 votes |
@Listener(order = Order.FIRST, beforeModifications = true) public void onFireSpread(ChangeBlockEvent.Place e, @First LocatableBlock locatable) { RedProtect.get().logger.debug(LogLevel.BLOCKS, "BlockListener - Is onFireSpread event!"); BlockState sourceState = locatable.getBlockState(); if (sourceState.getType() == BlockTypes.FIRE || sourceState.getType() == BlockTypes.LAVA || sourceState.getType() == BlockTypes.FLOWING_LAVA) { Region r = RedProtect.get().rm.getTopRegion(e.getTransactions().get(0).getOriginal().getLocation().get(), this.getClass().getName()); if (r != null && !r.canFire()) { RedProtect.get().logger.debug(LogLevel.BLOCKS, "Tryed to PLACE FIRE!"); e.setCancelled(true); } } }
Example 4
Source File: BlockListener.java From RedProtect with GNU General Public License v3.0 | 5 votes |
@Listener(order = Order.FIRST, beforeModifications = true) public void onFireSpread(ChangeBlockEvent.Break e, @First LocatableBlock locatable) { RedProtect.get().logger.debug(LogLevel.BLOCKS, "BlockListener - Is onBlockBreakGeneric event"); BlockState sourceState = locatable.getBlockState(); if (sourceState.getType() == BlockTypes.FIRE) { BlockSnapshot b = e.getTransactions().get(0).getOriginal(); Region r = RedProtect.get().rm.getTopRegion(b.getLocation().get(), this.getClass().getName()); if (r != null && !r.canFire() && b.getState().getType() != BlockTypes.FIRE) { RedProtect.get().logger.debug(LogLevel.BLOCKS, "Tryed to break from FIRE!"); e.setCancelled(true); } } }