Fix Parallax & update settings

This commit is contained in:
Daniel Mills 2021-01-01 22:54:17 -05:00
parent fcf8a80b0a
commit 9d634ba4d7
15 changed files with 42 additions and 103 deletions

View File

@ -66,7 +66,7 @@ public class Iris extends VolmitPlugin
public static int getThreadCount()
{
int tc = IrisSettings.get().getForceThreadCount();
int tc = IrisSettings.get().getConcurrency().getThreadCount();
if(tc <= 0)
{
@ -251,7 +251,7 @@ public class Iris extends VolmitPlugin
private void bstats()
{
if(IrisSettings.get().isPluginMetrics())
if(IrisSettings.get().getGeneral().isPluginMetrics())
{
J.s(() -> {
Metrics m = new Metrics(Iris.instance, 8757);
@ -415,7 +415,7 @@ public class Iris extends VolmitPlugin
{
try
{
if(IrisSettings.get().verbose)
if(IrisSettings.get().getGeneral().isVerbose())
{
msg(C.GRAY + string);
}
@ -444,7 +444,7 @@ public class Iris extends VolmitPlugin
public void splash()
{
if(!IrisSettings.get().isSplashLogoStartup())
if(!IrisSettings.get().getGeneral().isSplashLogoStartup())
{
return;
}
@ -518,6 +518,6 @@ public class Iris extends VolmitPlugin
}
public boolean isMCA() {
return IrisSettings.get().useExperimentalGleamMCADirectWriteMode;
return IrisSettings.get().getGenerator().isMcaPregenerator();
}
}

View File

@ -75,7 +75,7 @@ public class IrisComplex implements DataProvider
public IrisComplex(Engine engine)
{
int cacheSize = IrisSettings.get().getStreamingCacheSize();
int cacheSize = IrisSettings.get().getCache().getStreamingCacheSize();
this.rng = new RNG(engine.getWorld().getSeed());
this.data = engine.getData();
double height = engine.getHeight();

View File

@ -223,7 +223,7 @@ public class IrisEngineCompound implements EngineCompound {
int offset = 0;
BurstExecutor e = burster.burst();
Runnable[] insert = new Runnable[engines.length];
boolean structures = getDefaultEngine().getDimension().isVanillaStructures() && !IrisSettings.get().isDisableNMS();
boolean structures = getDefaultEngine().getDimension().isVanillaStructures() && !IrisSettings.get().getGeneral().isDisableNMS();
for(i = 0; i < engines.length; i++)
{

View File

@ -65,7 +65,7 @@ public class IrisEngineFramework implements EngineFramework {
this.caveModifier = new IrisCaveModifier(engine);
this.postModifier = new IrisPostModifier(engine);
cleaning = new AtomicBoolean(false);
cleanLatch = new ChronoLatch(Math.max(10000, Math.min(IrisSettings.get().parallaxChunkEvictionMS, IrisSettings.get().parallaxRegionEvictionMS)));
cleanLatch = new ChronoLatch(Math.max(10000, Math.min(IrisSettings.get().getParallax().getParallaxChunkEvictionMS(), IrisSettings.get().getParallax().getParallaxRegionEvictionMS())));
}
@Override

View File

@ -55,7 +55,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
try
{
if(!IrisSettings.get().isSystemEntitySpawnOverrides())
if(!IrisSettings.get().getGenerator().isSystemEntitySpawnOverrides())
{
return;
}

View File

@ -96,7 +96,7 @@ public class EditManager implements Listener
BlockEditor e = null;
if(Bukkit.getPluginManager().isPluginEnabled("WorldEdit") && !PaperLib.isPaper() && !IrisSettings.get().isIgnoreWorldEdit())
if(Bukkit.getPluginManager().isPluginEnabled("WorldEdit") && !PaperLib.isPaper() && !IrisSettings.get().getGeneral().isIgnoreWorldEdit())
{
try
{

View File

@ -81,7 +81,7 @@ public class IrisProject
sender.sendMessage("Workspace Updated");
});
if(IrisSettings.get().openVSCode)
if(IrisSettings.get().getStudio().isOpenVSCode())
{
Desktop.getDesktop().open(i);
}

View File

@ -3,6 +3,7 @@ package com.volmit.iris.manager.command;
import com.volmit.iris.Iris;
import com.volmit.iris.nms.INMS;
import com.volmit.iris.object.IrisDimension;
import com.volmit.iris.pregen.Pregenerator;
import com.volmit.iris.scaffold.IrisWorldCreator;
import com.volmit.iris.scaffold.engine.IrisAccess;
import com.volmit.iris.util.*;
@ -105,7 +106,7 @@ public class CommandIrisCreate extends MortarCommand
sender.sendMessage("Pregenerating " + worldName + " " + pregen + " x " + pregen);
sender.sendMessage("Expect Extreme server lag during this time. Use '/iris world pregen stop' to cancel");
new PregenJob(world, pregen, sender, () ->
new Pregenerator(world, pregen, () ->
{
b.set(true);
});
@ -130,7 +131,6 @@ public class CommandIrisCreate extends MortarCommand
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () ->
{
world.save();
sender.sendMessage("All Done!");
});
});

View File

@ -2,11 +2,9 @@ package com.volmit.iris.manager.command;
import com.volmit.iris.Iris;
import com.volmit.iris.pregen.Pregenerator;
import com.volmit.iris.scaffold.IrisWorlds;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
import com.volmit.iris.util.PregenJob;
import org.bukkit.World;
import org.bukkit.entity.Player;
@ -46,51 +44,21 @@ public class CommandIrisPregen extends MortarCommand
if(args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("x"))
{
if(PregenJob.task == -1) {
if (Pregenerator.shutdownInstance()) {
sender.sendMessage("Stopped Pregen.");
} else
{
sender.sendMessage("No Active Pregens.");
}
}
else
{
if (Pregenerator.shutdownInstance()) {
sender.sendMessage("Stopped Pregen.");
PregenJob.stop();
} else
{
sender.sendMessage("No Active Pregens.");
}
return true;
}
else if(args[0].equalsIgnoreCase("pause") || args[0].equalsIgnoreCase("resume"))
{
if(PregenJob.task == -1)
if(Pregenerator.getInstance() != null)
{
if(Pregenerator.getInstance() != null)
{
Pregenerator.pauseResume();
Pregenerator.pauseResume();
if(Pregenerator.isPaused())
{
sender.sendMessage("Pregen Paused");
}
else
{
sender.sendMessage("Pregen Resumed");
}
}
else
{
sender.sendMessage("No Active Pregens");
}
}
else
{
PregenJob.pauseResume();
if(PregenJob.isPaused())
if(Pregenerator.isPaused())
{
sender.sendMessage("Pregen Paused");
}
@ -101,6 +69,11 @@ public class CommandIrisPregen extends MortarCommand
}
}
else
{
sender.sendMessage("No Active Pregens");
}
return true;
}
@ -109,17 +82,7 @@ public class CommandIrisPregen extends MortarCommand
Player p = sender.player();
World world = p.getWorld();
try {
if(Iris.instance.isMCA() && IrisWorlds.access(world) != null)
{
new Pregenerator(world, getVal(args[0]), 0, 0);
}
else
{
new PregenJob(world, getVal(args[0]), sender, () ->
{
});
}
new Pregenerator(world, getVal(args[0]));
} catch (NumberFormatException e){
sender.sendMessage("Invalid argument in command");
return true;
@ -140,20 +103,20 @@ public class CommandIrisPregen extends MortarCommand
if(arg.toLowerCase().endsWith("c") || arg.toLowerCase().endsWith("chunks"))
{
return Integer.valueOf(arg.toLowerCase().replaceAll("\\Qc\\E", "").replaceAll("\\Qchunks\\E", "")) * 16;
return Integer.parseInt(arg.toLowerCase().replaceAll("\\Qc\\E", "").replaceAll("\\Qchunks\\E", "")) * 16;
}
if(arg.toLowerCase().endsWith("r") || arg.toLowerCase().endsWith("regions"))
{
return Integer.valueOf(arg.toLowerCase().replaceAll("\\Qr\\E", "").replaceAll("\\Qregions\\E", "")) * 512;
return Integer.parseInt(arg.toLowerCase().replaceAll("\\Qr\\E", "").replaceAll("\\Qregions\\E", "")) * 512;
}
if(arg.toLowerCase().endsWith("k"))
{
return Integer.valueOf(arg.toLowerCase().replaceAll("\\Qk\\E", "")) * 1000;
return Integer.parseInt(arg.toLowerCase().replaceAll("\\Qk\\E", "")) * 1000;
}
return Integer.valueOf(arg.toLowerCase());
return Integer.parseInt(arg.toLowerCase());
}
@Override

View File

@ -25,7 +25,7 @@ public class INMS
private static final String getNMSTag()
{
if(IrisSettings.get().disableNMS)
if(IrisSettings.get().getGeneral().isDisableNMS())
{
return "BUKKIT";
}

View File

@ -163,8 +163,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
}
if (hint == null) {
Iris.error("Cannot find iris dimension data for world: " + world.getName() + "! Assuming " + IrisSettings.get().getDefaultWorldType() + "!");
hint = IrisSettings.get().getDefaultWorldType();
Iris.error("Cannot find iris dimension data for world: " + world.getName() + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!");
hint = IrisSettings.get().getGenerator().getDefaultWorldType();
}
dim = IrisDataManager.loadAnyDimension(hint);
@ -238,8 +238,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
}
if (hint == null) {
Iris.error("Cannot find iris dimension data for world: " + world + "! Assuming " + IrisSettings.get().getDefaultWorldType() + "!");
hint = IrisSettings.get().getDefaultWorldType();
Iris.error("Cannot find iris dimension data for world: " + world + "! Assuming " + IrisSettings.get().getGenerator().getDefaultWorldType() + "!");
hint = IrisSettings.get().getGenerator().getDefaultWorldType();
}
dim = IrisDataManager.loadAnyDimension(hint);

View File

@ -199,7 +199,7 @@ public class ParallaxWorld implements ParallaxAccess
public void cleanup()
{
cleanup(IrisSettings.get().getParallaxRegionEvictionMS(), IrisSettings.get().getParallaxChunkEvictionMS());
cleanup(IrisSettings.get().getParallaxRegionEvictionMS(), IrisSettings.get().getParallax().getParallaxChunkEvictionMS());
}
@Override

View File

@ -1,7 +1,6 @@
package com.volmit.iris.scaffold.parallel;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -51,15 +50,6 @@ public class MultiBurst
public BurstExecutor burst(int estimate)
{
if(IrisSettings.get().isForceSingleThreadedPerChunk()) {
if(syncService == null)
{
syncService = Executors.newSingleThreadExecutor();
}
return new BurstExecutor(syncService, estimate);
}
return new BurstExecutor(service, estimate);
}
@ -69,19 +59,7 @@ public class MultiBurst
}
public void lazy(Runnable o) {
if(IrisSettings.get().isForceSingleThreadedPerChunk()) {
if(syncService == null)
{
syncService = Executors.newSingleThreadExecutor();
}
syncService.execute(o);
}
else
{
service.execute(o);
}
service.execute(o);
}
public void shutdownNow() {

View File

@ -1,6 +1,5 @@
package com.volmit.iris.util;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import org.bukkit.Sound;
@ -60,7 +59,7 @@ public abstract class MortarCommand implements ICommand
return null;
}
if(sender.isPlayer() && IrisSettings.get().commandSounds)
if(sender.isPlayer() && IrisSettings.get().getGeneral().isCommandSounds())
{
sender.player().getWorld().playSound(sender.player().getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 0.25f, 1.7f);
}
@ -94,7 +93,7 @@ public abstract class MortarCommand implements ICommand
sender.sendMessage("There are either no sub-commands or you do not have permission to use them.");
}
if(sender.isPlayer() && IrisSettings.get().commandSounds)
if(sender.isPlayer() && IrisSettings.get().getGeneral().isCommandSounds())
{
sender.player().getWorld().playSound(sender.player().getLocation(), Sound.ITEM_BOOK_PAGE_TURN, 0.28f, 1.4f);
sender.player().getWorld().playSound(sender.player().getLocation(), Sound.ITEM_AXE_STRIP, 0.35f, 1.7f);

View File

@ -1,13 +1,12 @@
package com.volmit.iris.util;
import java.lang.reflect.Field;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.command.CommandSender;
import com.volmit.iris.Iris;
import java.lang.reflect.Field;
/**
* Represents a virtual command. A chain of iterative processing through
@ -108,7 +107,7 @@ public class VirtualCommand
c.remove(0);
if(cmd.hit(sender, c, vs.getCommand()))
{
if(vs.isPlayer() && IrisSettings.get().commandSounds)
if(vs.isPlayer() && IrisSettings.get().getGeneral().isCommandSounds())
{
vs.player().getWorld().playSound(vs.player().getLocation(), Sound.ITEM_AXE_STRIP, 0.35f, 1.8f);
}