diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java index 914b2b066..1ea4883ac 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java @@ -12,13 +12,10 @@ import org.mvplugins.multiverse.core.command.flag.CommandFlagsManager; import org.mvplugins.multiverse.core.command.flag.FlagBuilder; -import org.mvplugins.multiverse.core.commands.DumpsLogPoster.LogsType; +import org.mvplugins.multiverse.core.command.flag.ParsedCommandFlags; import org.mvplugins.multiverse.core.commands.DumpsLogPoster.UploadType; import org.mvplugins.multiverse.core.command.MVCommandIssuer; -import org.mvplugins.multiverse.core.command.MVCommandManager; -import org.mvplugins.multiverse.core.command.flag.CommandFlag; import org.mvplugins.multiverse.core.command.flag.CommandValueFlag; -import org.mvplugins.multiverse.core.command.flag.ParsedCommandFlags; @Service final class DumpsCommand extends CoreCommand { @@ -35,22 +32,17 @@ final class DumpsCommand extends CoreCommand { @Subcommand("dumps") @CommandPermission("multiverse.core.dumps") @CommandCompletion("@flags:groupName=" + Flags.NAME) - @Syntax("[--logs ] [--upload ] [--paranoid]") + @Syntax("[--upload ]") @Description("{@@mv-core.dumps.description}") void onDumpsCommand( MVCommandIssuer issuer, @Optional - @Syntax("[--logs ] [--upload ] [--paranoid]") + @Syntax("[--upload ]") String[] flagArray) { ParsedCommandFlags parsedFlags = flags.parse(flagArray); - - // Grab all our flags - boolean paranoid = parsedFlags.hasFlag(flags.paranoid); - LogsType logsType = parsedFlags.flagValue(flags.logs, LogsType.MCLOGS); UploadType servicesType = parsedFlags.flagValue(flags.upload, UploadType.PASTESDEV); - - dumpsService.postLogs(issuer, logsType, servicesType, paranoid); + dumpsService.postLogs(issuer, servicesType); } @Service @@ -63,19 +55,9 @@ private Flags(@NotNull CommandFlagsManager flagsManager) { super(NAME, flagsManager); } - private final CommandValueFlag logs = flag(CommandValueFlag - .enumBuilder("--logs", LogsType.class) - .addAlias("-l") - .build()); - private final CommandValueFlag upload = flag(CommandValueFlag .enumBuilder("--upload", UploadType.class) .addAlias("-u") .build()); - - // Does not upload logs or plugin list (except if --logs mclogs is there) - private final CommandFlag paranoid = flag(CommandFlag.builder("--paranoid") - .addAlias("-p") - .build()); } } diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/DumpsLogPoster.java b/src/main/java/org/mvplugins/multiverse/core/commands/DumpsLogPoster.java index 8b3f51fe8..d0511d639 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/DumpsLogPoster.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/DumpsLogPoster.java @@ -1,11 +1,19 @@ package org.mvplugins.multiverse.core.commands; +import java.lang.management.ManagementFactory; +import java.time.Instant; +import java.util.Date; import java.util.Map; import com.dumptruckman.minecraft.util.Logging; +import io.vavr.control.Option; +import net.minidev.json.JSONArray; +import net.minidev.json.JSONObject; +import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; +import org.mvplugins.multiverse.core.MultiverseCore; import org.mvplugins.multiverse.core.command.MVCommandIssuer; import org.mvplugins.multiverse.core.event.MVDumpsDebugInfoEvent; import org.mvplugins.multiverse.core.locale.MVCorei18n; @@ -18,8 +26,10 @@ final class DumpsLogPoster extends BukkitRunnable { enum UploadType { // BEGIN CHECKSTYLE-SUPPRESSION: JavadocVariable - PASTEGG(PasteServiceType.PASTEGG, "paste.gg"), - PASTESDEV(PasteServiceType.PASTESDEV, "pastes.dev"); + // PASTEBIN(PasteServiceType.PASTEBIN, "pastebin.com"), + PASTESDEV(PasteServiceType.PASTESDEV, "pastes.dev"), + MCLOGS(PasteServiceType.MCLOGS, "mclo.gs"), + ; // END CHECKSTYLE-SUPPRESSION: JavadocVariable private final PasteServiceType pasteServiceType; @@ -31,34 +41,21 @@ enum UploadType { } } - enum LogsType { - /** - * Appends the log file to the debug info. - */ - APPEND, - /** - * Uploads the log file to a paste service. - */ - MCLOGS - } - + @NotNull + private final MultiverseCore plugin; private final MVCommandIssuer issuer; - private final LogsType logsType; private final UploadType uploadType; - private final boolean paranoid; private final String logs; private final MVDumpsDebugInfoEvent versionEvent; - DumpsLogPoster(@NotNull MVCommandIssuer issuer, - @NotNull DumpsLogPoster.LogsType logsType, + DumpsLogPoster(@NotNull MultiverseCore core, + @NotNull MVCommandIssuer issuer, @NotNull DumpsLogPoster.UploadType uploadType, - boolean paranoid, @NotNull String logs, @NotNull MVDumpsDebugInfoEvent versionEvent) { + this.plugin = core; this.issuer = issuer; - this.logsType = logsType; this.uploadType = uploadType; - this.paranoid = paranoid; this.logs = logs; this.versionEvent = versionEvent; } @@ -69,24 +66,12 @@ public void run() { handleVersionEvent(); } - @SuppressWarnings("checkstyle:MissingSwitchDefault") private void handleLogs() { - Logging.finer("Logs type is: " + logsType); - - if (!paranoid) { - switch (logsType) { - case MCLOGS -> sendDumpsUrl("Logs", postRawDataToMcLogs(logs)); - case APPEND -> versionEvent.putDetailedDebugInfo("latest.log", logs); - default -> Logging.finer("Not uploading logs."); - } - } else { - Logging.finer("Paranoid mode is on, not uploading logs."); - } + versionEvent.putDetailedDebugInfo("latest.log", logs); } private void handleVersionEvent() { Logging.finer("Upload service is: " + uploadType); - final Map files = versionEvent.getDetailedDebugInfo(); sendDumpsUrl(uploadType.serviceName, postFilesToService(files)); } @@ -95,37 +80,69 @@ private void sendDumpsUrl(String service, String url) { issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST, "{service}", service, "{link}", url); } - private String postRawDataToMcLogs(@NotNull String rawPasteData) { - PasteService pasteService = PasteServiceFactory.getService(PasteServiceType.MCLOGS, true); - - return pasteToService(() -> pasteService.postData(rawPasteData)); + private String postFilesToService(@NotNull Map pasteFiles) { + PasteService pasteService = PasteServiceFactory.getService(uploadType.pasteServiceType, false); + return pasteToService(() -> pasteService.postData(encodePasteAsJson(pasteFiles))); } - private String postFilesToService(@NotNull Map pasteFiles) { - PasteService pasteService = PasteServiceFactory.getService(uploadType.pasteServiceType, true); + private String encodePasteAsJson(Map files) { + JSONObject rootObject = new JSONObject(); + JSONArray plugins = new JSONArray(); + JSONArray filesObject = new JSONArray(); + + for (Plugin plugin : plugin.getServer().getPluginManager().getPlugins()) { + plugins.add(new JSONObject(Map.of( + "name", plugin.getName(), + "version", plugin.getDescription().getVersion(), + "description", Option.of(plugin.getDescription().getDescription()).getOrElse(""), + "authors", plugin.getDescription().getAuthors(), + "website", Option.of(plugin.getDescription().getWebsite()).getOrElse(""), + "enabled", plugin.isEnabled() + ))); + } - return pasteToService(() -> { - if (pasteService.supportsMultiFile()) { - return pasteService.postData(pasteFiles); - } else { - return pasteService.postData(this.encodeAsString(pasteFiles)); + for (Map.Entry entry : files.entrySet()) { + String fileType = "text"; + if (entry.getKey().endsWith(".yml") || entry.getKey().endsWith(".yaml")) { + fileType = "yaml"; + } else if (entry.getKey().endsWith(".json")) { + fileType = "json"; + } else if (entry.getKey().endsWith(".md")) { + fileType = "markdown"; + } else if (entry.getKey().endsWith(".log")) { + fileType = "accesslog"; } - }); - } - private String encodeAsString(Map files) { - StringBuilder uploadData = new StringBuilder(); - for (Map.Entry entry : files.entrySet()) { - String file = entry.getKey(); - String data = entry.getValue(); - uploadData.append("# ---------- ") - .append(file) - .append(" ----------\n\n") - .append(data) - .append("\n\n"); + filesObject.add(new JSONObject(Map.of( + "name", entry.getKey(), + "data", entry.getValue(), + "type", fileType + ))); } + rootObject.put("server", new JSONObject(Map.of( + "name", plugin.getServer().getName(), + "version", plugin.getServer().getVersion(), + "bukkitVersion", plugin.getServer().getBukkitVersion(), + "onlineMode", plugin.getServer().getOnlineMode(), + "javaVersion", Runtime.version().toString(), + "operatingSystem", System.getProperty("os.name") + " " + System.getProperty("os.version") + " " + System.getProperty("os.arch"), + "uptime", calculateUptimeString(), + "memory", (Runtime.getRuntime().totalMemory() / 1024 / 1024) + " MB" + ))); + rootObject.put("plugins", plugins); + rootObject.put("files", filesObject); + rootObject.put("createdAt", Instant.now().toString()); + + return rootObject.toJSONString(); + } - return uploadData.toString(); + private String calculateUptimeString() { + long uptimeMs = System.currentTimeMillis() - ManagementFactory.getRuntimeMXBean().getStartTime(); + long totalSeconds = uptimeMs / 1000; + long hours = totalSeconds / 3600; + long minutes = (totalSeconds % 3600) / 60; + long seconds = totalSeconds % 60; + return String.format("%d hrs, %d mins, %d sec", hours, minutes, seconds); } private String pasteToService(LogPaster paster) { diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/DumpsService.java b/src/main/java/org/mvplugins/multiverse/core/commands/DumpsService.java index 18cc263fd..7f3b8b103 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/DumpsService.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/DumpsService.java @@ -5,17 +5,15 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Arrays; import com.dumptruckman.minecraft.util.Logging; import jakarta.inject.Inject; -import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.jvnet.hk2.annotations.Service; import org.mvplugins.multiverse.core.MultiverseCore; +import org.mvplugins.multiverse.core.locale.MVCorei18n; import org.mvplugins.multiverse.core.module.MultiverseModulesRegistry; -import org.mvplugins.multiverse.core.commands.DumpsLogPoster.LogsType; import org.mvplugins.multiverse.core.commands.DumpsLogPoster.UploadType; import org.mvplugins.multiverse.core.command.MVCommandIssuer; import org.mvplugins.multiverse.core.event.MVDumpsDebugInfoEvent; @@ -39,16 +37,12 @@ final class DumpsService { this.fileUtils = fileUtils; } - void postLogs(MVCommandIssuer issuer, LogsType logsType, UploadType servicesType, boolean paranoid) { + void postLogs(MVCommandIssuer issuer, UploadType servicesType) { + issuer.sendInfo(MVCorei18n.DUMPS_STARTING); + // Initialise and add info to the debug event MVDumpsDebugInfoEvent versionEvent = createAndCallDebugInfoEvent(); - - // Add plugin list if user isn't paranoid - if (!paranoid) { - versionEvent.putDetailedDebugInfo("plugins.md", "# Plugins\n\n" + getPluginList()); - } - - new DumpsLogPoster(issuer, logsType, servicesType, paranoid, getLogs(), versionEvent) + new DumpsLogPoster(plugin, issuer, servicesType, getLogs(), versionEvent) .runTaskAsynchronously(plugin); } @@ -73,18 +67,18 @@ void postLogs(MVCommandIssuer issuer, LogsType logsType, UploadType servicesType private @NotNull String readLogsFromFile(Path logsPath) { String logs = "Could not read log"; - // Try reading as ANSI encoded + // Try reading as UTF-8 first try { logs = Files.readString(logsPath, StandardCharsets.UTF_8); } catch (IOException e) { - Logging.severe("Could not read logs/latest.log. See below for stack trace"); + Logging.severe("Could not read logs/latest.log as UTF-8. Trying ISO-8859-1. See below for stack trace"); e.printStackTrace(); try { - logs = Files.readString(logsPath, StandardCharsets.UTF_8); + logs = Files.readString(logsPath, StandardCharsets.ISO_8859_1); } catch (IOException ex) { // It is some other strange encoding - Logging.severe("Could not read ./logs/latest.log. See below for stack trace"); + Logging.severe("Could not read ./logs/latest.log as ISO-8859-1. See below for stack trace"); ex.printStackTrace(); } } @@ -92,15 +86,6 @@ void postLogs(MVCommandIssuer issuer, LogsType logsType, UploadType servicesType return logs; } - private String getDebugInfoString() { - return "# Multiverse-Core Version info" + "\n\n" - + " - Multiverse-Core Version: " + this.plugin.getDescription().getVersion() + '\n' - + " - Bukkit Version: " + this.plugin.getServer().getVersion() + '\n' - + " - Loaded Worlds: " + worldManager.getLoadedWorlds() + '\n' - + " - Multiverse Plugins Loaded: " + StringFormatter.joinAnd(MultiverseModulesRegistry.get().getRegisteredPlugins()) + '\n' - + " - Multiverse Plugins Count: " + MultiverseModulesRegistry.get().getPluginCount() + '\n'; - } - private MVDumpsDebugInfoEvent createAndCallDebugInfoEvent() { MVDumpsDebugInfoEvent event = new MVDumpsDebugInfoEvent(); addDebugInfoToEvent(event); @@ -112,34 +97,63 @@ private void addDebugInfoToEvent(MVDumpsDebugInfoEvent event) { // Add the legacy file, but as markdown, so it's readable event.putDetailedDebugInfo("version.md", this.getDebugInfoString()); - // add config.yml - File configFile = new File(plugin.getDataFolder(), "config.yml"); - event.putDetailedDebugInfo("Multiverse-Core/config.yml", configFile); - - // add worlds.yml - File worldsFile = new File(plugin.getDataFolder(), "worlds.yml"); - event.putDetailedDebugInfo("Multiverse-Core/worlds.yml", worldsFile); + // Add server.properties if we found it + if (fileUtils.getServerProperties() != null) { + event.putDetailedDebugInfo(fileUtils.getServerProperties().getName(), fileUtils.getServerProperties()); + } else { + Logging.warning("/mv dumps could not find server.properties. Not including file"); + } // Add bukkit.yml if we found it if (fileUtils.getBukkitConfig() != null) { - event.putDetailedDebugInfo(fileUtils.getBukkitConfig().getPath(), fileUtils.getBukkitConfig()); + event.putDetailedDebugInfo(fileUtils.getBukkitConfig().getName(), fileUtils.getBukkitConfig()); } else { Logging.warning("/mv dumps could not find bukkit.yml. Not including file"); } - // Add server.properties if we found it - if (fileUtils.getServerProperties() != null) { - event.putDetailedDebugInfo(fileUtils.getServerProperties().getPath(), fileUtils.getServerProperties()); + // Add spigot.yml + File spigotYml = fileUtils.getServerFolder().toPath().resolve("spigot.yml").toFile(); + if (spigotYml.isFile()) { + event.putDetailedDebugInfo(spigotYml.getName(), spigotYml); } else { - Logging.warning("/mv dumps could not find server.properties. Not including file"); + Logging.warning("/mv dumps could not find spigot.yml. Not including file"); + } + + // Add paper-global.yml + File paperGlobalYml = fileUtils.getServerFolder().toPath().resolve("config/paper-global.yml").toFile(); + if (paperGlobalYml.isFile()) { + event.putDetailedDebugInfo(paperGlobalYml.getName(), paperGlobalYml); + } else { + Logging.warning("/mv dumps could not find paper-global.yml. Not including file"); } + // add paper-world-defaults.yml + File paperWorldDefaultsYml = fileUtils.getServerFolder().toPath().resolve("config/paper-world-defaults.yml").toFile(); + if (paperWorldDefaultsYml.isFile()) { + event.putDetailedDebugInfo(paperWorldDefaultsYml.getName(), paperWorldDefaultsYml); + } else { + Logging.warning("/mv dumps could not find paper-global.yml. Not including file"); + } + + // add multiverse-core config.yml + File configFile = new File(plugin.getDataFolder(), "config.yml"); + event.putDetailedDebugInfo("multiverse-core/config.yml", configFile); + + // add multiverse-core worlds.yml + File worldsFile = new File(plugin.getDataFolder(), "worlds.yml"); + event.putDetailedDebugInfo("multiverse-core/worlds.yml", worldsFile); + + // add multiverse-core anchors.yml + File anchorsFile = new File(plugin.getDataFolder(), "anchors.yml"); + event.putDetailedDebugInfo("multiverse-core/anchors.yml", anchorsFile); } - private String getPluginList() { - return " - " + StringUtils.join(Arrays.stream(plugin.getServer().getPluginManager().getPlugins()) - .map(Object::toString) - .sorted() - .toList(), "\n - "); + private String getDebugInfoString() { + return "# Multiverse-Core Version info" + "\n\n" + + " - Multiverse-Core Version: " + this.plugin.getDescription().getVersion() + '\n' + + " - Bukkit Version: " + this.plugin.getServer().getVersion() + '\n' + + " - Loaded Worlds: " + worldManager.getLoadedWorlds() + '\n' + + " - Multiverse Plugins Loaded: " + StringFormatter.joinAnd(MultiverseModulesRegistry.get().getRegisteredPlugins()) + '\n' + + " - Multiverse Plugins Count: " + MultiverseModulesRegistry.get().getPluginCount() + '\n'; } } diff --git a/src/main/java/org/mvplugins/multiverse/core/event/MVDumpsDebugInfoEvent.java b/src/main/java/org/mvplugins/multiverse/core/event/MVDumpsDebugInfoEvent.java index 34f46fc58..846b1dbb0 100644 --- a/src/main/java/org/mvplugins/multiverse/core/event/MVDumpsDebugInfoEvent.java +++ b/src/main/java/org/mvplugins/multiverse/core/event/MVDumpsDebugInfoEvent.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.util.Collections; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import com.dumptruckman.minecraft.util.Logging; @@ -24,7 +25,7 @@ public final class MVDumpsDebugInfoEvent extends Event { public MVDumpsDebugInfoEvent() { debugInfoBuilder = new StringBuilder(); - detailedDebugInfo = new HashMap<>(); + detailedDebugInfo = new LinkedHashMap<>(); } private static final HandlerList HANDLERS = new HandlerList(); diff --git a/src/main/java/org/mvplugins/multiverse/core/locale/MVCorei18n.java b/src/main/java/org/mvplugins/multiverse/core/locale/MVCorei18n.java index 6948d8f7b..d52768b71 100644 --- a/src/main/java/org/mvplugins/multiverse/core/locale/MVCorei18n.java +++ b/src/main/java/org/mvplugins/multiverse/core/locale/MVCorei18n.java @@ -91,6 +91,7 @@ public enum MVCorei18n implements MessageKeyProvider { // /mv dumps DUMPS_DESCRIPTION, + DUMPS_STARTING, DUMPS_URL_LIST, // /mv gamerule set diff --git a/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/HttpAPIClient.java b/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/HttpAPIClient.java index 47e743bc7..3de5c9be0 100644 --- a/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/HttpAPIClient.java +++ b/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/HttpAPIClient.java @@ -16,6 +16,9 @@ * HTTP API-client. */ abstract sealed class HttpAPIClient permits PasteService, URLShortener { + + static final String DUMPS_VIEWER_URL = "https://multiverse-dumps.c0ding.party/"; + /** * The URL for this API-request, and if necessary, the access token. * If an access token is not necessary, it should be set to null. diff --git a/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/McloGsPasteService.java b/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/McloGsPasteService.java index 8101cbf80..b5a9cbd21 100644 --- a/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/McloGsPasteService.java +++ b/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/McloGsPasteService.java @@ -34,7 +34,8 @@ String encodeData(Map data) { public String postData(String data) throws PasteFailedException { try { String stringJSON = this.exec(encodeData(data), ContentType.URLENCODED); // Execute request - return String.valueOf(((JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(stringJSON)).get("url")); // Interpret result + return DUMPS_VIEWER_URL + "?service=mclogs&id=" + + ((JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(stringJSON)).get("id"); } catch (IOException | ParseException e) { throw new PasteFailedException(e); } @@ -44,7 +45,8 @@ public String postData(String data) throws PasteFailedException { public String postData(Map data) throws PasteFailedException { try { String stringJSON = this.exec(encodeData(data), ContentType.JSON); // Execute request - return String.valueOf(((JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(stringJSON)).get("url")); // Interpret result + return DUMPS_VIEWER_URL + "?service=mclogs&id=" + + ((JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(stringJSON)).get("id"); } catch (IOException | ParseException e) { throw new PasteFailedException(e); } diff --git a/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/PastebinPasteService.java b/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/PastebinPasteService.java index 7b5232852..561abc590 100644 --- a/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/PastebinPasteService.java +++ b/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/PastebinPasteService.java @@ -26,7 +26,7 @@ String encodeData(String data) { "&" + URLEncoder.encode("api_option", StandardCharsets.UTF_8) + "=" + URLEncoder.encode("paste", StandardCharsets.UTF_8) + "&" + URLEncoder.encode("api_paste_code", StandardCharsets.UTF_8) + "=" + URLEncoder.encode(data, StandardCharsets.UTF_8) + "&" + URLEncoder.encode("api_paste_private", StandardCharsets.UTF_8) + "=" + URLEncoder.encode(this.isPrivate ? "1" : "0", StandardCharsets.UTF_8) + - "&" + URLEncoder.encode("api_paste_format", StandardCharsets.UTF_8) + "=" + URLEncoder.encode("yaml", StandardCharsets.UTF_8) + + "&" + URLEncoder.encode("api_paste_format", StandardCharsets.UTF_8) + "=" + URLEncoder.encode("json", StandardCharsets.UTF_8) + "&" + URLEncoder.encode("api_paste_name", StandardCharsets.UTF_8) + "=" + URLEncoder.encode("Multiverse-Core Debug Info", StandardCharsets.UTF_8); } diff --git a/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/PastesDevPasteService.java b/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/PastesDevPasteService.java index 719f2af70..4a72b9337 100644 --- a/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/PastesDevPasteService.java +++ b/src/main/java/org/mvplugins/multiverse/core/utils/webpaste/PastesDevPasteService.java @@ -39,8 +39,9 @@ String encodeData(Map data) { @Override public String postData(String data) throws PasteFailedException { try { - String stringJSON = this.exec(encodeData(data), ContentType.PLAINTEXT_YAML); - return "https://pastes.dev/" + ((JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(stringJSON)).get("key"); + String stringJSON = this.exec(encodeData(data), ContentType.JSON); + return DUMPS_VIEWER_URL + "?id=" + + ((JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(stringJSON)).get("key"); } catch (IOException | ParseException e) { throw new PasteFailedException(e); } diff --git a/src/main/resources/multiverse-core_en.properties b/src/main/resources/multiverse-core_en.properties index e20aebb12..374a0372b 100644 --- a/src/main/resources/multiverse-core_en.properties +++ b/src/main/resources/multiverse-core_en.properties @@ -72,7 +72,8 @@ mv-core.delete.success=&aWorld '{world}' deleted! # /mv dumps mv-core.dumps.description=Dumps version info to the console or paste services -mv-core.dumps.url.list={service} : {link} +mv-core.dumps.starting=Gathering logs and debug info... +mv-core.dumps.url.list=Uploaded dumps with {service} backend:\n{link} # /mv gamerule set mv-core.gamerule.set.description=Changes a gamerule in one or more worlds.