Adds information about the appropriate crafting station in ActionStartEvent
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
This commit is contained in:
@@ -6,6 +6,7 @@ import net.knarcraft.blacksmith.event.BlacksmithReforgeStartEvent;
|
||||
import net.knarcraft.blacksmith.event.NPCSoundEvent;
|
||||
import net.knarcraft.blacksmith.event.ScrapperSalvageStartEvent;
|
||||
import net.knarcraft.blacksmith.util.ItemHelper;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.SoundCategory;
|
||||
import org.bukkit.World;
|
||||
@@ -100,10 +101,11 @@ public abstract class Session implements Runnable {
|
||||
this.finishTime = System.currentTimeMillis() + (actionDelay * 1000L);
|
||||
long actionDelayTicks = actionDelay * 20L;
|
||||
|
||||
BlacksmithPlugin instance = BlacksmithPlugin.getInstance();
|
||||
if (this instanceof ReforgeSession) {
|
||||
BlacksmithPlugin.getInstance().callEvent(new BlacksmithReforgeStartEvent(npc, player, actionDelayTicks));
|
||||
instance.callEvent(new BlacksmithReforgeStartEvent(npc, player, actionDelayTicks, getCraftingStation()));
|
||||
} else if (this instanceof SalvageSession) {
|
||||
BlacksmithPlugin.getInstance().callEvent(new ScrapperSalvageStartEvent(npc, player, actionDelayTicks));
|
||||
instance.callEvent(new ScrapperSalvageStartEvent(npc, player, actionDelayTicks, getCraftingStation()));
|
||||
}
|
||||
|
||||
taskId = scheduler.scheduleSyncDelayedTask(BlacksmithPlugin.getInstance(), this, actionDelayTicks);
|
||||
@@ -157,6 +159,13 @@ public abstract class Session implements Runnable {
|
||||
*/
|
||||
protected abstract int getActionDelay();
|
||||
|
||||
/**
|
||||
* Gets the appropriate crafting station for this session
|
||||
*
|
||||
* @return <p>The appropriate crafting station</p>
|
||||
*/
|
||||
protected abstract @NotNull Material getCraftingStation();
|
||||
|
||||
/**
|
||||
* Plays an NPC sound
|
||||
*
|
||||
|
Reference in New Issue
Block a user