本文整理汇总了Java中org.bukkit.event.world.StructureGrowEvent类的典型用法代码示例。如果您正苦于以下问题:Java StructureGrowEvent类的具体用法?Java StructureGrowEvent怎么用?Java StructureGrowEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StructureGrowEvent类属于org.bukkit.event.world包,在下文中一共展示了StructureGrowEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TreeGrowChecker
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler
public void TreeGrowChecker(StructureGrowEvent event) {
if (ConfigPatch.safetyBonemeal) {
if(event.isFromBonemeal() == false) {
return;
}
List<BlockState> blocks = event.getBlocks();
int bs = blocks.size();
for(int i = 0;i<bs;i++){
Block block = blocks.get(i).getBlock();
if(block.getType() != Material.AIR && block.getType() != Material.SAPLING && block.getType() != event.getLocation().getBlock().getRelative(BlockFace.DOWN).getType()){
event.setCancelled(true);
if (event.getPlayer() != null) {
AzureAPI.log(event.getPlayer(), "§c这棵树生长区域有方块阻挡,请不要尝试利用骨粉BUG!");
return;
}
}
}
}
}
示例2: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
/**
* Prevents trees from growing outside of the protected area.
*
* @param e
*/
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
}
// Check world
if (!Util.inWorld(e.getLocation())) {
return;
}
// Check if this is on an island
Island island = plugin.getIslands().getIslandAt(e.getLocation());
if (island == null || island.isSpawn()) {
return;
}
Iterator<BlockState> it = e.getBlocks().iterator();
while (it.hasNext()) {
BlockState b = it.next();
if (b.getType() == Material.LOG || b.getType() == Material.LOG_2
|| b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
if (!island.onIsland(b.getLocation())) {
it.remove();
}
}
}
}
示例3: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
/**
* Converts trees to gravel and glowstone
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.netherTrees) {
return;
}
if (!Settings.netherGenerate || IslandWorld.getNetherWorld() == null) {
return;
}
// Check world
if (!e.getLocation().getWorld().equals(IslandWorld.getNetherWorld())) {
return;
}
for (BlockState b : e.getBlocks()) {
if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
b.setType(Material.GRAVEL);
} else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
b.setType(Material.GLOWSTONE);
}
}
}
示例4: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent e){
RedProtect.get().logger.debug("RPBlockListener - Is StructureGrowEvent event");
if (!RPConfig.getBool("deny-structure-bypass-regions")){
return;
}
Region rfrom = RedProtect.get().rm.getTopRegion(e.getLocation());
for (BlockState bstt:e.getBlocks()){
Region rto = RedProtect.get().rm.getTopRegion(bstt.getLocation());
Block bloc = bstt.getLocation().getBlock();
//deny blocks spread in/out regions
if (rfrom != null && rto != null && rfrom != rto && !rfrom.sameLeaders(rto)){
bstt.setType(bloc.getType());
}
if (rfrom == null && rto != null){
bstt.setType(bloc.getType());
}
if (rfrom != null && rto == null){
bstt.setType(bloc.getType());
}
bstt.update();
}
}
示例5: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
/**
* Prevent trees from growing above beacons
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG)
getLogger().info("DEBUG: " + e.getEventName());
World world = e.getLocation().getWorld();
if (!world.equals(getBeaconzWorld())) {
return;
}
for (BlockState b : e.getBlocks()) {
if (getRegister().isAboveBeacon(b.getLocation())) {
e.setCancelled(true);
break;
}
}
}
示例6: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onStructureGrow(final StructureGrowEvent e) {
if (!PlotSquared.isPlotWorld(e.getWorld().getName())) {
return;
}
final List<BlockState> blocks = e.getBlocks();
if (blocks.size() == 0) {
return;
}
Plot origin = MainUtil.getPlot(BukkitUtil.getLocation(blocks.get(0).getLocation()));
BlockState start = blocks.get(0);
for (int i = blocks.size() - 1; i >= 0; i--) {
final Location loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
final Plot plot = MainUtil.getPlot(loc);
if (!MainUtil.equals(plot, origin)) {
e.getBlocks().remove(i);
}
}
}
示例7: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
if (plugin.getChestSettings().allowDestroyBy(AttackType.SAPLING)) {
return;
}
// Check deleted blocks
List<BlockState> blocks = event.getBlocks();
for (Iterator<BlockState> it = blocks.iterator(); it.hasNext();) {
BlockState blockState = it.next();
if (blockState.getType() == Material.AIR) {
// Almost all replaced blocks are air, so this is a cheap,
// zero-allocation way out
continue;
}
if (isProtected(blockState.getBlock())) {
it.remove();
}
}
}
示例8: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
/**
* Converts trees to gravel and glowstone
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (!Settings.netherTrees) {
return;
}
if (!Settings.createNether || ASkyBlock.getNetherWorld() == null) {
return;
}
// Check world
if (!e.getLocation().getWorld().equals(ASkyBlock.getNetherWorld())) {
return;
}
for (BlockState b : e.getBlocks()) {
if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
b.setType(Material.GRAVEL);
} else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
b.setType(Material.GLOWSTONE);
}
}
}
示例9: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
/**
* Prevents trees from growing outside of the protected area.
*
* @param e
*/
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
}
// Check world
if (!IslandGuard.inWorld(e.getLocation())) {
return;
}
// Check if this is on an island
Island island = plugin.getGrid().getIslandAt(e.getLocation());
if (island == null || island.isSpawn()) {
return;
}
Iterator<BlockState> it = e.getBlocks().iterator();
while (it.hasNext()) {
BlockState b = it.next();
if (b.getType() == Material.LOG || b.getType() == Material.LOG_2
|| b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
if (!island.onIsland(b.getLocation())) {
it.remove();
}
}
}
}
示例10: getBiome
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
public static String getBiome(StructureGrowEvent e)
{
if (tc != null)
{
String tControl = TerrainControl.getBiomeName(e.getWorld().getName(), e.getLocation().getBlockX(), e.getLocation().getBlockZ());
if (tControl != null)
{
return tControl;
}
else
{
return String.valueOf(e.getLocation().getBlock().getBiome());
}
}
else
{
return String.valueOf(e.getLocation().getBlock().getBiome());
}
}
示例11: onTreeGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler
public void onTreeGrow(StructureGrowEvent event)
{
if(this.rtCommand.GetPlayerSetting(event.getPlayer().getName()))
{
Material material = this.GetRndMaterial();
byte color = this.HandleWoolColor();
if(event.isFromBonemeal())
{
for(BlockState blockState : event.getBlocks())
{
if(blockState.getType() == Material.LEAVES)
{
this.HandleSpecialBlock(material, blockState, color);
}
}
}
}
}
示例12: check
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@Override
public boolean check(final Event e) {
if (types != null) {
return types.check(e, new Checker<StructureType>() {
@SuppressWarnings("null")
@Override
public boolean check(final StructureType t) {
return t.is(((StructureGrowEvent) e).getSpecies());
}
});
}
return true;
}
示例13: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent event) throws InterruptedException {
if (disabling) { return; }
while (plugin.isUpdatingChecks) {
Thread.sleep(25);
}
for (BlockState blockState : event.getBlocks()) {
plugin.needsCheck.add(blockState.getBlock());
}
}
示例14: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent grow) {
Game game = BedwarsRel.getInstance().getGameManager().getGameByLocation(grow.getLocation());
if (game == null) {
return;
}
grow.setCancelled(true);
}
示例15: onStructureGrow
import org.bukkit.event.world.StructureGrowEvent; //导入依赖的package包/类
@EventHandler
public void onStructureGrow(StructureGrowEvent event) {
for(BlockState block : event.getBlocks()) {
BlockProtection blockProtection = this.module.getProtectManager().getBlockProtection(block.getBlock().getLocation());
if(blockProtection.exists()) {
event.setCancelled(true);
break;
}
}
}