Java Code Examples for org.bukkit.Material#SNOW

The following examples show how to use org.bukkit.Material#SNOW . 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: WorldListener.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onForm(BlockFormEvent event) {
    if (event.isCancelled()) {
        return;
    }

    if (event.getNewState().getType() == Material.SNOW) {
        return;
    }

    for (String s : Main.getGameNames()) {
        Game game = Main.getGame(s);
        if (game.getStatus() == GameStatus.RUNNING || game.getStatus() == GameStatus.GAME_END_CELEBRATING) {
            if (GameCreator.isInArea(event.getBlock().getLocation(), game.getPos1(), game.getPos2())) {
                if (!game.isBlockAddedDuringGame(event.getBlock().getLocation())) {
                    event.setCancelled(true);
                }
                return;
            }
        }
    }
}
 
Example 2
Source File: WorldListener.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onForm(BlockFormEvent event) {
    if (event.isCancelled()) {
        return;
    }

    if (event.getNewState().getType() == Material.SNOW) {
        return;
    }

    for (String s : Main.getGameNames()) {
        Game game = Main.getGame(s);
        if (game.getStatus() == GameStatus.RUNNING || game.getStatus() == GameStatus.GAME_END_CELEBRATING) {
            if (GameCreator.isInArea(event.getBlock().getLocation(), game.getPos1(), game.getPos2())) {
                if (!game.isBlockAddedDuringGame(event.getBlock().getLocation())) {
                    event.setCancelled(true);
                }
                return;
            }
        }
    }
}
 
Example 3
Source File: EntityHorsePet.java    From SonarPet with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void makeStepSound(int i, int j, int k, Material block) {
    BlockSoundData soundData = INMS.getInstance().getBlockSoundData(block);

    if (getBukkitEntity().getWorld().getBlockAt(i, j + 1, k).getType() == Material.SNOW) {
        soundData = INMS.getInstance().getBlockSoundData(Material.SNOW);
    }

    if (!INMS.getInstance().isLiquid(block)) {
        if (!getEntity().getPassengers().isEmpty() && getHorseType() != HorseType.NORMAL && getHorseType() != HorseType.MULE) {
            ++this.stepSoundCount;
            if (this.stepSoundCount > 5 && this.stepSoundCount % 3 == 0) {
                getEntity().playSound(SafeSound.HORSE_GALLOP, soundData.getVolume() * 0.15F, soundData.getPitch());
                if (getHorseType() == HorseType.NORMAL && this.random() .nextInt(10) == 0) {
                    getEntity().playSound(SafeSound.HORSE_BREATHE, soundData.getVolume() * 0.6F, soundData.getPitch());
                }
            } else if (this.stepSoundCount <= 5) {
                getEntity().playSound(SafeSound.HORSE_STEP_WOOD, soundData.getVolume() * 0.15F, soundData.getPitch());
            }
        } else if (soundData.equals(BlockSoundData.WOOD)) {
            getEntity().playSound(SafeSound.HORSE_STEP_WOOD, soundData.getVolume() * 0.15F, soundData.getPitch());
        } else {
            getEntity().playSound(SafeSound.HORSE_STEP, soundData.getVolume() * 0.15F, soundData.getPitch());
        }
    }
}
 
Example 4
Source File: BlockListener.java    From BedwarsRel with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onForm(BlockFormEvent form) {

  if (form.getNewState().getType() != Material.SNOW) {
    return;
  }

  Game game =
      BedwarsRel.getInstance().getGameManager().getGameByLocation(form.getBlock().getLocation());
  if (game == null) {
    return;
  }

  if (game.getState() == GameState.STOPPED) {
    return;
  }

  form.setCancelled(true);
}
 
Example 5
Source File: SnowForm.java    From GlobalWarming with GNU Lesser General Public License v3.0 5 votes vote down vote up
@EventHandler
public void blockFormEvent(BlockFormEvent event) {
    if (event.getNewState().getType() == Material.SNOW) {
        WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(event.getBlock().getWorld().getUID());
        if (climateEngine != null && climateEngine.isEffectEnabled(ClimateEffectType.SNOW_FORMATION)) {
            double temperature = climateEngine.getTemperature();
            if (event.getBlock().getY() < heightMap.getValue(temperature)) {
                event.setCancelled(true);
            }
        }
    }
}
 
Example 6
Source File: WrappedBlock8.java    From Hawk with GNU General Public License v3.0 5 votes vote down vote up
private boolean isReallySolid(Block b) {
    boolean reallySolid = block.getMaterial().isSolid();
    MaterialData matData = b.getState().getData();
    if (matData instanceof Sign || matData instanceof Banner)
        reallySolid = false;
    else if (matData instanceof FlowerPot || matData instanceof Diode || matData instanceof Skull ||
            b.getType() == Material.CARPET || matData instanceof Ladder ||
            b.getType() == Material.REDSTONE_COMPARATOR || b.getType() == Material.REDSTONE_COMPARATOR_ON ||
            b.getType() == Material.REDSTONE_COMPARATOR_OFF || b.getType() == Material.SOIL ||
            b.getType() == Material.WATER_LILY || b.getType() == Material.SNOW || b.getType() == Material.COCOA) {
        reallySolid = true;
    }
    return reallySolid;
}