Skip to content
Snippets Groups Projects
Commit d3dd2606 authored by Adry85's avatar Adry85
Browse files

Using Java 8 Time API on BlackMarketeerOfMammon AI.

parent 0c05c9b6
No related branches found
No related tags found
No related merge requests found
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
*/ */
package ai.npc.BlackMarketeerOfMammon; package ai.npc.BlackMarketeerOfMammon;
import java.util.Calendar; import java.time.LocalTime;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.enums.QuestType; import com.l2jserver.gameserver.enums.QuestType;
import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.L2Npc;
...@@ -29,6 +27,8 @@ import com.l2jserver.gameserver.model.itemcontainer.Inventory; ...@@ -29,6 +27,8 @@ import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State; import com.l2jserver.gameserver.model.quest.State;
import ai.npc.AbstractNpcAI;
/** /**
* Black Marketeer of Mammon - Exchange Adena for AA. * Black Marketeer of Mammon - Exchange Adena for AA.
* @author Adry_85 * @author Adry_85
...@@ -100,17 +100,8 @@ public final class BlackMarketeerOfMammon extends AbstractNpcAI ...@@ -100,17 +100,8 @@ public final class BlackMarketeerOfMammon extends AbstractNpcAI
private boolean exchangeAvailable() private boolean exchangeAvailable()
{ {
Calendar currentTime = Calendar.getInstance(); LocalTime localTime = LocalTime.now();
Calendar minTime = Calendar.getInstance(); return (localTime.isAfter(LocalTime.parse("20:00:00")) && localTime.isBefore(LocalTime.MAX));
minTime.set(Calendar.HOUR_OF_DAY, 20);
minTime.set(Calendar.MINUTE, 0);
minTime.set(Calendar.SECOND, 0);
Calendar maxtTime = Calendar.getInstance();
maxtTime.set(Calendar.HOUR_OF_DAY, 23);
maxtTime.set(Calendar.MINUTE, 59);
maxtTime.set(Calendar.SECOND, 59);
return (currentTime.compareTo(minTime) >= 0) && (currentTime.compareTo(maxtTime) <= 0);
} }
public static void main(String[] args) public static void main(String[] args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment