org.bukkit.event.block.BlockFadeEvent Java Examples

The following examples show how to use org.bukkit.event.block.BlockFadeEvent. 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 onFade(BlockFadeEvent event) {
    if (event.isCancelled()) {
        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 onFade(BlockFadeEvent event) {
    if (event.isCancelled()) {
        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: BlockListener.java    From BedwarsRel with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onFade(BlockFadeEvent e) {

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

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

  if (!game.getRegion().isPlacedBlock(e.getBlock())) {
    e.setCancelled(true);
  }
}
 
Example #4
Source File: DWorldListener.java    From DungeonsXL with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onBlockFade(BlockFadeEvent event) {
    GameWorld gameWorld = plugin.getGameWorld(event.getBlock().getWorld());
    if (gameWorld == null) {
        return;
    }

    if (!gameWorld.isPlaying()) {
        event.setCancelled(true);
        return;
    }

    Set<ExItem> blockFadeDisabled = gameWorld.getGame().getRules().getState(GameRule.BLOCK_FADE_DISABLED);
    if (blockFadeDisabled == null) {
        return;
    }
    if (gameWorld.getGame() != null && blockFadeDisabled.contains(VanillaItem.get(event.getBlock().getType()))) {
        event.setCancelled(true);
    }
}
 
Example #5
Source File: BukkitPlotListener.java    From PlotMe-Core with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockFade(BlockFadeEvent event) {
    Location location = BukkitUtil.adapt(event.getBlock().getLocation());

    if (manager.isPlotWorld(location)) {
        PlotId id = manager.getPlotId(location);

        if (id == null) {
            event.setCancelled(true);
        } else {
            event.setCancelled(api.isPlotLocked(id));

        }
    }
}
 
Example #6
Source File: EventForwarder.java    From BlueMap with MIT License 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockChange(BlockFadeEvent evt) {
	onBlockChange(evt.getBlock().getLocation());
}
 
Example #7
Source File: BlockEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockFadeEvent(BlockFadeEvent event) {
    CommonBlockEventHandler.getInstance().handleBlockModify(event, event.getBlock(), event.getNewState());
}
 
Example #8
Source File: BlockTransformListener.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventWrapper
public void onBlockFade(final BlockFadeEvent event) {
  BlockState state = event.getBlock().getState();
  this.callEvent(new BlockTransformEvent(event, state, BlockStates.toAir(state)));
}
 
Example #9
Source File: BlockTransformListener.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventWrapper
public void onBlockFade(final BlockFadeEvent event) {
    BlockState state = event.getBlock().getState();
    this.callEvent(new BlockTransformEvent(event, state, BlockStateUtils.toAir(state)));
}
 
Example #10
Source File: EnvironmentControlListener.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH)
public void noFade(final BlockFadeEvent event) {
    event.setCancelled(true);
}
 
Example #11
Source File: GuildHeartProtectionHandler.java    From FunnyGuilds with Apache License 2.0 4 votes vote down vote up
@EventHandler
public void onBlockFade(BlockFadeEvent event) {
    if (isGuildHeart(event.getBlock())) {
        event.setCancelled(true);
    }
}
 
Example #12
Source File: WorldFreeze.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onBlockFade(BlockFadeEvent event) {
    if (!match.isRunning()) {
        event.setCancelled(true);
    }
}
 
Example #13
Source File: BlockEventRegion.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onBlockFade(BlockFadeEvent event) {
    if (filter.evaluate(event.getBlock(), event).equals(FilterState.DENY) && region.contains(new BlockRegion(null, event.getBlock().getLocation().toVector()))) {
        event.setCancelled(true);
    }
}
 
Example #14
Source File: LoggingManager.java    From Survival-Games with GNU General Public License v3.0 3 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void blockChanged(BlockFadeEvent e){
	if(e.isCancelled())return;

	logBlockDestoryed(e.getBlock());
	i.put("BFADE", i.get("BFADE")+1);

	//    System.out.println(3);

}