本文整理汇总了Java中org.bukkit.event.hanging.HangingBreakEvent.setCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java HangingBreakEvent.setCancelled方法的具体用法?Java HangingBreakEvent.setCancelled怎么用?Java HangingBreakEvent.setCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.hanging.HangingBreakEvent
的用法示例。
在下文中一共展示了HangingBreakEvent.setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFrameBrake
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onFrameBrake(HangingBreakEvent e) {
if (e.isCancelled()){
return;
}
Location l = e.getEntity().getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
if (r != null){
return;
}
if (e.getCause().toString().equals("EXPLOSION") || e.getCause().toString().equals("ENTITY")) {
if (!RPConfig.getGlobalFlagBool(l.getWorld().getName()+".entity-block-damage")){
e.setCancelled(true);
}
}
}
示例2: onFrameBrake
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onFrameBrake(HangingBreakEvent e) {
RedProtect.get().logger.debug("Is BlockListener - HangingBreakEvent event");
if (e.isCancelled()){
return;
}
Entity ent = e.getEntity();
Location l = e.getEntity().getLocation();
if ((ent instanceof ItemFrame || ent instanceof Painting) && (e.getCause().toString().equals("EXPLOSION"))) {
Region r = RedProtect.get().rm.getTopRegion(l);
if (r != null && !r.canFire()){
e.setCancelled(true);
}
}
}
示例3: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
EntityProtection entityProtection = this.module.getProtectManager().getEntityProtection(event.getEntity().getType(), event.getEntity().getUniqueId());
if(entityProtection.exists()) {
if(event instanceof HangingBreakByEntityEvent) {
HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
if(entityEvent.getRemover() instanceof Player) {
Player player = (Player) entityEvent.getRemover();
if(entityProtection.getOwner().equals(player.getUniqueId()) || player.hasPermission(ProtectPermissions.MODIFY_ALL)) {
entityProtection.remove();
sendMessage(player, "protect.entity-unprotected");
return;
}
sendMessage(player, "protect.entity-protected-by", getDisplayName(this.module.getManager().getUsername(entityProtection.getOwner()), event.getEntity().getWorld().getName()));
}
}
event.setCancelled(true);
}
}
示例4: onHangingDamage
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingDamage(HangingBreakEvent event) {
if (!event.isCancelled()) {
for (Region region : regions) {
if (region.contains(event.getEntity().getLocation())) {
event.setCancelled(true);
}
}
}
}
示例5: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event)
{
if(event.isCancelled())
return;
if(event.getCause() == RemoveCause.ENTITY)
event.setCancelled(true);
}
示例6: onItemFrameBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler(priority = HIGHEST, ignoreCancelled = true)
public void onItemFrameBreak(HangingBreakEvent ev) {
if (!(ev.getEntity() instanceof ItemFrame)) return;
ItemFrame f = (ItemFrame) ev.getEntity();
if (f.getItem() == null || f.getItem().getType() == Material.AIR) return;
if (ExhibitionFrame.fromItemFrame(f).isSet()) {
if (ev.getCause() == HangingBreakEvent.RemoveCause.EXPLOSION) { // Explosion protect
ev.setCancelled(true);
} else {
plugin.getLogger().warning(String.format("Exhibition broken: Location: %s, item: %s", f.getLocation().toString(),
f.getItem().toString()));
f.setItem(new ItemStack(Material.AIR));
}
}
}
示例7: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
if (event instanceof HangingBreakByEntityEvent) {
if (region.contains(event.getEntity().getLocation().toVector()) && filter.evaluate(event.getEntity(), ((HangingBreakByEntityEvent) event).getRemover(), event).equals(FilterState.DENY)) {
event.setCancelled(true);
}
} else {
if (region.contains(event.getEntity().getLocation().toVector()) && filter.evaluate(event.getEntity(), event).equals(FilterState.DENY)) {
event.setCancelled(true);
}
}
}
示例8: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onHangingBreak(HangingBreakEvent event) {
Hanging hanging = event.getEntity();
if (event.getCause().equals(RemoveCause.OBSTRUCTION)) {
hanging.getLocation().getBlock().breakNaturally();
event.setCancelled(true);
} else if (event.getCause().equals(RemoveCause.EXPLOSION)) {
event.setCancelled(true);
}
}
示例9: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
if(event instanceof HangingBreakByEntityEvent) {
Entity attacker = ((HangingBreakByEntityEvent) event).getRemover();
if(attacker instanceof Player) {
Player player = (Player) attacker;
Lot lot = this.module.getLotManager().getLot(event.getEntity().getLocation());
Town town = this.module.getLotManager().getTown(event.getEntity().getLocation());
if(((lot != null && !lot.canBuild(player)) || (lot == null && town != null)) && !player.hasPermission(LotPermissions.BUILD_ANYWHERE)) {
event.setCancelled(true);
}
}
}
}
示例10: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
if (event.getCause() == RemoveCause.ENTITY) {
HangingBreakByEntityEvent entityEvent = (HangingBreakByEntityEvent) event;
if (entityEvent.getRemover() instanceof Player) {
Player remover = (Player) entityEvent.getRemover();
if (remover.isOp() && remover.getGameMode() == GameMode.CREATIVE) {
return;
}
}
}
event.setCancelled(true);
}
示例11: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
/**
* On hanging break.
*
* @param event the event
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onHangingBreak(HangingBreakEvent event) {
if (conf.isOverrideExplosions()) {
// Check for painting
if (event.getCause() == RemoveCause.EXPLOSION) {
Factoid.getThisPlugin().iLog().write("Cancel HangingBreak : " + event.getEntity() + ", Cause: " + event.getCause());
event.setCancelled(true);
}
}
}
示例12: onHangingDestroy
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingDestroy(HangingBreakEvent event) {
for(Game game : SurvivalGames.gameManager.getGames()) {
for(Arena arena : game.getArenas()) {
if(arena.containsBlock(event.getEntity().getLocation()))
event.setCancelled(true);
}
}
}
示例13: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
// If there's no portal, we don't care.
final ABPortal portal = plugin.getManager().getByFrame(event.getEntity());
if (portal == null)
return;
// Cancel it so it doesn't break.
event.setCancelled(true);
}
示例14: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler
public void onHangingBreak(HangingBreakEvent event) {
Entity hanging = event.getEntity();
ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
for(Arena a : am.getArenas())
if(a.isArenaCuboidSet())
if(a.getArenaCuboid().isInsideCuboid(hanging.getLocation()))
if(!a.isInEditMode())
event.setCancelled(true);
}
示例15: onHangingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
@EventHandler (priority = EventPriority.HIGH)
public void onHangingBreak(HangingBreakEvent event) {
if (event.isCancelled() || (event.getEntity().getType() != EntityType.ITEM_FRAME)) return;
ItemFrame entity = (ItemFrame)event.getEntity();
Frame frame = this.manager.getFrame(entity);
if (frame == null) return;
Player player = null;
if (event instanceof HangingBreakByEntityEvent) {
Entity remover = ((HangingBreakByEntityEvent)event).getRemover();
if (remover.getType() == EntityType.PLAYER) {
player = (Player) remover;
}
}
if ((player != null) && Config.WORLDGUARD_ENABLED && Config.WORLDGUARD_BREAK && !player.hasPermission("FramePicture.ignoreWorldGuard"))
{
RegionManager rm = FramePicturePlugin.getWorldGuard().getRegionManager(player.getWorld());
LocalPlayer localPlayer = FramePicturePlugin.getWorldGuard().wrapPlayer(player);
if (!rm.getApplicableRegions(frame.getLocation()).canBuild(localPlayer)) {
player.sendMessage(Lang.PREFIX.getText() + Lang.NO_PERMISSION.getText());
event.setCancelled(true);
return;
}
}
this.manager.removeFrame(frame);
if (player != null)
player.sendMessage(Lang.PREFIX.getText() + Lang.FRAME_REMOVED.getText().replace("%id", String.valueOf(frame.getId())));
for (Entity e : entity.getNearbyEntities(32.0, 32.0, 32.0)) {
if (e.getType() != EntityType.PLAYER) continue;
Player p = (Player)e;
this.sendFrameDestroy(p, entity.getEntityId());
}
}