本文整理汇总了Java中org.bukkit.event.block.BlockDamageEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java BlockDamageEvent.isCancelled方法的具体用法?Java BlockDamageEvent.isCancelled怎么用?Java BlockDamageEvent.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.block.BlockDamageEvent
的用法示例。
在下文中一共展示了BlockDamageEvent.isCancelled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockDamage
import org.bukkit.event.block.BlockDamageEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockDamage(BlockDamageEvent event) {
if (event.isCancelled() || !OrebfuscatorConfig.UpdateOnDamage) {
return;
}
if (!BlockUpdate.needsUpdate(event.getBlock())) {
return;
}
if (!BlockHitManager.hitBlock(event.getPlayer(), event.getBlock())) {
return;
}
BlockUpdate.Update(event.getBlock());
}
示例2: checkBlockDamage
import org.bukkit.event.block.BlockDamageEvent; //导入方法依赖的package包/类
@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;
}
}
}
}
}
示例3: onBlockDamage
import org.bukkit.event.block.BlockDamageEvent; //导入方法依赖的package包/类
/**
* Filters BlockDamageEvent, Used for early warnings.
*
* <p>Applies to: block and block break<p/>
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockDamage(BlockDamageEvent event) {
Match match = Cardinal.getMatch(event.getPlayer());
if (match == null || !match.hasPlayer(event.getPlayer())) {
return;
}
for (AppliedRegion reg : get(match, ApplyType.BLOCK, ApplyType.BLOCK_BREAK)) {
Block evaluating = event.getBlock();
if (apply(reg, evaluating.getLocation(), event.getPlayer(), event, event, evaluating, event.getPlayer())) {
if (event.isCancelled()) {
event.setCancelled(false);
}
break;
}
}
}
示例4: onBlockDamage
import org.bukkit.event.block.BlockDamageEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockDamage(BlockDamageEvent event) {
Sign sign;
if (!event.isCancelled()
&& event.getBlock() != null
&& (event.getBlock().getType() == Material.WALL_SIGN || event
.getBlock().getType() == Material.SIGN_POST)) {
sign = (Sign) event.getBlock().getState();
if (sign.getLine(0).equals(
"" + ChatColor.GRAY + ChatColor.BOLD + "[" + ChatColor.YELLOW + "ATM"
+ ChatColor.GRAY + "]")
&& !tgym.Vault.HasPermissions(event.getPlayer(), "tgym.atm.create"))
event.setCancelled(true);
}
}