当前位置: 首页>>代码示例>>Java>>正文


Java FurnaceBurnEvent类代码示例

本文整理汇总了Java中org.bukkit.event.inventory.FurnaceBurnEvent的典型用法代码示例。如果您正苦于以下问题:Java FurnaceBurnEvent类的具体用法?Java FurnaceBurnEvent怎么用?Java FurnaceBurnEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FurnaceBurnEvent类属于org.bukkit.event.inventory包,在下文中一共展示了FurnaceBurnEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@Override
protected Slot[] get(final Event e, final Block[] source) {
	return get(source, new Getter<Slot, Block>() {
		@SuppressWarnings("null")
		@Override
		@Nullable
		public Slot get(final Block b) {
			if (b.getType() != Material.FURNACE && b.getType() != Material.BURNING_FURNACE)
				return null;
			if (getTime() >= 0 && (e instanceof FurnaceSmeltEvent && b.equals(((FurnaceSmeltEvent) e).getBlock()) || e instanceof FurnaceBurnEvent && b.equals(((FurnaceBurnEvent) e).getBlock())) && !Delay.isDelayed(e)) {
				return new FurnaceEventSlot(e, ((Furnace) b.getState()).getInventory());
			} else {
				return new InventorySlot(((Furnace) b.getState()).getInventory(), slot);
			}
		}
	});
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:18,代码来源:ExprFurnaceSlot.java

示例2: onFurnaceBurn

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = false)
public void onFurnaceBurn(cn.nukkit.event.inventory.FurnaceBurnEvent event) {
	if (canIgnore(FurnaceBurnEvent.getHandlerList())) {
		return;
	}

	Block furnace = PokkitBlock.toBukkit(event.getBlock());
	ItemStack fuel = PokkitItemStack.toBukkitCopy(event.getFuel());
	FurnaceBurnEvent bukkitEvent = new FurnaceBurnEvent(furnace, fuel, event.getBurnTime());
	bukkitEvent.setBurning(event.isBurning());

	callCancellable(event, bukkitEvent);

	event.setBurning(bukkitEvent.isBurning());
	event.setBurnTime((short) bukkitEvent.getBurnTime());
	PokkitItemStack.overwriteNukkit(bukkitEvent.getFuel(), event.getFuel());
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:18,代码来源:InventoryEvents.java

示例3: onFurnaceBurnEvent

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFurnaceBurnEvent(FurnaceBurnEvent event) {
    Block furnaceBlock = event.getBlock();
    BlockState furnaceState = furnaceBlock.getState();
    ItemStack smelting = furnaceState instanceof Furnace ? ((Furnace) furnaceState).getInventory().getSmelting() : null;

    if (!ItemUtils.isSmeltable(smelting)) {
        return;
    }

    Player player = getPlayerFromFurnace(furnaceBlock);

    if (!UserManager.hasPlayerDataKey(player) || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY)) {
        return;
    }

    event.setBurnTime(UserManager.getPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime()));
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:19,代码来源:InventoryListener.java

示例4: onBurn

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
public void onBurn(FurnaceBurnEvent e)
{
    if(BlockStorage.check(e.getBlock()) != null && (BlockStorage.check(e.getBlock()) instanceof EnhancedFurnace))
    {
        EnhancedFurnace furnace = (EnhancedFurnace)BlockStorage.check(e.getBlock());
        if(furnace.getFuelEfficiency() > 0)
            e.setBurnTime((int)((1.0D + 0.20000000000000001D * (double)furnace.getFuelEfficiency()) * (double)e.getBurnTime()));
    }
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:10,代码来源:FurnaceListener.java

示例5: onItemBurn

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler
public void onItemBurn(FurnaceBurnEvent e) {
	//we don't want out stuff to burn, so cancel it if it's ours!
	if (e.getBlock().getLocation().equals(furnace.getLocation())) {
		e.setCancelled(true);
		e.setBurning(true);
		
	
		return;
	}
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:12,代码来源:CookingGui.java

示例6: onFurnaceBurn

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler
public void onFurnaceBurn(FurnaceBurnEvent event) {
    if (!match.getState().equals(MatchState.PLAYING)) {
        event.setCancelled(true);
        event.setBurning(true);
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:8,代码来源:WorldFreeze.java

示例7: onBurn

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBurn(FurnaceBurnEvent e) {
	if (BlockStorage.check(e.getBlock()) != null && BlockStorage.check(e.getBlock()) instanceof EnhancedFurnace) {
		EnhancedFurnace furnace = (EnhancedFurnace) BlockStorage.check(e.getBlock());
		if (furnace.getFuelEfficiency() > 0) e.setBurnTime(((int) ((1.0 + 0.2 * furnace.getFuelEfficiency()) * e.getBurnTime())));
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:8,代码来源:FurnaceListener.java

示例8: onFurnaceBurn

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler
public void onFurnaceBurn(FurnaceBurnEvent event) {
    if (!match.isRunning()) {
        event.setCancelled(true);
        event.setBurning(true);
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:8,代码来源:WorldFreeze.java

示例9: onFurnaceBurn

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onFurnaceBurn(FurnaceBurnEvent event) {
    // Block custom items being used as fuel in furnace (todo: add fuel power to items?)
    if (registry.get().getDefinition(event.getFuel()).isPresent()) {
        event.setCancelled(true);
    }
}
 
开发者ID:t7seven7t,项目名称:CraftFX,代码行数:8,代码来源:RecipeListener.java

示例10: customFuel

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler
public void customFuel(FurnaceBurnEvent ev){
	SpoutItemStack item = new SpoutItemStack(ev.getFuel());
	if (item.getMaterial() instanceof Burnable && ((Burnable)item.getMaterial()).getBurnTime() > 0) {
		ev.setBurning(true);
		ev.setBurnTime(((Burnable)item.getMaterial()).getBurnTime());
	}
}
 
开发者ID:SamMauldin,项目名称:SxwPlugin,代码行数:9,代码来源:SxwEvents.java

示例11: fuelFast

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler
public void fuelFast(FurnaceBurnEvent e) {
    if (!(e.getBlock().getState() instanceof Furnace)) return;
    Furnace f = (Furnace) e.getBlock().getState();
    if (!RUtils.isInInfectedWorld(f.getLocation())) return;
    ConfManager cm = ConfManager.getConfManager("otherdata.yml");
    Location l = f.getLocation();
    String path = "furnaces." + l.getWorld().getName() + "," + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ();
    if (!cm.getBoolean(path, false)) return;
    f.setCookTime((short) 140); // 7 seconds in = 3 seconds left
}
 
开发者ID:RoyalDev,项目名称:RoyalSurvivors,代码行数:12,代码来源:SurvivorsListener.java

示例12: onFurnaceBurn

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler
public void onFurnaceBurn(FurnaceBurnEvent event)
{
    Random RND = new Random();
    startUpdate((Furnace)event.getBlock().getState(), RND.nextBoolean() ? 1 : 2);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:7,代码来源:FastBrewingListener.java

示例13: setTime

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean setTime(final int time) {
	return super.setTime(time, getExpr(), FurnaceSmeltEvent.class, FurnaceBurnEvent.class);
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:6,代码来源:ExprFurnaceSlot.java

示例14: h

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
public void h() {
    boolean flag = this.burnTime > 0;
    boolean flag1 = false;

    // CraftBukkit start - Use wall time instead of ticks for cooking
    int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
    this.lastTick = MinecraftServer.currentTick;

    // CraftBukkit - moved from below
    if (this.isBurning() && this.canBurn()) {
        this.cookTime += elapsedTicks;
        if (this.cookTime >= 200) {
            this.cookTime %= 200;
            this.burn();
            flag1 = true;
        }
    } else {
        this.cookTime = 0;
    }
    // CraftBukkit end

    if (this.burnTime > 0) {
        this.burnTime -= elapsedTicks; // CraftBukkit - use elapsedTicks in place of constant
    }

    if (!this.world.isStatic) {
        if (this.burnTime != 0 || this.items[1] != null && this.items[0] != null) {
            // CraftBukkit start - Handle multiple elapsed ticks
            if (this.burnTime <= 0 && this.canBurn()) { // CraftBukkit - == to <=
                CraftItemStack fuel = CraftItemStack.asCraftMirror(this.items[1]);

                FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, fuelTime(this.items[1]));
                this.world.getServer().getPluginManager().callEvent(furnaceBurnEvent);

                if (furnaceBurnEvent.isCancelled()) {
                    return;
                }

                this.ticksForCurrentFuel = furnaceBurnEvent.getBurnTime();
                this.burnTime += this.ticksForCurrentFuel;
                if (this.burnTime > 0 && furnaceBurnEvent.isBurning()) {
                    // CraftBukkit end
                    flag1 = true;
                    if (this.items[1] != null) {
                        --this.items[1].count;
                        if (this.items[1].count == 0) {
                            Item item = this.items[1].getItem().t();

                            this.items[1] = item != null ? new ItemStack(item) : null;
                        }
                    }
                }
            }

            /* CraftBukkit start - Moved up
            if (this.isBurning() && this.canBurn()) {
                ++this.cookTime;
                if (this.cookTime == 200) {
                    this.cookTime = 0;
                    this.burn();
                    flag1 = true;
                }
            } else {
                this.cookTime = 0;
            }
            */
        }

        if (flag != this.burnTime > 0) {
            flag1 = true;
            BlockFurnace.a(this.burnTime > 0, this.world, this.x, this.y, this.z);
        }
    }

    if (flag1) {
        this.update();
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:79,代码来源:TileEntityFurnace.java

示例15: h

import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
public void h() {
    boolean flag = this.burnTime > 0;
    boolean flag1 = false;

    // CraftBukkit start - Use wall time instead of ticks for cooking
    int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
    this.lastTick = MinecraftServer.currentTick;

    // CraftBukkit - moved from below
    if (this.isBurning() && this.canBurn()) {
        this.cookTime += elapsedTicks;
        if (this.cookTime >= 200) {
            this.cookTime %= 200;
            this.burn();
            flag1 = true;
        }
    } else {
        this.cookTime = 0;
    }
    // CraftBukkit end

    if (this.burnTime > 0) {
        this.burnTime -= elapsedTicks; // CraftBukkit
    }

    if (!this.world.isStatic) {
        // CraftBukkit start - Handle multiple elapsed ticks
        if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <=
            CraftItemStack fuel = CraftItemStack.asCraftMirror(this.items[1]);

            FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, fuelTime(this.items[1]));
            this.world.getServer().getPluginManager().callEvent(furnaceBurnEvent);

            if (furnaceBurnEvent.isCancelled()) {
                return;
            }

            this.ticksForCurrentFuel = furnaceBurnEvent.getBurnTime();
            this.burnTime += this.ticksForCurrentFuel;
            if (this.burnTime > 0 && furnaceBurnEvent.isBurning()) {
                // CraftBukkit end
                flag1 = true;
                if (this.items[1] != null) {
                    --this.items[1].count;
                    if (this.items[1].count == 0) {
                        Item item = this.items[1].getItem().t();

                        this.items[1] = item != null ? new ItemStack(item) : null;
                    }
                }
            }
        }

        /* CraftBukkit start - Moved up
        if (this.isBurning() && this.canBurn()) {
            ++this.cookTime;
            if (this.cookTime == 200) {
                this.cookTime = 0;
                this.burn();
                flag1 = true;
            }
        } else {
            this.cookTime = 0;
        }
        // CraftBukkit end */

        if (flag != this.burnTime > 0) {
            flag1 = true;
            BlockFurnace.a(this.burnTime > 0, this.world, this.x, this.y, this.z);
        }
    }

    if (flag1) {
        this.update();
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:77,代码来源:TileEntityFurnace.java


注:本文中的org.bukkit.event.inventory.FurnaceBurnEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。