mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-04 00:46:08 +00:00
Managers -> Services
This commit is contained in:
parent
e2f8e31fa0
commit
af602a414a
23
out/production/resources/plugin.yml
Normal file
23
out/production/resources/plugin.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
name: ${name}
|
||||||
|
version: ${version}
|
||||||
|
main: ${main}
|
||||||
|
load: STARTUP
|
||||||
|
authors: [ cyberpwn, NextdoorPsycho ]
|
||||||
|
website: volmit.com
|
||||||
|
description: More than a Dimension!
|
||||||
|
libraries:
|
||||||
|
- org.zeroturnaround:zt-zip:1.14
|
||||||
|
- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2
|
||||||
|
- org.ow2.asm:asm:9.2
|
||||||
|
- com.google.code.gson:gson:2.8.7
|
||||||
|
- it.unimi.dsi:fastutil:8.5.4
|
||||||
|
- com.google.guava:guava:30.1.1-jre
|
||||||
|
- bsf:bsf:2.4.0
|
||||||
|
- rhino:js:1.7R2
|
||||||
|
commands:
|
||||||
|
iris:
|
||||||
|
aliases: [ ir, irs ]
|
||||||
|
irisd:
|
||||||
|
aliases: [ ird, irsd ]
|
||||||
|
api-version: ${apiversion}
|
||||||
|
hotload-dependencies: false
|
@ -18,18 +18,17 @@
|
|||||||
|
|
||||||
package com.volmit.iris;
|
package com.volmit.iris;
|
||||||
|
|
||||||
import com.volmit.iris.core.*;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.command.CommandIris;
|
import com.volmit.iris.core.command.CommandIris;
|
||||||
import com.volmit.iris.core.command.PermissionIris;
|
import com.volmit.iris.core.command.PermissionIris;
|
||||||
import com.volmit.iris.core.command.studio.CommandIrisStudio;
|
import com.volmit.iris.core.command.studio.CommandIrisStudio;
|
||||||
import com.volmit.iris.core.command.world.CommandLocate;
|
|
||||||
import com.volmit.iris.core.link.IrisPapiExpansion;
|
import com.volmit.iris.core.link.IrisPapiExpansion;
|
||||||
import com.volmit.iris.core.link.MultiverseCoreLink;
|
import com.volmit.iris.core.link.MultiverseCoreLink;
|
||||||
import com.volmit.iris.core.link.MythicMobsLink;
|
import com.volmit.iris.core.link.MythicMobsLink;
|
||||||
import com.volmit.iris.core.link.OraxenLink;
|
import com.volmit.iris.core.link.OraxenLink;
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiomeCustom;
|
import com.volmit.iris.engine.object.biome.IrisBiomeCustom;
|
||||||
import com.volmit.iris.engine.object.common.IrisWorld;
|
import com.volmit.iris.engine.object.common.IrisWorld;
|
||||||
@ -37,6 +36,7 @@ import com.volmit.iris.engine.object.compat.IrisCompat;
|
|||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@ -48,10 +48,7 @@ import com.volmit.iris.util.io.JarScanner;
|
|||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.plugin.Metrics;
|
import com.volmit.iris.util.plugin.*;
|
||||||
import com.volmit.iris.util.plugin.Permission;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitPlugin;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.reflect.ShadeFix;
|
import com.volmit.iris.util.reflect.ShadeFix;
|
||||||
import com.volmit.iris.util.scheduling.GroupedExecutor;
|
import com.volmit.iris.util.scheduling.GroupedExecutor;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
@ -61,7 +58,6 @@ import io.papermc.lib.PaperLib;
|
|||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -78,19 +74,13 @@ import java.util.Date;
|
|||||||
|
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
public class Iris extends VolmitPlugin implements Listener {
|
public class Iris extends VolmitPlugin implements Listener {
|
||||||
|
private KMap<Class<? extends IrisService>, IrisService> services;
|
||||||
public static KList<GroupedExecutor> executors = new KList<>();
|
public static KList<GroupedExecutor> executors = new KList<>();
|
||||||
public static Iris instance;
|
public static Iris instance;
|
||||||
public static BukkitAudiences audiences;
|
public static BukkitAudiences audiences;
|
||||||
public static ProjectManager proj;
|
|
||||||
public static ConversionManager convert;
|
|
||||||
public static WandManager wand;
|
|
||||||
public static EditManager edit;
|
|
||||||
public static CoreBoardManager board;
|
|
||||||
public static MultiverseCoreLink linkMultiverseCore;
|
public static MultiverseCoreLink linkMultiverseCore;
|
||||||
public static OraxenLink linkOraxen;
|
public static OraxenLink linkOraxen;
|
||||||
public static MythicMobsLink linkMythicMobs;
|
public static MythicMobsLink linkMythicMobs;
|
||||||
public static CommandManager commandManager;
|
|
||||||
public static TreeManager saplingManager;
|
|
||||||
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
||||||
public static IrisCompat compat;
|
public static IrisCompat compat;
|
||||||
public static FileWatcher configWatcher;
|
public static FileWatcher configWatcher;
|
||||||
@ -105,68 +95,76 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
@com.volmit.iris.util.plugin.Command
|
@com.volmit.iris.util.plugin.Command
|
||||||
public CommandIrisStudio commandStudio;
|
public CommandIrisStudio commandStudio;
|
||||||
|
|
||||||
public Iris() {
|
private void preEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
INMS.get();
|
INMS.get();
|
||||||
IO.delete(new File("iris"));
|
IO.delete(new File("iris"));
|
||||||
installDataPacks();
|
installDataPacks();
|
||||||
|
fixShading();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEnable() {
|
@SuppressWarnings("unchecked")
|
||||||
|
private void enable() {
|
||||||
|
services = new KMap<>();
|
||||||
|
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
|
||||||
|
|
||||||
audiences = BukkitAudiences.create(this);
|
audiences = BukkitAudiences.create(this);
|
||||||
fixShading();
|
|
||||||
sender = new VolmitSender(Bukkit.getConsoleSender());
|
sender = new VolmitSender(Bukkit.getConsoleSender());
|
||||||
sender.setTag(getTag());
|
sender.setTag(getTag());
|
||||||
instance = this;
|
instance = this;
|
||||||
compat = IrisCompat.configured(getDataFile("compat.json"));
|
compat = IrisCompat.configured(getDataFile("compat.json"));
|
||||||
proj = new ProjectManager();
|
|
||||||
convert = new ConversionManager();
|
|
||||||
wand = new WandManager();
|
|
||||||
board = new CoreBoardManager();
|
|
||||||
linkMultiverseCore = new MultiverseCoreLink();
|
linkMultiverseCore = new MultiverseCoreLink();
|
||||||
linkOraxen = new OraxenLink();
|
linkOraxen = new OraxenLink();
|
||||||
linkMythicMobs = new MythicMobsLink();
|
linkMythicMobs = new MythicMobsLink();
|
||||||
saplingManager = new TreeManager();
|
|
||||||
edit = new EditManager();
|
|
||||||
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
||||||
commandManager = new CommandManager();
|
|
||||||
getServer().getPluginManager().registerEvents(new CommandLocate(), this);
|
services.values().forEach(IrisService::onEnable);
|
||||||
getServer().getPluginManager().registerEvents(new WandManager(), this);
|
services.values().forEach(this::registerListener);
|
||||||
getServer().getPluginManager().registerEvents(new DolphinManager(), this);
|
}
|
||||||
getServer().getPluginManager().registerEvents(new VillagerManager(), this);
|
|
||||||
super.onEnable();
|
private void postEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
J.a(() -> PaperLib.suggestPaper(this));
|
||||||
J.s(this::lateBind);
|
J.a(() -> IO.delete(getTemp()));
|
||||||
|
J.a(this::bstats);
|
||||||
|
J.ar(this::checkConfigHotload, 60);
|
||||||
|
J.sr(this::tickQueue, 0);
|
||||||
|
J.s(this::setupPapi);
|
||||||
|
J.a(this::verifyDataPacksPost, 20);
|
||||||
splash();
|
splash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T> T service(Class<T> c) {
|
||||||
|
return (T) instance.services.get(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iris() {
|
||||||
|
preEnable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void onEnable() {
|
||||||
|
enable();
|
||||||
|
super.onEnable();
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, this);
|
||||||
|
J.s(this::postEnable);
|
||||||
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
if (IrisSettings.get().isStudio()) {
|
for (GroupedExecutor i : executors) {
|
||||||
Iris.debug("Studio Mode Active: Closing Projects");
|
Iris.debug("Closing Executor " + i.toString());
|
||||||
proj.close();
|
i.closeNow();
|
||||||
|
|
||||||
for (World i : Bukkit.getWorlds()) {
|
|
||||||
if (IrisToolbelt.isIrisWorld(i)) {
|
|
||||||
Iris.debug("Closing Platform Generator " + i.getName());
|
|
||||||
IrisToolbelt.access(i).close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (GroupedExecutor i : executors) {
|
|
||||||
Iris.debug("Closing Executor " + i.toString());
|
|
||||||
i.closeNow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
executors.clear();
|
executors.clear();
|
||||||
board.disable();
|
|
||||||
Iris.debug("Cancelled all tasks");
|
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
Iris.debug("Unregistered all events");
|
|
||||||
HandlerList.unregisterAll((Plugin) this);
|
HandlerList.unregisterAll((Plugin) this);
|
||||||
Iris.debug("Multiburst Shutting down");
|
|
||||||
MultiBurst.burst.shutdown();
|
MultiBurst.burst.shutdown();
|
||||||
Iris.debug("Iris Shutdown");
|
|
||||||
|
services.values().forEach(IrisService::onDisable);
|
||||||
|
services.clear();
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,15 +201,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
ShadeFix.fix(ComponentSerializer.class);
|
ShadeFix.fix(ComponentSerializer.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lateBind() {
|
|
||||||
J.a(() -> PaperLib.suggestPaper(this));
|
|
||||||
J.a(() -> IO.delete(getTemp()));
|
|
||||||
J.a(this::bstats);
|
|
||||||
J.ar(this::checkConfigHotload, 60);
|
|
||||||
J.sr(this::tickQueue, 0);
|
|
||||||
J.s(this::setupPapi);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupPapi() {
|
private void setupPapi() {
|
||||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
new IrisPapiExpansion().register();
|
new IrisPapiExpansion().register();
|
||||||
@ -330,13 +319,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
|
|
||||||
private void bstats() {
|
private void bstats() {
|
||||||
if (IrisSettings.get().getGeneral().isPluginMetrics()) {
|
if (IrisSettings.get().getGeneral().isPluginMetrics()) {
|
||||||
J.s(() -> {
|
J.s(() -> new Metrics(Iris.instance, 8757));
|
||||||
Metrics m = new Metrics(Iris.instance, 8757);
|
|
||||||
|
|
||||||
m.addCustomChart(new Metrics.SingleLineChart("custom_dimensions", ProjectManager::countUniqueDimensions));
|
|
||||||
|
|
||||||
m.addCustomChart(new Metrics.SimplePie("using_custom_dimensions", () -> ProjectManager.countUniqueDimensions() > 0 ? "Active Projects" : "No Projects"));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +432,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||||
|
|
||||||
IrisDimension dim;
|
IrisDimension dim;
|
||||||
if (id == null || id.isEmpty()){
|
if (id == null || id.isEmpty()) {
|
||||||
dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType());
|
dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType());
|
||||||
} else {
|
} else {
|
||||||
dim = IrisData.loadAnyDimension(id);
|
dim = IrisData.loadAnyDimension(id);
|
||||||
@ -459,7 +442,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
if (dim == null) {
|
if (dim == null) {
|
||||||
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
||||||
|
|
||||||
Iris.proj.downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
|
service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
|
||||||
dim = IrisData.loadAnyDimension(id);
|
dim = IrisData.loadAnyDimension(id);
|
||||||
|
|
||||||
if (dim == null) {
|
if (dim == null) {
|
||||||
@ -611,12 +594,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
msg(C.WHITE + string);
|
msg(C.WHITE + string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hit(long hits2) {
|
|
||||||
board.hits.put(hits2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void splash() {
|
public void splash() {
|
||||||
J.a(this::verifyDataPacksPost, 20);
|
|
||||||
if (!IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
if (!IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
package com.volmit.iris.core;
|
|
||||||
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
|
|
||||||
public class DolphinManager implements Listener {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prevents dolphins from being fed, to locate a treasure map.
|
|
||||||
* Note: This results in odd dolphin behaviour, but it's the best we can do.
|
|
||||||
*/
|
|
||||||
@EventHandler
|
|
||||||
public void on(PlayerInteractEntityEvent event) {
|
|
||||||
if (!IrisToolbelt.isIrisWorld(event.getPlayer().getWorld())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Material hand = event.getPlayer().getInventory().getItem(event.getHand()).getType();
|
|
||||||
if (event.getRightClicked().getType().equals(EntityType.DOLPHIN) && (hand.equals(Material.TROPICAL_FISH) || hand.equals(Material.PUFFERFISH) || hand.equals(Material.COD) || hand.equals(Material.SALMON))) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.core.command;
|
package com.volmit.iris.core.command;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
@ -75,7 +76,7 @@ public class CommandIrisDownload extends MortarCommand {
|
|||||||
|
|
||||||
final String finalPack = pack + "/" + branch;
|
final String finalPack = pack + "/" + branch;
|
||||||
|
|
||||||
J.a(() -> Iris.proj.downloadSearch(sender, finalPack, btrim));
|
J.a(() -> Iris.service(StudioSVC.class).downloadSearch(sender, finalPack, btrim));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.core.command;
|
package com.volmit.iris.core.command;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
@ -45,7 +46,7 @@ public class CommandIrisUpdateProject extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
J.a(() -> Iris.proj.downloadSearch(sender, args[0], false, true));
|
J.a(() -> Iris.service(StudioSVC.class).downloadSearch(sender, args[0], false, true));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.ProjectManager;
|
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
@ -71,7 +71,7 @@ public class CommandIrisObjectAnalyze extends MortarCommand {
|
|||||||
IrisObject obj = IrisData.loadAnyObject(args[0]);
|
IrisObject obj = IrisData.loadAnyObject(args[0]);
|
||||||
|
|
||||||
if (obj == null || obj.getLoadFile() == null) {
|
if (obj == null || obj.getLoadFile() == null) {
|
||||||
sender.sendMessage("Can't find " + args[0] + " in the " + ProjectManager.WORKSPACE_NAME + " folder");
|
sender.sendMessage("Can't find " + args[0] + " in the " + StudioSVC.WORKSPACE_NAME + " folder");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.math.Direction;
|
import com.volmit.iris.util.math.Direction;
|
||||||
@ -58,13 +58,13 @@ public class CommandIrisObjectContract extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
|
|
||||||
if (!WandManager.isHoldingWand(p)) {
|
if (!WandSVC.isHoldingWand(p)) {
|
||||||
sender.sendMessage("Ready your Wand.");
|
sender.sendMessage("Ready your Wand.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
||||||
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
@ -72,7 +72,7 @@ public class CommandIrisObjectContract extends MortarCommand {
|
|||||||
cursor = cursor.expand(d, -amt);
|
cursor = cursor.expand(d, -amt);
|
||||||
b[0] = cursor.getLowerNE();
|
b[0] = cursor.getLowerNE();
|
||||||
b[1] = cursor.getUpperSW();
|
b[1] = cursor.getUpperSW();
|
||||||
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
|
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
||||||
p.updateInventory();
|
p.updateInventory();
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -51,7 +51,7 @@ public class CommandIrisObjectDust extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.player().getInventory().addItem(WandManager.createDust());
|
sender.player().getInventory().addItem(WandSVC.createDust());
|
||||||
sender.player().playSound(sender.player().getLocation(), Sound.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS, 1f, 1.5f);
|
sender.player().playSound(sender.player().getLocation(), Sound.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS, 1f, 1.5f);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.math.Direction;
|
import com.volmit.iris.util.math.Direction;
|
||||||
@ -58,13 +58,13 @@ public class CommandIrisObjectExpand extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
|
|
||||||
if (!WandManager.isHoldingWand(p)) {
|
if (!WandSVC.isHoldingWand(p)) {
|
||||||
sender.sendMessage("Ready your Wand.");
|
sender.sendMessage("Ready your Wand.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
||||||
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
@ -72,7 +72,7 @@ public class CommandIrisObjectExpand extends MortarCommand {
|
|||||||
cursor = cursor.expand(d, amt);
|
cursor = cursor.expand(d, amt);
|
||||||
b[0] = cursor.getLowerNE();
|
b[0] = cursor.getLowerNE();
|
||||||
b[1] = cursor.getUpperSW();
|
b[1] = cursor.getUpperSW();
|
||||||
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
|
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
||||||
p.updateInventory();
|
p.updateInventory();
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -57,15 +57,15 @@ public class CommandIrisObjectP1 extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
|
|
||||||
if (!WandManager.isHoldingWand(p)) {
|
if (!WandSVC.isHoldingWand(p)) {
|
||||||
sender.sendMessage("Ready your Wand.");
|
sender.sendMessage("Ready your Wand.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
ItemStack wand = p.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
if (WandManager.isWand(wand)) {
|
if (WandSVC.isWand(wand)) {
|
||||||
Location[] g = WandManager.getCuboid(wand);
|
Location[] g = WandSVC.getCuboid(wand);
|
||||||
g[0] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
g[0] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
||||||
|
|
||||||
if (args.length == 1 && args[0].equals("-l")) {
|
if (args.length == 1 && args[0].equals("-l")) {
|
||||||
@ -73,7 +73,7 @@ public class CommandIrisObjectP1 extends MortarCommand {
|
|||||||
g[0] = p.getTargetBlock(null, 256).getLocation().clone();
|
g[0] = p.getTargetBlock(null, 256).getLocation().clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
p.setItemInHand(WandManager.createWand(g[0], g[1]));
|
p.setItemInHand(WandSVC.createWand(g[0], g[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -57,15 +57,15 @@ public class CommandIrisObjectP2 extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
|
|
||||||
if (!WandManager.isHoldingWand(p)) {
|
if (!WandSVC.isHoldingWand(p)) {
|
||||||
sender.sendMessage("Ready your Wand.");
|
sender.sendMessage("Ready your Wand.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
ItemStack wand = p.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
if (WandManager.isWand(wand)) {
|
if (WandSVC.isWand(wand)) {
|
||||||
Location[] g = WandManager.getCuboid(wand);
|
Location[] g = WandSVC.getCuboid(wand);
|
||||||
g[1] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
g[1] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
||||||
|
|
||||||
if (args.length == 1 && args[0].equals("-l")) {
|
if (args.length == 1 && args[0].equals("-l")) {
|
||||||
@ -73,7 +73,7 @@ public class CommandIrisObjectP2 extends MortarCommand {
|
|||||||
g[1] = p.getTargetBlock(null, 256).getLocation().clone();
|
g[1] = p.getTargetBlock(null, 256).getLocation().clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
p.setItemInHand(WandManager.createWand(g[0], g[1]));
|
p.setItemInHand(WandSVC.createWand(g[0], g[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,9 +20,9 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.ProjectManager;
|
|
||||||
import com.volmit.iris.core.WandManager;
|
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||||
@ -91,7 +91,7 @@ public class CommandIrisObjectPaste extends MortarCommand {
|
|||||||
|
|
||||||
if (obj == null || obj.getLoadFile() == null) {
|
if (obj == null || obj.getLoadFile() == null) {
|
||||||
|
|
||||||
sender.sendMessage("Can't find " + args[0] + " in the " + ProjectManager.WORKSPACE_NAME + " folder");
|
sender.sendMessage("Can't find " + args[0] + " in the " + StudioSVC.WORKSPACE_NAME + " folder");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,14 +188,14 @@ public class CommandIrisObjectPaste extends MortarCommand {
|
|||||||
CommandIrisObjectUndo.addChanges(sender.player(), futureChanges);
|
CommandIrisObjectUndo.addChanges(sender.player(), futureChanges);
|
||||||
|
|
||||||
if (intoWand) {
|
if (intoWand) {
|
||||||
ItemStack newWand = WandManager.createWand(block.clone().subtract(obj.getCenter()).add(obj.getW() - 1,
|
ItemStack newWand = WandSVC.createWand(block.clone().subtract(obj.getCenter()).add(obj.getW() - 1,
|
||||||
obj.getH() + obj.getCenter().clone().getY() - 1, obj.getD() - 1), block.clone().subtract(obj.getCenter().clone().setY(0)));
|
obj.getH() + obj.getCenter().clone().getY() - 1, obj.getD() - 1), block.clone().subtract(obj.getCenter().clone().setY(0)));
|
||||||
if (WandManager.isWand(wand)) {
|
if (WandSVC.isWand(wand)) {
|
||||||
wand = newWand;
|
wand = newWand;
|
||||||
p.getInventory().setItemInMainHand(wand);
|
p.getInventory().setItemInMainHand(wand);
|
||||||
sender.sendMessage("Updated wand for " + "objects/" + args[0] + ".iob");
|
sender.sendMessage("Updated wand for " + "objects/" + args[0] + ".iob");
|
||||||
} else {
|
} else {
|
||||||
int slot = WandManager.findWand(sender.player().getInventory());
|
int slot = WandSVC.findWand(sender.player().getInventory());
|
||||||
if (slot == -1) {
|
if (slot == -1) {
|
||||||
p.getInventory().addItem(newWand);
|
p.getInventory().addItem(newWand);
|
||||||
sender.sendMessage("Given new wand for " + "objects/" + args[0] + ".iob");
|
sender.sendMessage("Given new wand for " + "objects/" + args[0] + ".iob");
|
||||||
|
@ -20,7 +20,8 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
@ -75,8 +76,8 @@ public class CommandIrisObjectSave extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
ItemStack wand = p.getInventory().getItemInMainHand();
|
||||||
IrisObject o = WandManager.createSchematic(wand);
|
IrisObject o = WandSVC.createSchematic(wand);
|
||||||
File file = Iris.proj.getWorkspaceFile(args[0], "objects", args[1] + ".iob");
|
File file = Iris.service(StudioSVC.class).getWorkspaceFile(args[0], "objects", args[1] + ".iob");
|
||||||
|
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
if (!overwrite) {
|
if (!overwrite) {
|
||||||
|
@ -20,7 +20,8 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.matter.Matter;
|
import com.volmit.iris.util.matter.Matter;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
@ -75,8 +76,8 @@ public class CommandIrisObjectSaveMatter extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
ItemStack wand = p.getInventory().getItemInMainHand();
|
||||||
Matter o = WandManager.createMatterSchem(p, wand);
|
Matter o = WandSVC.createMatterSchem(p, wand);
|
||||||
File file = Iris.proj.getWorkspaceFile(args[0], "objects", args[1] + ".iob");
|
File file = Iris.service(StudioSVC.class).getWorkspaceFile(args[0], "objects", args[1] + ".iob");
|
||||||
|
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
if (!overwrite) {
|
if (!overwrite) {
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.math.Direction;
|
import com.volmit.iris.util.math.Direction;
|
||||||
@ -58,13 +58,13 @@ public class CommandIrisObjectShift extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
|
|
||||||
if (!WandManager.isHoldingWand(p)) {
|
if (!WandSVC.isHoldingWand(p)) {
|
||||||
sender.sendMessage("Ready your Wand.");
|
sender.sendMessage("Ready your Wand.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
||||||
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
||||||
@ -73,7 +73,7 @@ public class CommandIrisObjectShift extends MortarCommand {
|
|||||||
Cuboid cursor = new Cuboid(a1, a2);
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
b[0] = cursor.getLowerNE();
|
b[0] = cursor.getLowerNE();
|
||||||
b[1] = cursor.getUpperSW();
|
b[1] = cursor.getUpperSW();
|
||||||
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
|
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
||||||
p.updateInventory();
|
p.updateInventory();
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -52,7 +52,7 @@ public class CommandIrisObjectWand extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.player().getInventory().addItem(WandManager.createWand());
|
sender.player().getInventory().addItem(WandSVC.createWand());
|
||||||
sender.player().playSound(sender.player().getLocation(), Sound.ITEM_ARMOR_EQUIP_NETHERITE, 1f, 1.5f);
|
sender.player().playSound(sender.player().getLocation(), Sound.ITEM_ARMOR_EQUIP_NETHERITE, 1f, 1.5f);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.data.Cuboid.CuboidDirection;
|
import com.volmit.iris.util.data.Cuboid.CuboidDirection;
|
||||||
@ -60,12 +60,12 @@ public class CommandIrisObjectXAY extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
|
|
||||||
if (!WandManager.isHoldingWand(p)) {
|
if (!WandSVC.isHoldingWand(p)) {
|
||||||
sender.sendMessage("Ready your Wand.");
|
sender.sendMessage("Ready your Wand.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
Location a1x = b[0].clone();
|
Location a1x = b[0].clone();
|
||||||
@ -99,7 +99,7 @@ public class CommandIrisObjectXAY extends MortarCommand {
|
|||||||
cursor = cursor.contract(CuboidDirection.West);
|
cursor = cursor.contract(CuboidDirection.West);
|
||||||
b[0] = cursor.getLowerNE();
|
b[0] = cursor.getLowerNE();
|
||||||
b[1] = cursor.getUpperSW();
|
b[1] = cursor.getUpperSW();
|
||||||
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
|
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
||||||
p.updateInventory();
|
p.updateInventory();
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.data.Cuboid.CuboidDirection;
|
import com.volmit.iris.util.data.Cuboid.CuboidDirection;
|
||||||
@ -59,11 +59,11 @@ public class CommandIrisObjectXPY extends MortarCommand {
|
|||||||
|
|
||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
|
|
||||||
if (!WandManager.isHoldingWand(p)) {
|
if (!WandSVC.isHoldingWand(p)) {
|
||||||
sender.sendMessage("Ready your Wand.");
|
sender.sendMessage("Ready your Wand.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Location[] b = WandManager.getCuboid(p.getInventory().getItemInMainHand());
|
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
b[0].add(new Vector(0, 1, 0));
|
b[0].add(new Vector(0, 1, 0));
|
||||||
b[1].add(new Vector(0, 1, 0));
|
b[1].add(new Vector(0, 1, 0));
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
@ -87,7 +87,7 @@ public class CommandIrisObjectXPY extends MortarCommand {
|
|||||||
cursor = cursor.contract(CuboidDirection.West);
|
cursor = cursor.contract(CuboidDirection.West);
|
||||||
b[0] = cursor.getLowerNE();
|
b[0] = cursor.getLowerNE();
|
||||||
b[1] = cursor.getUpperSW();
|
b[1] = cursor.getUpperSW();
|
||||||
p.getInventory().setItemInMainHand(WandManager.createWand(b[0], b[1]));
|
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
||||||
p.updateInventory();
|
p.updateInventory();
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
@ -54,12 +55,12 @@ public class CommandIrisStudioBeautify extends MortarCommand {
|
|||||||
File clean = null;
|
File clean = null;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
if (!Iris.proj.isProjectOpen()) {
|
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
sender.sendMessage("No open project. Either use /iris std beautify <project> or have a project open.");
|
sender.sendMessage("No open project. Either use /iris std beautify <project> or have a project open.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
clean = Iris.proj.getActiveProject().getPath();
|
clean = Iris.service(StudioSVC.class).getActiveProject().getPath();
|
||||||
} else {
|
} else {
|
||||||
clean = Iris.instance.getDataFolder("packs", args[0]);
|
clean = Iris.instance.getDataFolder("packs", args[0]);
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -47,7 +48,7 @@ public class CommandIrisStudioClose extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Iris.proj.isProjectOpen()) {
|
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
sender.sendMessage("No open projects.");
|
sender.sendMessage("No open projects.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -56,7 +57,7 @@ public class CommandIrisStudioClose extends MortarCommand {
|
|||||||
World f = null;
|
World f = null;
|
||||||
|
|
||||||
for (World i : Bukkit.getWorlds()) {
|
for (World i : Bukkit.getWorlds()) {
|
||||||
if (i.getWorldFolder().getAbsolutePath().equals(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().worldFolder().getAbsolutePath())) {
|
if (i.getWorldFolder().getAbsolutePath().equals(Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().worldFolder().getAbsolutePath())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,17 +66,17 @@ public class CommandIrisStudioClose extends MortarCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (f == null) {
|
if (f == null) {
|
||||||
for (Player i : Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().getPlayers()) {
|
for (Player i : Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().getPlayers()) {
|
||||||
i.kickPlayer("Project Closing, No other world to put you in. Rejoin Please!");
|
i.kickPlayer("Project Closing, No other world to put you in. Rejoin Please!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Player i : Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().getPlayers()) {
|
for (Player i : Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().getPlayers()) {
|
||||||
i.teleport(f.getSpawnLocation());
|
i.teleport(f.getSpawnLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.proj.close();
|
Iris.service(StudioSVC.class).close();
|
||||||
sender.sendMessage("Projects Closed & Caches Cleared!");
|
sender.sendMessage("Projects Closed & Caches Cleared!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.ConversionSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -44,7 +45,7 @@ public class CommandIrisStudioConvert extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.convert.check(sender);
|
Iris.service(ConversionSVC.class).check(sender);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
@ -60,9 +61,9 @@ public class CommandIrisStudioCreate extends MortarCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (template != null) {
|
if (template != null) {
|
||||||
Iris.proj.create(sender, args[0], template);
|
Iris.service(StudioSVC.class).create(sender, args[0], template);
|
||||||
} else {
|
} else {
|
||||||
Iris.proj.create(sender, args[0]);
|
Iris.service(StudioSVC.class).create(sender, args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -48,7 +49,7 @@ public class CommandIrisStudioEditBiome extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Iris.proj.isProjectOpen()) {
|
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
sender.sendMessage("There is not a studio currently loaded.");
|
sender.sendMessage("There is not a studio currently loaded.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -57,7 +58,7 @@ public class CommandIrisStudioEditBiome extends MortarCommand {
|
|||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File f = Iris.proj.getActiveProject().getActiveProvider().getEngine().getBiome(p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ()).getLoadFile();
|
File f = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getEngine().getBiome(p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ()).getLoadFile();
|
||||||
Desktop.getDesktop().open(f);
|
Desktop.getDesktop().open(f);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
|
@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.noise.IrisGenerator;
|
import com.volmit.iris.engine.object.noise.IrisGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
@ -75,9 +76,9 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand {
|
|||||||
Supplier<Function2<Double, Double, Double>> l = () -> {
|
Supplier<Function2<Double, Double, Double>> l = () -> {
|
||||||
long seed = 12345;
|
long seed = 12345;
|
||||||
IrisGenerator generator;
|
IrisGenerator generator;
|
||||||
if (Iris.proj.isProjectOpen()) {
|
if (Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
generator = Iris.proj.getActiveProject().getActiveProvider().getData().getGeneratorLoader().load(args[0]);
|
generator = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getData().getGeneratorLoader().load(args[0]);
|
||||||
seed = Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().seed();
|
seed = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().seed();
|
||||||
} else {
|
} else {
|
||||||
generator = IrisData.loadAnyGenerator(args[0]);
|
generator = IrisData.loadAnyGenerator(args[0]);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.loot.IrisLootTable;
|
import com.volmit.iris.engine.object.loot.IrisLootTable;
|
||||||
@ -58,7 +59,7 @@ public class CommandIrisStudioLoot extends MortarCommand {
|
|||||||
Player p = sender.player();
|
Player p = sender.player();
|
||||||
Engine prov = IrisToolbelt.access(sender.player().getWorld()).getEngine();
|
Engine prov = IrisToolbelt.access(sender.player().getWorld()).getEngine();
|
||||||
|
|
||||||
if (!Iris.proj.isProjectOpen()) {
|
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
sender.sendMessage("You can only use /iris studio loot in a studio world of iris.");
|
sender.sendMessage("You can only use /iris studio loot in a studio world of iris.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -67,7 +68,7 @@ public class CommandIrisStudioLoot extends MortarCommand {
|
|||||||
Inventory inv = Bukkit.createInventory(null, 27 * 2);
|
Inventory inv = Bukkit.createInventory(null, 27 * 2);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Iris.proj.getActiveProject().getActiveProvider().getEngine().addItems(true, inv, RNG.r, tables, InventorySlotType.STORAGE, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 1);
|
Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getEngine().addItems(true, inv, RNG.r, tables, InventorySlotType.STORAGE, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 1);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
sender.sendMessage("You can only use /iris loot in a studio world of iris.");
|
sender.sendMessage("You can only use /iris loot in a studio world of iris.");
|
||||||
@ -109,7 +110,7 @@ public class CommandIrisStudioLoot extends MortarCommand {
|
|||||||
inv.clear();
|
inv.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.proj.getActiveProject().getActiveProvider().getEngine().addItems(true, inv, new RNG(RNG.r.imax()), tables, InventorySlotType.STORAGE, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 1);
|
Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getEngine().addItems(true, inv, new RNG(RNG.r.imax()), tables, InventorySlotType.STORAGE, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 1);
|
||||||
}, 0, fast ? 5 : 35));
|
}, 0, fast ? 5 : 35));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -21,6 +21,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.gui.VisionGUI;
|
import com.volmit.iris.core.gui.VisionGUI;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
@ -55,7 +56,7 @@ public class CommandIrisStudioMap extends MortarCommand {
|
|||||||
Engine fe;
|
Engine fe;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Engine g = Iris.proj.getActiveProject().getActiveProvider().getEngine();
|
Engine g = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getEngine();
|
||||||
VisionGUI.launch(g, 0);
|
VisionGUI.launch(g, 0);
|
||||||
sender.sendMessage("Opening Map!");
|
sender.sendMessage("Opening Map!");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -50,7 +51,7 @@ public class CommandIrisStudioOpen extends MortarCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Opening studio world...");
|
sender.sendMessage("Opening studio world...");
|
||||||
Iris.proj.open(sender, args[0]);
|
Iris.service(StudioSVC.class).open(sender, args[0]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -63,7 +64,7 @@ public class CommandIrisStudioPackage extends MortarCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String dim = args[0];
|
String dim = args[0];
|
||||||
Iris.proj.compilePackage(sender, dim, o, m);
|
Iris.service(StudioSVC.class).compilePackage(sender, dim, o, m);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer;
|
import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer;
|
||||||
import com.volmit.iris.engine.object.noise.IrisGenerator;
|
import com.volmit.iris.engine.object.noise.IrisGenerator;
|
||||||
@ -70,12 +71,12 @@ public class CommandIrisStudioProfile extends MortarCommand {
|
|||||||
File report = Iris.instance.getDataFile("profile.txt");
|
File report = Iris.instance.getDataFile("profile.txt");
|
||||||
KList<String> v = new KList<>();
|
KList<String> v = new KList<>();
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
if (!Iris.proj.isProjectOpen()) {
|
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
sender.sendMessage("No open project. Either use /iris std beautify <project> or have a project open.");
|
sender.sendMessage("No open project. Either use /iris std beautify <project> or have a project open.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = Iris.proj.getActiveProject().getPath();
|
f = Iris.service(StudioSVC.class).getActiveProject().getPath();
|
||||||
} else {
|
} else {
|
||||||
f = Iris.instance.getDataFolder("packs", args[0]);
|
f = Iris.instance.getDataFolder("packs", args[0]);
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.command.studio;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
@ -50,14 +51,14 @@ public class CommandIrisStudioTPStudio extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Iris.proj.isProjectOpen()) {
|
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
sender.sendMessage("There is not a studio currently loaded.");
|
sender.sendMessage("There is not a studio currently loaded.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sender.sendMessage("Teleporting you to the active studio world.");
|
sender.sendMessage("Teleporting you to the active studio world.");
|
||||||
sender.player().teleport(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().spawnLocation());
|
sender.player().teleport(Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().spawnLocation());
|
||||||
sender.player().setGameMode(GameMode.SPECTATOR);
|
sender.player().setGameMode(GameMode.SPECTATOR);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
|
@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@ -62,7 +63,7 @@ public class CommandIrisStudioUpdate extends MortarCommand {
|
|||||||
|
|
||||||
for (String i : args) {
|
for (String i : args) {
|
||||||
if (i.equals("--rewrite-objects")) {
|
if (i.equals("--rewrite-objects")) {
|
||||||
IrisData data = new IrisData(Iris.proj.getWorkspaceFolder(args[0]));
|
IrisData data = new IrisData(Iris.service(StudioSVC.class).getWorkspaceFolder(args[0]));
|
||||||
int t = data.getObjectLoader().getPossibleKeys().length;
|
int t = data.getObjectLoader().getPossibleKeys().length;
|
||||||
ChronoLatch cl = new ChronoLatch(250, false);
|
ChronoLatch cl = new ChronoLatch(250, false);
|
||||||
MultiBurst bx = new MultiBurst("Object Rewriter", Thread.MIN_PRIORITY, Runtime.getRuntime().availableProcessors());
|
MultiBurst bx = new MultiBurst("Object Rewriter", Thread.MIN_PRIORITY, Runtime.getRuntime().availableProcessors());
|
||||||
@ -107,7 +108,7 @@ public class CommandIrisStudioUpdate extends MortarCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new IrisProject(Iris.proj.getWorkspaceFolder(args[0])).updateWorkspace()) {
|
if (new IrisProject(Iris.service(StudioSVC.class).getWorkspaceFolder(args[0])).updateWorkspace()) {
|
||||||
sender.sendMessage("Updated Code Workspace for " + args[0]);
|
sender.sendMessage("Updated Code Workspace for " + args[0]);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("Invalid project: " + args[0] + ". Try deleting the code-workspace file and try again.");
|
sender.sendMessage("Invalid project: " + args[0] + ". Try deleting the code-workspace file and try again.");
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.core.command.world;
|
package com.volmit.iris.core.command.world;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
@ -64,10 +65,10 @@ public class CommandIrisUpdateWorld extends MortarCommand {
|
|||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
|
|
||||||
if (bfre) {
|
if (bfre) {
|
||||||
Iris.proj.downloadSearch(sender, args[1], false, true);
|
Iris.service(StudioSVC.class).downloadSearch(sender, args[1], false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.proj.installIntoWorld(sender, args[1], folder);
|
Iris.service(StudioSVC.class).installIntoWorld(sender, args[1], folder);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -51,6 +51,7 @@ public class CommandLocate extends MortarCommand implements Listener {
|
|||||||
public CommandLocate() {
|
public CommandLocate() {
|
||||||
super("locate");
|
super("locate");
|
||||||
requiresPermission(Iris.perm);
|
requiresPermission(Iris.perm);
|
||||||
|
Iris.instance.registerListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.decrees;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
@ -141,7 +142,7 @@ public class DecIris implements DecreeExecutor
|
|||||||
boolean overwrite
|
boolean overwrite
|
||||||
) {
|
) {
|
||||||
sender().sendMessage(C.GREEN + "Downloading pack: " + pack + "/" + branch + (trim ? " trimmed" : ""));
|
sender().sendMessage(C.GREEN + "Downloading pack: " + pack + "/" + branch + (trim ? " trimmed" : ""));
|
||||||
Iris.proj.downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
|
Iris.service(StudioSVC.class).downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Get metrics for your world", aliases = "measure", origin = DecreeOrigin.PLAYER)
|
@Decree(description = "Get metrics for your world", aliases = "measure", origin = DecreeOrigin.PLAYER)
|
||||||
|
@ -24,6 +24,8 @@ import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
|||||||
import com.volmit.iris.core.gui.VisionGUI;
|
import com.volmit.iris.core.gui.VisionGUI;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.service.ConversionSVC;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.basic.IrisPosition;
|
import com.volmit.iris.engine.object.basic.IrisPosition;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
@ -89,17 +91,17 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
@Param(defaultValue = "1337", description = "The seed to generate the studio with", aliases = "s")
|
@Param(defaultValue = "1337", description = "The seed to generate the studio with", aliases = "s")
|
||||||
long seed) {
|
long seed) {
|
||||||
sender().sendMessage(C.GREEN + "Opening studio for the \"" + dimension.getName() + "\" pack (seed: " + seed + ")");
|
sender().sendMessage(C.GREEN + "Opening studio for the \"" + dimension.getName() + "\" pack (seed: " + seed + ")");
|
||||||
Iris.proj.open(sender(), seed, dimension.getLoadKey());
|
Iris.service(StudioSVC.class).open(sender(), seed, dimension.getLoadKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Close an open studio project", aliases = "x", sync = true)
|
@Decree(description = "Close an open studio project", aliases = "x", sync = true)
|
||||||
public void close() {
|
public void close() {
|
||||||
if (!Iris.proj.isProjectOpen()) {
|
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||||
sender().sendMessage(C.RED + "No open studio projects.");
|
sender().sendMessage(C.RED + "No open studio projects.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.proj.close();
|
Iris.service(StudioSVC.class).close();
|
||||||
sender().sendMessage(C.GREEN + "Project Closed.");
|
sender().sendMessage(C.GREEN + "Project Closed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,9 +113,9 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
IrisDimension template)
|
IrisDimension template)
|
||||||
{
|
{
|
||||||
if (template != null) {
|
if (template != null) {
|
||||||
Iris.proj.create(sender(), name, template.getLoadKey());
|
Iris.service(StudioSVC.class).create(sender(), name, template.getLoadKey());
|
||||||
} else {
|
} else {
|
||||||
Iris.proj.create(sender(), name);
|
Iris.service(StudioSVC.class).create(sender(), name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +139,7 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
MultiBurst burst = new MultiBurst("Cleaner", Thread.MIN_PRIORITY, Runtime.getRuntime().availableProcessors() * 2);
|
MultiBurst burst = new MultiBurst("Cleaner", Thread.MIN_PRIORITY, Runtime.getRuntime().availableProcessors() * 2);
|
||||||
|
|
||||||
jobs.add(new SingleJob("Updating Workspace", () -> {
|
jobs.add(new SingleJob("Updating Workspace", () -> {
|
||||||
if (!new IrisProject(Iris.proj.getWorkspaceFolder(project.getLoadKey())).updateWorkspace()) {
|
if (!new IrisProject(Iris.service(StudioSVC.class).getWorkspaceFolder(project.getLoadKey())).updateWorkspace()) {
|
||||||
sender().sendMessage(C.GOLD + "Invalid project: " + project.getLoadKey() + ". Try deleting the code-workspace file and try again.");
|
sender().sendMessage(C.GOLD + "Invalid project: " + project.getLoadKey() + ". Try deleting the code-workspace file and try again.");
|
||||||
}
|
}
|
||||||
J.sleep(250);
|
J.sleep(250);
|
||||||
@ -210,7 +212,7 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IrisData data = new IrisData(Iris.proj.getWorkspaceFolder(project.getLoadKey()));
|
IrisData data = new IrisData(Iris.service(StudioSVC.class).getWorkspaceFolder(project.getLoadKey()));
|
||||||
for (String f : data.getObjectLoader().getPossibleKeys()) {
|
for (String f : data.getObjectLoader().getPossibleKeys()) {
|
||||||
CompletableFuture<?> gg = burst.complete(() ->{
|
CompletableFuture<?> gg = burst.complete(() ->{
|
||||||
File ff = data.getObjectLoader().findFile(f);
|
File ff = data.getObjectLoader().findFile(f);
|
||||||
@ -256,7 +258,7 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
|
|
||||||
@Decree(description = "Convert objects in the \"convert\" folder")
|
@Decree(description = "Convert objects in the \"convert\" folder")
|
||||||
public void convert() {
|
public void convert() {
|
||||||
Iris.convert.check(sender());
|
Iris.service(ConversionSVC.class).check(sender());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -431,7 +433,7 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
@Param(name = "minify", description = "Whether or not to minify the pack", defaultValue = "true")
|
@Param(name = "minify", description = "Whether or not to minify the pack", defaultValue = "true")
|
||||||
boolean minify
|
boolean minify
|
||||||
){
|
){
|
||||||
Iris.proj.compilePackage(sender(), dimension.getLoadKey(), obfuscate, minify);
|
Iris.service(StudioSVC.class).compilePackage(sender(), dimension.getLoadKey(), obfuscate, minify);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Profiles the performance of a dimension", origin = DecreeOrigin.PLAYER)
|
@Decree(description = "Profiles the performance of a dimension", origin = DecreeOrigin.PLAYER)
|
||||||
@ -641,7 +643,7 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
|
|
||||||
@Decree(description = "Teleport to the active studio world", aliases = "stp", origin = DecreeOrigin.PLAYER, sync = true)
|
@Decree(description = "Teleport to the active studio world", aliases = "stp", origin = DecreeOrigin.PLAYER, sync = true)
|
||||||
public void tpstudio(){
|
public void tpstudio(){
|
||||||
if (!Iris.proj.isProjectOpen()){
|
if (!Iris.service(StudioSVC.class).isProjectOpen()){
|
||||||
sender().sendMessage(C.RED + "No studio world is open!");
|
sender().sendMessage(C.RED + "No studio world is open!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -652,7 +654,7 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sender().sendMessage(C.GREEN + "Sending you to the studio world!");
|
sender().sendMessage(C.GREEN + "Sending you to the studio world!");
|
||||||
player().teleport(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().spawnLocation());
|
player().teleport(Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().spawnLocation());
|
||||||
player().setGameMode(GameMode.SPECTATOR);
|
player().setGameMode(GameMode.SPECTATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,7 +775,7 @@ public class DecStudio implements DecreeExecutor {
|
|||||||
sender().sendMessage(C.RED + "Players only (this is a config error. Ask support to add DecreeOrigin.PLAYER to the command you tried to run)");
|
sender().sendMessage(C.RED + "Players only (this is a config error. Ask support to add DecreeOrigin.PLAYER to the command you tried to run)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Iris.proj.isProjectOpen()){
|
if (!Iris.service(StudioSVC.class).isProjectOpen()){
|
||||||
sender().sendMessage(C.RED + "No studio world is open!");
|
sender().sendMessage(C.RED + "No studio world is open!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.core.edit;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.engine.object.basic.IrisPosition;
|
import com.volmit.iris.engine.object.basic.IrisPosition;
|
||||||
import com.volmit.iris.engine.object.jigsaw.IrisJigsawPiece;
|
import com.volmit.iris.engine.object.jigsaw.IrisJigsawPiece;
|
||||||
import com.volmit.iris.engine.object.jigsaw.IrisJigsawPieceConnector;
|
import com.volmit.iris.engine.object.jigsaw.IrisJigsawPieceConnector;
|
||||||
@ -168,7 +169,7 @@ public class JigsawEditor implements Listener {
|
|||||||
|
|
||||||
public void onTick() {
|
public void onTick() {
|
||||||
if (cl.flip()) {
|
if (cl.flip()) {
|
||||||
Iris.wand.draw(cuboid, player);
|
Iris.service(WandSVC.class).draw(cuboid, player);
|
||||||
|
|
||||||
f:
|
f:
|
||||||
for (IrisPosition i : falling.k()) {
|
for (IrisPosition i : falling.k()) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.volmit.iris.core;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
@ -29,6 +29,7 @@ import com.volmit.iris.util.collection.KList;
|
|||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.math.RollingSequence;
|
import com.volmit.iris.util.math.RollingSequence;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -38,30 +39,31 @@ import org.bukkit.boss.BarStyle;
|
|||||||
import org.bukkit.boss.BossBar;
|
import org.bukkit.boss.BossBar;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CoreBoardManager implements BoardProvider, Listener {
|
public class BoardSVC implements IrisService, BoardProvider {
|
||||||
|
private BossBar energyBar;
|
||||||
private final BossBar energyBar;
|
private com.volmit.iris.util.board.BoardManager manager;
|
||||||
private final com.volmit.iris.util.board.BoardManager manager;
|
|
||||||
private String mem = "...";
|
private String mem = "...";
|
||||||
public final RollingSequence hits = new RollingSequence(20);
|
|
||||||
public final RollingSequence tp = new RollingSequence(100);
|
public final RollingSequence tp = new RollingSequence(100);
|
||||||
private final ChronoLatch cl = new ChronoLatch(1000);
|
private final ChronoLatch cl = new ChronoLatch(1000);
|
||||||
private final ChronoLatch ecl = new ChronoLatch(50);
|
private final ChronoLatch ecl = new ChronoLatch(50);
|
||||||
|
|
||||||
public CoreBoardManager() {
|
@Override
|
||||||
Iris.instance.registerListener(this);
|
public void onEnable() {
|
||||||
//@builder
|
|
||||||
manager = new com.volmit.iris.util.board.BoardManager(Iris.instance, BoardSettings.builder()
|
manager = new com.volmit.iris.util.board.BoardManager(Iris.instance, BoardSettings.builder()
|
||||||
.boardProvider(this)
|
.boardProvider(this)
|
||||||
.scoreDirection(ScoreDirection.DOWN)
|
.scoreDirection(ScoreDirection.DOWN)
|
||||||
.build());
|
.build());
|
||||||
energyBar = Bukkit.createBossBar("Spawner Energy " + 0, BarColor.BLUE, BarStyle.SOLID);
|
energyBar = Bukkit.createBossBar("Spawner Energy " + 0, BarColor.BLUE, BarStyle.SOLID);
|
||||||
//@done
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
manager.onDisable();
|
||||||
|
energyBar.removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -69,7 +71,6 @@ public class CoreBoardManager implements BoardProvider, Listener {
|
|||||||
J.s(() -> updatePlayer(e.getPlayer()));
|
J.s(() -> updatePlayer(e.getPlayer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isIrisWorld(World w) {
|
private boolean isIrisWorld(World w) {
|
||||||
return IrisToolbelt.isIrisWorld(w) && IrisToolbelt.access(w).isStudio();
|
return IrisToolbelt.isIrisWorld(w) && IrisToolbelt.access(w).isStudio();
|
||||||
}
|
}
|
||||||
@ -154,10 +155,4 @@ public class CoreBoardManager implements BoardProvider, Listener {
|
|||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void disable() {
|
|
||||||
manager.onDisable();
|
|
||||||
energyBar.removeAll();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.volmit.iris.core;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.decrees.DecIris;
|
import com.volmit.iris.core.decrees.DecIris;
|
||||||
@ -24,15 +24,22 @@ import com.volmit.iris.engine.data.cache.AtomicCache;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.decree.DecreeSystem;
|
import com.volmit.iris.util.decree.DecreeSystem;
|
||||||
import com.volmit.iris.util.decree.virtual.VirtualDecreeCommand;
|
import com.volmit.iris.util.decree.virtual.VirtualDecreeCommand;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
|
|
||||||
public class CommandManager implements DecreeSystem {
|
public class CommandSVC implements IrisService, DecreeSystem {
|
||||||
private final transient AtomicCache<VirtualDecreeCommand> commandCache = new AtomicCache<>();
|
@Override
|
||||||
private final transient AtomicCache<KList<String>> startsCache = new AtomicCache<>();
|
public void onEnable() {
|
||||||
|
|
||||||
public CommandManager(){
|
|
||||||
Iris.instance.getCommand("irisd").setExecutor(this);
|
Iris.instance.getCommand("irisd").setExecutor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private final transient AtomicCache<VirtualDecreeCommand> commandCache = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<KList<String>> startsCache = new AtomicCache<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VirtualDecreeCommand getRoot() {
|
public VirtualDecreeCommand getRoot() {
|
||||||
return commandCache.aquire(() -> {
|
return commandCache.aquire(() -> {
|
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.volmit.iris.core;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
@ -39,6 +39,7 @@ import com.volmit.iris.util.nbt.mca.NBTWorld;
|
|||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
import com.volmit.iris.util.nbt.tag.IntTag;
|
import com.volmit.iris.util.nbt.tag.IntTag;
|
||||||
import com.volmit.iris.util.nbt.tag.ListTag;
|
import com.volmit.iris.util.nbt.tag.ListTag;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -49,11 +50,9 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class ConversionManager {
|
public class ConversionSVC implements IrisService {
|
||||||
private final KList<Converter> converters;
|
@Override
|
||||||
private final File folder;
|
public void onEnable() {
|
||||||
|
|
||||||
public ConversionManager() {
|
|
||||||
folder = Iris.instance.getDataFolder("convert");
|
folder = Iris.instance.getDataFolder("convert");
|
||||||
converters = new KList<>();
|
converters = new KList<>();
|
||||||
|
|
||||||
@ -64,6 +63,14 @@ public class ConversionManager {
|
|||||||
}), 5);
|
}), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private KList<Converter> converters;
|
||||||
|
private File folder;
|
||||||
|
|
||||||
private String toPoolName(String poolReference) {
|
private String toPoolName(String poolReference) {
|
||||||
return poolReference.split("\\Q:\\E")[1];
|
return poolReference.split("\\Q:\\E")[1];
|
||||||
}
|
}
|
54
src/main/java/com/volmit/iris/core/service/DolphinSVC.java
Normal file
54
src/main/java/com/volmit/iris/core/service/DolphinSVC.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
|
||||||
|
public class DolphinSVC implements IrisService {
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents dolphins from being fed, to locate a treasure map.
|
||||||
|
* Note: This results in odd dolphin behaviour, but it's the best we can do.
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void on(PlayerInteractEntityEvent event) {
|
||||||
|
if (!IrisToolbelt.isIrisWorld(event.getPlayer().getWorld())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Material hand = event.getPlayer().getInventory().getItem(event.getHand()).getType();
|
||||||
|
if (event.getRightClicked().getType().equals(EntityType.DOLPHIN) && (hand.equals(Material.TROPICAL_FISH) || hand.equals(Material.PUFFERFISH) || hand.equals(Material.COD) || hand.equals(Material.SALMON))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,28 +16,34 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.volmit.iris.core;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.edit.BlockEditor;
|
import com.volmit.iris.core.edit.BlockEditor;
|
||||||
import com.volmit.iris.core.edit.BukkitBlockEditor;
|
import com.volmit.iris.core.edit.BukkitBlockEditor;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.world.WorldUnloadEvent;
|
import org.bukkit.event.world.WorldUnloadEvent;
|
||||||
|
|
||||||
public class EditManager implements Listener {
|
public class EditSVC implements IrisService {
|
||||||
private final KMap<World, BlockEditor> editors;
|
private KMap<World, BlockEditor> editors;
|
||||||
|
|
||||||
public EditManager() {
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
this.editors = new KMap<>();
|
this.editors = new KMap<>();
|
||||||
Iris.instance.registerListener(this);
|
Iris.info("EDIT SVC ENABLED!");
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, this::update, 0, 0);
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, this::update, 1000, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
flushNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockData get(World world, int x, int y, int z) {
|
public BlockData get(World world, int x, int y, int z) {
|
||||||
@ -90,11 +96,10 @@ public class EditManager implements Listener {
|
|||||||
return editors.get(world);
|
return editors.get(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockEditor e = null;
|
BlockEditor e = new BukkitBlockEditor(world);
|
||||||
e = new BukkitBlockEditor(world);
|
|
||||||
|
|
||||||
editors.put(world, e);
|
editors.put(world, e);
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -16,13 +16,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.volmit.iris.core;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
@ -31,9 +33,12 @@ import com.volmit.iris.util.format.Form;
|
|||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.json.JSONException;
|
import com.volmit.iris.util.json.JSONException;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
import com.volmit.iris.util.scheduling.GroupedExecutor;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import lombok.Data;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
import org.zeroturnaround.zip.ZipUtil;
|
||||||
import org.zeroturnaround.zip.commons.FileUtils;
|
import org.zeroturnaround.zip.commons.FileUtils;
|
||||||
|
|
||||||
@ -41,57 +46,46 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Data
|
public class StudioSVC implements IrisService {
|
||||||
public class ProjectManager {
|
|
||||||
public static final String LISTING = "https://raw.githubusercontent.com/IrisDimensions/_listing/main/listing-v2.json";
|
public static final String LISTING = "https://raw.githubusercontent.com/IrisDimensions/_listing/main/listing-v2.json";
|
||||||
public static final String WORKSPACE_NAME = "packs";
|
public static final String WORKSPACE_NAME = "packs";
|
||||||
private KMap<String, String> cacheListing = null;
|
private KMap<String, String> cacheListing = null;
|
||||||
private IrisProject activeProject;
|
private IrisProject activeProject;
|
||||||
private static final AtomicCache<Integer> counter = new AtomicCache<>();
|
private static final AtomicCache<Integer> counter = new AtomicCache<>();
|
||||||
|
|
||||||
public ProjectManager() {
|
@Override
|
||||||
if (IrisSettings.get().isStudio()) {
|
public void onEnable() {
|
||||||
J.a(() ->
|
J.a(() ->
|
||||||
{
|
{
|
||||||
File ignore = getWorkspaceFile(".gitignore");
|
File ignore = getWorkspaceFile(".gitignore");
|
||||||
|
|
||||||
if (!ignore.exists()) {
|
if (!ignore.exists()) {
|
||||||
File m = Iris.getCached("Pack Ignore (.gitignore)", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/packignore.ignore");
|
File m = Iris.getCached("Pack Ignore (.gitignore)", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/packignore.ignore");
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
try {
|
|
||||||
IO.copyFile(m, ignore);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int countUniqueDimensions() {
|
|
||||||
|
|
||||||
return counter.aquire(() -> {
|
|
||||||
int v = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
for (File i : Iris.instance.getDataFolder(WORKSPACE_NAME).listFiles()) {
|
|
||||||
try {
|
try {
|
||||||
if (i.isDirectory() && i.list().length > 0 && !Iris.proj.getListing(true).containsKey(i.getName())) {
|
IO.copyFile(m, ignore);
|
||||||
v++;
|
} catch (IOException e) {
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
if (IrisSettings.get().isStudio()) {
|
||||||
|
Iris.debug("Studio Mode Active: Closing Projects");
|
||||||
|
|
||||||
|
for (World i : Bukkit.getWorlds()) {
|
||||||
|
if (IrisToolbelt.isIrisWorld(i)) {
|
||||||
|
Iris.debug("Closing Platform Generator " + i.getName());
|
||||||
|
IrisToolbelt.access(i).close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IrisDimension installIntoWorld(VolmitSender sender, String type, File folder) {
|
public IrisDimension installIntoWorld(VolmitSender sender, String type, File folder) {
|
||||||
sender.sendMessage("Looking for Package: " + type);
|
sender.sendMessage("Looking for Package: " + type);
|
||||||
File iris = new File(folder, "iris");
|
File iris = new File(folder, "iris");
|
||||||
@ -99,15 +93,15 @@ public class ProjectManager {
|
|||||||
IrisDimension dim = IrisData.loadAnyDimension(type);
|
IrisDimension dim = IrisData.loadAnyDimension(type);
|
||||||
|
|
||||||
if (dim == null) {
|
if (dim == null) {
|
||||||
for (File i : Iris.proj.getWorkspaceFolder().listFiles()) {
|
for (File i : getWorkspaceFolder().listFiles()) {
|
||||||
if (i.isFile() && i.getName().equals(type + ".iris")) {
|
if (i.isFile() && i.getName().equals(type + ".iris")) {
|
||||||
sender.sendMessage("Found " + type + ".iris in " + ProjectManager.WORKSPACE_NAME + " folder");
|
sender.sendMessage("Found " + type + ".iris in " + WORKSPACE_NAME + " folder");
|
||||||
ZipUtil.unpack(i, irispack);
|
ZipUtil.unpack(i, irispack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("Found " + type + " dimension in " + ProjectManager.WORKSPACE_NAME + " folder. Repackaging");
|
sender.sendMessage("Found " + type + " dimension in " + WORKSPACE_NAME + " folder. Repackaging");
|
||||||
File f = new IrisProject(new File(getWorkspaceFolder(), type)).getPath();
|
File f = new IrisProject(new File(getWorkspaceFolder(), type)).getPath();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -120,8 +114,8 @@ public class ProjectManager {
|
|||||||
File dimf = new File(irispack, "dimensions/" + type + ".json");
|
File dimf = new File(irispack, "dimensions/" + type + ".json");
|
||||||
|
|
||||||
if (!dimf.exists() || !dimf.isFile()) {
|
if (!dimf.exists() || !dimf.isFile()) {
|
||||||
Iris.proj.downloadSearch(sender, type, false);
|
downloadSearch(sender, type, false);
|
||||||
File downloaded = Iris.proj.getWorkspaceFolder(type);
|
File downloaded = getWorkspaceFolder(type);
|
||||||
|
|
||||||
for (File i : downloaded.listFiles()) {
|
for (File i : downloaded.listFiles()) {
|
||||||
if (i.isFile()) {
|
if (i.isFile()) {
|
||||||
@ -454,9 +448,14 @@ public class ProjectManager {
|
|||||||
create(sender, s, "example");
|
create(sender, s, "example");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IrisProject getActiveProject()
|
||||||
|
{
|
||||||
|
return activeProject;
|
||||||
|
}
|
||||||
|
|
||||||
public void updateWorkspace() {
|
public void updateWorkspace() {
|
||||||
if (isProjectOpen()) {
|
if (isProjectOpen()) {
|
||||||
activeProject.updateWorkspace();
|
activeProject.updateWorkspace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.volmit.iris.core;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
@ -35,6 +35,7 @@ import com.volmit.iris.util.collection.KMap;
|
|||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.math.BlockPosition;
|
import com.volmit.iris.util.math.BlockPosition;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -44,19 +45,23 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.block.data.type.Sapling;
|
import org.bukkit.block.data.type.Sapling;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.world.StructureGrowEvent;
|
import org.bukkit.event.world.StructureGrowEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public class TreeManager implements Listener {
|
public class TreeSVC implements IrisService {
|
||||||
|
|
||||||
private boolean block = false;
|
private boolean block = false;
|
||||||
|
|
||||||
public TreeManager() {
|
@Override
|
||||||
Iris.instance.registerListener(this);
|
public void onEnable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,15 +1,43 @@
|
|||||||
package com.volmit.iris.core;
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.villager.IrisVillagerOverride;
|
import com.volmit.iris.engine.object.villager.IrisVillagerOverride;
|
||||||
import com.volmit.iris.engine.object.villager.IrisVillagerTrade;
|
import com.volmit.iris.engine.object.villager.IrisVillagerTrade;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.VillagerAcquireTradeEvent;
|
import org.bukkit.event.entity.VillagerAcquireTradeEvent;
|
||||||
|
|
||||||
public class VillagerManager implements Listener {
|
public class VillageSVC implements IrisService {
|
||||||
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace or disable villager trade add event to prevent explorer map
|
* Replace or disable villager trade add event to prevent explorer map
|
||||||
*/
|
*/
|
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.volmit.iris.core;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.edit.DustRevealer;
|
import com.volmit.iris.core.edit.DustRevealer;
|
||||||
@ -28,6 +28,7 @@ import com.volmit.iris.util.format.C;
|
|||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.matter.Matter;
|
import com.volmit.iris.util.matter.Matter;
|
||||||
import com.volmit.iris.util.matter.WorldMatter;
|
import com.volmit.iris.util.matter.WorldMatter;
|
||||||
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
@ -35,7 +36,6 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@ -45,16 +45,17 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class WandManager implements Listener {
|
public class WandSVC implements IrisService {
|
||||||
|
|
||||||
private static ItemStack wand;
|
private static ItemStack wand;
|
||||||
private static ItemStack dust;
|
private static ItemStack dust;
|
||||||
|
|
||||||
public WandManager() {
|
@Override
|
||||||
|
public void onEnable() {
|
||||||
wand = createWand();
|
wand = createWand();
|
||||||
dust = createDust();
|
dust = createDust();
|
||||||
|
|
||||||
@ -65,6 +66,11 @@ public class WandManager implements Listener {
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void tick(Player p) {
|
public void tick(Player p) {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
@ -22,6 +22,7 @@ import com.google.common.util.concurrent.AtomicDouble;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
@ -107,7 +108,7 @@ public class IrisCreator {
|
|||||||
|
|
||||||
if(!studio())
|
if(!studio())
|
||||||
{
|
{
|
||||||
Iris.proj.installIntoWorld(sender, d.getLoadKey(), new File(name()));
|
Iris.service(StudioSVC.class).installIntoWorld(sender, d.getLoadKey(), new File(name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
PlatformChunkGenerator access = null;
|
PlatformChunkGenerator access = null;
|
||||||
|
@ -20,7 +20,6 @@ package com.volmit.iris.core.tools;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.ProjectManager;
|
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
import com.volmit.iris.core.gui.PregeneratorJob;
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||||
@ -28,6 +27,7 @@ import com.volmit.iris.core.pregenerator.methods.HeadlessPregenMethod;
|
|||||||
import com.volmit.iris.core.pregenerator.methods.HybridPregenMethod;
|
import com.volmit.iris.core.pregenerator.methods.HybridPregenMethod;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
@ -71,7 +71,7 @@ public class IrisToolbelt {
|
|||||||
File pack = Iris.instance.getDataFolder("packs", dimension);
|
File pack = Iris.instance.getDataFolder("packs", dimension);
|
||||||
|
|
||||||
if (!pack.exists()) {
|
if (!pack.exists()) {
|
||||||
Iris.proj.downloadSearch(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), dimension, false, false);
|
Iris.service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag()), dimension, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pack.exists()) {
|
if (!pack.exists()) {
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.engine.object.common;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||||
@ -60,7 +61,7 @@ public class HeadlessWorld {
|
|||||||
new File(world.worldFolder(), "region").mkdirs();
|
new File(world.worldFolder(), "region").mkdirs();
|
||||||
|
|
||||||
if (!studio && !new File(world.worldFolder(), "iris/pack").exists()) {
|
if (!studio && !new File(world.worldFolder(), "iris/pack").exists()) {
|
||||||
Iris.proj.installIntoWorld(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag("Headless")), dimension.getLoadKey(), world.worldFolder());
|
Iris.service(StudioSVC.class).installIntoWorld(new VolmitSender(Bukkit.getConsoleSender(), Iris.instance.getTag("Headless")), dimension.getLoadKey(), world.worldFolder());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.util.hunk.view;
|
package com.volmit.iris.util.hunk.view;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.service.EditSVC;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
@ -52,11 +53,12 @@ public class ChunkBiomeHunkView implements Hunk<Biome> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.edit.setBiome(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
Iris.service(EditSVC.class).setBiome(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome getRaw(int x, int y, int z) {
|
public Biome getRaw(int x, int y, int z) {
|
||||||
return Iris.edit.getBiome(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16));
|
return Iris.service(EditSVC.class)
|
||||||
|
.getBiome(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.util.hunk.view;
|
package com.volmit.iris.util.hunk.view;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.service.EditSVC;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@ -52,11 +53,11 @@ public class ChunkHunkView implements Hunk<BlockData> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.edit.set(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
Iris.service(EditSVC.class).set(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockData getRaw(int x, int y, int z) {
|
public BlockData getRaw(int x, int y, int z) {
|
||||||
return Iris.edit.get(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16));
|
return Iris.service(EditSVC.class).get(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,16 +448,12 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerListener(Listener l) {
|
public void registerListener(Listener l) {
|
||||||
if (bad) {
|
Iris.debug("Register Listener " + l.getClass().getSimpleName());
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bukkit.getPluginManager().registerEvents(l, this);
|
Bukkit.getPluginManager().registerEvents(l, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterListener(Listener l) {
|
public void unregisterListener(Listener l) {
|
||||||
if (bad) {
|
Iris.debug("Register Listener " + l.getClass().getSimpleName());
|
||||||
return;
|
|
||||||
}
|
|
||||||
HandlerList.unregisterAll(l);
|
HandlerList.unregisterAll(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user