From 466cc84c1612607e41094de0474f4970ffa3f464 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Fri, 10 Sep 2021 13:55:32 +0200 Subject: [PATCH 1/2] Patches --- .../volmit/iris/core/commands/CommandIris.java | 1 + .../volmit/iris/core/commands/CommandPregen.java | 4 ++-- .../java/com/volmit/iris/engine/IrisEngine.java | 3 +-- .../com/volmit/iris/util/decree/DecreeNode.java | 3 +-- .../util/decree/virtual/VirtualDecreeCommand.java | 15 ++++++++------- .../java/com/volmit/iris/util/mantle/Mantle.java | 1 - .../com/volmit/iris/util/plugin/VolmitSender.java | 3 ++- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/volmit/iris/core/commands/CommandIris.java b/src/main/java/com/volmit/iris/core/commands/CommandIris.java index d63beb96a..2234b6154 100644 --- a/src/main/java/com/volmit/iris/core/commands/CommandIris.java +++ b/src/main/java/com/volmit/iris/core/commands/CommandIris.java @@ -144,6 +144,7 @@ public class CommandIris implements DecreeExecutor { ) { boolean to = on == null ? !IrisSettings.get().getGeneral().isDebug() : on; IrisSettings.get().getGeneral().setDebug(to); + IrisSettings.get().forceSave(); sender().sendMessage(C.GREEN + "Set debug to: " + to); } diff --git a/src/main/java/com/volmit/iris/core/commands/CommandPregen.java b/src/main/java/com/volmit/iris/core/commands/CommandPregen.java index a8e9424c1..25f0d0112 100644 --- a/src/main/java/com/volmit/iris/core/commands/CommandPregen.java +++ b/src/main/java/com/volmit/iris/core/commands/CommandPregen.java @@ -34,10 +34,10 @@ import org.bukkit.util.Vector; public class CommandPregen implements DecreeExecutor { @Decree(description = "Pregenerate a world") public void start( - @Param(description = "The world to pregen", contextual = true) - World world, @Param(description = "The radius of the pregen in blocks", aliases = "size") int radius, + @Param(description = "The world to pregen", contextual = true) + World world, @Param(aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0") Vector center ) { diff --git a/src/main/java/com/volmit/iris/engine/IrisEngine.java b/src/main/java/com/volmit/iris/engine/IrisEngine.java index acf789022..42fcc09b7 100644 --- a/src/main/java/com/volmit/iris/engine/IrisEngine.java +++ b/src/main/java/com/volmit/iris/engine/IrisEngine.java @@ -417,8 +417,7 @@ public class IrisEngine implements Engine { getData().getObjectLoader().clean(); } catch (Throwable e) { Iris.reportError(e); - Iris.error("Cleanup failed!"); - e.printStackTrace(); + Iris.error("Cleanup failed! Enable debug to see stacktrace."); } cleaning.lazySet(false); diff --git a/src/main/java/com/volmit/iris/util/decree/DecreeNode.java b/src/main/java/com/volmit/iris/util/decree/DecreeNode.java index 22cd9efcd..579b50d76 100644 --- a/src/main/java/com/volmit/iris/util/decree/DecreeNode.java +++ b/src/main/java/com/volmit/iris/util/decree/DecreeNode.java @@ -77,7 +77,7 @@ public class DecreeNode { } public KList getNames() { - KList d = new KList<>(); + KList d = new KList<>(getName()); for (String i : decree.aliases()) { if (i.isEmpty()) { @@ -88,7 +88,6 @@ public class DecreeNode { } - d.add(getName()); d.removeDuplicates(); return d; } diff --git a/src/main/java/com/volmit/iris/util/decree/virtual/VirtualDecreeCommand.java b/src/main/java/com/volmit/iris/util/decree/virtual/VirtualDecreeCommand.java index 402f6143e..ec95d9517 100644 --- a/src/main/java/com/volmit/iris/util/decree/virtual/VirtualDecreeCommand.java +++ b/src/main/java/com/volmit/iris/util/decree/virtual/VirtualDecreeCommand.java @@ -161,8 +161,8 @@ public class VirtualDecreeCommand { return getNode().getNames(); } - KList d = new KList<>(); Decree dc = getType().getDeclaredAnnotation(Decree.class); + KList d = new KList<>(dc.name()); for (String i : dc.aliases()) { if (i.isEmpty()) { continue; @@ -171,7 +171,6 @@ public class VirtualDecreeCommand { d.add(i); } - d.add(dc.name()); d.removeDuplicates(); return d; @@ -461,24 +460,25 @@ public class VirtualDecreeCommand { } if (sender.isPlayer() && i.isContextual() && value == null) { + Iris.debug("Contextual!"); DecreeContextHandler ch = DecreeContextHandler.contextHandlers.get(i.getType()); if (ch != null) { value = ch.handle(sender); if (value != null) { - Iris.debug("Null Parameter " + i.getName() + " derived a value of " + i.getHandler().toStringForce(value) + " from " + ch.getClass().getSimpleName()); + Iris.debug("Parameter \"" + i.getName() + "\" derived a value of \"" + i.getHandler().toStringForce(value) + "\" from " + ch.getClass().getSimpleName()); } else { - Iris.debug("Null Parameter " + i.getName() + " could not derive a value from " + ch.getClass().getSimpleName()); + Iris.debug("Parameter \"" + i.getName() + "\" could not derive a value from \"" + ch.getClass().getSimpleName()); } } else { - Iris.debug("Null Parameter " + i.getName() + " is contextual but has no context handler for " + i.getType().getCanonicalName()); + Iris.debug("Parameter \"" + i.getName() + "\" is contextual but has no context handler for \"" + i.getType().getCanonicalName() + "\""); } } if (i.hasDefault() && value == null) { try { - Iris.debug("Null Parameter " + i.getName() + " is using default value " + i.getParam().defaultValue()); + Iris.debug("Parameter \"" + i.getName() + "\" is using default value \"" + i.getParam().defaultValue() + "\""); value = i.getDefaultValue(); } catch (Throwable e) { e.printStackTrace(); @@ -486,7 +486,8 @@ public class VirtualDecreeCommand { } if (i.isRequired() && value == null) { - sender.sendMessage("Missing: " + i.getName() + " (" + i.getType().getSimpleName() + ") as the " + Form.getNumberSuffixThStRd(vm + 1) + " argument."); + sender.sendMessage(C.RED + "Missing argument \"" + i.getName() + "\" (" + i.getType().getSimpleName() + ") as the " + Form.getNumberSuffixThStRd(vm + 1) + " argument."); + sender.sendDecreeHelpNode(this); return false; } diff --git a/src/main/java/com/volmit/iris/util/mantle/Mantle.java b/src/main/java/com/volmit/iris/util/mantle/Mantle.java index eaa3004f8..2ee288565 100644 --- a/src/main/java/com/volmit/iris/util/mantle/Mantle.java +++ b/src/main/java/com/volmit/iris/util/mantle/Mantle.java @@ -470,7 +470,6 @@ public class Mantle { } catch (Throwable e) { Iris.error("Failed to read Tectonic Plate " + file.getAbsolutePath() + " creating a new chunk instead."); Iris.reportError(e); - e.printStackTrace(); region = new TectonicPlate(worldHeight, x, z); loadedRegions.put(k, region); Iris.debug("Created new Tectonic Plate (Due to Load Failure) " + C.DARK_GREEN + x + " " + z); diff --git a/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java b/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java index ea5a5ef41..4031ffe75 100644 --- a/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java +++ b/src/main/java/com/volmit/iris/util/plugin/VolmitSender.java @@ -544,7 +544,8 @@ public class VolmitSender implements CommandSender { String nDescription = "<#3fe05a>✎ <#6ad97d>" + p.getDescription(); String nUsage; String fullTitle; - if (p.isContextual() && isPlayer()) { + Iris.debug("Contextual: " + p.isContextual() + " / player: " + isPlayer()); + if (p.isContextual() && (isPlayer() || s instanceof CommandDummy)) { fullTitle = "<#ffcc00>[" + nTitle + "<#ffcc00>] "; nUsage = "<#ff9900>➱ <#ffcc00>The value may be derived from environment context."; } else if (p.isRequired()) { From e46b335dc07ef84743012e3b53d652c7be9bcc5c Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Fri, 10 Sep 2021 15:02:56 +0200 Subject: [PATCH 2/2] ok --- src/main/java/com/volmit/iris/util/decree/DecreeNode.java | 3 ++- .../volmit/iris/util/decree/virtual/VirtualDecreeCommand.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/util/decree/DecreeNode.java b/src/main/java/com/volmit/iris/util/decree/DecreeNode.java index 579b50d76..770218c6a 100644 --- a/src/main/java/com/volmit/iris/util/decree/DecreeNode.java +++ b/src/main/java/com/volmit/iris/util/decree/DecreeNode.java @@ -77,7 +77,8 @@ public class DecreeNode { } public KList getNames() { - KList d = new KList<>(getName()); + KList d = new KList<>(); + d.add(getName()); for (String i : decree.aliases()) { if (i.isEmpty()) { diff --git a/src/main/java/com/volmit/iris/util/decree/virtual/VirtualDecreeCommand.java b/src/main/java/com/volmit/iris/util/decree/virtual/VirtualDecreeCommand.java index ec95d9517..323077371 100644 --- a/src/main/java/com/volmit/iris/util/decree/virtual/VirtualDecreeCommand.java +++ b/src/main/java/com/volmit/iris/util/decree/virtual/VirtualDecreeCommand.java @@ -162,7 +162,8 @@ public class VirtualDecreeCommand { } Decree dc = getType().getDeclaredAnnotation(Decree.class); - KList d = new KList<>(dc.name()); + KList d = new KList<>(); + d.add(dc.name()); for (String i : dc.aliases()) { if (i.isEmpty()) { continue;