Java 类org.bukkit.event.block.LeavesDecayEvent 实例源码

项目:SunBurnsTrees    文件:EventListener.java   
@EventHandler
public void onLeavesDecay(LeavesDecayEvent event) throws InterruptedException {
    if (disabling) { return; }
    Block block = event.getBlock();

    if (plugin.needsCheck.contains(block)) {
        plugin.needsCheck.remove(block);
    }

    if (plugin.monitorBlocks.contains(block)) {
        while (plugin.isUpdatingChecks) {
            Thread.sleep(25);
        }
        plugin.monitorBlocks.remove(block);
    }
}
项目:CropControl    文件:CropControlEventHandler.java   
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onLeafDecay(LeavesDecayEvent e) {
    Block block = e.getBlock();
    Location loc = block.getLocation();
    if (!pendingChecks.contains(loc)) {
        pendingChecks.add(loc);
        handleBreak(block, BreakType.NATURAL, null, null);
    }
}
项目:UltimateSpawn    文件:BasicFeatures.java   
@EventHandler
public void onLeaveDecay(LeavesDecayEvent e) {
    if (ConfigGServerEvent.getConfig().getBoolean("Server.Disable.Leave-Decay.Disable")) {
        if (!ConfigGServerEvent.getConfig().getBoolean("Server.Disable.Leave-Decay.World.All_World")) {
            if (WorldUtils.getWLD().contains(e.getBlock().getWorld().getName())) {
                e.setCancelled(true);
            }
        } else {
            e.setCancelled(true);
        }
    }
}
项目:ExoticGarden    文件:PlantsListener.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onDecay(LeavesDecayEvent e) {
    dropFruitFromTree(e.getBlock());
    ItemStack item = BlockStorage.retrieve(e.getBlock());
    if (item != null) {
        e.setCancelled(true);
        e.getBlock().setType(Material.AIR);
        e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), item);
    }
}
项目:GriefPreventionFlags    文件:FlagDef_NoLeafDecay.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onLeafDecay(LeavesDecayEvent event)
{
    Block block = event.getBlock();

    Flag flag = this.GetFlagInstanceAtLocation(block.getLocation(), null);
    if(flag == null) return;

    event.setCancelled(true);
}
项目:Pokkit    文件:PlayerBlockEvents.java   
@EventHandler(ignoreCancelled = false)
public void onLeavesDecay(cn.nukkit.event.block.LeavesDecayEvent event) {
    if (canIgnore(LeavesDecayEvent.getHandlerList())) {
        return;
    }

    cn.nukkit.block.Block leaves = event.getBlock();

    LeavesDecayEvent bukkitEvent = new LeavesDecayEvent(PokkitBlock.toBukkit(leaves));
    callCancellable(event, bukkitEvent);
}
项目:CanaryBukkit    文件:CanaryBlockListener.java   
@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onLeafDecay(final LeafDecayHook hook) {
    LeavesDecayEvent event = new LeavesDecayEvent(new CanaryBlock(hook.getBlock()));
    event.setCancelled(hook.isCanceled());
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        hook.setCanceled();
    }
}
项目:RedProtect    文件:RPGlobalListener.java   
@EventHandler
public void onLeafDecay(LeavesDecayEvent e){
    RedProtect.get().logger.debug("RPBlockListener - Is LeavesDecayEvent event");
    Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());        
    if (r == null && !RPConfig.getGlobalFlagBool(e.getBlock().getWorld().getName()+".allow-changes-of.leaves-decay")){
             e.setCancelled(true);                
    }       
}
项目:RedProtect    文件:RPBlockListener.java   
@EventHandler
public void onLeafDecay(LeavesDecayEvent e){
    RedProtect.get().logger.debug("RPBlockListener - Is LeavesDecayEvent event");
    if (e.isCancelled()){
        return;
    }
    Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());        
    if (r != null && !r.leavesDecay()){
             e.setCancelled(true);                
    }       
}
项目:CraftBukkit    文件:BlockLeaves.java   
private void e(World world, int i, int j, int k) {
    // CraftBukkit start
    LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
    world.getServer().getPluginManager().callEvent(event);

    if (event.isCancelled()) {
        return;
    }
    // CraftBukkit end

    this.b(world, i, j, k, world.getData(i, j, k), 0);
    world.setAir(i, j, k);
}
项目:Factoid    文件:WorldListener.java   
/**
 * On leaves decay.
 *
 * @param event the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onLeavesDecay(LeavesDecayEvent event) {

    IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(event.getBlock().getLocation());

    if (land.getFlagAndInherit(FlagList.LEAF_DECAY.getFlagType()).getValueBoolean() == false) {
        event.setCancelled(true);
    }
}
项目:Tweakkit-Server    文件:BlockLeaves.java   
private void e(World world, int i, int j, int k) {
    // CraftBukkit start
    LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
    world.getServer().getPluginManager().callEvent(event);

    if (event.isCancelled()) {
        return;
    }
    // CraftBukkit end

    this.b(world, i, j, k, world.getData(i, j, k), 0);
    world.setAir(i, j, k);
}
项目:Cauldron    文件:BlockLeaves.java   
private void removeLeaves(World p_150126_1_, int p_150126_2_, int p_150126_3_, int p_150126_4_)
{
    // CraftBukkit start
    LeavesDecayEvent event = new LeavesDecayEvent(p_150126_1_.getWorld().getBlockAt(p_150126_2_, p_150126_3_, p_150126_4_));
    p_150126_1_.getServer().getPluginManager().callEvent(event);

    if (event.isCancelled())
    {
        return;
    }

    // CraftBukkit end
    this.dropBlockAsItem(p_150126_1_, p_150126_2_, p_150126_3_, p_150126_4_, p_150126_1_.getBlockMetadata(p_150126_2_, p_150126_3_, p_150126_4_), 0);
    p_150126_1_.setBlockToAir(p_150126_2_, p_150126_3_, p_150126_4_);
}
项目:RealChop    文件:LeavesDecayListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onLeavesDecay(LeavesDecayEvent event) {
    if (event.isCancelled()) return;
    Block breakBlock = event.getBlock();
    if (!detectBlockBreakAll && !detectBlockBreakLeaves) {
        return;
    }
    plugin.blockBreak(breakBlock, breakBlock.getLocation().clone().add(1, 0, 0));
}
项目:Empirecraft    文件:OnLeavesDecay.java   
@EventHandler
public void onLeavesDecay(LeavesDecayEvent event) {
    Block block = event.getBlock();
    String world = block.getWorld().getUID().toString();
    Integer x = block.getLocation().getChunk().getX(), z = block.getLocation().getChunk().getZ();
    if (QuickChecks.isWorldChunkClaimed(serverdata.get("worldmap").get(world), x, z, "cla")) {
        if (((HashMap) ((HashMap) serverdata.get("worldmap").get(world).get(x)).get(z)).containsKey("str")) {
            event.setCancelled(true);
        }
    }
}
项目:SpigotSource    文件:BlockLeaves.java   
private void b(World world, BlockPosition blockposition) {
    // CraftBukkit start
    LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
    world.getServer().getPluginManager().callEvent(event);

    if (event.isCancelled() || world.getType(blockposition).getBlock() != this) {
        return;
    }
    // CraftBukkit end
    this.b(world, blockposition, world.getType(blockposition), 0);
    world.setAir(blockposition);
}
项目:xEssentials-deprecated-bukkit    文件:RealisticTreeEvent.java   
@SuppressWarnings("deprecation")
@EventHandler
public void onLeaveDecay(LeavesDecayEvent e) {
    if(e.isCancelled()) {
        return;
    }
    byte sub = e.getBlock().getData();
    Material mat = e.getBlock().getType();
    FallingBlock fall = e.getBlock().getWorld().spawnFallingBlock(e.getBlock().getLocation(), mat.getId(), sub);
    fall.setMetadata("tree", new FixedMetadataValue(pl, "a tree"));
    e.getBlock().setType(Material.AIR);
}
项目:ZentrelaRPG    文件:EnvironmentManager.java   
@EventHandler
public void onLeafDecay(LeavesDecayEvent event) {
    event.setCancelled(true);
}
项目:ProjectAres    文件:EnvironmentControlListener.java   
@EventHandler(priority = EventPriority.HIGH)
public void noBucket(final LeavesDecayEvent event) {
    event.setCancelled(true);
}
项目:SurvivalAPI    文件:FastTreeModule.java   
private void removeTree(Block block, boolean nearwood, int range)
{
    if (range < 0 || block.hasMetadata("placed"))
        return;

    this.plugin.getServer().getScheduler().runTask(this.plugin, () ->
    {
        if (block.getType() == Material.LEAVES || block.getType() == Material.LEAVES_2)
        {
            LeavesDecayEvent event = new LeavesDecayEvent(block);
            Bukkit.getServer().getPluginManager().callEvent(event);

            if (event.isCancelled())
                return;

            block.breakNaturally();

            if (10 > new Random().nextInt(100))
                block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.LEAVES);
        }

        if (block.getType() == Material.LOG || block.getType() == Material.LOG_2)
        {
            for (ItemStack item : block.getDrops())
                block.getWorld().dropItemNaturally(block.getLocation(), item);

            block.setType(Material.AIR);
        }

        for (int y = -1; y <= 1; y++)
        {
            for (int z = -1; z <= 1; z++)
            {
                for (int x = -1; x <= 1; x++)
                {
                    Block block1 = block.getRelative(x, y, z);

                    if (block != null)
                    {
                        if (block1.getType() == Material.LOG || block1.getType() == Material.LOG_2)
                        {
                            removeTree(block1, nearwood, range - ((z == 0 && x == 0 || nearwood) ? 0 : 1));
                        }
                        else if (block1.getType() == Material.LEAVES || block1.getType() == Material.LEAVES_2)
                        {
                            int finalZ = z;
                            int finalX = x;

                            this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, () ->
                            {
                                if (!this.isNearWood(block1, 2))
                                    this.plugin.getServer().getScheduler().runTask(this.plugin, () -> removeTree(block1, false, nearwood ? 4 : (range - ((finalZ == 0 && finalX == 0) ? 0 : 1))));
                            });
                        }
                    }
                }
            }
        }
    });
}
项目:libelula    文件:EventListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onLeavesDecay(LeavesDecayEvent e) {
    e.setCancelled(true);
}
项目:MiniMiniGames    文件:WorldListener.java   
@EventHandler
public void onLeavesDecay(LeavesDecayEvent event) {
   event.setCancelled(true);
}
项目:UltimateSurvivalGames    文件:ResetListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onLeafDecay(LeavesDecayEvent event) {
    if(!event.isCancelled()) {
        logChunk(event.getBlock().getLocation());
    }
}
项目:TreeLogging    文件:BlockListener.java   
@EventHandler(ignoreCancelled = true)
public void onLeavesDecay(final LeavesDecayEvent event) {
    TreeRecorder.remove(mPlugin, event.getBlock());
}
项目:modules-extra    文件:ListenerBlock.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onLeavesDecay(LeavesDecayEvent event)
{
    this.setAndLog(BlockDecay.class, event.getBlock().getState(), AIR);
}
项目:TatsuCraftMod    文件:TFM_PlayerListener.java   
@EventHandler(priority = EventPriority.NORMAL)
public void onLeavesDecay(LeavesDecayEvent event)
{
    event.setCancelled(true);
}
项目:xEssentials-deprecated-bukkit    文件:StopLeavesDecayEvent.java   
@EventHandler(priority = EventPriority.LOW)
public void onDecay(LeavesDecayEvent e) {
    e.setCancelled(true);
}
项目:SuperSkyBros    文件:WorldListeners.java   
@EventHandler(priority = EventPriority.LOWEST)
public void leafDecay(LeavesDecayEvent e) {
    if (isDedicated() || isNotBlacklist(e.getBlock().getWorld().getName())) {
        e.setCancelled(true);
    }
}
项目:Breakpoint    文件:BanListener.java   
@EventHandler public void e(LeavesDecayEvent event) { event.setCancelled(true); }
项目:Breakpoint    文件:BanListener.java   
@EventHandler public void e(LeavesDecayEvent event) { event.setCancelled(true); }