下面列出了org.bukkit.event.block.BlockFadeEvent#setCancelled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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;
}
}
}
}
@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;
}
}
}
}
@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);
}
}
@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);
}
}
@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));
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void noFade(final BlockFadeEvent event) {
event.setCancelled(true);
}
@EventHandler
public void onBlockFade(BlockFadeEvent event) {
if (isGuildHeart(event.getBlock())) {
event.setCancelled(true);
}
}
@EventHandler
public void onBlockFade(BlockFadeEvent event) {
if (!match.isRunning()) {
event.setCancelled(true);
}
}
@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);
}
}