本文整理汇总了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;
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例11: onBlockRedstone
import org.bukkit.event.block.BlockRedstoneEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockRedstone(BlockRedstoneEvent event) {
if (!match.isRunning()) {
event.setNewCurrent(event.getOldCurrent());
}
}
示例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);
}
}