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 ArrayList<ExtendedLocation> controlPoints = new ArrayList<>();
|
||||||
public static Logger logger;
|
public static Logger logger;
|
||||||
public static Plugin plugin;
|
public static Plugin plugin;
|
||||||
private static float dt = 0.01f;
|
public static int nbSubdiv = 100;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -89,6 +89,8 @@ public class Camera extends JavaPlugin implements Listener {
|
||||||
public static void compute() {
|
public static void compute() {
|
||||||
patchYaws();
|
patchYaws();
|
||||||
|
|
||||||
|
float dt = 1 / (float) nbSubdiv;
|
||||||
|
|
||||||
int nControlPoints = controlPoints.size();
|
int nControlPoints = controlPoints.size();
|
||||||
curve = new ArrayList<>();
|
curve = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,18 @@ public class ExecuteTraveling implements CommandExecutor {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
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) {
|
if (taskID >= 0) {
|
||||||
// Cancel show task
|
// Cancel show task
|
||||||
Bukkit.getScheduler().cancelTask(taskID);
|
Bukkit.getScheduler().cancelTask(taskID);
|
||||||
|
@ -25,7 +37,8 @@ public class ExecuteTraveling implements CommandExecutor {
|
||||||
return true;
|
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() {
|
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Camera.plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue