Revert "cooking plugin: rename session to cooking session"
This reverts commit e40b1a7b10.
This commit is contained in:
@@ -29,8 +29,8 @@ import java.awt.Color;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.Duration;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import static net.runelite.api.AnimationID.COOKING_FIRE;
|
import static net.runelite.api.AnimationID.COOKING_FIRE;
|
||||||
import static net.runelite.api.AnimationID.COOKING_RANGE;
|
import static net.runelite.api.AnimationID.COOKING_RANGE;
|
||||||
@@ -72,7 +72,7 @@ class CookingOverlay extends Overlay
|
|||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
CookingSession session = plugin.getCookingSession();
|
CookingSession session = plugin.getSession();
|
||||||
if (session == null)
|
if (session == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -54,13 +54,13 @@ public class CookingPlugin extends Plugin
|
|||||||
private CookingConfig config;
|
private CookingConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private CookingOverlay cookingOverlay;
|
private CookingOverlay overlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private CookingSession cookingSession;
|
private CookingSession session;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
CookingConfig getConfig(ConfigManager configManager)
|
CookingConfig getConfig(ConfigManager configManager)
|
||||||
@@ -71,31 +71,31 @@ public class CookingPlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
cookingSession = null;
|
session = null;
|
||||||
overlayManager.add(cookingOverlay);
|
overlayManager.add(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.remove(cookingOverlay);
|
overlayManager.remove(overlay);
|
||||||
cookingSession = null;
|
session = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameTick(GameTick gameTick)
|
public void onGameTick(GameTick gameTick)
|
||||||
{
|
{
|
||||||
if (cookingSession == null || config.statTimeout() == 0)
|
if (session == null || config.statTimeout() == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration statTimeout = Duration.ofMinutes(config.statTimeout());
|
Duration statTimeout = Duration.ofMinutes(config.statTimeout());
|
||||||
Duration sinceCut = Duration.between(cookingSession.getLastCookingAction(), Instant.now());
|
Duration sinceCut = Duration.between(session.getLastCookingAction(), Instant.now());
|
||||||
|
|
||||||
if (sinceCut.compareTo(statTimeout) >= 0)
|
if (sinceCut.compareTo(statTimeout) >= 0)
|
||||||
{
|
{
|
||||||
cookingSession = null;
|
session = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,24 +116,24 @@ public class CookingPlugin extends Plugin
|
|||||||
|| message.startsWith("You cook")
|
|| message.startsWith("You cook")
|
||||||
|| message.startsWith("You squeeze the grapes into the jug"))
|
|| message.startsWith("You squeeze the grapes into the jug"))
|
||||||
{
|
{
|
||||||
if (cookingSession == null)
|
if (session == null)
|
||||||
{
|
{
|
||||||
cookingSession = new CookingSession();
|
session = new CookingSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
cookingSession.updateLastCookingAction();
|
session.updateLastCookingAction();
|
||||||
cookingSession.increaseCookAmount();
|
session.increaseCookAmount();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (message.startsWith("You accidentally burn"))
|
else if (message.startsWith("You accidentally burn"))
|
||||||
{
|
{
|
||||||
if (cookingSession == null)
|
if (session == null)
|
||||||
{
|
{
|
||||||
cookingSession = new CookingSession();
|
session = new CookingSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
cookingSession.updateLastCookingAction();
|
session.updateLastCookingAction();
|
||||||
cookingSession.increaseBurnAmount();
|
session.increaseBurnAmount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user