本文整理汇总了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);
}
}
});
}
示例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());
}
示例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()));
}
示例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()));
}
}
示例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;
}
}
示例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);
}
}
示例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())));
}
}
示例8: onFurnaceBurn
import org.bukkit.event.inventory.FurnaceBurnEvent; //导入依赖的package包/类
@EventHandler
public void onFurnaceBurn(FurnaceBurnEvent event) {
if (!match.isRunning()) {
event.setCancelled(true);
event.setBurning(true);
}
}
示例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);
}
}
示例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());
}
}
示例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
}
示例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);
}
示例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);
}
示例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();
}
}
示例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();
}
}