mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Poor attempt at adding pregen pausing
Please fix /command/CommandIrisPregen.java (has // TODO:) and /util/PregenJob.java (has // TODO:)
This commit is contained in:
parent
265936a791
commit
6199256058
@ -35,11 +35,41 @@ public class CommandIrisPregen extends MortarCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Stopped all pregens.");
|
||||
}
|
||||
sender.sendMessage("Stopped All Pregens.");
|
||||
PregenJob.stop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/* TODO: help
|
||||
else if(args[0].equalsIgnoreCase("pause"))
|
||||
{
|
||||
if(PregenJob.task == -1)
|
||||
{
|
||||
sender.sendMessage("No Active Pregens");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PregenJob.isPaused()) {
|
||||
PregenJob.resume();
|
||||
} else {
|
||||
PregenJob.pause();
|
||||
}
|
||||
sender.sendMessage("Paused Active Pregen");
|
||||
}
|
||||
return true;
|
||||
} else if(args[0].equalsIgnoreCase("resume")){
|
||||
if(!PregenJob.isPaused())
|
||||
{
|
||||
sender.sendMessage("No Paused Pregens");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Resumed Paused Pregen");
|
||||
PregenJob.resume();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
|
@ -17,6 +17,7 @@ import com.volmit.iris.gen.scaffold.IrisWorlds;
|
||||
import com.volmit.iris.gui.PregenGui;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class PregenJob implements Listener
|
||||
{
|
||||
@ -51,6 +52,8 @@ public class PregenJob implements Listener
|
||||
private long nogen = M.ms();
|
||||
private KList<ChunkPosition> requeueMCA = new KList<ChunkPosition>();
|
||||
private RollingSequence acps = new RollingSequence(PaperLib.isPaper() ? 8 : 32);
|
||||
private BukkitTask pausedTask;
|
||||
private boolean isPaused = false;
|
||||
int xc = 0;
|
||||
|
||||
public PregenJob(World world, int size, MortarSender sender, Runnable onDone)
|
||||
@ -124,6 +127,40 @@ public class PregenJob implements Listener
|
||||
task = -1;
|
||||
}
|
||||
|
||||
// TODO: Cannot get paused value from this. Have to check bukkit tasks, not sure how.
|
||||
// TODO: Trying to add functionality here to allow for pausing an continuing.
|
||||
public static boolean isPaused(){
|
||||
return false;
|
||||
//return this.isPaused;
|
||||
}
|
||||
|
||||
public static void pause()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Save the task, tell bukkit to cancel it
|
||||
stop();
|
||||
}
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
task = -1;
|
||||
}
|
||||
|
||||
public static void resume()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Load task and tell bukkit to continue it
|
||||
}
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
task = -1;
|
||||
}
|
||||
|
||||
public void onTick()
|
||||
{
|
||||
if(completed)
|
||||
|
Loading…
x
Reference in New Issue
Block a user