当前位置: 首页>>代码示例>>Java>>正文


Java BlockRedstoneEvent.setNewCurrent方法代码示例

本文整理汇总了Java中org.bukkit.event.block.BlockRedstoneEvent.setNewCurrent方法的典型用法代码示例。如果您正苦于以下问题:Java BlockRedstoneEvent.setNewCurrent方法的具体用法?Java BlockRedstoneEvent.setNewCurrent怎么用?Java BlockRedstoneEvent.setNewCurrent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.block.BlockRedstoneEvent的用法示例。


在下文中一共展示了BlockRedstoneEvent.setNewCurrent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBlockRedstoneEvent

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL) 
public void onBlockRedstoneEvent(BlockRedstoneEvent event) {
	
	bcoord.setFromLocation(event.getBlock().getLocation());

	CampBlock cb = CivGlobal.getCampBlock(bcoord);
	if (cb != null) {
		if (ItemManager.getId(event.getBlock()) == CivData.WOOD_DOOR ||
				ItemManager.getId(event.getBlock()) == CivData.IRON_DOOR) {
			event.setNewCurrent(0);
			return;
		}
	}
	
	if (War.isWarTime()) {
		event.setNewCurrent(0);
		return;
	}

}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:21,代码来源:BlockListener.java

示例2: onBlockRedstone

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
/**
 * Stop redstone if team members are offline and disableOfflineRedstone is TRUE.
 * @param e
 */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockRedstone(BlockRedstoneEvent e){
    if(Settings.disableOfflineRedstone) {
        // Check world
        if (!inWorld(e.getBlock())) {
            return;
        }
        // Check if this is on an island
        Island island = plugin.getGrid().getIslandAt(e.getBlock().getLocation());
        if (island == null || island.isSpawn()) {
            return;
        }
        for(UUID member : island.getMembers()){
            if(plugin.getServer().getPlayer(member) != null) return;
        }
        e.setNewCurrent(0);
    }
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:23,代码来源:IslandGuard.java

示例3: keepLightsStable

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
/**
 * Maintains the OreGin lights stable
 */
@EventHandler
public void keepLightsStable(BlockRedstoneEvent event)
{
	if (event.getBlock().getType().equals(MachineFactoryPlugin.LIGHT_ON) || event.getBlock().getType().equals(MachineFactoryPlugin.LIGHT_OFF))
	{
		if (oreGinMan.oreGinLightExistsAt(event.getBlock().getLocation()))
		{
			if (((OreGin)oreGinMan.getMachine(event.getBlock().getRelative(BlockFace.DOWN).getLocation())).getMining())
			{
				event.setNewCurrent(1);
			}
			else if (!((OreGin)oreGinMan.getMachine(event.getBlock().getRelative(BlockFace.DOWN).getLocation())).getBroken())
			{
				event.setNewCurrent(0);
			}
		}	
	}						
}
 
开发者ID:MrTwiggy,项目名称:MachineFactory,代码行数:22,代码来源:OreGinListener.java

示例4: onPower

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler
public void onPower(BlockRedstoneEvent event) {
	Block block = event.getBlock();
	String chunk = block.getLocation().getChunk().getX() + ";" + block.getLocation().getChunk().getZ();

	if (!powerable.get(block.getWorld().getName()).getList(chunk).contains(block.getLocation())) {
		block.getWorld().spawnParticle(Particle.SMOKE_NORMAL, block.getLocation().add(0.5, 1, 0.5), 7, 0, 0.2, 0,
				0.03);
		event.setNewCurrent(0);
	}
}
 
开发者ID:kadeska,项目名称:MT_Core,代码行数:12,代码来源:GeneratorListener.java

示例5: onRedstone

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler
public void onRedstone(BlockRedstoneEvent event) {
    if (event.getNewCurrent() == event.getOldCurrent()) {
        return;
    }

    if (isProtectedForRedstone(event.getBlock())) {
        event.setNewCurrent(event.getOldCurrent());
    }
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:11,代码来源:BlockDestroyListener.java

示例6: onBlockRedstoneChange

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
/**
 *
 * @param bre
 */
@EventHandler
public void onBlockRedstoneChange(BlockRedstoneEvent bre) {
    if (DataHandler.isBlueprintBlock(bre.getBlock())) {
        bre.setNewCurrent(0);
    }
}
 
开发者ID:Max9403,项目名称:Blueprint-A-Bukkit-Plugin,代码行数:11,代码来源:PlayerListener.java

示例7: a

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    boolean flag = this.m(world, i, j, k);
    List list = (List) b.get(world);

    while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).d > 60L) {
        list.remove(0);
    }

    // CraftBukkit start
    org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
    org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
    int oldCurrent = this.isOn ? 15 : 0;

    BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
    // CraftBukkit end

    if (this.isOn) {
        if (flag) {
            // CraftBukkit start
            if (oldCurrent != 0) {
                event.setNewCurrent(0);
                manager.callEvent(event);
                if (event.getNewCurrent() != 0) {
                    return;
                }
            }
            // CraftBukkit end

            world.setTypeAndData(i, j, k, Blocks.REDSTONE_TORCH_OFF, world.getData(i, j, k), 3);
            if (this.a(world, i, j, k, true)) {
                world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);

                for (int l = 0; l < 5; ++l) {
                    double d0 = (double) i + random.nextDouble() * 0.6D + 0.2D;
                    double d1 = (double) j + random.nextDouble() * 0.6D + 0.2D;
                    double d2 = (double) k + random.nextDouble() * 0.6D + 0.2D;

                    world.addParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
                }
            }
        }
    } else if (!flag && !this.a(world, i, j, k, false)) {
        // CraftBukkit start
        if (oldCurrent != 15) {
            event.setNewCurrent(15);
            manager.callEvent(event);
            if (event.getNewCurrent() != 15) {
                return;
            }
        }
        // CraftBukkit end

        world.setTypeAndData(i, j, k, Blocks.REDSTONE_TORCH_ON, world.getData(i, j, k), 3);
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:56,代码来源:BlockRedstoneTorch.java

示例8: onRedstoneEvent

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler
public void onRedstoneEvent(BlockRedstoneEvent event) {
    Block block = event.getBlock();
    Location loc = BukkitUtil.getLocation(block.getLocation());
    if (!PlotSquared.isPlotWorld(loc.getWorld())) {
        return;
    }
    Plot plot = MainUtil.getPlot(loc);
    if (plot == null) {
        return;
    }
    if (Settings.REDSTONE_DISABLER) {
        if (UUIDHandler.getPlayer(plot.owner) == null) {
            boolean disable = true;
            for (UUID trusted : plot.trusted) {
                if (UUIDHandler.getPlayer(trusted) != null) {
                    disable = false;
                    break;
                }
            }
            if (disable) {
                event.setNewCurrent(0);
                return;
            }
        }
    }
    Flag redstone = FlagManager.getPlotFlag(plot, "redstone");
    if (redstone == null || (Boolean) redstone.getValue()) {
        return;
    }
    switch (block.getType()) {
        case REDSTONE_LAMP_OFF:
        case REDSTONE_LAMP_ON:
        case PISTON_BASE:
        case PISTON_STICKY_BASE:
        case IRON_DOOR_BLOCK:
        case LEVER:
        case WOODEN_DOOR:
        case FENCE_GATE:
        case WOOD_BUTTON:
        case STONE_BUTTON:
        case IRON_PLATE:
        case WOOD_PLATE:
        case STONE_PLATE:
        case GOLD_PLATE:
        case SPRUCE_DOOR:
        case BIRCH_DOOR:
        case JUNGLE_DOOR:
        case ACACIA_DOOR:
        case DARK_OAK_DOOR:
        case IRON_TRAPDOOR:
        case SPRUCE_FENCE_GATE:
        case BIRCH_FENCE_GATE:
        case JUNGLE_FENCE_GATE:
        case ACACIA_FENCE_GATE:
        case DARK_OAK_FENCE_GATE:
        case POWERED_RAIL: {
            return;
        }
    }
    event.setNewCurrent(0);
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:63,代码来源:PlayerEvents.java

示例9: a

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    boolean flag = this.m(world, i, j, k);
    List list = (List) b.get(world);

    while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).d > 60L) {
        list.remove(0);
    }

    // CraftBukkit start
    org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
    org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
    int oldCurrent = this.isOn ? 15 : 0;

    BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
    // CraftBukkit end

    if (this.isOn) {
        if (flag) {
            // CraftBukkit start
            if (oldCurrent != 0) {
                event.setNewCurrent(0);
                manager.callEvent(event);
                if (event.getNewCurrent() != 0) {
                    return;
                }
            }
            // CraftBukkit end

            world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k), 3);
            if (this.a(world, i, j, k, true)) {
                world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);

                for (int l = 0; l < 5; ++l) {
                    double d0 = (double) i + random.nextDouble() * 0.6D + 0.2D;
                    double d1 = (double) j + random.nextDouble() * 0.6D + 0.2D;
                    double d2 = (double) k + random.nextDouble() * 0.6D + 0.2D;

                    world.addParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
                }
            }
        }
    } else if (!flag && !this.a(world, i, j, k, false)) {
        // CraftBukkit start
        if (oldCurrent != 15) {
            event.setNewCurrent(15);
            manager.callEvent(event);
            if (event.getNewCurrent() != 15) {
                return;
            }
        }
        // CraftBukkit end

        world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k), 3);
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:56,代码来源:BlockRedstoneTorch.java

示例10: updateTick

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
    boolean flag = this.func_150110_m(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
    List list = (List)field_150112_b.get(p_149674_1_);

    while (list != null && !list.isEmpty() && p_149674_1_.getTotalWorldTime() - ((BlockRedstoneTorch.Toggle)list.get(0)).field_150844_d > 60L)
    {
        list.remove(0);
    }

    // CraftBukkit start
    org.bukkit.plugin.PluginManager manager = p_149674_1_.getServer().getPluginManager();
    org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
    int oldCurrent = this.field_150113_a ? 15 : 0;
    BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
    // CraftBukkit end

    if (this.field_150113_a)
    {
        if (flag)
        {
            // CraftBukkit start
            if (oldCurrent != 0)
            {
                event.setNewCurrent(0);
                manager.callEvent(event);

                if (event.getNewCurrent() != 0)
                {
                    return;
                }
            }

            // CraftBukkit end
            p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.unlit_redstone_torch, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 3);

            if (this.func_150111_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, true))
            {
                p_149674_1_.playSoundEffect((double)((float)p_149674_2_ + 0.5F), (double)((float)p_149674_3_ + 0.5F), (double)((float)p_149674_4_ + 0.5F), "random.fizz", 0.5F, 2.6F + (p_149674_1_.rand.nextFloat() - p_149674_1_.rand.nextFloat()) * 0.8F);

                for (int l = 0; l < 5; ++l)
                {
                    double d0 = (double)p_149674_2_ + p_149674_5_.nextDouble() * 0.6D + 0.2D;
                    double d1 = (double)p_149674_3_ + p_149674_5_.nextDouble() * 0.6D + 0.2D;
                    double d2 = (double)p_149674_4_ + p_149674_5_.nextDouble() * 0.6D + 0.2D;
                    p_149674_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
                }
            }
        }
    }
    else if (!flag && !this.func_150111_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, false))
    {
        // CraftBukkit start
        if (oldCurrent != 15)
        {
            event.setNewCurrent(15);
            manager.callEvent(event);

            if (event.getNewCurrent() != 15)
            {
                return;
            }
        }

        // CraftBukkit end
        p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.redstone_torch, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 3);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:69,代码来源:BlockRedstoneTorch.java

示例11: onBlockRedstone

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockRedstone(BlockRedstoneEvent event) {
    if (!match.isRunning()) {
        event.setNewCurrent(event.getOldCurrent());
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:7,代码来源:WorldFreeze.java

示例12: b

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
    boolean flag = this.g(world, blockposition, iblockdata);
    List list = (List) BlockRedstoneTorch.g.get(world);

    while (list != null && !list.isEmpty() && world.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) {
        list.remove(0);
    }

    // CraftBukkit start
    org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
    org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
    int oldCurrent = this.isOn ? 15 : 0;

    BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
    // CraftBukkit end

    if (this.isOn) {
        if (flag) {
            // CraftBukkit start
            if (oldCurrent != 0) {
                event.setNewCurrent(0);
                manager.callEvent(event);
                if (event.getNewCurrent() != 0) {
                    return;
                }
            }
            // CraftBukkit end
            world.setTypeAndData(blockposition, Blocks.UNLIT_REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
            if (this.a(world, blockposition, true)) {
                world.a((EntityHuman) null, blockposition, SoundEffects.eG, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);

                for (int i = 0; i < 5; ++i) {
                    double d0 = (double) blockposition.getX() + random.nextDouble() * 0.6D + 0.2D;
                    double d1 = (double) blockposition.getY() + random.nextDouble() * 0.6D + 0.2D;
                    double d2 = (double) blockposition.getZ() + random.nextDouble() * 0.6D + 0.2D;

                    world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
                }

                world.a(blockposition, world.getType(blockposition).getBlock(), 160);
            }
        }
    } else if (!flag && !this.a(world, blockposition, false)) {
        // CraftBukkit start
        if (oldCurrent != 15) {
            event.setNewCurrent(15);
            manager.callEvent(event);
            if (event.getNewCurrent() != 15) {
                return;
            }
        }
        // CraftBukkit end
        world.setTypeAndData(blockposition, Blocks.REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3);
    }

}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:57,代码来源:BlockRedstoneTorch.java


注:本文中的org.bukkit.event.block.BlockRedstoneEvent.setNewCurrent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。