1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Merge pull request #2306 from poma123/patch-1

Made MachineProcessCompleteEvent async
This commit is contained in:
TheBusyBiscuit 2020-09-10 15:56:49 +02:00 committed by GitHub
commit 4d1407563f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -15,7 +15,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
* @author poma123
*
*/
public class MachineProcessCompleteEvent extends Event {
public class AsyncMachineProcessCompleteEvent extends Event {
private static final HandlerList handlerList = new HandlerList();
@ -23,7 +23,9 @@ public class MachineProcessCompleteEvent extends Event {
private final MachineRecipe machineRecipe;
@ParametersAreNonnullByDefault
public MachineProcessCompleteEvent(Block block, MachineRecipe machineRecipe) {
public AsyncMachineProcessCompleteEvent(Block block, MachineRecipe machineRecipe) {
super(true);
this.block = block;
this.machineRecipe = machineRecipe;
}

View File

@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.github.thebusybiscuit.slimefun4.api.events.MachineProcessCompleteEvent;
import io.github.thebusybiscuit.slimefun4.api.events.AsyncMachineProcessCompleteEvent;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -253,7 +253,7 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock,
inv.pushItem(output.clone(), getOutputSlots());
}
Bukkit.getPluginManager().callEvent(new MachineProcessCompleteEvent(b, getProcessing(b)));
Bukkit.getPluginManager().callEvent(new AsyncMachineProcessCompleteEvent(b, getProcessing(b)));
progress.remove(b);
processing.remove(b);