本文整理汇总了Java中org.bukkit.event.hanging.HangingBreakEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java HangingBreakEvent.isCancelled方法的具体用法?Java HangingBreakEvent.isCancelled怎么用?Java HangingBreakEvent.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.hanging.HangingBreakEvent
的用法示例。
在下文中一共展示了HangingBreakEvent.isCancelled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: move
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
public void move(double d0, double d1, double d2) {
if (!this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
if (this.dead) return; // CraftBukkit
// CraftBukkit start - fire break events
// TODO - Does this need its own cause? Seems to only be triggered by pistons
HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
this.world.getServer().getPluginManager().callEvent(event);
if (this.dead || event.isCancelled()) {
return;
}
// CraftBukkit end
this.die();
this.b((Entity) null);
}
}
示例4: moveEntity
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
public void moveEntity(double p_70091_1_, double p_70091_3_, double p_70091_5_)
{
if (!this.worldObj.isRemote && !this.isDead && p_70091_1_ * p_70091_1_ + p_70091_3_ * p_70091_3_ + p_70091_5_ * p_70091_5_ > 0.0D)
{
if (this.isDead)
{
return; // CraftBukkit
}
// CraftBukkit start
// TODO - Does this need its own cause? Seems to only be triggered by pistons
HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
this.worldObj.getServer().getPluginManager().callEvent(event);
if (this.isDead || event.isCancelled())
{
return;
}
// CraftBukkit end
this.setDead();
this.onBroken((Entity)null);
}
}
示例5: move
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
public void move(double d0, double d1, double d2) {
if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
if (this.dead) return; // CraftBukkit
// CraftBukkit start - fire break events
// TODO - Does this need its own cause? Seems to only be triggered by pistons
HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
this.world.getServer().getPluginManager().callEvent(event);
if (this.dead || event.isCancelled()) {
return;
}
// CraftBukkit end
this.die();
this.a((Entity) null);
}
}
示例6: 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);
}
}
}
}
示例7: 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);
}
示例8: m
import org.bukkit.event.hanging.HangingBreakEvent; //导入方法依赖的package包/类
public void m() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
if (this.d++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isClientSide) { // Spigot
this.d = 0;
if (!this.dead && !this.survives()) {
// CraftBukkit start - fire break events
Material material = this.world.getType(new BlockPosition(this)).getMaterial();
HangingBreakEvent.RemoveCause cause;
if (!material.equals(Material.AIR)) {
// TODO: This feels insufficient to catch 100% of suffocation cases
cause = HangingBreakEvent.RemoveCause.OBSTRUCTION;
} else {
cause = HangingBreakEvent.RemoveCause.PHYSICS;
}
HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), cause);
this.world.getServer().getPluginManager().callEvent(event);
if (dead || event.isCancelled()) {
return;
}
// CraftBukkit end
this.die();
this.a((Entity) null);
}
}
}
示例9: 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());
}
}