本文整理汇总了Java中org.bukkit.event.block.BlockSpreadEvent.setCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java BlockSpreadEvent.setCancelled方法的具体用法?Java BlockSpreadEvent.setCancelled怎么用?Java BlockSpreadEvent.setCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.block.BlockSpreadEvent
的用法示例。
在下文中一共展示了BlockSpreadEvent.setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
/**
* Prevent fire spread
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
plugin.getLogger().info(e.getSource().getType().toString());
}
if (e.getSource().getType() == Material.FIRE) {
if (!Util.inWorld(e.getBlock())) {
//plugin.getLogger().info("DEBUG: Not in world");
return;
}
if (actionAllowed(e.getBlock().getLocation(), SettingsFlag.FIRE_SPREAD)) {
return;
}
e.setCancelled(true);
}
}
示例2: 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);
}
}
示例3: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
/**
* Prevent fire spread
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
plugin.getLogger().info(e.getSource().getType().toString());
}
if (e.getSource().getType() == Material.FIRE) {
if (!inWorld(e.getBlock())) {
//plugin.getLogger().info("DEBUG: Not in world");
return;
}
if (actionAllowed(e.getBlock().getLocation(), SettingsFlag.FIRE_SPREAD)) {
return;
}
e.setCancelled(true);
}
}
示例4: blockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler
public void blockSpread(BlockSpreadEvent event) {
Location source = event.getSource().getLocation();
Tribe sourceGroup = TribeProtect.getBlockOwnership(source);
Location spread = event.getBlock().getLocation();
Tribe spreadGroup = TribeProtect.getBlockOwnership(spread);
//if spreadgroup == null, allow
//if sourcegroup == null, do not allow where spreadgroup != null
if (!sourceGroup.isValid()) {
if (!spreadGroup.isValid()) return;
else event.setCancelled(true);
} else {
if (!spreadGroup.isValid()) return;
else {
if (sourceGroup != spreadGroup)
event.setCancelled(true);
}
}
}
示例5: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockSpread (BlockSpreadEvent spreadEvent)
{
if(spreadEvent.getSource().getType() != Material.FIRE) return;
if(!GriefPrevention.instance.config_fireSpreads)
{
spreadEvent.setCancelled(true);
Block underBlock = spreadEvent.getSource().getRelative(BlockFace.DOWN);
if(underBlock.getType() != Material.NETHERRACK)
{
spreadEvent.getSource().setType(Material.AIR);
}
return;
}
//don't track in worlds where claims are not enabled
if(!GriefPrevention.instance.claimsEnabledForWorld(spreadEvent.getBlock().getWorld())) return;
//never spread into a claimed area, regardless of settings
if(this.dataStore.getClaimAt(spreadEvent.getBlock().getLocation(), false, null) != null)
{
spreadEvent.setCancelled(true);
//if the source of the spread is not fire on netherrack, put out that source fire to save cpu cycles
Block source = spreadEvent.getSource();
if(source.getRelative(BlockFace.DOWN).getType() != Material.NETHERRACK)
{
source.setType(Material.AIR);
}
}
}
示例6: onSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onSpread(BlockSpreadEvent spread) {
if (spread.getBlock() == null) {
return;
}
Game game =
BedwarsRel.getInstance().getGameManager()
.getGameByLocation(spread.getBlock().getLocation());
if (game == null) {
return;
}
if (game.getState() != GameState.RUNNING) {
return;
}
if (spread.getNewState() == null || spread.getSource() == null) {
return;
}
if (spread.getNewState().getType().equals(Material.FIRE)) {
spread.setCancelled(true);
return;
}
if (game.getRegion().isPlacedBlock(spread.getSource())) {
game.getRegion().addPlacedBlock(spread.getBlock(), spread.getBlock().getState());
} else {
game.getRegion().addPlacedUnbreakableBlock(spread.getBlock(), spread.getBlock().getState());
}
}
示例7: 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);
}
}
示例8: 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);
}
}
示例9: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockSpread(BlockSpreadEvent e) {
String w = e.getBlock().getWorld().getName();
for (String p : worlds.keySet()) {
for (int i = 0; i < worlds.get(p).size(); i++) {
if (worlds.get(p).get(i).equals(w)) {
if (!Minigame.getMinigameInstance(p).getConfigManager().isBlockSpreadAllowed()) {
e.setCancelled(true);
break;
}
}
}
}
}
示例10: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
/**
* Prevents trees from growing into this space
* @param event
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBlockSpread(BlockSpreadEvent event) {
World world = event.getBlock().getWorld();
if (!world.equals(getBeaconzWorld())) {
return;
}
if (event.getBlock().getY() == BLOCK_HEIGHT) {
event.setCancelled(true);
}
}
示例11: onBS
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBS(final BlockSpreadEvent e) {
final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation());
if (PlotSquared.isPlotWorld(loc.getWorld())) {
if (MainUtil.isPlotRoad(loc)) {
e.setCancelled(true);
}
}
}
示例12: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler
public void onBlockSpread(BlockSpreadEvent event) {
Lot from = this.module.getLotManager().getLot(event.getSource().getLocation());
Lot to = this.module.getLotManager().getLot(event.getBlock().getLocation());
Town fromTown = this.module.getLotManager().getTown(event.getSource().getLocation());
Town toTown = this.module.getLotManager().getTown(event.getBlock().getLocation());
if((event.getBlock().getType() == Material.FIRE && (from != null || to != null || fromTown != null || toTown != null)) || (from != null && to == null) || (from == null && to != null) || from != to || (fromTown != null && toTown == null) || (fromTown == null && toTown != null) || fromTown != toTown) {
event.setCancelled(true);
}
}
示例13: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent event) {
Location location = BukkitUtil.adapt(event.getBlock().getLocation());
if (manager.isPlotWorld(location)) {
PlotId id = manager.getPlotId(location);
if (id == null) {
event.setCancelled(true);
} else {
event.setCancelled(api.isPlotLocked(id));
}
}
}
示例14: onBlockSpread
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent event) {
Block block = event.getBlock();
Location location = BukkitUtil.getLocation(block.getLocation());
if (location.isPlotRoad()) {
event.setCancelled(true);
return;
}
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Plot plot = area.getOwnedPlot(location);
if (plot == null) {
return;
}
switch (event.getSource().getType()) {
case GRASS:
if (Flags.GRASS_GROW.isFalse(plot)) {
event.setCancelled(true);
}
break;
case MYCEL:
if (Flags.MYCEL_GROW.isFalse(plot)) {
event.setCancelled(true);
}
break;
case VINE:
if (Flags.VINE_GROW.isFalse(plot)) {
event.setCancelled(true);
}
break;
}
}
示例15: firespreads
import org.bukkit.event.block.BlockSpreadEvent; //导入方法依赖的package包/类
@EventHandler
public void firespreads(BlockSpreadEvent e) {
if(e.getNewState().getType() == Material.FIRE) {
e.setCancelled(true);
}
}