本文整理汇总了Java中org.bukkit.event.hanging.HangingBreakEvent类的典型用法代码示例。如果您正苦于以下问题:Java HangingBreakEvent类的具体用法?Java HangingBreakEvent怎么用?Java HangingBreakEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HangingBreakEvent类属于org.bukkit.event.hanging包,在下文中一共展示了HangingBreakEvent类的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: 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: 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);
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: onHangingBreakEvent
import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
/**
* Event handler to watch whenever an itemframe is broken by something other than a player..
* This will remove the cache of the hoppers around it.
*
* @param event HangingBreakEvent containing data about the broken hanging item. We care about the ItemFrame being removed.
*/
@EventHandler(ignoreCancelled=true)
public void onHangingBreakEvent(HangingBreakEvent event) {
if (event.getEntity() instanceof ItemFrame) {
//get the item frame entity
ItemFrame itemFrame = (ItemFrame)event.getEntity();
//get the block location that represents the ItemFrame location
Location itemFrameLocation = itemFrame.getLocation().getBlock().getLocation();
//debug if requested
if (plugin.debugLevel_get() > 0) plugin.getLogger().info("ItemFrame broken by non-player at (" + itemFrameLocation.toString() + ")");
//an itemFrame was broken. Clear the cache from the hoppers around the frame.
plugin.knownHoppersCache_ClearAroundLocation(itemFrameLocation);
}
}
示例8: onPaintingBreak
import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPaintingBreak(final HangingBreakByEntityEvent event)
{
final ProtectHolder settings = prot.getSettings();
Entity remover = event.getRemover();
if ((event.getCause() == HangingBreakEvent.RemoveCause.ENTITY)
&& ((remover instanceof Creeper) && getSettings().isCreeperBlockdamage())
|| ((remover instanceof Wither) && getSettings().isWitherSpawnBlockdamage())
|| ((remover instanceof Fireball) && getSettings().isFireballBlockdamage())
|| ((remover instanceof TNTPrimed) && getSettings().isTntBlockdamage())
|| ((remover instanceof WitherSkull) && getSettings().isWitherskullBlockdamage())
|| ((remover instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage()))
{
event.setCancelled(true);
}
}
示例9: 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);
}
}
}
}
示例10: check
import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@Override
public boolean check(Event event) {
return removeCauseOptional.map(cause -> cause.check(event, new Checker<HangingBreakEvent.RemoveCause>() {
@Override
public boolean check(HangingBreakEvent.RemoveCause removeCause) {
return removeCause == ((HangingBreakEvent) event).getCause();
}
})).orElse(true);
}
示例11: init
import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
if (ScriptLoader.isCurrentEvent(HangingPlaceEvent.class) || ScriptLoader.isCurrentEvent(HangingBreakEvent.class)) {
return true;
}
Skript.error("'hanged entity' can only be used in hang and unhang events!");
return false;
}
示例12: 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);
}
示例13: 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));
}
}
}
示例14: init
import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
if (!ScriptLoader.isCurrentEvent(HangingBreakEvent.class) && ScriptLoader.isCurrentEvent(HangingBreakByEntityEvent.class)) {
Skript.error("You can not use HangingCause expression in any event but on unhang!");
return false;
}
return true;
}
示例15: init
import org.bukkit.event.hanging.HangingBreakEvent; //导入依赖的package包/类
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
if (!ScriptLoader.isCurrentEvent(HangingBreakByEntityEvent.class) && !ScriptLoader.isCurrentEvent(HangingBreakEvent.class)) {
Skript.error("You can not use HangingCause expression in any event but on unhang remove!");
return false;
}
return true;
}