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


Java BlockRedstoneEvent.getNewCurrent方法代码示例

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


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

示例1: doPhysics

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void doPhysics(World world, int i, int j, int k, Block block) {
    if (!world.isStatic) {
        boolean flag = world.isBlockIndirectlyPowered(i, j, k);
        int l = world.getData(i, j, k);
        boolean flag1 = (l & 1) != 0;

        // CraftBukkit start
        org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
        int old = flag1 ? 15 : 0;
        int current = flag ? 15 : 0;

        BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
        world.getServer().getPluginManager().callEvent(eventRedstone);
        // CraftBukkit end

        if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
            world.setData(i, j, k, l | 1, 4);
            world.a(i, j, k, this, this.a(world));
        } else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
            world.setData(i, j, k, l & -2, 4);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:24,代码来源:BlockCommand.java

示例2: doPhysics

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void doPhysics(World world, int i, int j, int k, int l) {
    if (!world.isStatic) {
        boolean flag = world.isBlockIndirectlyPowered(i, j, k);
        int i1 = world.getData(i, j, k);
        boolean flag1 = (i1 & 1) != 0;

        // CraftBukkit start
        org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
        int old = flag1 ? 15 : 0;
        int current = flag ? 15 : 0;

        BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
        world.getServer().getPluginManager().callEvent(eventRedstone);
        // CraftBukkit end

        if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
            world.setData(i, j, k, i1 | 1, 4);
            world.a(i, j, k, this.id, this.a(world));
        } else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
            world.setData(i, j, k, i1 & -2, 4);
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:24,代码来源:BlockCommand.java

示例3: onNeighborBlockChange

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
{
    if (!p_149695_1_.isRemote)
    {
        boolean flag = p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_);
        int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_);
        boolean flag1 = (l & 1) != 0;
        // CraftBukkit start
        org.bukkit.block.Block bukkitBlock = p_149695_1_.getWorld().getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
        int old = flag1 ? 15 : 0;
        int current = flag ? 15 : 0;
        BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
        p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
        // CraftBukkit end

        if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0))   // CraftBukkit
        {
            p_149695_1_.setBlockMetadataWithNotify(p_149695_2_, p_149695_3_, p_149695_4_, l | 1, 4);
            p_149695_1_.scheduleBlockUpdate(p_149695_2_, p_149695_3_, p_149695_4_, this, this.tickRate(p_149695_1_));
        }
        else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0)     // CraftBukkit
        {
            p_149695_1_.setBlockMetadataWithNotify(p_149695_2_, p_149695_3_, p_149695_4_, l & -2, 4);
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:27,代码来源:BlockCommandBlock.java

示例4: interact

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, @Nullable ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) {
    if (((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue()) {
        return true;
    } else {
        // CraftBukkit start
        boolean powered = ((Boolean) iblockdata.get(POWERED));
        org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
        int old = (powered) ? 15 : 0;
        int current = (!powered) ? 15 : 0;

        BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
        world.getServer().getPluginManager().callEvent(eventRedstone);

        if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
            return true;
        }
        // CraftBukkit end
        world.setTypeAndData(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)), 3);
        world.b(blockposition, blockposition);
        this.a(entityhuman, world, blockposition);
        this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
        world.a(blockposition, (Block) this, this.a(world));
        return true;
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:26,代码来源:BlockButtonAbstract.java

示例5: b

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
    if (!world.isClientSide) {
        if (((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue()) {
            if (this.I) {
                this.e(iblockdata, world, blockposition);
            } else {
                // CraftBukkit start
                org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());

                BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
                world.getServer().getPluginManager().callEvent(eventRedstone);

                if (eventRedstone.getNewCurrent() > 0) {
                    return;
                }
                // CraftBukkit end
                world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(false)));
                this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING));
                this.b(world, blockposition);
                world.b(blockposition, blockposition);
            }

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

示例6: onBlockRedstone

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGH )
public void onBlockRedstone(BlockRedstoneEvent event) 
{
	System.out.println("  ");
	Block block = event.getBlock();
	int iBlockID = block.getTypeId();
	if (iBlockID==69 || iBlockID==77 || iBlockID==143) {  return; }
	if(event.getOldCurrent() >=1 && event.getNewCurrent() == 0 ) { return; }
	System.out.println(" plugin:  onBlockRedstone()  ");
	System.out.println("     iBlockID = " + iBlockID);
	if(plugin.itemFrame1 != null)
	{
		//  funzelt  :-)
		//ItemStack  item01 = new ItemStack( Helper.random_IntRange(2, 128) );
		//plugin.itemFrame1.setItem(item01);
	}
	if(event.getNewCurrent()>=1) {
		plugin.umschauenNachSchild(block, event);
	}
	return;
}
 
开发者ID:Kryssi79,项目名称:RahmenTests,代码行数:22,代码来源:RahmenListener.java

示例7: onBlockRedstone

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockRedstone(BlockRedstoneEvent event) {
    if (event.getOldCurrent() != 0 || event.getNewCurrent() == 0) {
        return;
    }
    Block block = event.getBlock();
    World world = block.getWorld();
    String worldName = world.getName();
    Map<BlockVector, BankSet> worldInteresting = bankInfo.get(worldName);
    if (worldInteresting == null) {
        worldInteresting = buildWorldInteresting(worldName);
        bankInfo.put(worldName, worldInteresting);
    }
    BlockVector target = new BlockVector(block.getX(), block.getY(), block.getZ());
    BankSet targetBank = worldInteresting.get(target);
    if (targetBank != null) {
        targetBank.shelveItems(world);
    }
}
 
开发者ID:crast,项目名称:MondoChest,代码行数:20,代码来源:RedstoneListener.java

示例8: CheckRedstone

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler
public void CheckRedstone(BlockRedstoneEvent event){
	if(ConfigOptimize.AntiRedstoneenable){
		if(event.getOldCurrent() > event.getNewCurrent()){
            return;
        }
        final Block block = event.getBlock();
        Location loc = block.getLocation();
        if(CheckedTimes.get(loc) == null){
            CheckedTimes.put(loc, 0);
        }
        CheckedTimes.put(loc, CheckedTimes.get(loc) + 1);

        if(CheckedTimes.get(loc) > ConfigOptimize.AntiRedstoneTimes){
            if(ConfigOptimize.AntiRedstoneRemoveBlockList.contains(block.getType().name())){
	Bukkit.getScheduler().runTaskLater(EscapeLag.MainThis,new Runnable(){
		public void run(){
			block.setType(Material.AIR);
		}
	},1);
                String message = ConfigOptimize.AntiRedstoneMessage;
                message = StringUtils.replace(message, "%location%", loc.toString());
                AzureAPI.bc(message);
            }
        }
	}
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:28,代码来源:AntiRedstone.java

示例9: handleBlockRedstone

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

    Block block = event.getBlock();

    for (BlockFace face : BridgeManager.faces) {
        Block faceBlock = block.getRelative(face);

        if(this.storage.getGearblock(new BlockCoord(faceBlock)) != null) {
            this.waitingBlocks.add(faceBlock);
        }
    }
}
 
开发者ID:Aleksey-Terzi,项目名称:CastleGates,代码行数:14,代码来源:BridgeEventHandler.java

示例10: pressRaw

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
private boolean pressRaw()
{
	// taken from net.minecraft.server.v1_9_R1.BlockButtonAbstract

	World world = ((CraftWorld) this.location.getWorld()).getHandle();
	BlockPosition blockposition = new BlockPosition(this.location.getX(), this.location.getY(), this.location.getZ());
	IBlockData iblockdata = world.getType(blockposition);
	Block block = iblockdata.getBlock();

	if(iblockdata.get(POWERED))
		return true;

	boolean powered = iblockdata.get(POWERED);
	org.bukkit.block.Block bukkitBlock = world.getWorld()
			.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
	int old = powered ? 15 : 0;
	int current = !powered ? 15 : 0;

	BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
	world.getServer().getPluginManager().callEvent(eventRedstone);

	if((eventRedstone.getNewCurrent() > 0 ? 1 : 0) != (powered ? 0 : 1))
		return true;

	world.setTypeAndData(blockposition, iblockdata.set(POWERED, true), 3);
	world.b(blockposition, blockposition);
	world.a(null, blockposition, getSoundEffects(), SoundCategory.BLOCKS, 0.3f, 0.3f); // null is for entity human, maybe
	// cause problems
	c(world, blockposition, iblockdata.get(FACING), block);
	world.a(blockposition, block, getPressDuration());
	return true;
}
 
开发者ID:domisum,项目名称:AnimulusLib,代码行数:33,代码来源:BlockButton.java

示例11: interact

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
    int i1 = world.getData(i, j, k);
    int j1 = i1 & 7;
    int k1 = 8 - (i1 & 8);

    if (k1 == 0) {
        return true;
    } else {
        // CraftBukkit start
        org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
        int old = (k1 != 8) ? 15 : 0;
        int current = (k1 == 8) ? 15 : 0;

        BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
        world.getServer().getPluginManager().callEvent(eventRedstone);

        if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8)) {
            return true;
        }
        // CraftBukkit end

        world.setData(i, j, k, j1 + k1, 3);
        world.c(i, j, k, i, j, k);
        world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
        this.a(world, i, j, k, j1);
        world.a(i, j, k, this, this.a(world));
        return true;
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:30,代码来源:BlockButtonAbstract.java

示例12: a

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    if (!world.isStatic) {
        int l = world.getData(i, j, k);

        if ((l & 8) != 0) {
            if (this.a) {
                this.n(world, i, j, k);
            } else {
                // CraftBukkit start
                org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);

                BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
                world.getServer().getPluginManager().callEvent(eventRedstone);

                if (eventRedstone.getNewCurrent() > 0) {
                    return;
                }
                // CraftBukkit end
                world.setData(i, j, k, l & 7, 3);
                int i1 = l & 7;

                this.a(world, i, j, k, i1);
                world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
                world.c(i, j, k, i, j, k);
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:29,代码来源:BlockButtonAbstract.java

示例13: a

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
protected void a(World world, int i, int j, int k, int l) {
    int i1 = this.e(world, i, j, k);
    boolean flag = l > 0;
    boolean flag1 = i1 > 0;

    // CraftBukkit start - Interact Pressure Plate
    org.bukkit.World bworld = world.getWorld();
    org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();

    if (flag != flag1) {
        BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), l, i1);
        manager.callEvent(eventRedstone);

        flag1 = eventRedstone.getNewCurrent() > 0;
        i1 = eventRedstone.getNewCurrent();
    }
    // CraftBukkit end

    if (l != i1) {
        world.setData(i, j, k, this.d(i1), 2);
        this.a_(world, i, j, k);
        world.c(i, j, k, i, j, k);
    }

    if (!flag1 && flag) {
        world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
    } else if (flag1 && !flag) {
        world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
    }

    if (flag1) {
        world.a(i, j, k, this, this.a(world));
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:35,代码来源:BlockPressurePlateAbstract.java

示例14: 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_)
{
    if (!p_149674_1_.isRemote)
    {
        int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);

        if ((l & 8) != 0)
        {
            // CraftBukkit start
            org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
            BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
            p_149674_1_.getServer().getPluginManager().callEvent(eventRedstone);

            if (eventRedstone.getNewCurrent() > 0)
            {
                return;
            }

            // CraftBukkit end

            if (this.field_150047_a)
            {
                this.func_150046_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
            }
            else
            {
                p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l & 7, 3);
                int i1 = l & 7;
                this.func_150042_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, i1);
                p_149674_1_.playSoundEffect((double)p_149674_2_ + 0.5D, (double)p_149674_3_ + 0.5D, (double)p_149674_4_ + 0.5D, "random.click", 0.3F, 0.5F);
                p_149674_1_.markBlockRangeForRenderUpdate(p_149674_2_, p_149674_3_, p_149674_4_, p_149674_2_, p_149674_3_, p_149674_4_);
            }
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:36,代码来源:BlockButton.java

示例15: a

import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
    if (!world.isStatic) {
        int l = world.getData(i, j, k);

        if ((l & 8) != 0) {
            // CraftBukkit start
            org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);

            BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
            world.getServer().getPluginManager().callEvent(eventRedstone);

            if (eventRedstone.getNewCurrent() > 0) {
                return;
            }
            // CraftBukkit end

            if (this.a) {
                this.n(world, i, j, k);
            } else {
                world.setData(i, j, k, l & 7, 3);
                int i1 = l & 7;

                this.d(world, i, j, k, i1);
                world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
                world.g(i, j, k, i, j, k);
            }
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:30,代码来源:BlockButtonAbstract.java


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