org.bukkit.event.inventory.FurnaceBurnEvent Java Examples
The following examples show how to use
org.bukkit.event.inventory.FurnaceBurnEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExprFurnaceSlot.java From Skript with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings({"unchecked", "null"}) @Override public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) { isEvent = matchedPattern == 0; slot = parseResult.mark; if (isEvent && slot == RESULT && !ScriptLoader.isCurrentEvent(FurnaceSmeltEvent.class)) { Skript.error("Cannot use 'result slot' outside a fuel smelt event."); return false; } else if (isEvent && slot == FUEL && !ScriptLoader.isCurrentEvent(FurnaceBurnEvent.class)) { Skript.error("Cannot use 'fuel slot' outside a fuel burn event."); return false; } if (!isEvent) setExpr((Expression<Block>) exprs[0]); return true; }
Example #2
Source File: ExprFurnaceSlot.java From Skript with GNU General Public License v3.0 | 6 votes |
@Override @Nullable public ItemStack getItem() { switch (slot) { case RESULT: if (e instanceof FurnaceSmeltEvent) return getTime() > -1 ? ((FurnaceSmeltEvent) e).getResult().clone() : super.getItem(); else return super.getItem(); case FUEL: if (e instanceof FurnaceBurnEvent) return getTime() > -1 ? ((FurnaceBurnEvent) e).getFuel().clone() : super.getItem(); else return pastItem(); case ORE: if (e instanceof FurnaceSmeltEvent) return pastItem(); else return super.getItem(); default: return null; } }
Example #3
Source File: FastSmeltingListener.java From UhcCore with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onFurnaceBurn(FurnaceBurnEvent e){ Block block = e.getBlock(); Bukkit.getScheduler().runTaskLater(UhcCore.getPlugin(), new Runnable() { @Override public void run() { // If the furnace is broken stop thread. if (block.getType() == Material.AIR){ return; } Furnace furnace = (Furnace) block.getState(); // If furnace almost stopped burning stop thread. A new FurnaceBurnEvent will be called. if (furnace.getBurnTime() <= 10) { return; } // If no item is cooking don't speed up cooking time but show down thread while waiting for the burning to stop. if (furnace.getCookTime() <= 0){ Bukkit.getScheduler().runTaskLater(UhcCore.getPlugin(), this, 5); return; } // Speed up cooking time by 10 ticks, this happens every 2 ticks (5x the default speed). short newCookTime = (short) (furnace.getCookTime() + speed); // If new cook time is greater than the max cook time of item set to 199. if (newCookTime >= 200){ newCookTime = 199; } furnace.setCookTime(newCookTime); furnace.update(); Bukkit.getScheduler().runTaskLater(UhcCore.getPlugin(), this, 2); } }, 1); }
Example #4
Source File: FurnaceBurn.java From AdditionsAPI with MIT License | 5 votes |
@EventHandler(priority = EventPriority.LOWEST) public void onFurnaceBurn(FurnaceBurnEvent event) { if (event.isCancelled()) return; ItemStack fuel = event.getFuel(); if (!AdditionsAPI.isCustomItem(fuel)) return; CustomItemStack cStack = new CustomItemStack(fuel); Bukkit.getPluginManager().callEvent(new CustomItemFurnaceBurnEvent(event, cStack)); }
Example #5
Source File: ExprBurnCookTime.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { cookTime = parseResult.mark == 1; isEvent = matchedPattern == 0; if (isEvent && !ScriptLoader.isCurrentEvent(FurnaceBurnEvent.class)) { Skript.error("Cannot use 'burning time' outside a fuel burn event."); return false; } if (!isEvent) setExpr((Expression<? extends Block>) exprs[0]); return true; }
Example #6
Source File: EnhancedFurnaceListener.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onFuelBurn(FurnaceBurnEvent e) { SlimefunItem furnace = BlockStorage.check(e.getBlock()); if (furnace instanceof EnhancedFurnace && ((EnhancedFurnace) furnace).getFuelEfficiency() > 0) { int burnTime = e.getBurnTime(); int newBurnTime = ((EnhancedFurnace) furnace).getFuelEfficiency() * burnTime; e.setBurnTime(Math.min(newBurnTime, Short.MAX_VALUE)); } }
Example #7
Source File: WorldFreeze.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onFurnaceBurn(FurnaceBurnEvent event) { if (!match.isRunning()) { event.setCancelled(true); event.setBurning(true); } }
Example #8
Source File: CustomItemFurnaceBurnEvent.java From AdditionsAPI with MIT License | 4 votes |
public CustomItemFurnaceBurnEvent(FurnaceBurnEvent event, CustomItemStack cStack) { super(cStack); this.setFurnaceBurnEvent(event); }
Example #9
Source File: CustomItemFurnaceBurnEvent.java From AdditionsAPI with MIT License | 4 votes |
/** * @return the event */ public FurnaceBurnEvent getFurnaceBurnEvent() { return event; }
Example #10
Source File: ExprFurnaceSlot.java From Skript with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public boolean setTime(final int time) { return super.setTime(time, getExpr(), FurnaceSmeltEvent.class, FurnaceBurnEvent.class); }
Example #11
Source File: CustomItemFurnaceBurnEvent.java From AdditionsAPI with MIT License | 2 votes |
/** * @param event * the event to set */ public void setFurnaceBurnEvent(FurnaceBurnEvent event) { this.event = event; }