Rename MVDumpsDebugInfoEvent methods to reflect the class name change

This commit is contained in:
Ben Woo 2024-11-24 13:26:22 +08:00
parent 8d852c5269
commit d0774614c8
2 changed files with 23 additions and 23 deletions

View File

@ -105,7 +105,7 @@ class DumpsCommand extends CoreCommand {
// Add plugin list if user isn't paranoid // Add plugin list if user isn't paranoid
if (!paranoid) { if (!paranoid) {
versionEvent.putDetailedVersionInfo("plugins.md", "# Plugins\n\n" + getPluginList()); versionEvent.putDetailedDebugInfo("plugins.md", "# Plugins\n\n" + getPluginList());
} }
BukkitRunnable logPoster = new BukkitRunnable() { BukkitRunnable logPoster = new BukkitRunnable() {
@ -121,12 +121,12 @@ class DumpsCommand extends CoreCommand {
case MCLOGS -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST, case MCLOGS -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
"{service}", "Logs", "{service}", "Logs",
"{link}", postToService(PasteServiceType.MCLOGS, true, getLogs(), null)); "{link}", postToService(PasteServiceType.MCLOGS, true, getLogs(), null));
case APPEND -> versionEvent.putDetailedVersionInfo("latest.log", getLogs()); case APPEND -> versionEvent.putDetailedDebugInfo("latest.log", getLogs());
} }
} }
// Get the files from the event // Get the files from the event
final Map<String, String> files = versionEvent.getDetailedVersionInfo(); final Map<String, String> files = versionEvent.getDetailedDebugInfo();
// Deal with uploading debug info // Deal with uploading debug info
switch (servicesType) { switch (servicesType) {
@ -179,7 +179,7 @@ class DumpsCommand extends CoreCommand {
return "Could not read log"; return "Could not read log";
} }
private String getVersionString() { private String getDebugInfoString() {
return "# Multiverse-Core Version info" + "\n\n" return "# Multiverse-Core Version info" + "\n\n"
+ " - Multiverse-Core Version: " + this.plugin.getDescription().getVersion() + '\n' + " - Multiverse-Core Version: " + this.plugin.getDescription().getVersion() + '\n'
+ " - Bukkit Version: " + this.plugin.getServer().getVersion() + '\n' + " - Bukkit Version: " + this.plugin.getServer().getVersion() + '\n'
@ -189,26 +189,26 @@ class DumpsCommand extends CoreCommand {
private void addDebugInfoToEvent(MVDumpsDebugInfoEvent event) { private void addDebugInfoToEvent(MVDumpsDebugInfoEvent event) {
// Add the legacy file, but as markdown, so it's readable // Add the legacy file, but as markdown, so it's readable
event.putDetailedVersionInfo("version.md", this.getVersionString()); event.putDetailedDebugInfo("version.md", this.getDebugInfoString());
// add config.yml // add config.yml
File configFile = new File(plugin.getDataFolder(), "config.yml"); File configFile = new File(plugin.getDataFolder(), "config.yml");
event.putDetailedVersionInfo("multiverse-core/config.yml", configFile); event.putDetailedDebugInfo("multiverse-core/config.yml", configFile);
// add worlds.yml // add worlds.yml
File worldsFile = new File(plugin.getDataFolder(), "worlds.yml"); File worldsFile = new File(plugin.getDataFolder(), "worlds.yml");
event.putDetailedVersionInfo("multiverse-core/worlds.yml", worldsFile); event.putDetailedDebugInfo("multiverse-core/worlds.yml", worldsFile);
// Add bukkit.yml if we found it // Add bukkit.yml if we found it
if (getBukkitConfig() != null) { if (getBukkitConfig() != null) {
event.putDetailedVersionInfo(getBukkitConfig().getPath(), getBukkitConfig()); event.putDetailedDebugInfo(getBukkitConfig().getPath(), getBukkitConfig());
} else { } else {
Logging.warning("/mv version could not find bukkit.yml. Not including file"); Logging.warning("/mv version could not find bukkit.yml. Not including file");
} }
// Add server.properties if we found it // Add server.properties if we found it
if (getServerProperties() != null) { if (getServerProperties() != null) {
event.putDetailedVersionInfo(getServerProperties().getPath(), getServerProperties()); event.putDetailedDebugInfo(getServerProperties().getPath(), getServerProperties());
} else { } else {
Logging.warning("/mv version could not find server.properties. Not including file"); Logging.warning("/mv version could not find server.properties. Not including file");
} }

View File

@ -18,12 +18,12 @@ import org.bukkit.event.HandlerList;
*/ */
public class MVDumpsDebugInfoEvent extends Event { public class MVDumpsDebugInfoEvent extends Event {
private final StringBuilder versionInfoBuilder; private final StringBuilder debugInfoBuilder;
private final Map<String, String> detailedVersionInfo; private final Map<String, String> detailedDebugInfo;
public MVDumpsDebugInfoEvent() { public MVDumpsDebugInfoEvent() {
versionInfoBuilder = new StringBuilder(); debugInfoBuilder = new StringBuilder();
detailedVersionInfo = new HashMap<>(); detailedDebugInfo = new HashMap<>();
} }
private static final HandlerList HANDLERS = new HandlerList(); private static final HandlerList HANDLERS = new HandlerList();
@ -48,8 +48,8 @@ public class MVDumpsDebugInfoEvent extends Event {
* Gets the version-info currently saved in this event. * Gets the version-info currently saved in this event.
* @return The version-info. * @return The version-info.
*/ */
public String getVersionInfo() { public String getDebugInfo() {
return this.versionInfoBuilder.toString(); return this.debugInfoBuilder.toString();
} }
/** /**
@ -63,16 +63,16 @@ public class MVDumpsDebugInfoEvent extends Event {
* *
* @return The immutable key value mapping of files and the contents of those files. * @return The immutable key value mapping of files and the contents of those files.
*/ */
public Map<String, String> getDetailedVersionInfo() { public Map<String, String> getDetailedDebugInfo() {
return Collections.unmodifiableMap(this.detailedVersionInfo); return Collections.unmodifiableMap(this.detailedDebugInfo);
} }
/** /**
* Appends more version-info to the version-info currently saved in this event. * Appends more version-info to the version-info currently saved in this event.
* @param moreVersionInfo The version-info to add. Should end with '\n'. * @param moreVersionInfo The version-info to add. Should end with '\n'.
*/ */
public void appendVersionInfo(String moreVersionInfo) { public void appendDebugInfo(String moreVersionInfo) {
this.versionInfoBuilder.append(moreVersionInfo); this.debugInfoBuilder.append(moreVersionInfo);
} }
private String readFile(final String filename) { private String readFile(final String filename) {
@ -104,8 +104,8 @@ public class MVDumpsDebugInfoEvent extends Event {
* @param fileName The name of the file. * @param fileName The name of the file.
* @param contents The contents of the file. * @param contents The contents of the file.
*/ */
public void putDetailedVersionInfo(String fileName, String contents) { public void putDetailedDebugInfo(String fileName, String contents) {
this.detailedVersionInfo.put(fileName, contents); this.detailedDebugInfo.put(fileName, contents);
} }
/** /**
@ -113,7 +113,7 @@ public class MVDumpsDebugInfoEvent extends Event {
* @param filename The name of the file. * @param filename The name of the file.
* @param file The file. * @param file The file.
*/ */
public void putDetailedVersionInfo(String filename, File file) { public void putDetailedDebugInfo(String filename, File file) {
this.putDetailedVersionInfo(filename, readFile(file.getAbsolutePath())); this.putDetailedDebugInfo(filename, readFile(file.getAbsolutePath()));
} }
} }