本文整理匯總了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);
}
}