package parachute.scripts.pwoodcutter.strategies;

import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.GroundItems;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.GroundItem;
import org.rev317.min.api.wrappers.SceneObject;

import parachute.scripts.pwoodcutter.main.Boot;
import parachute.scripts.pwoodcutter.main.Data;

public class CutEvent implements Strategy {

	GroundItem[] nests;

	@Override
	public boolean activate() {
		nests = GroundItems.getNearest(Data.nestids);
		SceneObject[] willow = SceneObjects.getNearest(Data.idwillow);
		return willow[0] != null && !Inventory.isFull() && nestTrue();
	}

	@Override
	public void execute() {
		SceneObject[] willow = SceneObjects.getNearest(Data.idwillow);
		if (willow[0] != null) {
			if (willow[0].getLocation().distanceTo() < 20) {
				willow[0].interact(46);
				Time.sleep(2000);
			}
			while (Players.getMyPlayer().getAnimation() != -1
					&& !Inventory.isFull() && nestTrue()
					&& willow[0] != null && logErbij()) {
				nests = GroundItems.getNearest(Data.nestids);
				Time.sleep(10);
			}
		}
	}
	
	public boolean logErbij(){
		int Inventory1 = Inventory.getCount();
		Time.sleep(1500);
		int Inventory2 = Inventory.getCount();
		return Inventory1 < Inventory2;		
		
	}
	
	public boolean nestTrue(){
		if(Boot.Method == "Banking"){
			if(nests.length <= 0){
				return true;
			}
		}
		if(Boot.Method == "Empty"){
			return true;
		}
		return false;
	}

}

@@ -433,56 +433,8 @@
 t;%0A%0A
-import parachute.scripts.pwoodcutter.main.Boot;%0A
 impo
@@ -543,16 +543,39 @@
 %5D nests;
+%0A%09SceneObject%5B%5D chosen;
 %0A%0A%09@Over
@@ -658,36 +658,22 @@
 ids);%0A%09%09
-SceneObject%5B%5D willow
+chosen
  = Scene
@@ -694,30 +694,30 @@
 rest(Data.id
-willow
+chosen
 );%0A%09%09return 
@@ -716,22 +716,43 @@
 %09return 
-willow
+chosen.length %3E 0 && chosen
 %5B0%5D != n
@@ -791,16 +791,50 @@
 stTrue()
+ && Data.chosenRegion.isInRegion()
 ;%0A%09%7D%0A%0A%09@
@@ -883,22 +883,22 @@
 bject%5B%5D 
-willow
+chosen
  = Scene
@@ -923,22 +923,22 @@
 (Data.id
-willow
+chosen
 );%0A%09%09if 
@@ -938,22 +938,22 @@
 ;%0A%09%09if (
-willow
+chosen
 %5B0%5D != n
@@ -966,22 +966,22 @@
 %0A%09%09%09if (
-willow
+chosen
 %5B0%5D.getL
@@ -1015,22 +1015,22 @@
 ) %7B%0A%09%09%09%09
-willow
+chosen
 %5B0%5D.inte
@@ -1038,10 +1038,9 @@
 act(
-46
+1
 );%0A%09
@@ -1172,14 +1172,14 @@
 %09&& 
-willow
+chosen
 %5B0%5D 
@@ -1490,28 +1490,28 @@
 rue()%7B%0A%09%09if(
-Boot
+Data
 .Method == %22
@@ -1582,12 +1582,12 @@
 %09if(
-Boot
+Data
 .Met

Update CutEvent.java