feat: exec from to
This commit is contained in:
parent
1638d4be32
commit
cc2197174c
|
@ -21,7 +21,7 @@ public class Camera extends JavaPlugin implements Listener {
|
|||
public static ArrayList<ExtendedLocation> controlPoints = new ArrayList<>();
|
||||
public static Logger logger;
|
||||
public static Plugin plugin;
|
||||
private static float dt = 0.01f;
|
||||
public static int nbSubdiv = 100;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -89,6 +89,8 @@ public class Camera extends JavaPlugin implements Listener {
|
|||
public static void compute() {
|
||||
patchYaws();
|
||||
|
||||
float dt = 1 / (float) nbSubdiv;
|
||||
|
||||
int nControlPoints = controlPoints.size();
|
||||
curve = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -17,6 +17,18 @@ public class ExecuteTraveling implements CommandExecutor {
|
|||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
int fromIndex, toIndex;
|
||||
try {
|
||||
fromIndex = Integer.parseInt(args[0]);
|
||||
} catch (Exception e) {
|
||||
fromIndex = 0;
|
||||
}
|
||||
try {
|
||||
toIndex = Integer.parseInt(args[1]);
|
||||
} catch (Exception e) {
|
||||
toIndex = (Camera.controlPoints.size() - 1) / 3;
|
||||
}
|
||||
|
||||
if (taskID >= 0) {
|
||||
// Cancel show task
|
||||
Bukkit.getScheduler().cancelTask(taskID);
|
||||
|
@ -25,7 +37,8 @@ public class ExecuteTraveling implements CommandExecutor {
|
|||
return true;
|
||||
}
|
||||
|
||||
curveIterator = Camera.curve.iterator();
|
||||
curveIterator = Camera.curve.subList(fromIndex * (Camera.nbSubdiv + 1), toIndex * (Camera.nbSubdiv + 1))
|
||||
.iterator();
|
||||
|
||||
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Camera.plugin, new Runnable() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue