Merge pull request #624 from CocoTheOwner/patches

Patches
This commit is contained in:
Dan 2021-09-10 09:03:30 -04:00 committed by GitHub
commit f86cd11d74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 14 deletions

View File

@ -144,6 +144,7 @@ public class CommandIris implements DecreeExecutor {
) { ) {
boolean to = on == null ? !IrisSettings.get().getGeneral().isDebug() : on; boolean to = on == null ? !IrisSettings.get().getGeneral().isDebug() : on;
IrisSettings.get().getGeneral().setDebug(to); IrisSettings.get().getGeneral().setDebug(to);
IrisSettings.get().forceSave();
sender().sendMessage(C.GREEN + "Set debug to: " + to); sender().sendMessage(C.GREEN + "Set debug to: " + to);
} }

View File

@ -34,10 +34,10 @@ import org.bukkit.util.Vector;
public class CommandPregen 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)
World world,
@Param(description = "The radius of the pregen in blocks", aliases = "size") @Param(description = "The radius of the pregen in blocks", aliases = "size")
int radius, 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") @Param(aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0")
Vector center Vector center
) { ) {

View File

@ -417,8 +417,7 @@ public class IrisEngine implements Engine {
getData().getObjectLoader().clean(); getData().getObjectLoader().clean();
} catch (Throwable e) { } catch (Throwable e) {
Iris.reportError(e); Iris.reportError(e);
Iris.error("Cleanup failed!"); Iris.error("Cleanup failed! Enable debug to see stacktrace.");
e.printStackTrace();
} }
cleaning.lazySet(false); cleaning.lazySet(false);

View File

@ -78,6 +78,7 @@ public class DecreeNode {
public KList<String> getNames() { public KList<String> getNames() {
KList<String> d = new KList<>(); KList<String> d = new KList<>();
d.add(getName());
for (String i : decree.aliases()) { for (String i : decree.aliases()) {
if (i.isEmpty()) { if (i.isEmpty()) {
@ -88,7 +89,6 @@ public class DecreeNode {
} }
d.add(getName());
d.removeDuplicates(); d.removeDuplicates();
return d; return d;
} }

View File

@ -161,8 +161,9 @@ public class VirtualDecreeCommand {
return getNode().getNames(); return getNode().getNames();
} }
KList<String> d = new KList<>();
Decree dc = getType().getDeclaredAnnotation(Decree.class); Decree dc = getType().getDeclaredAnnotation(Decree.class);
KList<String> d = new KList<>();
d.add(dc.name());
for (String i : dc.aliases()) { for (String i : dc.aliases()) {
if (i.isEmpty()) { if (i.isEmpty()) {
continue; continue;
@ -171,7 +172,6 @@ public class VirtualDecreeCommand {
d.add(i); d.add(i);
} }
d.add(dc.name());
d.removeDuplicates(); d.removeDuplicates();
return d; return d;
@ -461,24 +461,25 @@ public class VirtualDecreeCommand {
} }
if (sender.isPlayer() && i.isContextual() && value == null) { if (sender.isPlayer() && i.isContextual() && value == null) {
Iris.debug("Contextual!");
DecreeContextHandler<?> ch = DecreeContextHandler.contextHandlers.get(i.getType()); DecreeContextHandler<?> ch = DecreeContextHandler.contextHandlers.get(i.getType());
if (ch != null) { if (ch != null) {
value = ch.handle(sender); value = ch.handle(sender);
if (value != null) { 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 { } 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 { } 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) { if (i.hasDefault() && value == null) {
try { 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(); value = i.getDefaultValue();
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
@ -486,7 +487,8 @@ public class VirtualDecreeCommand {
} }
if (i.isRequired() && value == null) { 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; return false;
} }

View File

@ -470,7 +470,6 @@ public class Mantle {
} catch (Throwable e) { } catch (Throwable e) {
Iris.error("Failed to read Tectonic Plate " + file.getAbsolutePath() + " creating a new chunk instead."); Iris.error("Failed to read Tectonic Plate " + file.getAbsolutePath() + " creating a new chunk instead.");
Iris.reportError(e); Iris.reportError(e);
e.printStackTrace();
region = new TectonicPlate(worldHeight, x, z); region = new TectonicPlate(worldHeight, x, z);
loadedRegions.put(k, region); loadedRegions.put(k, region);
Iris.debug("Created new Tectonic Plate (Due to Load Failure) " + C.DARK_GREEN + x + " " + z); Iris.debug("Created new Tectonic Plate (Due to Load Failure) " + C.DARK_GREEN + x + " " + z);

View File

@ -544,7 +544,8 @@ public class VolmitSender implements CommandSender {
String nDescription = "<#3fe05a>✎ <#6ad97d><font:minecraft:uniform>" + p.getDescription(); String nDescription = "<#3fe05a>✎ <#6ad97d><font:minecraft:uniform>" + p.getDescription();
String nUsage; String nUsage;
String fullTitle; String fullTitle;
if (p.isContextual() && isPlayer()) { Iris.debug("Contextual: " + p.isContextual() + " / player: " + isPlayer());
if (p.isContextual() && (isPlayer() || s instanceof CommandDummy)) {
fullTitle = "<#ffcc00>[" + nTitle + "<#ffcc00>] "; fullTitle = "<#ffcc00>[" + nTitle + "<#ffcc00>] ";
nUsage = "<#ff9900>➱ <#ffcc00><font:minecraft:uniform>The value may be derived from environment context."; nUsage = "<#ff9900>➱ <#ffcc00><font:minecraft:uniform>The value may be derived from environment context.";
} else if (p.isRequired()) { } else if (p.isRequired()) {