mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-26 18:49:06 +00:00
Fixes
This commit is contained in:
@@ -1,15 +1,26 @@
|
||||
package ninja.bytecode.iris;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import mortar.api.rift.Rift;
|
||||
import mortar.api.sched.J;
|
||||
import mortar.bukkit.command.Command;
|
||||
import mortar.bukkit.plugin.Control;
|
||||
import mortar.bukkit.plugin.Instance;
|
||||
import mortar.bukkit.plugin.Mortar;
|
||||
import mortar.bukkit.plugin.MortarPlugin;
|
||||
import mortar.lib.control.RiftController;
|
||||
import mortar.util.text.C;
|
||||
import ninja.bytecode.iris.command.CommandIris;
|
||||
import ninja.bytecode.iris.controller.ExecutionController;
|
||||
@@ -24,13 +35,11 @@ public class Iris extends MortarPlugin
|
||||
public static Thread primaryThread;
|
||||
public static Settings settings;
|
||||
public static IrisMetrics metrics;
|
||||
private ExecutionController executionController;
|
||||
|
||||
@Instance
|
||||
public static Iris instance;
|
||||
|
||||
@Control
|
||||
private ExecutionController executionController;
|
||||
|
||||
@Control
|
||||
private PackController packController;
|
||||
|
||||
@@ -40,6 +49,22 @@ public class Iris extends MortarPlugin
|
||||
@Command
|
||||
private CommandIris commandIris;
|
||||
|
||||
private Rift r;
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
instance = this;
|
||||
executionController = new ExecutionController();
|
||||
executionController.start();
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
public File getCacheFolder()
|
||||
{
|
||||
return getDataFolder("cache", "object");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
@@ -50,13 +75,60 @@ public class Iris extends MortarPlugin
|
||||
settings = new Settings();
|
||||
getServer().getPluginManager().registerEvents((Listener) this, this);
|
||||
packController.compile();
|
||||
|
||||
J.s(() ->
|
||||
{
|
||||
if(settings.performance.debugMode)
|
||||
{
|
||||
try
|
||||
{
|
||||
r = Mortar.getController(RiftController.class).createRift("iris/" + UUID.randomUUID().toString());
|
||||
r.setGenerator(IrisGenerator.class);
|
||||
r.setDifficulty(Difficulty.NORMAL);
|
||||
r.setTemporary(true);
|
||||
r.setSeed(0);
|
||||
r.setViewDistance(10);
|
||||
r.setTileTickLimit(0.1);
|
||||
r.setEntityTickLimit(0.1);
|
||||
r.setPhysicsThrottle(5);
|
||||
r.setMonsterActivationRange(5);
|
||||
r.setArrowDespawnRate(1);
|
||||
r.load();
|
||||
|
||||
for(Player i : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
i.teleport(r.getSpawn());
|
||||
}
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
if(settings.performance.debugMode && r != null)
|
||||
{
|
||||
r.colapse();
|
||||
}
|
||||
|
||||
HandlerList.unregisterAll((Plugin) this);
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
executionController.stop();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerJoinEvent e)
|
||||
{
|
||||
if(settings.performance.debugMode && r != null)
|
||||
{
|
||||
e.getPlayer().teleport(r.getSpawn());
|
||||
}
|
||||
}
|
||||
|
||||
public void reload()
|
||||
|
||||
Reference in New Issue
Block a user