本文整理匯總了Java中org.bukkit.event.block.BlockIgniteEvent.isCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockIgniteEvent.isCancelled方法的具體用法?Java BlockIgniteEvent.isCancelled怎麽用?Java BlockIgniteEvent.isCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.block.BlockIgniteEvent
的用法示例。
在下文中一共展示了BlockIgniteEvent.isCancelled方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ignite
import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public boolean ignite(Player igniter, Location loc, IgniteCause cause) {
Random rand = new Random();
loc.add(0.5, 0.5, 0.5);
BlockIgniteEvent igniteEvent = new BlockIgniteEvent(loc.getBlock(),
cause, (org.bukkit.entity.Entity) igniter);
Bukkit.getServer().getPluginManager().callEvent(igniteEvent);
if (igniteEvent.isCancelled()) {
return false;
}
BlockState blockState = loc.getBlock().getState();
BlockPlaceEvent placeEvent = new BlockPlaceEvent(loc.getBlock(),
blockState, loc.getBlock(), igniter.getItemInHand(), igniter, true);
Bukkit.getServer().getPluginManager().callEvent(placeEvent);
if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false);
return false;
}
loc.getWorld().playSound(loc, Sound.ITEM_FLINTANDSTEEL_USE, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
loc.getBlock().setType(Material.FIRE);
return true;
}
示例2: onBlockStartBurn
import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockStartBurn(BlockIgniteEvent e){
if (e.isCancelled()){
return;
}
Block b = e.getBlock();
Block bignit = e.getIgnitingBlock();
if ( b == null || bignit == null){
return;
}
RedProtect.get().logger.debug("Is BlockIgniteEvent event from global-listener");
Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
if (r != null){
return;
}
if ((bignit.getType().equals(Material.FIRE) || bignit.getType().name().contains("LAVA")) && !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".fire-spread")){
e.setCancelled(true);
}
}
示例3: onBlockIgnite
import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH)
public void onBlockIgnite(final BlockIgniteEvent event) {
if (event.isCancelled())
return;
final Block block = event.getBlock();
// Ok so a frame block ignites
// Find the nearest gate!
final WorldCoord blockCoord = new WorldCoord(block);
final Gate nearestGate = Gates.gateFromFrameAndSurround(blockCoord);
if (nearestGate != null) {
event.setCancelled(true);
}
}
示例4: onBlockStartBurn
import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void onBlockStartBurn(BlockIgniteEvent e){
RedProtect.get().logger.debug("RPBlockListener - Is BlockIgniteEvent event");
if (e.isCancelled()){
return;
}
Block b = e.getBlock();
Block bignit = e.getIgnitingBlock();
if (b == null){
return;
}
RedProtect.get().logger.debug("Is BlockIgniteEvent event. Canceled? " + e.isCancelled());
Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
if (r != null && !r.canFire()){
if (e.getIgnitingEntity() != null){
if (e.getIgnitingEntity() instanceof Player){
Player p = (Player) e.getIgnitingEntity();
if (!r.canBuild(p)){
RPLang.sendMessage(p, "blocklistener.region.cantplace");
e.setCancelled(true);
return;
}
} else {
e.setCancelled(true);
return;
}
}
if (bignit != null && (bignit.getType().equals(Material.FIRE) || bignit.getType().name().contains("LAVA"))){
e.setCancelled(true);
return;
}
if (e.getCause().equals(IgniteCause.LIGHTNING) || e.getCause().equals(IgniteCause.EXPLOSION) || e.getCause().equals(IgniteCause.FIREBALL)){
e.setCancelled(true);
}
}
}
示例5: ignite
import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public boolean ignite(Player igniter, Location loc, IgniteCause cause) {
Random rand = new Random();
loc.add(0.5, 0.5, 0.5);
BlockIgniteEvent igniteEvent = new BlockIgniteEvent(loc.getBlock(),
cause, (org.bukkit.entity.Entity) igniter);
Bukkit.getServer().getPluginManager().callEvent(igniteEvent);
if (igniteEvent.isCancelled()) {
return false;
}
List<Location> locations = new ArrayList<Location>();
for(double x = loc.getX() - 2;x <= loc.getX() + 2;x++)
{
for(double y = loc.getY() - 1;y <= loc.getY() + 1;y++)
{
for(double z = loc.getZ() - 2;z <= loc.getZ() + 2;z++)
{
locations.add(new Location(loc.getWorld(),x,y,z));
}
}
}
for(Location l : locations)
{
BlockIgniteEvent igniteEvent2 = new BlockIgniteEvent(l.getBlock(),
cause, (org.bukkit.entity.Entity) igniter);
Bukkit.getServer().getPluginManager().callEvent(igniteEvent2);
if (igniteEvent2.isCancelled()) {
continue;
}
BlockState blockState = l.getBlock().getState();
BlockPlaceEvent placeEvent = new BlockPlaceEvent(l.getBlock(),
blockState, l.getBlock(), igniter.getItemInHand(), igniter, true);
Bukkit.getServer().getPluginManager().callEvent(placeEvent);
if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
continue;
}
if(l.getBlock() == null || l.getBlock().getType() == Material.AIR)
l.getBlock().setType(Material.FIRE);
}
loc.getWorld().playSound(loc, Sound.ITEM_FIRECHARGE_USE, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
return true;
}
示例6: captureIgniteEvent
import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler
public void captureIgniteEvent(BlockIgniteEvent event) {
if (!event.isCancelled())
logAndSend(getLoggableBlockEvent(BlockEventAction.IGNITE, event));
}
示例7: onBlockIgnite
import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockIgnite(BlockIgniteEvent event) {
if(!event.isCancelled()) {
logChunk(event.getBlock().getLocation());
}
}
示例8: onBlockIgnite
import org.bukkit.event.block.BlockIgniteEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockIgnite(BlockIgniteEvent event) {
if (!event.isCancelled() && event.getPlayer() != null)
tgym.afkTimer
.put(event.getPlayer().getName(), System.currentTimeMillis());
}