本文整理汇总了Java中org.bukkit.event.block.BlockSpreadEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java BlockSpreadEvent.isCancelled方法的具体用法?Java BlockSpreadEvent.isCancelled怎么用?Java BlockSpreadEvent.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.block.BlockSpreadEvent
的用法示例。
在下文中一共展示了BlockSpreadEvent.isCancelled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onBlockSpread(final BlockSpreadEvent event) {
if (event.isCancelled())
return;
final Block block = event.getBlock();
// Ok so a frame block fire spreads
// Find the nearest gate!
final WorldCoord blockCoord = new WorldCoord(block);
final Gate nearestGate = Gates.gateFromFrameAndSurround(blockCoord);
if (nearestGate != null) {
event.setCancelled(true);
}
}
示例2: onFireSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler
public void onFireSpread(BlockSpreadEvent e){
if (e.isCancelled()){
return;
}
Block b = e.getSource();
Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
if (r != null){
return;
}
if ((b.getType().equals(Material.FIRE) || b.getType().name().contains("LAVA")) && !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".fire-spread")){
e.setCancelled(true);
}
}
示例3: onFireSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler
public void onFireSpread(BlockSpreadEvent e){
RedProtect.get().logger.debug("RPBlockListener - Is BlockSpreadEvent event");
if (e.isCancelled()){
return;
}
Block bfrom = e.getSource();
Block bto = e.getBlock();
RedProtect.get().logger.debug("Is BlockSpreadEvent event, source is " + bfrom.getType().name());
Region rfrom = RedProtect.get().rm.getTopRegion(bfrom.getLocation());
Region rto = RedProtect.get().rm.getTopRegion(bto.getLocation());
if ((bfrom.getType().equals(Material.FIRE) || bfrom.getType().name().contains("LAVA")) && rfrom != null && !rfrom.canFire()){
e.setCancelled(true);
return;
}
//deny blocks spread in/out regions
if (rfrom != null && rto != null && rfrom != rto && !rfrom.sameLeaders(rto)){
e.setCancelled(true);
return;
}
if (rfrom == null && rto != null){
e.setCancelled(true);
return;
}
if (rfrom != null && rto == null){
e.setCancelled(true);
}
}
示例4: a
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit
if (random.nextInt(25) == 0) {
byte b0 = 4;
int l = 5;
int i1;
int j1;
int k1;
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
if (world.getType(i1, k1, j1) == this) {
--l;
if (l <= 0) {
return;
}
}
}
}
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
}
if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this)); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
示例5: a
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit
if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot
byte b0 = 4;
int l = 5;
int i1;
int j1;
int k1;
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
if (world.getTypeId(i1, k1, j1) == this.id) {
--l;
if (l <= 0) {
return;
}
}
}
}
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
}
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
示例6: a
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit
if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot
byte b0 = 4;
int l = 5;
int i1;
int j1;
int k1;
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
if (world.getType(i1, k1, j1) == this) {
--l;
if (l <= 0) {
return;
}
}
}
}
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
}
if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this)); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
示例7: updateTick
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
final int sourceX = p_149674_2_, sourceY = p_149674_3_, sourceZ = p_149674_4_; // CraftBukkit
if (p_149674_5_.nextInt(Math.max(1, (int) p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().mushroomModifier * 25)) == 0) // Spigot // Cauldron
{
byte b0 = 4;
int l = 5;
int i1;
int j1;
int k1;
for (i1 = p_149674_2_ - b0; i1 <= p_149674_2_ + b0; ++i1)
{
for (j1 = p_149674_4_ - b0; j1 <= p_149674_4_ + b0; ++j1)
{
for (k1 = p_149674_3_ - 1; k1 <= p_149674_3_ + 1; ++k1)
{
if (p_149674_1_.getBlock(i1, k1, j1) == this)
{
--l;
if (l <= 0)
{
return;
}
}
}
}
}
i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1;
j1 = p_149674_3_ + p_149674_5_.nextInt(2) - p_149674_5_.nextInt(2);
k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1)
{
if (p_149674_1_.isAirBlock(i1, j1, k1) && this.canBlockStay(p_149674_1_, i1, j1, k1))
{
p_149674_2_ = i1;
p_149674_3_ = j1;
p_149674_4_ = k1;
}
i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1;
j1 = p_149674_3_ + p_149674_5_.nextInt(2) - p_149674_5_.nextInt(2);
k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
}
if (p_149674_1_.isAirBlock(i1, j1, k1) && this.canBlockStay(p_149674_1_, i1, j1, k1))
{
// CraftBukkit start
org.bukkit.World bworld = p_149674_1_.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(Block.getIdFromBlock(this)); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
p_149674_1_.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled())
{
blockState.update(true);
}
// CraftBukkit end
}
}
}
示例8: b
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit
if (random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.mushroomModifier) * 25)) == 0) { // Spigot
int i = 5;
boolean flag = true;
Iterator iterator = BlockPosition.b(blockposition.a(-4, -1, -4), blockposition.a(4, 1, 4)).iterator();
while (iterator.hasNext()) {
BlockPosition blockposition1 = (BlockPosition) iterator.next();
if (world.getType(blockposition1).getBlock() == this) {
--i;
if (i <= 0) {
return;
}
}
}
BlockPosition blockposition2 = blockposition.a(random.nextInt(3) - 1, random.nextInt(2) - random.nextInt(2), random.nextInt(3) - 1);
for (int j = 0; j < 4; ++j) {
if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) {
blockposition = blockposition2;
}
blockposition2 = blockposition.a(random.nextInt(3) - 1, random.nextInt(2) - random.nextInt(2), random.nextInt(3) - 1);
}
if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) {
// CraftBukkit start
// world.setTypeAndData(blockposition2, this.getBlockData(), 2);
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(blockposition2.getX(), blockposition2.getY(), blockposition2.getZ()).getState();
blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this)); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
示例9: a
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
public void a(World world, int i, int j, int k, Random random) {
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit
if (random.nextInt(25) == 0) {
byte b0 = 4;
int l = 5;
int i1;
int j1;
int k1;
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
if (world.getTypeId(i1, k1, j1) == this.id) {
--l;
if (l <= 0) {
return;
}
}
}
}
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
}
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id);
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}