org.bukkit.event.block.BlockDamageEvent Java Examples
The following examples show how to use
org.bukkit.event.block.BlockDamageEvent.
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: RegionMatchModule.java From PGM with GNU Affero General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void checkBlockDamage(final BlockDamageEvent event) { MatchPlayer player = this.match.getParticipant(event.getPlayer()); if (player == null) return; PlayerBlockQuery query = new PlayerBlockQuery(event, player, event.getBlock().getState()); for (RegionFilterApplication rfa : this.rfaContext.get(RFAScope.BLOCK_BREAK)) { if (rfa.earlyWarning && rfa.region.contains(event.getBlock())) { if (processQuery(rfa, query)) { if (event.isCancelled() && rfa.message != null) { player.sendWarning(rfa.message); } if (this.useRegionPriority || rfa.useRegionPriority) { break; } } } } }
Example #2
Source File: DestroyableMatchModule.java From PGM with GNU Affero General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void processBlockDamage(BlockDamageEvent event) { if (this.match.getWorld() != event.getBlock().getWorld()) return; Block block = event.getBlock(); MaterialData material = block.getState().getData(); MatchPlayer player = this.match.getPlayer(event.getPlayer()); for (Destroyable destroyable : this.destroyables) { if (player != null && player.getParty() == destroyable.getOwner() && !destroyable.isDestroyed() && destroyable.getBlockRegion().contains(block) && destroyable.hasMaterial(material)) { event.setCancelled(true); // TODO: translate this player.sendWarning(TextComponent.of("You may not damage your own objective.")); } } }
Example #3
Source File: CoreMatchModule.java From PGM with GNU Affero General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void damageCheck(BlockDamageEvent event) { Block block = event.getBlock(); if (block.getWorld() != this.match.getWorld()) return; MatchPlayer player = this.match.getPlayer(event.getPlayer()); Vector center = BlockVectors.center(block).toVector(); for (Core core : this.cores) { if (!core.hasLeaked() && core.getCasingRegion().contains(center) && player.getParty() == core.getOwner()) { event.setCancelled(true); player.sendWarning(TranslatableComponent.of("core.damageOwn")); } } }
Example #4
Source File: EventRuleMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void checkBlockDamage(final BlockDamageEvent event) { MatchPlayer player = this.match.getParticipant(event.getPlayer()); if(player == null) return; PlayerBlockEventQuery query = new PlayerBlockEventQuery(player, event, event.getBlock().getState()); for(EventRule rule : this.ruleContext.get(EventRuleScope.BLOCK_BREAK)) { if(rule.earlyWarning() && rule.region().contains(event.getBlock())) { if(processQuery(rule, query)) { if(event.isCancelled() && rule.message() != null) { player.sendWarning(rule.message(), true); } if(this.useRegionPriority) { break; } } } } }
Example #5
Source File: DestroyableMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void processBlockDamage(BlockDamageEvent event) { if(this.match.getWorld() != event.getBlock().getWorld()) return; Block block = event.getBlock(); MaterialData material = block.getState().getData(); MatchPlayer player = this.match.getPlayer(event.getPlayer()); for(Destroyable destroyable : this.destroyables) { if(player != null && player.getParty() == destroyable.getOwner() && !destroyable.isDestroyed() && destroyable.getBlockRegion().contains(block) && destroyable.hasMaterial(material)) { event.setCancelled(true); player.sendWarning(new TranslatableComponent("match.destroyable.damageOwn"), true); } } }
Example #6
Source File: CoreMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void damageCheck(BlockDamageEvent event) { Block block = event.getBlock(); if(block.getWorld() != this.match.getWorld()) return; MatchPlayer player = this.match.getPlayer(event.getPlayer()); Vector center = BlockUtils.center(block).toVector(); for(Core core : this.cores) { if(!core.hasLeaked() && core.getCasingRegion().contains(center) && player.getParty() == core.getOwner()) { event.setCancelled(true); player.sendWarning(PGMTranslations.t("match.core.damageOwn", player), true); } } }
Example #7
Source File: SpectatorEvents.java From Survival-Games with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onBlockDamage(BlockDamageEvent event) { Player player = event.getPlayer(); if (GameManager.getInstance().isSpectator(player)) { event.setCancelled(true); } }
Example #8
Source File: BukkitPlotListener.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockDamage(BlockDamageEvent 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 #9
Source File: EventFilterMatchModule.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerBlockDamage(final BlockDamageEvent event) { cancelUnlessInteracting(event, event.getPlayer()); }
Example #10
Source File: EventFilterMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerBlockDamage(final BlockDamageEvent event) { cancelUnlessInteracting(event, event.getPlayer()); }
Example #11
Source File: PlayerStaminaState.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
void onEvent(BlockDamageEvent event) { swinging = false; }
Example #12
Source File: StaminaMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler public void onPlayerDig(BlockDamageEvent event) { PlayerStaminaState state = states.get(event.getPlayer()); if(state != null) state.onEvent(event); }
Example #13
Source File: LoreCraftableMaterial.java From civcraft with GNU General Public License v2.0 | 4 votes |
@Override public void onBlockDamage(BlockDamageEvent event) { // TODO Auto-generated method stub }
Example #14
Source File: UnitItemMaterial.java From civcraft with GNU General Public License v2.0 | 4 votes |
@Override public void onBlockDamage(BlockDamageEvent arg0) { }
Example #15
Source File: UnitMaterial.java From civcraft with GNU General Public License v2.0 | 4 votes |
@Override public void onBlockDamage(BlockDamageEvent event) { }
Example #16
Source File: LoreMaterial.java From civcraft with GNU General Public License v2.0 | votes |
public abstract void onBlockDamage(BlockDamageEvent event);