From 8ffd716190b1a3babebf27006fae7b390ce27728 Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Sun, 10 Sep 2023 13:34:36 -0400 Subject: [PATCH] Fix some checkstyle issues. --- .../MultiverseCore/commands/CloneCommand.java | 2 +- .../commands/CreateCommand.java | 3 +-- .../commands/DeleteCommand.java | 20 ++++++++----------- .../commands/ImportCommand.java | 17 ++++++++-------- .../MultiverseCore/utils/MVCorei18n.java | 6 ++++-- .../utils/result/package-info.java | 1 + 6 files changed, 24 insertions(+), 25 deletions(-) create mode 100644 src/main/java/com/onarandombox/MultiverseCore/utils/result/package-info.java diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/CloneCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/CloneCommand.java index 9138a178..17bb67b7 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/CloneCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/CloneCommand.java @@ -63,7 +63,7 @@ public class CloneCommand extends MultiverseCommand { String newWorldName, @Optional - @Syntax("") // TODO + @Syntax(/* TODO */ "") @Description("{@@mv-core.regen.other.description}") String[] flags) { ParsedCommandFlags parsedFlags = parseFlags(flags); diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java index e5021218..bcb4f87b 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/CreateCommand.java @@ -82,8 +82,7 @@ public class CreateCommand extends MultiverseCommand { @Optional @Syntax("--seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures") @Description("{@@mv-core.create.flags.description}") - String[] flags - ) { + String[] flags) { ParsedCommandFlags parsedFlags = parseFlags(flags); issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES, "{worldName}", worldName); diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/DeleteCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/DeleteCommand.java index f8b34799..e23c4a02 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/DeleteCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/DeleteCommand.java @@ -49,18 +49,14 @@ public class DeleteCommand extends MultiverseCommand { issuer.getIssuer(), () -> { issuer.sendInfo(MVCorei18n.DELETE_DELETING, "{world}", worldName); - try { - worldManager.deleteWorld(worldName) - .onSuccess(deletedWorldName -> { - Logging.fine("World delete success: " + deletedWorldName); - issuer.sendInfo(MVCorei18n.DELETE_SUCCESS, "{world}", deletedWorldName); - }).onFailure(failure -> { - Logging.fine("World delete failure: " + failure); - issuer.sendError(failure.getFailureMessage()); - }); - } catch (Exception e) { - e.printStackTrace(); - } + worldManager.deleteWorld(worldName) + .onSuccess(deletedWorldName -> { + Logging.fine("World delete success: " + deletedWorldName); + issuer.sendInfo(MVCorei18n.DELETE_SUCCESS, "{world}", deletedWorldName); + }).onFailure(failure -> { + Logging.fine("World delete failure: " + failure); + issuer.sendError(failure.getFailureMessage()); + }); }, this.commandManager.formatMessage( issuer, diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java index 11c5d012..7031f8f7 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java @@ -78,13 +78,14 @@ public class ImportCommand extends MultiverseCommand { worldManager.importWorld(ImportWorldOptions.worldName(worldName) .environment(environment) .generator(parsedFlags.flagValue("--generator", String.class)) - .useSpawnAdjust(parsedFlags.hasFlag("--adjust-spawn")) - ).onSuccess(newWorld -> { - Logging.fine("World import success: " + newWorld); - issuer.sendInfo(MVCorei18n.IMPORT_SUCCESS, "{world}", newWorld.getName()); - }).onFailure(failure -> { - Logging.fine("World import failure: " + failure); - issuer.sendError(failure.getFailureMessage()); - }); + .useSpawnAdjust(parsedFlags.hasFlag("--adjust-spawn"))) + .onSuccess(newWorld -> { + Logging.fine("World import success: " + newWorld); + issuer.sendInfo(MVCorei18n.IMPORT_SUCCESS, "{world}", newWorld.getName()); + }) + .onFailure(failure -> { + Logging.fine("World import failure: " + failure); + issuer.sendError(failure.getFailureMessage()); + }); } } diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/MVCorei18n.java b/src/main/java/com/onarandombox/MultiverseCore/utils/MVCorei18n.java index dd4faa47..fcfe1bea 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/MVCorei18n.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/MVCorei18n.java @@ -7,6 +7,8 @@ import com.onarandombox.MultiverseCore.utils.message.MessageReplacement; import org.jetbrains.annotations.NotNull; public enum MVCorei18n implements MessageKeyProvider { + // BEGIN CHECKSTYLE-SUPPRESSION: Javadoc + // config status CONFIG_SAVE_FAILED, CONFIG_NODE_NOTFOUND, @@ -140,9 +142,9 @@ public enum MVCorei18n implements MessageKeyProvider { // generic GENERIC_SUCCESS, - GENERIC_FAILURE + GENERIC_FAILURE; - ; + // END CHECKSTYLE-SUPPRESSION: Javadoc private final MessageKey key = MessageKey.of("mv-core." + this.name().replace('_', '.').toLowerCase()); diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/result/package-info.java b/src/main/java/com/onarandombox/MultiverseCore/utils/result/package-info.java new file mode 100644 index 00000000..b4b03292 --- /dev/null +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/result/package-info.java @@ -0,0 +1 @@ +package com.onarandombox.MultiverseCore.utils.result;