Java Code Examples for org.bukkit.Material#FIRE

The following examples show how to use org.bukkit.Material#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: BlockTransformListener.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
@EventWrapper
public void onBlockBurn(final BlockBurnEvent event) {
  Match match = PGM.get().getMatchManager().getMatch(event.getBlock().getWorld());
  if (match == null) return;

  BlockState oldState = event.getBlock().getState();
  BlockState newState = BlockStates.toAir(oldState);
  MatchPlayerState igniterState = null;
  TrackerMatchModule tmm = match.needModule(TrackerMatchModule.class);

  for (BlockFace face : NEIGHBORS) {
    Block neighbor = oldState.getBlock().getRelative(face);
    if (neighbor.getType() == Material.FIRE) {
      igniterState = tmm.getOwner(neighbor);
      if (igniterState != null) break;
    }
  }

  this.callEvent(event, oldState, newState, igniterState);
}
 
Example 2
Source File: BlockTransformListener.java    From ProjectAres with GNU Affero General Public License v3.0 6 votes vote down vote up
@EventWrapper
public void onBlockBurn(final BlockBurnEvent event) {
    Match match = PGM.getMatchManager().getMatch(event.getBlock().getWorld());
    if(match == null) return;

    BlockState oldState = event.getBlock().getState();
    BlockState newState = BlockStateUtils.toAir(oldState);
    MatchPlayerState igniterState = null;

    for(BlockFace face : NEIGHBORS) {
        Block neighbor = oldState.getBlock().getRelative(face);
        if(neighbor.getType() == Material.FIRE) {
            igniterState = blockResolver.getOwner(neighbor);
            if(igniterState != null) break;
        }
    }

    this.callEvent(event, oldState, newState, igniterState);
}
 
Example 3
Source File: BlockListener.java    From civcraft with GNU General Public License v2.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.NORMAL)
public void OnBlockFormEvent (BlockFormEvent event) {

	/* Disable cobblestone generators. */
	if (ItemManager.getId(event.getNewState()) == CivData.COBBLESTONE) {
		ItemManager.setTypeId(event.getNewState(), CivData.GRAVEL);
		return;
	}

	Chunk spreadChunk = event.getNewState().getChunk();
	coord.setX(spreadChunk.getX());
	coord.setZ(spreadChunk.getZ());
	coord.setWorldname(spreadChunk.getWorld().getName());

	TownChunk tc = CivGlobal.getTownChunk(coord);
	if (tc == null) {
		return;
	}

	if (tc.perms.isFire() == false) {
		if(event.getNewState().getType() == Material.FIRE) {
			event.setCancelled(true);
		}
	}
}
 
Example 4
Source File: IslandGuard.java    From askyblock with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Prevent fire spread
 * @param e - event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info(e.getSource().getType().toString());
    }
    if (e.getSource().getType() == Material.FIRE) {
        if (!inWorld(e.getBlock())) {
            //plugin.getLogger().info("DEBUG: Not in world");
            return;
        }
        if (actionAllowed(e.getBlock().getLocation(), SettingsFlag.FIRE_SPREAD)) {
            return;
        }
        e.setCancelled(true);
    }
}
 
Example 5
Source File: BlockTransformListener.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventWrapper
public void onBlockSpread(final BlockSpreadEvent event) {
  // This fires for: fire, grass, mycelium, mushrooms, and vines
  // Fire is already handled by BlockIgniteEvent
  if (event.getNewState().getType() != Material.FIRE) {
    this.callEvent(
        new BlockTransformEvent(event, event.getBlock().getState(), event.getNewState()));
  }
}
 
Example 6
Source File: BlockTransformListener.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventWrapper
public void onBlockSpread(final BlockSpreadEvent event) {
    // This fires for: fire, grass, mycelium, mushrooms, and vines
    // Fire is already handled by BlockIgniteEvent
    if(event.getNewState().getType() != Material.FIRE) {
        this.callEvent(new BlockTransformEvent(event, event.getBlock().getState(), event.getNewState()));
    }
}
 
Example 7
Source File: ChunkEventHelper.java    From ClaimChunk with MIT License 5 votes vote down vote up
public static void handleSpreadEvent(@Nonnull BlockSpreadEvent e) {
    if (e.isCancelled()) return;

    // Only cancel fire spreading
    if (e.getBlock().getType() == Material.FIRE) {
        cancelWorldEvent(e.getBlock().getChunk(), e, "blockFireSpread");
    }
}
 
Example 8
Source File: Pyro.java    From AnnihilationPro with MIT License 4 votes vote down vote up
@Override
protected ItemStack getIcon()
{
	return new ItemStack(Material.FIRE);
}