本文整理汇总了Java中org.bukkit.Material.FIRE属性的典型用法代码示例。如果您正苦于以下问题:Java Material.FIRE属性的具体用法?Java Material.FIRE怎么用?Java Material.FIRE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.FIRE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockSpread
/**
* 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: onBlockBurn
@EventWrapper
public void onBlockBurn(final BlockBurnEvent event) {
Match match = PGM.getMatchManager().getMatch(event.getBlock().getWorld());
if(match == null) return;
BlockState oldState = event.getBlock().getState();
BlockState newState = BlockStateUtils.toAir(oldState);
MatchPlayerState igniterState = null;
for(BlockFace face : NEIGHBORS) {
Block neighbor = oldState.getBlock().getRelative(face);
if(neighbor.getType() == Material.FIRE) {
igniterState = blockResolver.getOwner(neighbor);
if(igniterState != null) break;
}
}
this.callEvent(event, oldState, newState, igniterState);
}
示例3: BlockPlaceEvent
@EventHandler
public void BlockPlaceEvent(BlockPlaceEvent e){
Player p = e.getPlayer();
Block b = e.getBlock();
if (e.getItemInHand().getType() == Material.DROPPER && e.getItemInHand().getEnchantments() != null && e.getItemInHand().getEnchantments().containsKey(Enchantment.ARROW_DAMAGE)) {
Casino c = new Casino(e.getBlockPlaced().getLocation());
c.effect();
}
for(Entity en : p.getNearbyEntities (4D, 4D, 4D)){
if (en instanceof Player){
if(en == p) continue;
if(b.getType() == Material.FIRE){
if(Files.user.getBoolean("Users." + en.getName() + ".pvp") == false){
p.sendMessage(Utils.colorize(PAData.SURVIVAL.getPrefix() + ChatColor.DARK_RED + " No puedes poner ese bloque cerca de un jugador con el pvp desactivado."));
e.setCancelled(true);
}
}
}
}
}
示例4: onBlockSpread
@EventWrapper
public void onBlockSpread(final BlockSpreadEvent event) {
// This fires for: fire, grass, mycelium, mushrooms, and vines
// Fire is already handled by BlockIgniteEvent
if(event.getNewState().getType() != Material.FIRE) {
this.callEvent(new BlockTransformEvent(event, event.getBlock().getState(), event.getNewState()));
}
}
示例5: BlockPlaceEvent
@EventHandler
public void BlockPlaceEvent(org.bukkit.event.block.BlockPlaceEvent e){
Player p = e.getPlayer();
Block b = e.getBlock();
for(Entity en : p.getNearbyEntities (4D, 4D, 4D)){
if (en instanceof Player){
if(en == p) continue;
if(b.getType() == Material.FIRE){
if(Files.user.getBoolean("Users." + en.getName() + ".pvp") == false){
p.sendMessage(Message.prefix + ChatColor.DARK_RED + " No puedes poner ese bloque cerca de un jugador con el pvp desactivado.");
e.setCancelled(true);
}
}
}
}
}
示例6: onItemClick
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemClick(PlayerInteractEvent event)
{
if(event.isCancelled()) return;
if(event.hasItem())
{
Player player = event.getPlayer();
if(player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE)
{
ItemStack mainItem = player.getInventory().getItemInMainHand();
if(mainItem.getType() == Material.GLASS_BOTTLE)
{
if(event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
if(event.getClickedBlock().getType() == Material.CAULDRON && event.getClickedBlock().getData() != (byte)0)
{
Block fire = event.getClickedBlock().getRelative(BlockFace.DOWN);
event.setCancelled(true);
event.getClickedBlock().setData((byte)((int)event.getClickedBlock().getData() - 1));
ItemStack waterBottle = new ItemStack(Material.POTION, 1);
net.minecraft.server.v1_12_R1.ItemStack nmsStack_bottle = CraftItemStack.asNMSCopy(waterBottle);
NBTTagCompound compound_bottle = nmsStack_bottle.getTag();
compound_bottle.setString("Potion","minecraft:water");
compound_bottle.setInt("HideFlags", 32);
nmsStack_bottle.setTag(compound_bottle);
waterBottle = CraftItemStack.asBukkitCopy(nmsStack_bottle);
ItemMeta meta = waterBottle.getItemMeta();
if(fire != null && fire.getType() == Material.FIRE)
{
List<String> lore = Arrays.asList
(
ChatColor.RESET + "" + ChatColor.GRAY + Survival.Words.get("Purified")
);
meta.setLore(lore);
}
waterBottle.setItemMeta(meta);
if(mainItem.getAmount() > 1)
{
mainItem.setAmount(mainItem.getAmount() - 1);
if(player.getInventory().firstEmpty() != -1)
player.getInventory().addItem(waterBottle);
else
player.getWorld().dropItem(player.getLocation(), waterBottle);
}
else
{
player.getInventory().setItemInMainHand(waterBottle);
}
}
}
}
}
}
}