mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Added AsyncReactorProcessCompleteEvent
This commit is contained in:
parent
fa1aad7bf8
commit
b98cdcf7d8
@ -0,0 +1,77 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.api.events;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This {@link Event} is fired whenever a {@link Reactor} has completed its process.
|
||||||
|
*
|
||||||
|
* @author poma123
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AsyncReactorProcessCompleteEvent extends Event {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private final Location location;
|
||||||
|
private final Reactor reactor;
|
||||||
|
private final MachineFuel machineFuel;
|
||||||
|
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public AsyncReactorProcessCompleteEvent(Location l, Reactor reactor, MachineFuel machineFuel) {
|
||||||
|
super(true);
|
||||||
|
|
||||||
|
this.location = l;
|
||||||
|
this.reactor = reactor;
|
||||||
|
this.machineFuel = machineFuel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This returns the {@link Location} of the reactor.
|
||||||
|
*
|
||||||
|
* @return The {@link Location} of the reactor
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public Location getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link SlimefunItem} instance of the reactor.
|
||||||
|
*
|
||||||
|
* @return The {@link SlimefunItem} instance of the reactor
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public Reactor getReactor() {
|
||||||
|
return reactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This returns the used {@link MachineFuel} in the process.
|
||||||
|
*
|
||||||
|
* @return The {@link MachineFuel} of the process
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
public MachineFuel getMachineFuel() {
|
||||||
|
return machineFuel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return getHandlerList();
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.api.events.AsyncReactorProcessCompleteEvent;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.events.ReactorExplodeEvent;
|
import io.github.thebusybiscuit.slimefun4.api.events.ReactorExplodeEvent;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||||
@ -376,6 +377,8 @@ public abstract class Reactor extends AbstractEnergyProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new AsyncReactorProcessCompleteEvent(l, Reactor.this, getProcessing(l)));
|
||||||
|
|
||||||
progress.remove(l);
|
progress.remove(l);
|
||||||
processing.remove(l);
|
processing.remove(l);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user