mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Activate decree
This commit is contained in:
parent
93f2c83c0e
commit
faf5bcb32b
@ -19,9 +19,6 @@
|
|||||||
package com.volmit.iris;
|
package com.volmit.iris;
|
||||||
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.command.CommandIris;
|
|
||||||
import com.volmit.iris.core.command.PermissionIris;
|
|
||||||
import com.volmit.iris.core.command.studio.CommandIrisStudio;
|
|
||||||
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;
|
||||||
@ -90,9 +87,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
private static VolmitSender sender;
|
private static VolmitSender sender;
|
||||||
private final KList<Runnable> postShutdown = new KList<>();
|
private final KList<Runnable> postShutdown = new KList<>();
|
||||||
|
|
||||||
@Permission
|
|
||||||
public static PermissionIris perm;
|
|
||||||
|
|
||||||
public static VolmitSender getSender() {
|
public static VolmitSender getSender() {
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
@ -380,7 +374,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
Iris.error("============================================================================");
|
Iris.error("============================================================================");
|
||||||
|
|
||||||
for (Player i : Bukkit.getOnlinePlayers()) {
|
for (Player i : Bukkit.getOnlinePlayers()) {
|
||||||
if (i.isOp() || Iris.perm.has(i)) {
|
if (i.isOp() || i.hasPermission("iris.all")) {
|
||||||
VolmitSender sender = new VolmitSender(i, getTag("WARNING"));
|
VolmitSender sender = new VolmitSender(i, getTag("WARNING"));
|
||||||
sender.sendMessage("There are some Iris Packs that have custom biomes in them");
|
sender.sendMessage("There are some Iris Packs that have custom biomes in them");
|
||||||
sender.sendMessage("You need to restart your server to use these packs.");
|
sender.sendMessage("You need to restart your server to use these packs.");
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.command.jigsaw.CommandIrisJigsaw;
|
|
||||||
import com.volmit.iris.core.command.object.CommandIrisObject;
|
|
||||||
import com.volmit.iris.core.command.pregen.CommandIrisPregen;
|
|
||||||
import com.volmit.iris.core.command.studio.CommandIrisStudio;
|
|
||||||
import com.volmit.iris.core.command.what.CommandIrisWhat;
|
|
||||||
import com.volmit.iris.core.command.world.CommandIrisCreate;
|
|
||||||
import com.volmit.iris.core.command.world.CommandIrisRegen;
|
|
||||||
import com.volmit.iris.core.command.world.CommandIrisUpdateWorld;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIris extends MortarCommand {
|
|
||||||
@Command
|
|
||||||
private CommandIrisCreate create;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisRegen regen;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisDebug debug;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudio studio;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisJigsaw jigsaw;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObject object;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisDownload download;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisUpdateProject updateProject;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisUpdateWorld updateWorld;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisBitwise bitwise;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisWhat what;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisMetrics metrics;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisPregen pregen;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisReload reload;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisAura aura;
|
|
||||||
|
|
||||||
public CommandIris() {
|
|
||||||
super("iris", "ir", "irs");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
sender.sendMessage("Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
|
|
||||||
printHelp(sender);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisAura extends MortarCommand {
|
|
||||||
public CommandIrisAura() {
|
|
||||||
super("aura", "au");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Set aura spins");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
try {
|
|
||||||
int h = Integer.parseInt(args[0]);
|
|
||||||
int s = Integer.parseInt(args[1]);
|
|
||||||
int b = Integer.parseInt(args[2]);
|
|
||||||
IrisSettings.get().getGeneral().setSpinh(h);
|
|
||||||
IrisSettings.get().getGeneral().setSpins(s);
|
|
||||||
IrisSettings.get().getGeneral().setSpinb(b);
|
|
||||||
IrisSettings.get().forceSave();
|
|
||||||
sender.sendMessage("<rainbow>Aura Spins updated to " + h + " " + s + " " + b);
|
|
||||||
} catch (Throwable b) {
|
|
||||||
sender.sendMessage(getArgsUsage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<spinH> <spinS> <spinB>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.pack.IrisPack;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.exceptions.IrisException;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
public class CommandIrisBitwise extends MortarCommand {
|
|
||||||
public CommandIrisBitwise() {
|
|
||||||
super("bitwise", "bits", "bw");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Run bitwise calculations");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (args.length != 3) {
|
|
||||||
sender.sendMessage("/iris bw " + getArgsUsage());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (args[0].contains(",")) {
|
|
||||||
KList<Integer> r = new KList<>();
|
|
||||||
|
|
||||||
for (String i : args[0].split("\\Q,\\E")) {
|
|
||||||
int a = Integer.parseInt(i);
|
|
||||||
String op = args[1];
|
|
||||||
int b = Integer.parseInt(args[2]);
|
|
||||||
int v = 0;
|
|
||||||
|
|
||||||
switch (op) {
|
|
||||||
case "|" -> v = a | b;
|
|
||||||
case "&" -> v = a & b;
|
|
||||||
case "^" -> v = a ^ b;
|
|
||||||
case "%" -> v = a % b;
|
|
||||||
case ">>" -> v = a >> b;
|
|
||||||
case "<<" -> v = a << b;
|
|
||||||
default -> {
|
|
||||||
{
|
|
||||||
sender.sendMessage("Error Invalid operation");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
r.add(v);
|
|
||||||
sender.sendMessage("Result: " + r.toString(","));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int a = Integer.parseInt(args[0]);
|
|
||||||
String op = args[1];
|
|
||||||
int b = Integer.parseInt(args[2]);
|
|
||||||
int v = 0;
|
|
||||||
|
|
||||||
switch (op) {
|
|
||||||
case "|" -> v = a | b;
|
|
||||||
case "&" -> v = a & b;
|
|
||||||
case "^" -> v = a ^ b;
|
|
||||||
case "%" -> v = a % b;
|
|
||||||
case ">>" -> v = a >> b;
|
|
||||||
case "<<" -> v = a << b;
|
|
||||||
default -> {
|
|
||||||
{
|
|
||||||
sender.sendMessage("Error Invalid operation");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Result: " + v);
|
|
||||||
}
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<number> [|,&,^,>>,<<,%] <other>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisDebug extends MortarCommand {
|
|
||||||
@Command
|
|
||||||
private CommandIrisDebugSpawnerBoost boost;
|
|
||||||
@Command
|
|
||||||
private CommandIrisDebugReupdate reupdate;
|
|
||||||
|
|
||||||
public CommandIrisDebug() {
|
|
||||||
super("debug", "dbg");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Toggle debug mode");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
IrisSettings.get().getGeneral().setDebug(!IrisSettings.get().getGeneral().isDebug());
|
|
||||||
IrisSettings.get().forceSave();
|
|
||||||
sender.sendMessage("Debug Mode: " + (IrisSettings.get().getGeneral().isDebug() ? "Enabled" : "Disabled"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<number> [|,&,^,>>,<<,%] <other>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
|
|
||||||
public class CommandIrisDebugReupdate extends MortarCommand {
|
|
||||||
public CommandIrisDebugReupdate() {
|
|
||||||
super("reupdate", "rupt");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Force update a chunk again");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
|
|
||||||
Chunk c = sender.player().getLocation().getChunk();
|
|
||||||
Engine e = IrisToolbelt.access(sender.player().getWorld()).getEngine();
|
|
||||||
e.getMantle().getMantle().flag(c.getX(), c.getZ(), MantleFlag.UPDATE, false);
|
|
||||||
e.updateChunk(c);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<number> [|,&,^,>>,<<,%] <other>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisDebugSpawnerBoost extends MortarCommand {
|
|
||||||
public CommandIrisDebugSpawnerBoost() {
|
|
||||||
super("charge", "zzt");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Charge spawner energy");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
|
|
||||||
IrisToolbelt.access(sender.player().getWorld()).getEngine().getWorldManager().chargeEnergy();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<number> [|,&,^,>>,<<,%] <other>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class CommandIrisDownload extends MortarCommand {
|
|
||||||
public CommandIrisDownload() {
|
|
||||||
super("download", "down", "dl");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Download a project.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (args.length < 1) {
|
|
||||||
sender.sendMessage("/iris dl " + C.BOLD + "<NAME> [BRANCH=master]");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean trim = false;
|
|
||||||
String branch = "master";
|
|
||||||
|
|
||||||
for (String i : Arrays.copyOfRange(args, 1, args.length)) {
|
|
||||||
if (i.equals("-t") || i.equals("--trim")) {
|
|
||||||
trim = true;
|
|
||||||
break;
|
|
||||||
} else if (i.startsWith("-")) {
|
|
||||||
sender.sendMessage("Invalid parameter.");
|
|
||||||
sender.sendMessage("/iris dl " + C.BOLD + "<NAME> [BRANCH=master]");
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
branch = i;
|
|
||||||
if (branch.toLowerCase().startsWith("branch=")) branch = branch.substring(7);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean btrim = trim;
|
|
||||||
|
|
||||||
String pack = args[0];
|
|
||||||
|
|
||||||
if (!pack.contains("/")) {
|
|
||||||
pack = "IrisDimensions/" + pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String finalPack = pack + "/" + branch;
|
|
||||||
|
|
||||||
J.a(() -> Iris.service(StudioSVC.class).downloadSearch(sender, finalPack, btrim));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<name> [branch=master] [-t/--trim]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisMetrics extends MortarCommand {
|
|
||||||
public CommandIrisMetrics() {
|
|
||||||
super("metrics", "stats", "mt");
|
|
||||||
setDescription("Get timings for this world");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Metrics");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
Player p = sender.player();
|
|
||||||
World world = p.getWorld();
|
|
||||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
|
||||||
sender.sendMessage("You must be in an iris world.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine g = IrisToolbelt.access(world).getEngine();
|
|
||||||
|
|
||||||
try {
|
|
||||||
g.printMetrics(sender);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("You must be in an iris world.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisReload extends MortarCommand {
|
|
||||||
public CommandIrisReload() {
|
|
||||||
super("reload", "rld");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Reload configs");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
IrisSettings.invalidate();
|
|
||||||
IrisSettings.get();
|
|
||||||
sender.sendMessage("settings.json Reloaded");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<name> [-t/--trim]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
|
|
||||||
public class CommandIrisUpdateProject extends MortarCommand {
|
|
||||||
public CommandIrisUpdateProject() {
|
|
||||||
super("update-project", "^project");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Update a project from git.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (args.length < 1) {
|
|
||||||
sender.sendMessage("/iris update-project " + C.BOLD + "<PROJECT>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
J.a(() -> Iris.service(StudioSVC.class).downloadSearch(sender, args[0], false, true));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<project>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.util.plugin.MortarPermission;
|
|
||||||
import com.volmit.iris.util.plugin.Permission;
|
|
||||||
|
|
||||||
public class PermissionIris extends MortarPermission {
|
|
||||||
@Permission
|
|
||||||
public PermissionIrisStudio studio;
|
|
||||||
|
|
||||||
public PermissionIris() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getNode() {
|
|
||||||
return "iris";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return "Iris Permissions";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDefault() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command;
|
|
||||||
|
|
||||||
import com.volmit.iris.util.plugin.MortarPermission;
|
|
||||||
|
|
||||||
public class PermissionIrisStudio extends MortarPermission {
|
|
||||||
public PermissionIrisStudio() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getNode() {
|
|
||||||
return "studio";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return "Iris Studio Permissions";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDefault() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.jigsaw;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisJigsaw extends MortarCommand {
|
|
||||||
@Command
|
|
||||||
private CommandIrisJigsawNew create;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisJigsawEdit edit;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisJigsawSave save;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisJigsawPlace place;
|
|
||||||
|
|
||||||
public CommandIrisJigsaw() {
|
|
||||||
super("jigsaw", "jig", "jsw", "j");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Jigsaw");
|
|
||||||
setDescription("Iris jigsaw commands");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Jigsaw, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Ingame only");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Iris Jigsaw Commands:");
|
|
||||||
printHelp(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.jigsaw;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.edit.JigsawEditor;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.engine.object.jigsaw.IrisJigsawPiece;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class CommandIrisJigsawEdit extends MortarCommand {
|
|
||||||
public CommandIrisJigsawEdit() {
|
|
||||||
super("edit", "e", "*");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Jigsaw");
|
|
||||||
setDescription("Edit an existing Jigsaw piece");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Jigsaw, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Ingame only");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length < 1) {
|
|
||||||
sender.sendMessage(getArgsUsage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisJigsawPiece piece = IrisData.loadAnyJigsawPiece(args[0]);
|
|
||||||
|
|
||||||
if (piece != null) {
|
|
||||||
File dest = piece.getLoadFile();
|
|
||||||
new JigsawEditor(sender.player(), piece, IrisData.loadAnyObject(piece.getObject()), dest);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Failed to find existing jigsaw piece: " + args[0]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<name>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.jigsaw;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.edit.JigsawEditor;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisJigsawExit extends MortarCommand {
|
|
||||||
public CommandIrisJigsawExit() {
|
|
||||||
super("exit", "x", "close", "stop");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Jigsaw");
|
|
||||||
setDescription("Close a currently open piece without saving");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Jigsaw, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Ingame only");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
JigsawEditor editor = JigsawEditor.editors.get(sender.player());
|
|
||||||
|
|
||||||
if (editor == null) {
|
|
||||||
sender.sendMessage("You don't have any pieces open to close!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.exit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.jigsaw;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.edit.JigsawEditor;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class CommandIrisJigsawNew extends MortarCommand {
|
|
||||||
public CommandIrisJigsawNew() {
|
|
||||||
super("create", "new", "+", "n");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Jigsaw");
|
|
||||||
setDescription("Create a new jigsaw piece");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Jigsaw, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Ingame only");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length != 3) {
|
|
||||||
sender.sendMessage(getArgsUsage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisObject object = IrisData.loadAnyObject(args[2]);
|
|
||||||
|
|
||||||
if (object == null) {
|
|
||||||
sender.sendMessage("Failed to find existing object: " + args[2]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
File dest = Iris.instance.getDataFile("packs", args[1], "jigsaw-pieces", args[0] + ".json");
|
|
||||||
new JigsawEditor(sender.player(), null, object, dest);
|
|
||||||
sender.sendMessage("* Right Click blocks to make them connectors");
|
|
||||||
sender.sendMessage("* Right Click connectors to orient them");
|
|
||||||
sender.sendMessage("* Shift + Right Click connectors to remove them");
|
|
||||||
sender.sendMessage("Remember to use /iris jigsaw save");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<name> <project> <object>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.jigsaw;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.jigsaw.PlannedStructure;
|
|
||||||
import com.volmit.iris.engine.object.basic.IrisPosition;
|
|
||||||
import com.volmit.iris.engine.object.jigsaw.IrisJigsawStructure;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
|
||||||
|
|
||||||
public class CommandIrisJigsawPlace extends MortarCommand {
|
|
||||||
public CommandIrisJigsawPlace() {
|
|
||||||
super("place", "paste", "p");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Jigsaw");
|
|
||||||
setDescription("Place a jigsaw structure");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
if ((args.length == 0 || args.length == 1) && sender.isPlayer() && IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
IrisData data = IrisToolbelt.access(sender.player().getWorld()).getEngine().getData();
|
|
||||||
if (data == null) {
|
|
||||||
sender.sendMessage("Tab complete options only work for jigsaw structures while in an Iris world.");
|
|
||||||
} else if (args.length == 0) {
|
|
||||||
list.add(data.getJigsawStructureLoader().getPossibleKeys());
|
|
||||||
} else if (args.length == 1) {
|
|
||||||
list.add(data.getJigsawStructureLoader().getPossibleKeys(args[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Jigsaw, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Ingame only");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("You have to specify a jigsaw structure!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisJigsawStructure str = IrisData.loadAnyJigsawStructure(args[0]);
|
|
||||||
|
|
||||||
if (str != null) {
|
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
|
||||||
PlannedStructure ps = new PlannedStructure(str, new IrisPosition(sender.player().getLocation()), new RNG());
|
|
||||||
sender.sendMessage("Generated " + ps.getPieces().size() + " pieces in " + Form.duration(p.getMilliseconds(), 2));
|
|
||||||
ps.place(sender.player().getWorld());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<name>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.jigsaw;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.edit.JigsawEditor;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisJigsawSave extends MortarCommand {
|
|
||||||
public CommandIrisJigsawSave() {
|
|
||||||
super("save", "s");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Jigsaw");
|
|
||||||
setDescription("Save a currently open piece");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Jigsaw, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Ingame only");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
JigsawEditor editor = JigsawEditor.editors.get(sender.player());
|
|
||||||
|
|
||||||
if (editor == null) {
|
|
||||||
sender.sendMessage("You don't have any pieces open to save!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisObject extends MortarCommand {
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectWand wand;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectDust dust;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectPasteMatter mpaste;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectSaveMatter msave;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectXPY xpy;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectXAY xay;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectShift shift;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectExpand expand;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectContract contract;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectP1 p1;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectP2 p2;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectSave save;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectPaste paste;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectUndo undo;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisObjectAnalyze analyze;
|
|
||||||
|
|
||||||
public CommandIrisObject() {
|
|
||||||
super("object", "iob", "o", "obj");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Object Commands");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Iris Object Commands:");
|
|
||||||
printHelp(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisObjectAnalyze extends MortarCommand {
|
|
||||||
|
|
||||||
public CommandIrisObjectAnalyze() {
|
|
||||||
super("check", "c", "analyze");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Check an object's composition");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
if ((args.length == 0 || args.length == 1) && sender.isPlayer() && IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
IrisData data = IrisToolbelt.access(sender.player().getWorld()).getEngine().getData();
|
|
||||||
if (data == null) {
|
|
||||||
sender.sendMessage("Tab complete options only work for objects while in an Iris world.");
|
|
||||||
} else if (args.length == 0) {
|
|
||||||
list.add(data.getObjectLoader().getPossibleKeys());
|
|
||||||
} else {
|
|
||||||
list.add(data.getObjectLoader().getPossibleKeys(args[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[name]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Only players can spawn objects with this command");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("Please specify the name of of the object want to paste");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
J.a(() -> {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
|
||||||
import com.volmit.iris.util.math.Direction;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisObjectContract extends MortarCommand {
|
|
||||||
public CommandIrisObjectContract() {
|
|
||||||
super("-");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Contract a selection based on your looking direction");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
if (!WandSVC.isHoldingWand(p)) {
|
|
||||||
sender.sendMessage("Ready your Wand.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
|
||||||
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
|
||||||
cursor = cursor.expand(d, -amt);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
sender.playSound(Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[amt]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
|
|
||||||
public class CommandIrisObjectDust extends MortarCommand {
|
|
||||||
public CommandIrisObjectDust() {
|
|
||||||
super("dust", "dst", "d");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Get a powder that reveals placed objects");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have an inventory");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.player().getInventory().addItem(WandSVC.createDust());
|
|
||||||
sender.playSound(Sound.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS, 1f, 1.5f);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
|
||||||
import com.volmit.iris.util.math.Direction;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisObjectExpand extends MortarCommand {
|
|
||||||
public CommandIrisObjectExpand() {
|
|
||||||
super("+");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Expand based on looking direction");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
if (!WandSVC.isHoldingWand(p)) {
|
|
||||||
sender.sendMessage("Ready your Wand.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
|
||||||
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
|
||||||
cursor = cursor.expand(d, amt);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
sender.playSound(Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[amt]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class CommandIrisObjectP1 extends MortarCommand {
|
|
||||||
public CommandIrisObjectP1() {
|
|
||||||
super("p1");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Set point 1 to pos (or look)");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
if (!WandSVC.isHoldingWand(p)) {
|
|
||||||
sender.sendMessage("Ready your Wand.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
|
||||||
|
|
||||||
if (WandSVC.isWand(wand)) {
|
|
||||||
Location[] g = WandSVC.getCuboid(wand);
|
|
||||||
g[0] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
|
||||||
|
|
||||||
if (args.length == 1 && args[0].equals("-l")) {
|
|
||||||
// TODO: WARNING HEIGHT
|
|
||||||
g[0] = p.getTargetBlock(null, 256).getLocation().clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
p.setItemInHand(WandSVC.createWand(g[0], g[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[-l]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class CommandIrisObjectP2 extends MortarCommand {
|
|
||||||
public CommandIrisObjectP2() {
|
|
||||||
super("p2");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Set point 1 to pos (or look)");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
if (!WandSVC.isHoldingWand(p)) {
|
|
||||||
sender.sendMessage("Ready your Wand.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
|
||||||
|
|
||||||
if (WandSVC.isWand(wand)) {
|
|
||||||
Location[] g = WandSVC.getCuboid(wand);
|
|
||||||
g[1] = p.getLocation().getBlock().getLocation().clone().add(0, -1, 0);
|
|
||||||
|
|
||||||
if (args.length == 1 && args[0].equals("-l")) {
|
|
||||||
// TODO: WARNING HEIGHT
|
|
||||||
g[1] = p.getTargetBlock(null, 256).getLocation().clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
p.setItemInHand(WandSVC.createWand(g[0], g[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[-l]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,289 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.service.ObjectSVC;
|
|
||||||
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.engine.object.common.IObjectPlacer;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacement;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacementScaleInterpolator;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectRotation;
|
|
||||||
import com.volmit.iris.engine.object.tile.TileData;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.*;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.block.TileState;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class CommandIrisObjectPaste extends MortarCommand {
|
|
||||||
|
|
||||||
public CommandIrisObjectPaste() {
|
|
||||||
super("paste", "pasta", "place", "p");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Paste an object");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
if ((args.length == 0 || args.length == 1) && sender.isPlayer() && IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
IrisData data = IrisToolbelt.access(sender.player().getWorld()).getEngine().getData();
|
|
||||||
if (data == null) {
|
|
||||||
sender.sendMessage("Tab complete options only work for objects while in an Iris world.");
|
|
||||||
} else if (args.length == 0) {
|
|
||||||
list.add(data.getObjectLoader().getPossibleKeys());
|
|
||||||
} else {
|
|
||||||
list.add(data.getObjectLoader().getPossibleKeys(args[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Only players can spawn objects with this command");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("Please specify the name of of the object want to paste");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
IrisObject obj = IrisData.loadAnyObject(args[0]);
|
|
||||||
|
|
||||||
if (obj == null || obj.getLoadFile() == null) {
|
|
||||||
|
|
||||||
sender.sendMessage("Can't find " + args[0] + " in the " + StudioSVC.WORKSPACE_NAME + " folder");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean intoWand = false;
|
|
||||||
int rotate = 0;
|
|
||||||
double scale = 1;
|
|
||||||
IrisObjectPlacementScaleInterpolator interpolator = IrisObjectPlacementScaleInterpolator.NONE;
|
|
||||||
|
|
||||||
for (int i = 0; i < args.length; i++) {
|
|
||||||
String str = args[i];
|
|
||||||
if (str.equalsIgnoreCase("-edit") || str.equalsIgnoreCase("-e")) {
|
|
||||||
intoWand = true;
|
|
||||||
} else if (str.equalsIgnoreCase("-r") || str.equalsIgnoreCase("-rotate")) {
|
|
||||||
if (i + 1 >= args.length) {
|
|
||||||
sender.sendMessage("No rotation parameter provided! Usage is -rotate <degrees>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
rotate = Integer.parseInt(args[i + 1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
sender.sendMessage("\"" + args[i + 1] + "\" is not a number!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (str.equalsIgnoreCase("-s") || str.equalsIgnoreCase("-scale")) {
|
|
||||||
if (i + 1 >= args.length) {
|
|
||||||
sender.sendMessage("No scale parameter provided! Usage is -scale <size> [method=linear|cubic|hermite|none]");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
scale = Double.parseDouble(args[i + 1]);
|
|
||||||
|
|
||||||
int max = 10;
|
|
||||||
|
|
||||||
if (obj.getBlocks().size() > 30_000) {
|
|
||||||
max = 5;
|
|
||||||
}
|
|
||||||
if (obj.getBlocks().size() > 60_000) {
|
|
||||||
max = 3;
|
|
||||||
}
|
|
||||||
if (obj.getBlocks().size() > 90_000) {
|
|
||||||
max = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scale > max) {
|
|
||||||
sender.sendMessage("Due to size restrictions, the object will only be scaled to " + max + "x size");
|
|
||||||
scale = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i + 2 >= args.length) {
|
|
||||||
continue; //Dont parse the method and keep it at none
|
|
||||||
}
|
|
||||||
String intpol = args[i + 2];
|
|
||||||
if (intpol.toLowerCase().startsWith("method=")) intpol = intpol.split("=", 2)[1];
|
|
||||||
if (intpol.toLowerCase().startsWith("tri")) intpol = intpol.substring(3);
|
|
||||||
|
|
||||||
interpolator = IrisObjectPlacementScaleInterpolator.valueOf("TRI" + intpol.toUpperCase());
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
sender.sendMessage("\"" + args[i + 1] + "\" is not a decimal number!");
|
|
||||||
return true;
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
sender.sendMessage("\"" + args[i + 2] + "\" is not a valid interpolator method! Must be LINEAR, CUBIC, HERMITE or NONE!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (str.startsWith("-")) {
|
|
||||||
sender.sendMessage("Unknown flag \"" + args[i + 1] + "\" provided! Valid flags are -edit, -rotate and -scale");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisObjectPlacement placement = new IrisObjectPlacement();
|
|
||||||
if (rotate != 0) {
|
|
||||||
IrisObjectRotation rot = IrisObjectRotation.of(0, rotate, 0);
|
|
||||||
placement.setRotation(rot);
|
|
||||||
}
|
|
||||||
if (scale != 1) {
|
|
||||||
obj = obj.scaled(scale, interpolator);
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack wand = sender.player().getInventory().getItemInMainHand();
|
|
||||||
|
|
||||||
Iris.debug("Loaded object for placement: " + "objects/" + args[0] + ".iob");
|
|
||||||
|
|
||||||
sender.playSound(Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
|
|
||||||
|
|
||||||
Set<Material> skipBlocks = Set.of(Material.GRASS, Material.SNOW, Material.VINE, Material.TORCH, Material.DEAD_BUSH,
|
|
||||||
Material.POPPY, Material.DANDELION);
|
|
||||||
|
|
||||||
Location block = sender.player().getTargetBlock(skipBlocks, 256).getLocation().clone().add(0, 1, 0);
|
|
||||||
|
|
||||||
//WandManager.pasteSchematic(obj, block);
|
|
||||||
|
|
||||||
Map<Block, BlockData> futureChanges = new HashMap<>();
|
|
||||||
obj.place(block.getBlockX(), block.getBlockY() + (int) obj.getCenter().getY(), block.getBlockZ(), createPlacer(sender.player(), block.getWorld(), futureChanges), placement, new RNG(), null);
|
|
||||||
Iris.service(ObjectSVC.class).addChanges(futureChanges);
|
|
||||||
|
|
||||||
if (intoWand) {
|
|
||||||
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)));
|
|
||||||
if (WandSVC.isWand(wand)) {
|
|
||||||
wand = newWand;
|
|
||||||
p.getInventory().setItemInMainHand(wand);
|
|
||||||
sender.sendMessage("Updated wand for " + "objects/" + args[0] + ".iob");
|
|
||||||
} else {
|
|
||||||
int slot = WandSVC.findWand(sender.player().getInventory());
|
|
||||||
if (slot == -1) {
|
|
||||||
p.getInventory().addItem(newWand);
|
|
||||||
sender.sendMessage("Given new wand for " + "objects/" + args[0] + ".iob");
|
|
||||||
} else {
|
|
||||||
sender.player().getInventory().setItem(slot, newWand);
|
|
||||||
sender.sendMessage("Updated wand for " + "objects/" + args[0] + ".iob");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Placed " + "objects/" + args[0] + ".iob");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[name] [-edit] [-rotate [angle]] [-scale [num] [method]]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IObjectPlacer createPlacer(Player player, World world, Map<Block, BlockData> futureBlockChanges) {
|
|
||||||
|
|
||||||
return new IObjectPlacer() {
|
|
||||||
@Override
|
|
||||||
public int getHighest(int x, int z, IrisData data) {
|
|
||||||
return world.getHighestBlockYAt(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
|
|
||||||
return world.getHighestBlockYAt(x, z, ignoreFluid ? HeightMap.OCEAN_FLOOR : HeightMap.MOTION_BLOCKING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void set(int x, int y, int z, BlockData d) {
|
|
||||||
Block block = world.getBlockAt(x, y, z);
|
|
||||||
|
|
||||||
//Prevent blocks being set in or bellow bedrock
|
|
||||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK) return;
|
|
||||||
|
|
||||||
futureBlockChanges.put(block, block.getBlockData());
|
|
||||||
|
|
||||||
block.setBlockData(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockData get(int x, int y, int z) {
|
|
||||||
return world.getBlockAt(x, y, z).getBlockData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPreventingDecay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCarved(int x, int y, int z) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSolid(int x, int y, int z) {
|
|
||||||
return world.getBlockAt(x, y, z).getType().isSolid();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUnderwater(int x, int z) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getFluidHeight() {
|
|
||||||
return 63;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDebugSmartBore() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTile(int xx, int yy, int zz, TileData<? extends TileState> tile) {
|
|
||||||
BlockState state = world.getBlockAt(xx, yy, zz).getState();
|
|
||||||
tile.toBukkitTry(state);
|
|
||||||
state.update();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,169 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
|
||||||
import com.volmit.iris.engine.object.tile.TileData;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.matter.Matter;
|
|
||||||
import com.volmit.iris.util.matter.WorldMatter;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.HeightMap;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.block.TileState;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class CommandIrisObjectPasteMatter extends MortarCommand {
|
|
||||||
|
|
||||||
public CommandIrisObjectPasteMatter() {
|
|
||||||
super("mpaste");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Paste an object");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
if ((args.length == 0 || args.length == 1) && sender.isPlayer() && IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
IrisData data = IrisToolbelt.access(sender.player().getWorld()).getEngine().getData();
|
|
||||||
if (data == null) {
|
|
||||||
sender.sendMessage("Tab complete options only work for objects while in an Iris world.");
|
|
||||||
} else if (args.length == 0) {
|
|
||||||
list.add(data.getObjectLoader().getPossibleKeys());
|
|
||||||
} else {
|
|
||||||
list.add(data.getObjectLoader().getPossibleKeys(args[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Only players can spawn objects with this command");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("Please specify the name of of the object want to paste");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
File f = new File(args[0]);
|
|
||||||
try {
|
|
||||||
Matter matter = Matter.read(f);
|
|
||||||
WorldMatter.placeMatter(matter, p.getLocation());
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[name] [-edit] [-rotate [angle]] [-scale [num] [method]]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IObjectPlacer createPlacer(Player player, World world, Map<Block, BlockData> futureBlockChanges) {
|
|
||||||
|
|
||||||
return new IObjectPlacer() {
|
|
||||||
@Override
|
|
||||||
public int getHighest(int x, int z, IrisData data) {
|
|
||||||
return world.getHighestBlockYAt(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
|
|
||||||
return world.getHighestBlockYAt(x, z, ignoreFluid ? HeightMap.OCEAN_FLOOR : HeightMap.MOTION_BLOCKING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void set(int x, int y, int z, BlockData d) {
|
|
||||||
Block block = world.getBlockAt(x, y, z);
|
|
||||||
|
|
||||||
//Prevent blocks being set in or bellow bedrock
|
|
||||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK) return;
|
|
||||||
|
|
||||||
futureBlockChanges.put(block, block.getBlockData());
|
|
||||||
|
|
||||||
block.setBlockData(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockData get(int x, int y, int z) {
|
|
||||||
return world.getBlockAt(x, y, z).getBlockData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPreventingDecay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCarved(int x, int y, int z) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSolid(int x, int y, int z) {
|
|
||||||
return world.getBlockAt(x, y, z).getType().isSolid();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUnderwater(int x, int z) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getFluidHeight() {
|
|
||||||
return 63;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDebugSmartBore() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTile(int xx, int yy, int zz, TileData<? extends TileState> tile) {
|
|
||||||
BlockState state = world.getBlockAt(xx, yy, zz).getState();
|
|
||||||
tile.toBukkitTry(state);
|
|
||||||
state.update();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
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.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class CommandIrisObjectSave extends MortarCommand {
|
|
||||||
public CommandIrisObjectSave() {
|
|
||||||
super("save", "s");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Save an object");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length < 2) {
|
|
||||||
sender.sendMessage("/iris o save <project> <object>");
|
|
||||||
sender.sendMessage("I.e. /iris o save overworld some-tree/tree1");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
boolean overwrite = false;
|
|
||||||
|
|
||||||
for (String i : args) {
|
|
||||||
if (i.equals("-o")) {
|
|
||||||
overwrite = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
|
||||||
IrisObject o = WandSVC.createSchematic(wand);
|
|
||||||
File file = Iris.service(StudioSVC.class).getWorkspaceFile(args[0], "objects", args[1] + ".iob");
|
|
||||||
|
|
||||||
if (file.exists()) {
|
|
||||||
if (!overwrite) {
|
|
||||||
sender.sendMessage("File Exists. Overwrite by adding -o");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
o.write(file);
|
|
||||||
sender.sendMessage("Saved " + args[1]);
|
|
||||||
sender.playSound(Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("Failed to save " + args[1] + ". Are you holding your wand?");
|
|
||||||
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[project] [name]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
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.matter.Matter;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class CommandIrisObjectSaveMatter extends MortarCommand {
|
|
||||||
public CommandIrisObjectSaveMatter() {
|
|
||||||
super("msave");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Save an object");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length < 2) {
|
|
||||||
sender.sendMessage("/iris o save <project> <object>");
|
|
||||||
sender.sendMessage("I.e. /iris o save overworld some-tree/tree1");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
boolean overwrite = false;
|
|
||||||
|
|
||||||
for (String i : args) {
|
|
||||||
if (i.equals("-o")) {
|
|
||||||
overwrite = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
ItemStack wand = p.getInventory().getItemInMainHand();
|
|
||||||
Matter o = WandSVC.createMatterSchem(p, wand);
|
|
||||||
File file = Iris.service(StudioSVC.class).getWorkspaceFile(args[0], "objects", args[1] + ".iob");
|
|
||||||
|
|
||||||
if (file.exists()) {
|
|
||||||
if (!overwrite) {
|
|
||||||
sender.sendMessage("File Exists. Overwrite by adding -o");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
o.write(file);
|
|
||||||
sender.sendMessage("Saved " + args[1]);
|
|
||||||
sender.playSound(Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("Failed to save " + args[1] + ". Are you holding your wand?");
|
|
||||||
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[project] [name]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
|
||||||
import com.volmit.iris.util.math.Direction;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisObjectShift extends MortarCommand {
|
|
||||||
public CommandIrisObjectShift() {
|
|
||||||
super(">");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Shift selection based on direction");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
if (!WandSVC.isHoldingWand(p)) {
|
|
||||||
sender.sendMessage("Ready your Wand.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amt = args.length == 1 ? Integer.parseInt(args[0]) : 1;
|
|
||||||
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
|
||||||
a1.add(d.toVector().multiply(amt));
|
|
||||||
a2.add(d.toVector().multiply(amt));
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
sender.playSound(Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[amt]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.ObjectSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class CommandIrisObjectUndo extends MortarCommand {
|
|
||||||
|
|
||||||
|
|
||||||
public CommandIrisObjectUndo() {
|
|
||||||
super("undo", "u", "revert");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Undo an object paste ");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID player = null;
|
|
||||||
int amount = 1;
|
|
||||||
|
|
||||||
for (int i = 0; i < args.length; i++) {
|
|
||||||
String str = args[i];
|
|
||||||
if (str.equalsIgnoreCase("-u") || str.equalsIgnoreCase("-user")
|
|
||||||
|| str.equalsIgnoreCase("-p") || str.equalsIgnoreCase("-player")) {
|
|
||||||
if (i + 1 >= args.length) {
|
|
||||||
sender.sendMessage("No user parameter provided! Usage is -user <player>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
OfflinePlayer p = Bukkit.getOfflinePlayer(args[i + 1]);
|
|
||||||
if (!p.hasPlayedBefore()) {
|
|
||||||
sender.sendMessage("\"" + args[i + 1] + "\" is not a player that has played before!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
player = p.getUniqueId();
|
|
||||||
} else if (str.equalsIgnoreCase("-n") || str.equalsIgnoreCase("-number")) {
|
|
||||||
if (i + 1 >= args.length) {
|
|
||||||
sender.sendMessage("No number parameter provided! Usage is -number <amount>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
amount = Integer.parseInt(args[i + 1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
sender.sendMessage("\"" + args[i + 1] + "\" is not a number!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (str.startsWith("-")) {
|
|
||||||
sender.sendMessage("Unknown flag \"" + args[i + 1] + "\" provided! Valid flags are -number and -user");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer() && player == null) {
|
|
||||||
sender.sendMessage("Please specify a player to revert!");
|
|
||||||
return true;
|
|
||||||
} else if (sender.isPlayer()) {
|
|
||||||
player = sender.player().getUniqueId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amount < 0) {
|
|
||||||
sender.sendMessage("Please specify an amount greater than 0!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
ObjectSVC service = Iris.service(ObjectSVC.class);
|
|
||||||
if (service.getUndos().size() == 0) {
|
|
||||||
sender.sendMessage("No pastes to undo");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int actualReverts = Math.min(service.getUndos().size(), amount);
|
|
||||||
service.revertChanges(actualReverts);
|
|
||||||
sender.sendMessage("Reverted " + actualReverts + " pastes!");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[-number [num]] [-user [username]]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
|
|
||||||
public class CommandIrisObjectWand extends MortarCommand {
|
|
||||||
public CommandIrisObjectWand() {
|
|
||||||
super("wand", "w");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Get an Iris Wand for selecting objects");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have an inventory");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.player().getInventory().addItem(WandSVC.createWand());
|
|
||||||
sender.playSound(Sound.ITEM_ARMOR_EQUIP_NETHERITE, 1f, 1.5f);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,113 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
|
||||||
import com.volmit.iris.util.data.Cuboid.CuboidDirection;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
public class CommandIrisObjectXAY extends MortarCommand {
|
|
||||||
public CommandIrisObjectXAY() {
|
|
||||||
super("x&y");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Auto select up, down and out");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
if (!WandSVC.isHoldingWand(p)) {
|
|
||||||
sender.sendMessage("Ready your Wand.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Location a1x = b[0].clone();
|
|
||||||
Location a2x = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
Cuboid cursorx = new Cuboid(a1, a2);
|
|
||||||
|
|
||||||
while (!cursor.containsOnly(Material.AIR)) {
|
|
||||||
a1.add(new Vector(0, 1, 0));
|
|
||||||
a2.add(new Vector(0, 1, 0));
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1.add(new Vector(0, -1, 0));
|
|
||||||
a2.add(new Vector(0, -1, 0));
|
|
||||||
|
|
||||||
while (!cursorx.containsOnly(Material.AIR)) {
|
|
||||||
a1x.add(new Vector(0, -1, 0));
|
|
||||||
a2x.add(new Vector(0, -1, 0));
|
|
||||||
cursorx = new Cuboid(a1x, a2x);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1x.add(new Vector(0, 1, 0));
|
|
||||||
a2x.add(new Vector(0, 1, 0));
|
|
||||||
b[0] = a1;
|
|
||||||
b[1] = a2x;
|
|
||||||
cursor = new Cuboid(b[0], b[1]);
|
|
||||||
cursor = cursor.contract(CuboidDirection.North);
|
|
||||||
cursor = cursor.contract(CuboidDirection.South);
|
|
||||||
cursor = cursor.contract(CuboidDirection.East);
|
|
||||||
cursor = cursor.contract(CuboidDirection.West);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
sender.playSound(Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.object;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
|
||||||
import com.volmit.iris.util.data.Cuboid.CuboidDirection;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
public class CommandIrisObjectXPY extends MortarCommand {
|
|
||||||
public CommandIrisObjectXPY() {
|
|
||||||
super("x+y");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Object");
|
|
||||||
setDescription("Auto select up and out");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("You don't have a wand");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
if (!WandSVC.isHoldingWand(p)) {
|
|
||||||
sender.sendMessage("Ready your Wand.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Location[] b = WandSVC.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
b[0].add(new Vector(0, 1, 0));
|
|
||||||
b[1].add(new Vector(0, 1, 0));
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
|
|
||||||
while (!cursor.containsOnly(Material.AIR)) {
|
|
||||||
a1.add(new Vector(0, 1, 0));
|
|
||||||
a2.add(new Vector(0, 1, 0));
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1.add(new Vector(0, -1, 0));
|
|
||||||
a2.add(new Vector(0, -1, 0));
|
|
||||||
b[0] = a1;
|
|
||||||
a2 = b[1];
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
cursor = cursor.contract(CuboidDirection.North);
|
|
||||||
cursor = cursor.contract(CuboidDirection.South);
|
|
||||||
cursor = cursor.contract(CuboidDirection.East);
|
|
||||||
cursor = cursor.contract(CuboidDirection.West);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
sender.playSound(Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.pregen;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisPregen extends MortarCommand {
|
|
||||||
@Command
|
|
||||||
private CommandIrisPregenStart start;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisPregenStop stop;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisPregenPause toggle;
|
|
||||||
|
|
||||||
public CommandIrisPregen() {
|
|
||||||
super("pregen", "preg", "p");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Pregen");
|
|
||||||
setDescription("Pregeneration Commands");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
if (!IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
sender.sendMessage("Pregen only works in Iris worlds!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Note that pregeneration only works in Iris worlds!");
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Iris Pregen Commands:");
|
|
||||||
printHelp(sender);
|
|
||||||
sender.sendMessage("Pregen wiki page: https://docs.volmit.com/iris/pregeneration");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.pregen;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisPregenPause extends MortarCommand {
|
|
||||||
|
|
||||||
public CommandIrisPregenPause() {
|
|
||||||
super("pause", "toggle", "t", "continue", "resume", "p", "c", "unpause", "up");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Pregen");
|
|
||||||
setDescription("Toggle an ongoing pregeneration task");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (PregeneratorJob.pauseResume()) {
|
|
||||||
sender.sendMessage("Paused/unpaused pregeneration task, now: " + (PregeneratorJob.isPaused() ? "Paused" : "Running") + ".");
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("No active pregeneration tasks to pause/unpause.");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,324 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.pregen;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.math.Position2;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
|
|
||||||
public class CommandIrisPregenStart extends MortarCommand {
|
|
||||||
|
|
||||||
private static final KList<String> argus = new KList<>("radius=", "x=", "z=");
|
|
||||||
|
|
||||||
public CommandIrisPregenStart() {
|
|
||||||
super("start", "create", "c", "new", "+");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Pregen");
|
|
||||||
setDescription("Create a new pregeneration task.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add arguments
|
|
||||||
argus.forEach(p -> {
|
|
||||||
boolean hasArg = false;
|
|
||||||
for (String arg : args) {
|
|
||||||
if (!arg.contains("=") || !p.contains("=") || arg.equals("=")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg.split("=")[0].equals(p.split("=")[0])) {
|
|
||||||
hasArg = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!hasArg) {
|
|
||||||
list.add(p);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add -here
|
|
||||||
boolean hasHere = false;
|
|
||||||
for (String arg : args) {
|
|
||||||
if (arg.equals("-here")) {
|
|
||||||
hasHere = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!hasHere) {
|
|
||||||
list.add("-here");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Iris worlds
|
|
||||||
if (Bukkit.getWorlds().isEmpty()) {
|
|
||||||
list.add("world=<name>");
|
|
||||||
} else {
|
|
||||||
Bukkit.getWorlds().forEach(w -> {
|
|
||||||
if (IrisToolbelt.isIrisWorld(w)) {
|
|
||||||
list.add("world=" + w.getName());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<radius> [x=<centerX>] [z=<centerZ>] [world=<world>] [-here]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage(getHelp());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PregeneratorJob.getInstance() != null) {
|
|
||||||
sender.sendMessage("Pregeneration task already ongoing. You can stop it with /ir p stop.");
|
|
||||||
sender.sendMessage("Cannot create new pregen while one is already going. Cancelling...");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
World world = null;
|
|
||||||
int width = -1;
|
|
||||||
int height = -1;
|
|
||||||
int x = 0;
|
|
||||||
int z = 0;
|
|
||||||
boolean here = false;
|
|
||||||
|
|
||||||
// Check all arguments
|
|
||||||
KList<String> failed = new KList<>();
|
|
||||||
for (String a : args) {
|
|
||||||
if (a.equals("-here")) {
|
|
||||||
here = true;
|
|
||||||
} else if (a.contains("=")) {
|
|
||||||
String pre = a.split("=")[0];
|
|
||||||
String val = a.split("=")[1];
|
|
||||||
if (pre.equals("world")) {
|
|
||||||
world = Bukkit.getWorld(val);
|
|
||||||
if (world == null) {
|
|
||||||
failed.add(a + " (invalid world)");
|
|
||||||
sender.sendMessage("Entered world is " + val + ", but that world does not exist.");
|
|
||||||
sender.sendMessage("Cancelling the command.");
|
|
||||||
sender.sendMessage(getHelp());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (!isVal(val)) {
|
|
||||||
failed.add(a + " (non-value)");
|
|
||||||
} else {
|
|
||||||
switch (pre) {
|
|
||||||
case "width" -> width = getVal(val);
|
|
||||||
case "height" -> height = getVal(val);
|
|
||||||
case "radius" -> {
|
|
||||||
width = getVal(val);
|
|
||||||
height = getVal(val);
|
|
||||||
}
|
|
||||||
case "x" -> x = getVal(val);
|
|
||||||
case "z" -> z = getVal(val);
|
|
||||||
default -> failed.add(a + " (no type)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (isVal(a)) {
|
|
||||||
width = getVal(a);
|
|
||||||
height = getVal(a);
|
|
||||||
} else {
|
|
||||||
failed.add(a + " (nothing)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checking if a radius was specified or forgotten
|
|
||||||
if (width == -1 || height == -1) {
|
|
||||||
sender.sendMessage("Radius not specified! Cancelling...");
|
|
||||||
sender.sendMessage(getHelp());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// World specified & cancelling `-here` if it's another world
|
|
||||||
if (world == null) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
world = sender.player().getWorld();
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Must specify world=<name> if sending from console! Cancelling...");
|
|
||||||
sender.sendMessage(getHelp());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (sender.isPlayer() && !world.equals(sender.player().getWorld()) && here) {
|
|
||||||
sender.sendMessage("Ignoring `-here` because `world=` is specified!");
|
|
||||||
here = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checking if -here is used
|
|
||||||
if (here) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
x = sender.player().getLocation().getBlockX();
|
|
||||||
z = sender.player().getLocation().getBlockZ();
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Specifying -here does not work from console!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build details print
|
|
||||||
StringBuilder details = new StringBuilder("Pregeneration details:")
|
|
||||||
.append("\n")
|
|
||||||
.append(" - World > ")
|
|
||||||
.append(world.getName())
|
|
||||||
.append("\n")
|
|
||||||
.append(" - Radius > ")
|
|
||||||
.append(width)
|
|
||||||
.append("(")
|
|
||||||
.append(width * 2)
|
|
||||||
.append(" by ")
|
|
||||||
.append(height * 2)
|
|
||||||
.append(")\n")
|
|
||||||
.append(" - Center x,z > ")
|
|
||||||
.append(x)
|
|
||||||
.append(",")
|
|
||||||
.append(z)
|
|
||||||
.append("\n")
|
|
||||||
|
|
||||||
// Append failed args
|
|
||||||
.append(failed.isEmpty() ? "(No failed arguments)\n" : "FAILED ARGS:\n");
|
|
||||||
for (String s : failed) {
|
|
||||||
details.append(s).append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start pregen and append info to details
|
|
||||||
if (pregenerate(world, width, height, x, z)) {
|
|
||||||
details.append("Successfully started pregen.");
|
|
||||||
} else {
|
|
||||||
details.append("Failed to start pregen. Doublecheck your arguments!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send details
|
|
||||||
sender.sendMessage(details.toString());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pregenerate a
|
|
||||||
*
|
|
||||||
* @param world world with a
|
|
||||||
* @param width and
|
|
||||||
* @param height with center
|
|
||||||
* @param x and
|
|
||||||
* @param z coords
|
|
||||||
* @return true if successful
|
|
||||||
*/
|
|
||||||
private boolean pregenerate(World world, int width, int height, int x, int z) {
|
|
||||||
try {
|
|
||||||
IrisToolbelt.pregenerate(PregenTask
|
|
||||||
.builder()
|
|
||||||
.center(new Position2(x, z))
|
|
||||||
.width((width >> 9 + 1) * 2)
|
|
||||||
.height((height >> 9 + 1) * 2)
|
|
||||||
.build(), world);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the ingeger value from an argument that may contain `c` `chunks` `r` `regions` or `k`<br>
|
|
||||||
* "5r" returns 5 * 512 = 2560
|
|
||||||
*
|
|
||||||
* @param arg the string argument to parse into a value
|
|
||||||
* @return the integer value result
|
|
||||||
*/
|
|
||||||
private int getVal(String arg) {
|
|
||||||
|
|
||||||
if (arg.toLowerCase().endsWith("c") || arg.toLowerCase().endsWith("chunks")) {
|
|
||||||
return Integer.parseInt(arg.toLowerCase().replaceAll("\\Qc\\E", "").replaceAll("\\Qchunks\\E", "")) * 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arg.toLowerCase().endsWith("r") || arg.toLowerCase().endsWith("regions")) {
|
|
||||||
return Integer.parseInt(arg.toLowerCase().replaceAll("\\Qr\\E", "").replaceAll("\\Qregions\\E", "")) * 512;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arg.toLowerCase().endsWith("k")) {
|
|
||||||
return Integer.parseInt(arg.toLowerCase().replaceAll("\\Qk\\E", "")) * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Integer.parseInt(arg.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the
|
|
||||||
*
|
|
||||||
* @param arg string value
|
|
||||||
* @return is valid -> true
|
|
||||||
*/
|
|
||||||
private boolean isVal(String arg) {
|
|
||||||
try {
|
|
||||||
Integer.parseInt(
|
|
||||||
arg.toLowerCase()
|
|
||||||
.replace("chunks", "")
|
|
||||||
.replace("c", "")
|
|
||||||
.replace("regions", "")
|
|
||||||
.replace("r", "")
|
|
||||||
.replace("k", "")
|
|
||||||
);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get command help
|
|
||||||
*
|
|
||||||
* @return help string
|
|
||||||
*/
|
|
||||||
private String getHelp() {
|
|
||||||
return """
|
|
||||||
Create a new pregeneration task.
|
|
||||||
Command usage:
|
|
||||||
/iris pregen create [radius=<radius>] [x=<centerX>] [z=<centerZ>] [world=<world>] [-here]
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
/iris pregen start 5k -here
|
|
||||||
/iris pregen start radius=5000 x=10r z=10r world=IrisWorld
|
|
||||||
/iris pregen start 10k world=WorldName
|
|
||||||
|
|
||||||
<radius>: Sets both width and height to a value
|
|
||||||
<x> & <z>: Give the center point of the pregen
|
|
||||||
-here: Sets the center x and z to the current location
|
|
||||||
<world>: Specify a world name for generation
|
|
||||||
|
|
||||||
In radius, x and z multiply the value by c => 16, r => 512, k => 1000
|
|
||||||
Example: entering '1000' is the same as '1k' (1 * 1000)
|
|
||||||
Make sure to check https://docs.volmit.com/iris/pregeneration for guidance""";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.pregen;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisPregenStop extends MortarCommand {
|
|
||||||
|
|
||||||
public CommandIrisPregenStop() {
|
|
||||||
super("stop", "s", "x", "close");
|
|
||||||
requiresPermission(Iris.perm);
|
|
||||||
setCategory("Pregen");
|
|
||||||
setDescription("Stop an ongoing pregeneration task");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (PregeneratorJob.shutdownInstance()) {
|
|
||||||
sender.sendMessage("Stopped pregeneration task");
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("No active pregeneration tasks to stop");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,113 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisStudio extends MortarCommand {
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioCreate create;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioExecute execute;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioCompile compile;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioOpen open;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioSummon summon;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioClose close;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioPackage pkg;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioUpdate update;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioGoto got0;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioEditBiome ebiome;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioHotload hotload;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioExplorer exp;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioBeautify beautify;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioProfile profile;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioExplorerGenerator generator;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioLoot loot;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioTPStudio tps;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioConvert convert;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioMap map;
|
|
||||||
|
|
||||||
public CommandIrisStudio() {
|
|
||||||
super("studio", "std", "s");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Iris Studio Commands:");
|
|
||||||
printHelp(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
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.format.Form;
|
|
||||||
import com.volmit.iris.util.io.IO;
|
|
||||||
import com.volmit.iris.util.json.JSONArray;
|
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class CommandIrisStudioBeautify extends MortarCommand {
|
|
||||||
public CommandIrisStudioBeautify() {
|
|
||||||
super("beautify", "prettify");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Prettify the project by cleaning up json.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
File clean = null;
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
|
||||||
sender.sendMessage("No open project. Either use /iris std beautify <project> or have a project open.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
clean = Iris.service(StudioSVC.class).getActiveProject().getPath();
|
|
||||||
} else {
|
|
||||||
clean = Iris.instance.getDataFolder("packs", args[0]);
|
|
||||||
|
|
||||||
if (!clean.exists()) {
|
|
||||||
sender.sendMessage("Not a valid project.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Cleaned " + Form.f(clean(sender, clean)) + " JSON Files");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int clean(VolmitSender s, File clean) {
|
|
||||||
int c = 0;
|
|
||||||
if (clean.isDirectory()) {
|
|
||||||
for (File i : clean.listFiles()) {
|
|
||||||
c += clean(s, i);
|
|
||||||
}
|
|
||||||
} else if (clean.getName().endsWith(".json")) {
|
|
||||||
try {
|
|
||||||
clean(clean);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
Iris.error("Failed to beautify " + clean.getAbsolutePath() + " You may have errors in your json!");
|
|
||||||
}
|
|
||||||
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clean(File clean) throws IOException {
|
|
||||||
JSONObject obj = new JSONObject(IO.readAll(clean));
|
|
||||||
fixBlocks(obj, clean);
|
|
||||||
|
|
||||||
IO.writeAll(clean, obj.toString(4));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fixBlocks(JSONObject obj, File f) {
|
|
||||||
for (String i : obj.keySet()) {
|
|
||||||
Object o = obj.get(i);
|
|
||||||
|
|
||||||
if (i.equals("block") && o instanceof String && !o.toString().trim().isEmpty() && !o.toString().contains(":")) {
|
|
||||||
obj.put(i, "minecraft:" + o);
|
|
||||||
Iris.debug("Updated Block Key: " + o + " to " + obj.getString(i) + " in " + f.getPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o instanceof JSONObject) {
|
|
||||||
fixBlocks((JSONObject) o, f);
|
|
||||||
} else if (o instanceof JSONArray) {
|
|
||||||
fixBlocks((JSONArray) o, f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fixBlocks(JSONArray obj, File f) {
|
|
||||||
for (int i = 0; i < obj.length(); i++) {
|
|
||||||
Object o = obj.get(i);
|
|
||||||
|
|
||||||
if (o instanceof JSONObject) {
|
|
||||||
fixBlocks((JSONObject) o, f);
|
|
||||||
} else if (o instanceof JSONArray) {
|
|
||||||
fixBlocks((JSONArray) o, f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[project]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
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.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisStudioClose extends MortarCommand {
|
|
||||||
public CommandIrisStudioClose() {
|
|
||||||
super("close", "x");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Close the existing dimension");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
|
||||||
sender.sendMessage("No open projects.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
World f = null;
|
|
||||||
|
|
||||||
for (World i : Bukkit.getWorlds()) {
|
|
||||||
if (i.getWorldFolder().getAbsolutePath().equals(Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().worldFolder().getAbsolutePath())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
f = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f == null) {
|
|
||||||
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!");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (Player i : Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().getPlayers()) {
|
|
||||||
i.teleport(f.getSpawnLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.service(StudioSVC.class).close();
|
|
||||||
sender.sendMessage("Projects Closed & Caches Cleared!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisStudioCompile extends MortarCommand {
|
|
||||||
public CommandIrisStudioCompile() {
|
|
||||||
super("compile");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Compiles a pack for speed");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage(getArgsUsage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisProject project = new IrisProject(Iris.instance.getDataFolder(StudioSVC.WORKSPACE_NAME, args[0]));
|
|
||||||
project.compile(sender);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[project]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
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.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisStudioConvert extends MortarCommand {
|
|
||||||
public CommandIrisStudioConvert() {
|
|
||||||
super("convert", "cvt");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Convert .ewg schematics into Iris (.iob) files");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.service(ConversionSVC.class).check(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
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.format.C;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisStudioCreate extends MortarCommand {
|
|
||||||
public CommandIrisStudioCreate() {
|
|
||||||
super("create", "new", "+");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Create a new project & open it.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length < 1) {
|
|
||||||
sender.sendMessage("Please use a lowercase name with hyphens (-) for spaces.");
|
|
||||||
sender.sendMessage("I.e. /iris std new " + C.BOLD + "aether");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String template = null;
|
|
||||||
|
|
||||||
for (String i : args) {
|
|
||||||
if (i.startsWith("template=")) {
|
|
||||||
template = i.split("\\Q=\\E")[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (template != null) {
|
|
||||||
Iris.service(StudioSVC.class).create(sender, args[0], template);
|
|
||||||
} else {
|
|
||||||
Iris.service(StudioSVC.class).create(sender, args[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[dimension] [template=<project>]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
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.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class CommandIrisStudioEditBiome extends MortarCommand {
|
|
||||||
public CommandIrisStudioEditBiome() {
|
|
||||||
super("editbiome", "ebiome", "eb");
|
|
||||||
setDescription("Open this biome file in vscode");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
|
||||||
sender.sendMessage("There is not a studio currently loaded.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
try {
|
|
||||||
File f = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getEngine().getBiome(p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ()).getLoadFile();
|
|
||||||
Desktop.getDesktop().open(f);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("Cant find the file. Are you in an Iris Studio world?");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[width]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisStudioExecute extends MortarCommand {
|
|
||||||
public CommandIrisStudioExecute() {
|
|
||||||
super("execute", "ex", "exec");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Execute a script");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
if ((args.length == 0 || args.length == 1) && sender.isPlayer() && IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
IrisData data = IrisToolbelt.access(sender.player().getWorld()).getEngine().getData();
|
|
||||||
if (data == null) {
|
|
||||||
sender.sendMessage("Tab complete options only work for summons while in an Iris world.");
|
|
||||||
} else if (args.length == 0) {
|
|
||||||
list.add(data.getScriptLoader().getPossibleKeys());
|
|
||||||
} else {
|
|
||||||
list.add(data.getScriptLoader().getPossibleKeys(args[0]));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("You must be in an Iris world as a player to run scripts!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("null")
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer() || !IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
sender.sendMessage("To execute scripts you must be in an Iris world as a player");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("You need to specify a script name (use auto-completions to see which are available)");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.info("Executing script: " + args[0] + ". See script output in console.");
|
|
||||||
|
|
||||||
try {
|
|
||||||
IrisToolbelt.access(sender.player().getWorld()).getEngine().getExecution().execute(args[0]);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("Failed to execute script " + args[0] + "!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisStudioExplorer extends MortarCommand {
|
|
||||||
@Command
|
|
||||||
private CommandIrisStudioExplorerGenerator generator;
|
|
||||||
|
|
||||||
public CommandIrisStudioExplorer() {
|
|
||||||
super("noise", "nmap");
|
|
||||||
setDescription("Explore different noise generators visually");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("World");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (args.length != 0) {
|
|
||||||
printHelp(sender);
|
|
||||||
} else {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IrisSettings.get().isUseServerLaunchedGuis()) {
|
|
||||||
sender.sendMessage("To use Iris Guis, please enable serverLaunchedGuis in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NoiseExplorerGUI.launch();
|
|
||||||
sender.sendMessage("Opening Noise Explorer!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.object.noise.IrisGenerator;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.function.Function2;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
public class CommandIrisStudioExplorerGenerator extends MortarCommand {
|
|
||||||
public CommandIrisStudioExplorerGenerator() {
|
|
||||||
super("generator", "gen");
|
|
||||||
setDescription("Preview created noise noises generators");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("World");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
if ((args.length == 0 || args.length == 1) && sender.isPlayer() && IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
IrisData data = IrisToolbelt.access(sender.player().getWorld()).getData();
|
|
||||||
if (data == null) {
|
|
||||||
sender.sendMessage("Issue when loading tab completions. No data found (?)");
|
|
||||||
} else if (args.length == 0) {
|
|
||||||
list.add(data.getGeneratorLoader().getPossibleKeys());
|
|
||||||
} else if (args.length == 1) {
|
|
||||||
list.add(data.getGeneratorLoader().getPossibleKeys(args[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IrisSettings.get().isUseServerLaunchedGuis()) {
|
|
||||||
sender.sendMessage("To use Iris Guis, please enable serverLaunchedGuis in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("Specify a generator to preview");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Supplier<Function2<Double, Double, Double>> l = () -> {
|
|
||||||
long seed = 12345;
|
|
||||||
IrisGenerator generator;
|
|
||||||
if (Iris.service(StudioSVC.class).isProjectOpen()) {
|
|
||||||
generator = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getData().getGeneratorLoader().load(args[0]);
|
|
||||||
seed = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().seed();
|
|
||||||
} else {
|
|
||||||
generator = IrisData.loadAnyGenerator(args[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (generator == null) {
|
|
||||||
return (x, z) -> 0D;
|
|
||||||
}
|
|
||||||
|
|
||||||
long finalSeed = seed;
|
|
||||||
return (x, z) -> generator.getHeight(x, z, new RNG(finalSeed).nextParallelRNG(3245).lmax());
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
NoiseExplorerGUI.launch(l, "Custom Generator");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[generator]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,160 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.object.basic.IrisPosition;
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
|
||||||
import com.volmit.iris.engine.object.jigsaw.IrisJigsawStructure;
|
|
||||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CommandIrisStudioGoto extends MortarCommand {
|
|
||||||
public CommandIrisStudioGoto() {
|
|
||||||
super("goto", "find", "g");
|
|
||||||
setDescription("Find any region or biome");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("World");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
if ((args.length == 0 || args.length == 1) && sender.isPlayer() && IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
IrisData data = IrisToolbelt.access(sender.player().getWorld()).getEngine().getData();
|
|
||||||
if (data == null) {
|
|
||||||
sender.sendMessage("Issue when loading tab completions. No data found (?)");
|
|
||||||
} else if (args.length == 0) {
|
|
||||||
list.add(data.getBiomeLoader().getPossibleKeys());
|
|
||||||
list.add(data.getRegionLoader().getPossibleKeys());
|
|
||||||
} else if (args.length == 1) {
|
|
||||||
list.add(data.getBiomeLoader().getPossibleKeys(args[0]));
|
|
||||||
list.add(data.getRegionLoader().getPossibleKeys(args[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
try {
|
|
||||||
if (args.length < 1) {
|
|
||||||
sender.sendMessage("/iris std goto " + getArgsUsage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
Player p = sender.player();
|
|
||||||
World world = p.getWorld();
|
|
||||||
|
|
||||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
|
||||||
sender.sendMessage("You must be in an iris world.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine g = IrisToolbelt.access(world).getEngine();
|
|
||||||
IrisBiome b = IrisData.loadAnyBiome(args[0]);
|
|
||||||
IrisRegion r = IrisData.loadAnyRegion(args[0]);
|
|
||||||
IrisJigsawStructure s = IrisData.loadAnyJigsawStructure(args[0]);
|
|
||||||
|
|
||||||
if (b != null) {
|
|
||||||
J.a(() -> {
|
|
||||||
IrisPosition l = g.lookForBiome(b, 10000, (v) -> sender.sendMessage("Looking for " + C.BOLD + C.WHITE + b.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places"));
|
|
||||||
|
|
||||||
if (l == null) {
|
|
||||||
sender.sendMessage("Couldn't find " + b.getName() + ".");
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Found " + b.getName() + "!");
|
|
||||||
J.s(() -> sender.player().teleport(l.toLocation(world)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (r != null) {
|
|
||||||
J.a(() -> {
|
|
||||||
IrisPosition l = g.lookForRegion(r, 60000, (v) -> sender.sendMessage(C.BOLD + "" + C.WHITE + r.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places"));
|
|
||||||
|
|
||||||
if (l == null) {
|
|
||||||
sender.sendMessage("Couldn't find " + r.getName() + ".");
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Found " + r.getName() + "!");
|
|
||||||
J.s(() -> sender.player().teleport(l.toLocation(world)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (s != null) {
|
|
||||||
J.a(() -> {
|
|
||||||
IrisPosition l = g.lookForRegion(r, 60000, (v) -> sender.sendMessage(C.BOLD + "" + C.WHITE + r.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places"));
|
|
||||||
|
|
||||||
if (l == null) {
|
|
||||||
sender.sendMessage("Couldn't find " + r.getName() + ".");
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Found " + r.getName() + "!");
|
|
||||||
J.s(() -> sender.player().teleport(l.toLocation(world)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(args[0] + " is not a biome or region in this dimension. (Biome teleportation works best!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
Iris.error("Failed goto!");
|
|
||||||
e.printStackTrace();
|
|
||||||
sender.sendMessage("We cant seem to aquire a lock on the biome cache. Please report the error in the console to our github. Thanks!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[biome/region]";
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<File> listf(String directoryName) {
|
|
||||||
File directory = new File(directoryName);
|
|
||||||
List<File> files = new ArrayList<>();
|
|
||||||
|
|
||||||
// Get all files from a directory.
|
|
||||||
File[] fList = directory.listFiles();
|
|
||||||
if (fList != null)
|
|
||||||
for (File file : fList) {
|
|
||||||
if (file.isFile()) {
|
|
||||||
files.add(file);
|
|
||||||
} else if (file.isDirectory()) {
|
|
||||||
files.addAll(listf(file.getAbsolutePath()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisStudioHotload extends MortarCommand {
|
|
||||||
public CommandIrisStudioHotload() {
|
|
||||||
super("hotload", "hot", "h", "reload");
|
|
||||||
setDescription("Force a hotload");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("World");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = sender.player();
|
|
||||||
World world = p.getWorld();
|
|
||||||
|
|
||||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
|
||||||
sender.sendMessage("You must be in an iris world.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlatformChunkGenerator worldAccess = IrisToolbelt.access(world);
|
|
||||||
if (worldAccess == null) {
|
|
||||||
sender.sendMessage("Could not gain access to the world you are in");
|
|
||||||
} else {
|
|
||||||
worldAccess.hotload();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.object.loot.IrisLootTable;
|
|
||||||
import com.volmit.iris.engine.object.meta.InventorySlotType;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.O;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
|
|
||||||
public class CommandIrisStudioLoot extends MortarCommand {
|
|
||||||
public CommandIrisStudioLoot() {
|
|
||||||
super("loot");
|
|
||||||
setDescription("Show loot if a chest were right here");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Loot");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
Player p = sender.player();
|
|
||||||
Engine prov = IrisToolbelt.access(sender.player().getWorld()).getEngine();
|
|
||||||
|
|
||||||
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
|
||||||
sender.sendMessage("You can only use /iris studio loot in a studio world of iris.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
KList<IrisLootTable> tables = prov.getLootTables(RNG.r, p.getLocation().getBlock());
|
|
||||||
Inventory inv = Bukkit.createInventory(null, 27 * 2);
|
|
||||||
|
|
||||||
try {
|
|
||||||
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) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("You can only use /iris loot in a studio world of iris.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.openInventory(inv);
|
|
||||||
|
|
||||||
for (IrisLootTable i : tables) {
|
|
||||||
sender.sendMessage("- " + i.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean ffast = false;
|
|
||||||
boolean fadd = false;
|
|
||||||
|
|
||||||
for (String i : args) {
|
|
||||||
if (i.equals("--fast")) {
|
|
||||||
ffast = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i.equals("--add")) {
|
|
||||||
fadd = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean fast = ffast;
|
|
||||||
boolean add = fadd;
|
|
||||||
O<Integer> ta = new O<>();
|
|
||||||
ta.set(-1);
|
|
||||||
|
|
||||||
ta.set(Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, () ->
|
|
||||||
{
|
|
||||||
if (!p.getOpenInventory().getType().equals(InventoryType.CHEST)) {
|
|
||||||
Bukkit.getScheduler().cancelTask(ta.get());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!add) {
|
|
||||||
inv.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[width]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
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.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisStudioMap extends MortarCommand {
|
|
||||||
public CommandIrisStudioMap() {
|
|
||||||
super("map", "render");
|
|
||||||
setDescription("Render a map (gui outside of mc)");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("World");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IrisSettings.get().isUseServerLaunchedGuis()) {
|
|
||||||
sender.sendMessage("To use Iris Guis, please enable serverLaunchedGuis in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine fe;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Engine g = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getEngine();
|
|
||||||
VisionGUI.launch(g, 0);
|
|
||||||
sender.sendMessage("Opening Map!");
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
Engine g = IrisToolbelt.access(sender.player().getWorld()).getEngine();
|
|
||||||
VisionGUI.launch(g, 0);
|
|
||||||
sender.sendMessage("Opening Map!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[pack] [seed=1337]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
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.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisStudioOpen extends MortarCommand {
|
|
||||||
public CommandIrisStudioOpen() {
|
|
||||||
super("open", "o");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Create a new temporary world to design a dimension.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length < 1) {
|
|
||||||
sender.sendMessage("/iris std open <DIMENSION> (file name without .json)");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Opening studio world...");
|
|
||||||
Iris.service(StudioSVC.class).open(sender, args[0]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[dimension]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
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.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
|
|
||||||
public class CommandIrisStudioPackage extends MortarCommand {
|
|
||||||
public CommandIrisStudioPackage() {
|
|
||||||
super("package", "pkg");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Package your dimension into a compressed format.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("/iris std package <DIMENSION> [-o] [-m]");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
J.a(() ->
|
|
||||||
{
|
|
||||||
boolean o = false;
|
|
||||||
boolean m = true;
|
|
||||||
|
|
||||||
for (String i : args) {
|
|
||||||
if (i.equalsIgnoreCase("-o")) {
|
|
||||||
o = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String dim = args[0];
|
|
||||||
Iris.service(StudioSVC.class).compilePackage(sender, dim, o, m);
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[dimension] [-o] [-m]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,276 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer;
|
|
||||||
import com.volmit.iris.engine.object.noise.IrisGenerator;
|
|
||||||
import com.volmit.iris.engine.object.noise.IrisInterpolator;
|
|
||||||
import com.volmit.iris.engine.object.noise.IrisNoiseGenerator;
|
|
||||||
import com.volmit.iris.engine.object.noise.NoiseStyle;
|
|
||||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.function.NoiseProvider;
|
|
||||||
import com.volmit.iris.util.interpolation.InterpolationMethod;
|
|
||||||
import com.volmit.iris.util.io.IO;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.noise.CNG;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class CommandIrisStudioProfile extends MortarCommand {
|
|
||||||
public CommandIrisStudioProfile() {
|
|
||||||
super("profile", "blame");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Profile the specified project");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
J.a(() -> {
|
|
||||||
File f = null;
|
|
||||||
File report = Iris.instance.getDataFile("profile.txt");
|
|
||||||
KList<String> v = new KList<>();
|
|
||||||
if (args.length == 0) {
|
|
||||||
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
|
||||||
sender.sendMessage("No open project. Either use /iris std beautify <project> or have a project open.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
f = Iris.service(StudioSVC.class).getActiveProject().getPath();
|
|
||||||
} else {
|
|
||||||
f = Iris.instance.getDataFolder("packs", args[0]);
|
|
||||||
|
|
||||||
if (!f.exists()) {
|
|
||||||
sender.sendMessage("Not a valid project.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisProject p = new IrisProject(f);
|
|
||||||
IrisData data = IrisData.get(f);
|
|
||||||
KMap<NoiseStyle, Double> styleTimings = new KMap<>();
|
|
||||||
KMap<InterpolationMethod, Double> interpolatorTimings = new KMap<>();
|
|
||||||
KMap<String, Double> generatorTimings = new KMap<>();
|
|
||||||
KMap<String, Double> biomeTimings = new KMap<>();
|
|
||||||
KMap<String, Double> regionTimings = new KMap<>();
|
|
||||||
|
|
||||||
sender.sendMessage("Calculating Performance Metrics for Noise Generators...");
|
|
||||||
|
|
||||||
|
|
||||||
for (NoiseStyle i : NoiseStyle.values()) {
|
|
||||||
CNG c = i.create(new RNG(i.hashCode()));
|
|
||||||
|
|
||||||
for (int j = 0; j < 3000; j++) {
|
|
||||||
c.noise(j, j + 1000, j * j);
|
|
||||||
c.noise(j, -j);
|
|
||||||
}
|
|
||||||
|
|
||||||
PrecisionStopwatch px = PrecisionStopwatch.start();
|
|
||||||
|
|
||||||
for (int j = 0; j < 100000; j++) {
|
|
||||||
c.noise(j, j + 1000, j * j);
|
|
||||||
c.noise(j, -j);
|
|
||||||
}
|
|
||||||
|
|
||||||
styleTimings.put(i, px.getMilliseconds());
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("Noise Style Performance Impacts: ");
|
|
||||||
|
|
||||||
for (NoiseStyle i : styleTimings.sortKNumber()) {
|
|
||||||
v.add(i.name() + ": " + styleTimings.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("");
|
|
||||||
|
|
||||||
sender.sendMessage("Calculating Interpolator Timings...");
|
|
||||||
|
|
||||||
for (InterpolationMethod i : InterpolationMethod.values()) {
|
|
||||||
IrisInterpolator in = new IrisInterpolator();
|
|
||||||
in.setFunction(i);
|
|
||||||
in.setHorizontalScale(8);
|
|
||||||
|
|
||||||
NoiseProvider np = (x, z) -> Math.random();
|
|
||||||
|
|
||||||
for (int j = 0; j < 3000; j++) {
|
|
||||||
in.interpolate(j, -j, np);
|
|
||||||
}
|
|
||||||
|
|
||||||
PrecisionStopwatch px = PrecisionStopwatch.start();
|
|
||||||
|
|
||||||
for (int j = 0; j < 100000; j++) {
|
|
||||||
in.interpolate(j + 10000, -j - 100000, np);
|
|
||||||
}
|
|
||||||
|
|
||||||
interpolatorTimings.put(i, px.getMilliseconds());
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("Noise Interpolator Performance Impacts: ");
|
|
||||||
|
|
||||||
for (InterpolationMethod i : interpolatorTimings.sortKNumber()) {
|
|
||||||
v.add(i.name() + ": " + interpolatorTimings.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("");
|
|
||||||
|
|
||||||
sender.sendMessage("Processing Generator Scores: ");
|
|
||||||
|
|
||||||
KMap<String, KList<String>> btx = new KMap<>();
|
|
||||||
|
|
||||||
for (String i : data.getGeneratorLoader().getPossibleKeys()) {
|
|
||||||
KList<String> vv = new KList<>();
|
|
||||||
IrisGenerator g = data.getGeneratorLoader().load(i);
|
|
||||||
KList<IrisNoiseGenerator> composites = g.getAllComposites();
|
|
||||||
double score = 0;
|
|
||||||
int m = 0;
|
|
||||||
for (IrisNoiseGenerator j : composites) {
|
|
||||||
m++;
|
|
||||||
score += styleTimings.get(j.getStyle().getStyle());
|
|
||||||
vv.add("Composite Noise Style " + m + " " + j.getStyle().getStyle().name() + ": " + styleTimings.get(j.getStyle().getStyle()));
|
|
||||||
}
|
|
||||||
|
|
||||||
score += interpolatorTimings.get(g.getInterpolator().getFunction());
|
|
||||||
vv.add("Interpolator " + g.getInterpolator().getFunction().name() + ": " + interpolatorTimings.get(g.getInterpolator().getFunction()));
|
|
||||||
generatorTimings.put(i, score);
|
|
||||||
btx.put(i, vv);
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("Project Generator Performance Impacts: ");
|
|
||||||
|
|
||||||
for (String i : generatorTimings.sortKNumber()) {
|
|
||||||
v.add(i + ": " + generatorTimings.get(i));
|
|
||||||
|
|
||||||
btx.get(i).forEach((ii) -> v.add(" " + ii));
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("");
|
|
||||||
|
|
||||||
KMap<String, KList<String>> bt = new KMap<>();
|
|
||||||
|
|
||||||
for (String i : data.getBiomeLoader().getPossibleKeys()) {
|
|
||||||
KList<String> vv = new KList<>();
|
|
||||||
IrisBiome b = data.getBiomeLoader().load(i);
|
|
||||||
double score = 0;
|
|
||||||
|
|
||||||
int m = 0;
|
|
||||||
for (IrisBiomePaletteLayer j : b.getLayers()) {
|
|
||||||
m++;
|
|
||||||
score += styleTimings.get(j.getStyle().getStyle());
|
|
||||||
vv.add("Palette Layer " + m + ": " + styleTimings.get(j.getStyle().getStyle()));
|
|
||||||
}
|
|
||||||
|
|
||||||
score += styleTimings.get(b.getBiomeStyle().getStyle());
|
|
||||||
vv.add("Biome Style: " + styleTimings.get(b.getBiomeStyle().getStyle()));
|
|
||||||
score += styleTimings.get(b.getChildStyle().getStyle());
|
|
||||||
vv.add("Child Style: " + styleTimings.get(b.getChildStyle().getStyle()));
|
|
||||||
biomeTimings.put(i, score);
|
|
||||||
bt.put(i, vv);
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("Project Biome Performance Impacts: ");
|
|
||||||
|
|
||||||
for (String i : biomeTimings.sortKNumber()) {
|
|
||||||
v.add(i + ": " + biomeTimings.get(i));
|
|
||||||
|
|
||||||
bt.get(i).forEach((ff) -> v.add(" " + ff));
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("");
|
|
||||||
|
|
||||||
for (String i : data.getRegionLoader().getPossibleKeys()) {
|
|
||||||
IrisRegion b = data.getRegionLoader().load(i);
|
|
||||||
double score = 0;
|
|
||||||
|
|
||||||
score += styleTimings.get(b.getLakeStyle().getStyle());
|
|
||||||
score += styleTimings.get(b.getRiverStyle().getStyle());
|
|
||||||
regionTimings.put(i, score);
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("Project Region Performance Impacts: ");
|
|
||||||
|
|
||||||
for (String i : regionTimings.sortKNumber()) {
|
|
||||||
v.add(i + ": " + regionTimings.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
v.add("");
|
|
||||||
|
|
||||||
double m = 0;
|
|
||||||
for (double i : biomeTimings.v()) {
|
|
||||||
m += i;
|
|
||||||
}
|
|
||||||
m /= biomeTimings.size();
|
|
||||||
double mm = 0;
|
|
||||||
for (double i : generatorTimings.v()) {
|
|
||||||
mm += i;
|
|
||||||
}
|
|
||||||
mm /= generatorTimings.size();
|
|
||||||
m += mm;
|
|
||||||
double mmm = 0;
|
|
||||||
for (double i : regionTimings.v()) {
|
|
||||||
mmm += i;
|
|
||||||
}
|
|
||||||
mmm /= regionTimings.size();
|
|
||||||
m += mmm;
|
|
||||||
|
|
||||||
v.add("Average Score: " + m);
|
|
||||||
sender.sendMessage("Score: " + Form.duration(m, 0));
|
|
||||||
|
|
||||||
try {
|
|
||||||
IO.writeAll(report, v.toString("\n"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage("Done! " + report.getPath());
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[project]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.object.entity.IrisEntity;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisStudioSummon extends MortarCommand {
|
|
||||||
public CommandIrisStudioSummon() {
|
|
||||||
super("summon", "spawnmob");
|
|
||||||
setDescription("Spawn an Iris entity");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Summon");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
if ((args.length == 0 || args.length == 1) && sender.isPlayer() && IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
IrisData data = IrisToolbelt.access(sender.player().getWorld()).getEngine().getData();
|
|
||||||
if (data == null) {
|
|
||||||
sender.sendMessage("Tab complete options only work for summons while in an Iris world.");
|
|
||||||
} else if (args.length == 0) {
|
|
||||||
list.add(data.getEntityLoader().getPossibleKeys());
|
|
||||||
} else if (args.length == 1) {
|
|
||||||
list.add(data.getEntityLoader().getPossibleKeys(args[0]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
Player p = sender.player();
|
|
||||||
World world = p.getWorld();
|
|
||||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
|
||||||
sender.sendMessage("You must be in an iris world.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine g = IrisToolbelt.access(world).getEngine();
|
|
||||||
if (args.length == 0) {
|
|
||||||
for (String i : g.getData().getEntityLoader().getPossibleKeys()) {
|
|
||||||
sender.sendMessage("- " + i);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
IrisEntity e = g.getData().getEntityLoader().load(args[0]);
|
|
||||||
|
|
||||||
if (e == null) {
|
|
||||||
sender.sendMessage("Couldnt find entity " + args[0] + ". Use '/iris std summon' to see a list of iris entities.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Location vl = sender.player().getTargetBlockExact(256).getLocation().clone().add(0, 1, 0);
|
|
||||||
e.spawn(g, vl);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
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.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
|
|
||||||
public class CommandIrisStudioTPStudio extends MortarCommand {
|
|
||||||
public CommandIrisStudioTPStudio() {
|
|
||||||
super("tps", "stp", "tpstudio", "tp");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Go to the spawn of the currently open studio world.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Cannot be ran by console.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
|
||||||
sender.sendMessage("There is not a studio currently loaded.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
sender.sendMessage("Teleporting you to the active studio world.");
|
|
||||||
sender.player().teleport(Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getTarget().getWorld().spawnLocation());
|
|
||||||
sender.player().setGameMode(GameMode.SPECTATOR);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("Failed to teleport to the studio world. Try re-opening the project.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.studio;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class CommandIrisStudioUpdate extends MortarCommand {
|
|
||||||
public CommandIrisStudioUpdate() {
|
|
||||||
super("update", "upd", "u");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Update your dimension project.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!IrisSettings.get().isStudio()) {
|
|
||||||
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("/iris std package <DIMENSION>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String i : args) {
|
|
||||||
if (i.equals("--rewrite-objects")) {
|
|
||||||
IrisData data = IrisData.get(Iris.service(StudioSVC.class).getWorkspaceFolder(args[0]));
|
|
||||||
int t = data.getObjectLoader().getPossibleKeys().length;
|
|
||||||
ChronoLatch cl = new ChronoLatch(250, false);
|
|
||||||
MultiBurst bx = MultiBurst.burst;
|
|
||||||
BurstExecutor b = bx.burst();
|
|
||||||
int g = 0;
|
|
||||||
for (String f : data.getObjectLoader().getPossibleKeys()) {
|
|
||||||
int finalG1 = g;
|
|
||||||
b.queue(() -> {
|
|
||||||
|
|
||||||
if (cl.flip()) {
|
|
||||||
Iris.info("Rewriting: " + Form.f(t - finalG1) + " Objects Left");
|
|
||||||
}
|
|
||||||
File ff = data.getObjectLoader().findFile(f);
|
|
||||||
IrisObject oo = new IrisObject(0, 0, 0);
|
|
||||||
try {
|
|
||||||
oo.read(ff);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.error("FAILER TO READ: " + f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oo == null) {
|
|
||||||
Iris.error("FAILER TO READ: " + f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
oo.write(ff);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.error("FAILURE TO WRITE: " + oo.getLoadFile());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g++;
|
|
||||||
}
|
|
||||||
|
|
||||||
int finalG = g;
|
|
||||||
J.a(() -> {
|
|
||||||
b.complete();
|
|
||||||
sender.sendMessage("Done! Rewrote " + Form.f(finalG) + " Objects!");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new IrisProject(Iris.service(StudioSVC.class).getWorkspaceFolder(args[0])).updateWorkspace()) {
|
|
||||||
sender.sendMessage("Updated Code Workspace for " + args[0]);
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Invalid project: " + args[0] + ". Try deleting the code-workspace file and try again.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[dimension] [--rewrite-objects]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.what;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
public class CommandIrisWhat extends MortarCommand {
|
|
||||||
@Command
|
|
||||||
private CommandIrisWhatBlock block;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisWhatHand hand;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisWhatFeatures features;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisWhatBiome biome;
|
|
||||||
|
|
||||||
@Command
|
|
||||||
private CommandIrisWhatObjects objects;
|
|
||||||
|
|
||||||
public CommandIrisWhat() {
|
|
||||||
super("what", "w", "?");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Wut");
|
|
||||||
setDescription("Figure out what stuff is");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
sender.sendMessage("Iris 'What' Commands:");
|
|
||||||
printHelp(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[subcommand]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.what;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.nms.INMS;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisWhatBiome extends MortarCommand {
|
|
||||||
public CommandIrisWhatBiome() {
|
|
||||||
super("biome", "bi", "b");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Wut");
|
|
||||||
setDescription("What biome am I in");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
Player p = sender.player();
|
|
||||||
World w = p.getWorld();
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Engine g = IrisToolbelt.access(w).getEngine();
|
|
||||||
assert g != null;
|
|
||||||
IrisBiome b = g.getBiome(p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ());
|
|
||||||
sender.sendMessage("IBiome: " + b.getLoadKey() + " (" + b.getDerivative().name() + ")");
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("Non-Iris Biome: " + p.getLocation().getBlock().getBiome().name());
|
|
||||||
|
|
||||||
if (p.getLocation().getBlock().getBiome().equals(Biome.CUSTOM)) {
|
|
||||||
try {
|
|
||||||
sender.sendMessage("Data Pack Biome: " + INMS.get().getTrueBiomeBaseKey(p.getLocation()) + " (ID: " + INMS.get().getTrueBiomeBaseId(INMS.get().getTrueBiomeBase(p.getLocation())) + ")");
|
|
||||||
} catch (Throwable ee) {
|
|
||||||
Iris.reportError(ee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.what;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.data.B;
|
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.FluidCollisionMode;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisWhatBlock extends MortarCommand {
|
|
||||||
public CommandIrisWhatBlock() {
|
|
||||||
super("block", "l", "bl");
|
|
||||||
setDescription("Get the block data of the block you're looking at.");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Wut");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
BlockData bd;
|
|
||||||
Player p = sender.player();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.what;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisWhatFeatures extends MortarCommand {
|
|
||||||
public CommandIrisWhatFeatures() {
|
|
||||||
super("features", "nf", "f");
|
|
||||||
setDescription("Get the noise feature data in chunk.");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Wut");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
BlockData bd;
|
|
||||||
Player p = sender.player();
|
|
||||||
Chunk c = p.getLocation().getChunk();
|
|
||||||
|
|
||||||
if (IrisToolbelt.isIrisWorld(c.getWorld())) {
|
|
||||||
int m = 1;
|
|
||||||
for (IrisFeaturePositional i : IrisToolbelt.access(c.getWorld()).getEngine().getMantle().forEachFeature(c)) {
|
|
||||||
sender.sendMessage("#" + m++ + " " + new JSONObject(new Gson().toJson(i)).toString(4));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Iris worlds only.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.what;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CommandIrisWhatHand extends MortarCommand {
|
|
||||||
public CommandIrisWhatHand() {
|
|
||||||
super("hand", "h");
|
|
||||||
setDescription("Get the block data for the block you're holding.");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Wut");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
Player p = sender.player();
|
|
||||||
try {
|
|
||||||
BlockData bd = p.getInventory().getItemInMainHand().getType().createBlockData();
|
|
||||||
if (!bd.getMaterial().equals(Material.AIR)) {
|
|
||||||
sender.sendMessage("Material: " + C.GREEN + bd.getMaterial().name());
|
|
||||||
sender.sendMessage("Full: " + C.WHITE + bd.getAsString(true));
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Please hold a block/item");
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
Material bd = p.getInventory().getItemInMainHand().getType();
|
|
||||||
if (!bd.equals(Material.AIR)) {
|
|
||||||
sender.sendMessage("Material: " + C.GREEN + bd.name());
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Please hold a block/item");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,254 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.what;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacement;
|
|
||||||
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.format.Form;
|
|
||||||
import com.volmit.iris.util.math.M;
|
|
||||||
import com.volmit.iris.util.math.Spiraler;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import io.papermc.lib.PaperLib;
|
|
||||||
import org.bukkit.*;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.BlockVector;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.attribute.FileTime;
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.temporal.ChronoUnit;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class CommandIrisWhatObjects extends MortarCommand {
|
|
||||||
public CommandIrisWhatObjects() {
|
|
||||||
super("objects", "o", "obj", "capture", "capt");
|
|
||||||
setDescription("Capture nearby information to help with reporting problems. Can specify the number of threads like /ir w o 4");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("World");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (sender.isPlayer()) {
|
|
||||||
Player p = sender.player();
|
|
||||||
World world = p.getWorld();
|
|
||||||
|
|
||||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
|
||||||
sender.sendMessage("You must be in an iris world.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine g = IrisToolbelt.access(world).getEngine();
|
|
||||||
KList<Chunk> chunks = new KList<>();
|
|
||||||
int bx = p.getLocation().getChunk().getX();
|
|
||||||
int bz = p.getLocation().getChunk().getZ();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Location l = p.getTargetBlockExact(48, FluidCollisionMode.NEVER).getLocation();
|
|
||||||
|
|
||||||
int cx = l.getChunk().getX();
|
|
||||||
int cz = l.getChunk().getZ();
|
|
||||||
new Spiraler(3, 3, (x, z) -> chunks.addIfMissing(world.getChunkAt(x + cx, z + cz))).drain();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
new Spiraler(3, 3, (x, z) -> chunks.addIfMissing(world.getChunkAt(x + bx, z + bz))).drain();
|
|
||||||
sender.sendMessage("Capturing IGenData from " + chunks.size() + " nearby chunks.");
|
|
||||||
try {
|
|
||||||
File ff = Iris.instance.getDataFile("reports/" + M.ms() + ".txt");
|
|
||||||
PrintWriter pw = new PrintWriter(ff);
|
|
||||||
pw.println("=== Iris Chunk Report ===");
|
|
||||||
pw.println("== General Info ==");
|
|
||||||
pw.println("Iris Version: " + Iris.instance.getDescription().getVersion());
|
|
||||||
pw.println("Bukkit Version: " + Bukkit.getBukkitVersion());
|
|
||||||
pw.println("MC Version: " + Bukkit.getVersion());
|
|
||||||
pw.println("PaperSpigot: " + (PaperLib.isPaper() ? "Yup!" : "Nope!"));
|
|
||||||
pw.println("Report Captured At: " + new Date());
|
|
||||||
pw.println("Chunks: (" + chunks.size() + "): ");
|
|
||||||
|
|
||||||
for (Chunk i : chunks) {
|
|
||||||
pw.println("- [" + i.getX() + ", " + i.getZ() + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
int regions = 0;
|
|
||||||
long size = 0;
|
|
||||||
String age = "No idea...";
|
|
||||||
|
|
||||||
try {
|
|
||||||
for (File i : Objects.requireNonNull(new File(world.getWorldFolder(), "region").listFiles())) {
|
|
||||||
if (i.isFile()) {
|
|
||||||
size += i.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
FileTime creationTime = (FileTime) Files.getAttribute(world.getWorldFolder().toPath(), "creationTime");
|
|
||||||
age = hrf(Duration.of(M.ms() - creationTime.toMillis(), ChronoUnit.MILLIS));
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
KList<String> biomes = new KList<>();
|
|
||||||
KList<String> caveBiomes = new KList<>();
|
|
||||||
KMap<String, KMap<String, KList<String>>> objects = new KMap<>();
|
|
||||||
|
|
||||||
for (Chunk i : chunks) {
|
|
||||||
for (int j = 0; j < 16; j += 3) {
|
|
||||||
|
|
||||||
for (int k = 0; k < 16; k += 3) {
|
|
||||||
|
|
||||||
assert g != null;
|
|
||||||
IrisBiome bb = g.getSurfaceBiome((i.getX() * 16) + j, (i.getZ() * 16) + k);
|
|
||||||
IrisBiome bxf = g.getCaveBiome((i.getX() * 16) + j, (i.getZ() * 16) + k);
|
|
||||||
biomes.addIfMissing(bb.getName() + " [" + Form.capitalize(bb.getInferredType().name().toLowerCase()) + "] " + " (" + bb.getLoadFile().getName() + ")");
|
|
||||||
caveBiomes.addIfMissing(bxf.getName() + " (" + bxf.getLoadFile().getName() + ")");
|
|
||||||
exportObjects(bb, pw, g, objects);
|
|
||||||
exportObjects(bxf, pw, g, objects);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
regions = Objects.requireNonNull(new File(world.getWorldFolder().getPath() + "/region").list()).length;
|
|
||||||
|
|
||||||
pw.println();
|
|
||||||
pw.println("== World Info ==");
|
|
||||||
pw.println("World Name: " + world.getName());
|
|
||||||
pw.println("Age: " + age);
|
|
||||||
pw.println("Folder: " + world.getWorldFolder().getPath());
|
|
||||||
pw.println("Regions: " + Form.f(regions));
|
|
||||||
pw.println("Chunks: max. " + Form.f(regions * 32 * 32));
|
|
||||||
pw.println("World Size: min. " + Form.fileSize(size));
|
|
||||||
pw.println();
|
|
||||||
pw.println("== Biome Info ==");
|
|
||||||
pw.println("Found " + biomes.size() + " Biome(s): ");
|
|
||||||
|
|
||||||
for (String i : biomes) {
|
|
||||||
pw.println("- " + i);
|
|
||||||
}
|
|
||||||
pw.println();
|
|
||||||
|
|
||||||
pw.println("== Object Info ==");
|
|
||||||
|
|
||||||
for (String i : objects.k()) {
|
|
||||||
pw.println("- " + i);
|
|
||||||
|
|
||||||
for (String j : objects.get(i).k()) {
|
|
||||||
pw.println(" @ " + j);
|
|
||||||
|
|
||||||
for (String k : objects.get(i).get(j)) {
|
|
||||||
pw.println(" * " + k);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pw.println();
|
|
||||||
pw.close();
|
|
||||||
|
|
||||||
sender.sendMessage("Reported to: " + ff.getPath());
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Players only.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void exportObjects(IrisBiome bb, PrintWriter pw, Engine g, KMap<String, KMap<String, KList<String>>> objects) {
|
|
||||||
String n1 = bb.getName() + " [" + Form.capitalize(bb.getInferredType().name().toLowerCase()) + "] " + " (" + bb.getLoadFile().getName() + ")";
|
|
||||||
int m = 0;
|
|
||||||
KSet<String> stop = new KSet<>();
|
|
||||||
for (IrisObjectPlacement f : bb.getObjects()) {
|
|
||||||
m++;
|
|
||||||
String n2 = "Placement #" + m + " (" + f.getPlace().size() + " possible objects)";
|
|
||||||
|
|
||||||
for (String i : f.getPlace()) {
|
|
||||||
String nn3 = i + ": [ERROR] Failed to find object!";
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (stop.contains(i)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
File ff = g.getData().getObjectLoader().findFile(i);
|
|
||||||
BlockVector sz = IrisObject.sampleSize(ff);
|
|
||||||
nn3 = i + ": size=[" + sz.getBlockX() + "," + sz.getBlockY() + "," + sz.getBlockZ() + "] location=[" + ff.getPath() + "]";
|
|
||||||
stop.add(i);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
String n3 = nn3;
|
|
||||||
|
|
||||||
objects.compute(n1, (k1, v1) ->
|
|
||||||
{
|
|
||||||
//noinspection ReplaceNullCheck
|
|
||||||
if (v1 == null) {
|
|
||||||
return new KMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
return v1;
|
|
||||||
}).compute(n2, (k, v) ->
|
|
||||||
{
|
|
||||||
if (v == null) {
|
|
||||||
return new KList<String>().qaddIfMissing(n3);
|
|
||||||
}
|
|
||||||
|
|
||||||
v.addIfMissing(n3);
|
|
||||||
return v;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String hrf(Duration duration) {
|
|
||||||
return duration.toString().substring(2).replaceAll("(\\d[HMS])(?!$)", "$1 ").toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[thread-count]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,144 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.world;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.exceptions.IrisException;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class CommandIrisCreate extends MortarCommand {
|
|
||||||
public CommandIrisCreate() {
|
|
||||||
super("create", "c", "cr", "new", "+");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setCategory("Create");
|
|
||||||
setDescription("Create a new Iris World!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
boolean seed = false;
|
|
||||||
boolean type = false;
|
|
||||||
|
|
||||||
File packsFolder = new File("plugins/Iris/packs/");
|
|
||||||
packsFolder.mkdirs();
|
|
||||||
|
|
||||||
for (String arg : args) {
|
|
||||||
if (arg.equals("seed=")) {
|
|
||||||
list.add("seed=random");
|
|
||||||
list.add("seed=1234");
|
|
||||||
} else if (arg.startsWith("seed=")) {
|
|
||||||
seed = true;
|
|
||||||
} else if (arg.equals("type=")) {
|
|
||||||
for (File dim : packsFolder.listFiles()) {
|
|
||||||
if (dim.isDirectory()) {
|
|
||||||
list.add("type=" + dim.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type = true;
|
|
||||||
} else if (arg.startsWith("type=")) {
|
|
||||||
type = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!seed) {
|
|
||||||
list.add("seed=random");
|
|
||||||
list.add("seed=1234");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!type) {
|
|
||||||
for (File dim : packsFolder.listFiles()) {
|
|
||||||
if (dim.isDirectory()) {
|
|
||||||
list.add("type=" + dim.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
String worldName;
|
|
||||||
File folder;
|
|
||||||
String dimensionName;
|
|
||||||
IrisDimension dimension;
|
|
||||||
long seed;
|
|
||||||
|
|
||||||
if (args.length < 1) {
|
|
||||||
sender.sendMessage(getArgsUsage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
worldName = args[0];
|
|
||||||
|
|
||||||
if (worldName.equalsIgnoreCase("iris")) {
|
|
||||||
sender.sendMessage("You cannot use the world name \"iris\" for creating worlds as Iris uses this directory for studio worlds.");
|
|
||||||
sender.sendMessage("May we suggest the name \"IrisWorld\" instead?");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
folder = new File(worldName);
|
|
||||||
|
|
||||||
if (folder.exists()) {
|
|
||||||
sender.sendMessage("That world folder already exists!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
dimensionName = IrisSettings.get().getGenerator().getDefaultWorldType();
|
|
||||||
seed = new Random().nextLong(); //Random seed when creating a world
|
|
||||||
|
|
||||||
for (String i : args) {
|
|
||||||
dimensionName = i.startsWith("type=") ? i.split("\\Q=\\E")[1] : dimensionName;
|
|
||||||
seed = i.startsWith("seed=") ? Long.parseLong(i.split("\\Q=\\E")[1]) : seed;
|
|
||||||
}
|
|
||||||
|
|
||||||
String finalDimensionName = dimensionName;
|
|
||||||
|
|
||||||
|
|
||||||
long finalSeed = seed;
|
|
||||||
J.a(() -> {
|
|
||||||
try {
|
|
||||||
IrisToolbelt.createWorld()
|
|
||||||
.dimension(finalDimensionName)
|
|
||||||
.name(worldName)
|
|
||||||
.seed(finalSeed)
|
|
||||||
.sender(sender)
|
|
||||||
.studio(false)
|
|
||||||
.create();
|
|
||||||
} catch (IrisException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
sender.sendMessage("Creation Failed! Check Console.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<name> [type=<type>] [seed=<seed>]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,129 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.world;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
|
|
||||||
public class CommandIrisRegen extends MortarCommand {
|
|
||||||
public CommandIrisRegen() {
|
|
||||||
super("regen");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Regenerate nearby chunks");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (!sender.isPlayer()) {
|
|
||||||
sender.sendMessage("Must be in an iris world.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
|
||||||
J.a(() -> {
|
|
||||||
PlatformChunkGenerator plat = IrisToolbelt.access(sender.player().getWorld());
|
|
||||||
Engine engine = plat.getEngine();
|
|
||||||
try {
|
|
||||||
int vd = Integer.parseInt(args[0]);
|
|
||||||
int rg = 0;
|
|
||||||
Chunk cx = sender.player().getLocation().getChunk();
|
|
||||||
KList<Runnable> js = new KList<>();
|
|
||||||
BurstExecutor b = MultiBurst.burst.burst();
|
|
||||||
b.setMulticore(false);
|
|
||||||
int rad = engine.getMantle().getRealRadius();
|
|
||||||
for (int i = -(vd + rad); i <= vd + rad; i++) {
|
|
||||||
for (int j = -(vd + rad); j <= vd + rad; j++) {
|
|
||||||
engine.getMantle().getMantle().deleteChunk(i + cx.getX(), j + cx.getZ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = -vd; i <= vd; i++) {
|
|
||||||
for (int j = -vd; j <= vd; j++) {
|
|
||||||
int finalJ = j;
|
|
||||||
int finalI = i;
|
|
||||||
b.queue(() -> plat.injectChunkReplacement(sender.player().getWorld(), finalI + cx.getX(), finalJ + cx.getZ(), (f) -> {
|
|
||||||
synchronized (js) {
|
|
||||||
js.add(f);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
b.complete();
|
|
||||||
sender.sendMessage("Regenerating " + Form.f(js.size()) + " Sections");
|
|
||||||
QueueJob<Runnable> r = new QueueJob<>() {
|
|
||||||
final KList<Future<?>> futures = new KList<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(Runnable runnable) {
|
|
||||||
futures.add(J.sfut(runnable));
|
|
||||||
|
|
||||||
if (futures.size() > 64) {
|
|
||||||
while (futures.isNotEmpty()) {
|
|
||||||
try {
|
|
||||||
futures.remove(0).get();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ExecutionException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "Regenerating";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
r.queue(js);
|
|
||||||
r.execute(sender);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
sender.sendMessage("Unable to parse view-distance");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[view-distance]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.world;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.format.C;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class CommandIrisUpdateWorld extends MortarCommand {
|
|
||||||
public CommandIrisUpdateWorld() {
|
|
||||||
super("update-world", "^world");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Update a world from a project.");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
if (args.length < 2) {
|
|
||||||
sender.sendMessage("/iris update-world " + C.BOLD + "<WORLD> <PROJECT>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean fresh = false;
|
|
||||||
|
|
||||||
for (String i : args) {
|
|
||||||
if (i.equalsIgnoreCase("--fresh-download")) {
|
|
||||||
fresh = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean bfre = fresh;
|
|
||||||
|
|
||||||
J.a(() ->
|
|
||||||
{
|
|
||||||
File folder = new File(args[0]);
|
|
||||||
folder.mkdirs();
|
|
||||||
|
|
||||||
if (bfre) {
|
|
||||||
Iris.service(StudioSVC.class).downloadSearch(sender, args[1], false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.service(StudioSVC.class).installIntoWorld(sender, args[1], folder);
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "<world> <project>";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.command.world;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.nbt.mca.Chunk;
|
|
||||||
import com.volmit.iris.util.nbt.mca.MCAFile;
|
|
||||||
import com.volmit.iris.util.nbt.mca.MCAUtil;
|
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
public class CommandIrisVerify extends MortarCommand {
|
|
||||||
public CommandIrisVerify() {
|
|
||||||
super("verifymca");
|
|
||||||
requiresPermission(Iris.perm.studio);
|
|
||||||
setDescription("Fix nearby chunks");
|
|
||||||
setCategory("Studio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTabOptions(VolmitSender sender, String[] args, KList<String> list) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
|
||||||
try {
|
|
||||||
Engine a = IrisToolbelt.access(sender.player().getWorld()).getEngine();
|
|
||||||
File folder = a.getTarget().getWorld().worldFolder();
|
|
||||||
File r = new File(folder, "region");
|
|
||||||
BurstExecutor e = MultiBurst.burst.burst(r.listFiles().length);
|
|
||||||
AtomicInteger f = new AtomicInteger(0);
|
|
||||||
for (File i : r.listFiles()) {
|
|
||||||
e.queue(() -> {
|
|
||||||
MCAFile file = null;
|
|
||||||
try {
|
|
||||||
file = MCAUtil.read(i);
|
|
||||||
int rx = Integer.parseInt(i.getName().split("\\Q.\\E")[1]);
|
|
||||||
int rz = Integer.parseInt(i.getName().split("\\Q.\\E")[2]);
|
|
||||||
for (int j = 0; j < 32; j++) {
|
|
||||||
for (int k = 0; k < 32; k++) {
|
|
||||||
f.incrementAndGet();
|
|
||||||
Chunk c = file.getChunk(j, k);
|
|
||||||
if (c == null) {
|
|
||||||
sender.sendMessage("Found Missing Chunk " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5) << 4) + (j << 4)) + "," + (((rz << 5) << 4) + (k << 4)));
|
|
||||||
} else if (c.sectionCount() == 0) {
|
|
||||||
sender.sendMessage("Found Missing Chunk (valid, but 0 sections) " + i.getName() + ", chunk #" + j + "," + k + " (see " + (((rx << 5) << 4) + (j << 4)) + "," + (((rz << 5) << 4) + (k << 4)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException ioException) {
|
|
||||||
ioException.printStackTrace();
|
|
||||||
sender.sendMessage("Error loading region " + i.getName());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
e.complete();
|
|
||||||
sender.sendMessage("Done! Checked " + f.get() + " chunks");
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
sender.sendMessage("Not a valid Iris World (or bad argument)");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getArgsUsage() {
|
|
||||||
return "[view-distance]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,39 +16,28 @@
|
|||||||
* 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.decrees;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
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.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
|
||||||
import com.volmit.iris.util.data.B;
|
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||||
import com.volmit.iris.util.decree.DecreeSystem;
|
|
||||||
import com.volmit.iris.util.decree.annotations.Decree;
|
import com.volmit.iris.util.decree.annotations.Decree;
|
||||||
import com.volmit.iris.util.decree.annotations.Param;
|
import com.volmit.iris.util.decree.annotations.Param;
|
||||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
|
||||||
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import org.bukkit.FluidCollisionMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
|
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
|
||||||
public class DecIris implements DecreeExecutor {
|
public class CommandIris implements DecreeExecutor {
|
||||||
private DecStudio studio;
|
private CommandStudio studio;
|
||||||
private DecPregen pregen;
|
private CommandPregen pregen;
|
||||||
private DecSettings settings;
|
private CommandSettings settings;
|
||||||
private DecObject object;
|
private CommandObject object;
|
||||||
private DecWhat what;
|
private CommandWhat what;
|
||||||
|
|
||||||
@Decree(description = "Create a new world", aliases = "+")
|
@Decree(description = "Create a new world", aliases = "+")
|
||||||
public void create(
|
public void create(
|
@ -1,4 +1,4 @@
|
|||||||
package com.volmit.iris.core.decrees;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
@ -37,7 +37,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Decree(name = "object", aliases = "o", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris object manipulation")
|
@Decree(name = "object", aliases = "o", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris object manipulation")
|
||||||
public class DecObject implements DecreeExecutor {
|
public class CommandObject implements DecreeExecutor {
|
||||||
|
|
||||||
@Decree(description = "Check the composition of an object")
|
@Decree(description = "Check the composition of an object")
|
||||||
public void analyze(
|
public void analyze(
|
@ -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.decrees;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.gui.PregeneratorJob;
|
import com.volmit.iris.core.gui.PregeneratorJob;
|
||||||
@ -31,7 +31,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@Decree(name = "pregen", aliases = "pregenerate", description = "Pregenerate your Iris worlds!")
|
@Decree(name = "pregen", aliases = "pregenerate", description = "Pregenerate your Iris worlds!")
|
||||||
public class DecPregen implements DecreeExecutor {
|
public class CommandPregen implements DecreeExecutor {
|
||||||
@Decree(description = "Pregenerate a world")
|
@Decree(description = "Pregenerate a world")
|
||||||
public void start(
|
public void start(
|
||||||
@Param(description = "The world to pregen", contextual = true)
|
@Param(description = "The world to pregen", contextual = true)
|
@ -16,10 +16,10 @@
|
|||||||
* 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.decrees;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
|
|
||||||
public class DecSettings implements DecreeExecutor {
|
public class CommandSettings implements DecreeExecutor {
|
||||||
|
|
||||||
}
|
}
|
@ -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.decrees;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
@ -48,7 +48,6 @@ import com.volmit.iris.engine.object.regional.IrisRegion;
|
|||||||
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.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.data.B;
|
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||||
import com.volmit.iris.util.decree.annotations.Decree;
|
import com.volmit.iris.util.decree.annotations.Decree;
|
||||||
@ -75,8 +74,6 @@ import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
|||||||
import com.volmit.iris.util.scheduling.jobs.SingleJob;
|
import com.volmit.iris.util.scheduling.jobs.SingleJob;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
@ -98,7 +95,7 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@Decree(name = "studio", aliases = {"std", "s"}, description = "Studio Commands", studio = true)
|
@Decree(name = "studio", aliases = {"std", "s"}, description = "Studio Commands", studio = true)
|
||||||
public class DecStudio implements DecreeExecutor {
|
public class CommandStudio implements DecreeExecutor {
|
||||||
@Decree(description = "Open a new studio world", aliases = "o", sync = true)
|
@Decree(description = "Open a new studio world", aliases = "o", sync = true)
|
||||||
public void open(
|
public void open(
|
||||||
@Param(defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
|
@Param(defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
|
@ -1,53 +1,23 @@
|
|||||||
package com.volmit.iris.core.decrees;
|
package com.volmit.iris.core.commands;
|
||||||
|
|
||||||
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.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.core.service.ObjectSVC;
|
|
||||||
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.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
|
||||||
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
|
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacement;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacementScaleInterpolator;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectRotation;
|
|
||||||
import com.volmit.iris.engine.object.tile.TileData;
|
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||||
import com.volmit.iris.util.decree.annotations.Decree;
|
import com.volmit.iris.util.decree.annotations.Decree;
|
||||||
import com.volmit.iris.util.decree.annotations.Param;
|
|
||||||
import com.volmit.iris.util.decree.specialhandlers.ObjectHandler;
|
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
import com.volmit.iris.util.math.Direction;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.scheduling.Queue;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.block.TileState;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Decree(name = "what", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris What?")
|
@Decree(name = "what", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris What?")
|
||||||
public class DecWhat implements DecreeExecutor {
|
public class CommandWhat implements DecreeExecutor {
|
||||||
@Decree(description = "What is in my hand?", origin = DecreeOrigin.PLAYER)
|
@Decree(description = "What is in my hand?", origin = DecreeOrigin.PLAYER)
|
||||||
public void hand() {
|
public void hand() {
|
||||||
try {
|
try {
|
@ -19,9 +19,8 @@
|
|||||||
package com.volmit.iris.core.service;
|
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.commands.CommandIris;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
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;
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
@ -38,18 +37,9 @@ public class CommandSVC implements IrisService, DecreeSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final transient AtomicCache<VirtualDecreeCommand> commandCache = new AtomicCache<>();
|
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.aquireNastyPrint(() -> VirtualDecreeCommand.createRoot(new CommandIris()));
|
||||||
try {
|
|
||||||
return VirtualDecreeCommand.createRoot(new DecIris());
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,17 @@ public class AtomicCache<T> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T aquireNastyPrint(NastySupplier<T> t) {
|
||||||
|
return aquire(() -> {
|
||||||
|
try {
|
||||||
|
return t.get();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public T aquire(Supplier<T> t) {
|
public T aquire(Supplier<T> t) {
|
||||||
if (this.t.get() != null) {
|
if (this.t.get() != null) {
|
||||||
return this.t.get();
|
return this.t.get();
|
||||||
|
@ -60,6 +60,11 @@ public interface DecreeSystem extends CommandExecutor, TabCompleter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
default boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
if(!sender.hasPermission("iris.all"))
|
||||||
|
{
|
||||||
|
sender.sendMessage("You lack the Permission 'iris.all'");
|
||||||
|
}
|
||||||
|
|
||||||
J.aBukkit(() -> {
|
J.aBukkit(() -> {
|
||||||
if (!call(new VolmitSender(sender), args)) {
|
if (!call(new VolmitSender(sender), args)) {
|
||||||
sender.sendMessage(C.RED + "Unknown Iris Command");
|
sender.sendMessage(C.RED + "Unknown Iris Command");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user