Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@

import org.mvplugins.multiverse.core.MultiverseCore;
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand;
import org.mvplugins.multiverse.core.commandtools.flags.CommandFlag;
import org.mvplugins.multiverse.core.commandtools.flags.CommandValueFlag;
import org.mvplugins.multiverse.core.commandtools.flags.ParsedCommandFlags;
import org.mvplugins.multiverse.core.event.MVVersionEvent;
import org.mvplugins.multiverse.core.event.MVDumpsDebugInfoEvent;
import org.mvplugins.multiverse.core.utils.MVCorei18n;
import org.mvplugins.multiverse.core.utils.webpaste.PasteFailedException;
import org.mvplugins.multiverse.core.utils.webpaste.PasteService;
Expand Down Expand Up @@ -100,13 +99,13 @@
final ServiceTypeOption servicesType = parsedFlags.flagValue(UPLOAD_FLAG, ServiceTypeOption.PASTEGG);

// Initialise and add info to the debug event
MVVersionEvent versionEvent = new MVVersionEvent();
MVDumpsDebugInfoEvent versionEvent = new MVDumpsDebugInfoEvent();
this.addDebugInfoToEvent(versionEvent);
plugin.getServer().getPluginManager().callEvent(versionEvent);

// Add plugin list if user isn't paranoid
if (!paranoid) {
versionEvent.putDetailedVersionInfo("plugins.md", "# Plugins\n\n" + getPluginList());
versionEvent.putDetailedDebugInfo("plugins.md", "# Plugins\n\n" + getPluginList());
}

BukkitRunnable logPoster = new BukkitRunnable() {
Expand All @@ -122,12 +121,12 @@
case MCLOGS -> issuer.sendInfo(MVCorei18n.DUMPS_URL_LIST,
"{service}", "Logs",
"{link}", postToService(PasteServiceType.MCLOGS, true, getLogs(), null));
case APPEND -> versionEvent.putDetailedVersionInfo("latest.log", getLogs());
case APPEND -> versionEvent.putDetailedDebugInfo("latest.log", getLogs());

Check warning on line 124 in src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 The String "latest.log" appears 2 times in the file. Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/commands/DumpsCommand.java:124:74: warning: The String "latest.log" appears 2 times in the file. (com.puppycrawl.tools.checkstyle.checks.coding.MultipleStringLiteralsCheck)
}
}

// 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
switch (servicesType) {
Expand Down Expand Up @@ -180,36 +179,36 @@
return "Could not read log";
}

private String getVersionString() {
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: " + this.plugin.getPluginCount() + '\n';
}

private void addDebugInfoToEvent(MVVersionEvent event) {
private void addDebugInfoToEvent(MVDumpsDebugInfoEvent event) {
// 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
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
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
if (getBukkitConfig() != null) {
event.putDetailedVersionInfo(getBukkitConfig().getPath(), getBukkitConfig());
event.putDetailedDebugInfo(getBukkitConfig().getPath(), getBukkitConfig());
} else {
Logging.warning("/mv version could not find bukkit.yml. Not including file");
}

// Add server.properties if we found it
if (getServerProperties() != null) {
event.putDetailedVersionInfo(getServerProperties().getPath(), getServerProperties());
event.putDetailedDebugInfo(getServerProperties().getPath(), getServerProperties());
} else {
Logging.warning("/mv version could not find server.properties. Not including file");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Called when the Multiverse-config should be reloaded.
*/
public class MVConfigReloadEvent extends Event {
private List<String> configsLoaded;
private final List<String> configsLoaded;

public MVConfigReloadEvent(List<String> configsLoaded) {
this.configsLoaded = configsLoaded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
/**
* Called when somebody requests version information about Multiverse.
*/
public class MVVersionEvent extends Event {
public class MVDumpsDebugInfoEvent extends Event {

private final StringBuilder versionInfoBuilder;
private final Map<String, String> detailedVersionInfo;
private final StringBuilder debugInfoBuilder;
private final Map<String, String> detailedDebugInfo;

public MVVersionEvent() {
versionInfoBuilder = new StringBuilder();
detailedVersionInfo = new HashMap<>();
public MVDumpsDebugInfoEvent() {

Check warning on line 24 in src/main/java/org/mvplugins/multiverse/core/event/MVDumpsDebugInfoEvent.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/event/MVDumpsDebugInfoEvent.java:24:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
debugInfoBuilder = new StringBuilder();
detailedDebugInfo = new HashMap<>();
}

private static final HandlerList HANDLERS = new HandlerList();
Expand All @@ -48,8 +48,8 @@
* Gets the version-info currently saved in this event.
* @return The version-info.
*/
public String getVersionInfo() {
return this.versionInfoBuilder.toString();
public String getDebugInfo() {
return this.debugInfoBuilder.toString();
}

/**
Expand All @@ -63,16 +63,16 @@
*
* @return The immutable key value mapping of files and the contents of those files.
*/
public Map<String, String> getDetailedVersionInfo() {
return Collections.unmodifiableMap(this.detailedVersionInfo);
public Map<String, String> getDetailedDebugInfo() {
return Collections.unmodifiableMap(this.detailedDebugInfo);
}

/**
* Appends more version-info to the version-info currently saved in this event.
* @param moreVersionInfo The version-info to add. Should end with '\n'.
*/
public void appendVersionInfo(String moreVersionInfo) {
this.versionInfoBuilder.append(moreVersionInfo);
public void appendDebugInfo(String moreVersionInfo) {
this.debugInfoBuilder.append(moreVersionInfo);
}

private String readFile(final String filename) {
Expand Down Expand Up @@ -104,16 +104,16 @@
* @param fileName The name of the file.
* @param contents The contents of the file.
*/
public void putDetailedVersionInfo(String fileName, String contents) {
this.detailedVersionInfo.put(fileName, contents);
public void putDetailedDebugInfo(String fileName, String contents) {
this.detailedDebugInfo.put(fileName, contents);
}

/**
* Adds a file to to the detailed version-info currently saved in this event.
* @param filename The name of the file.
* @param file The file.
*/
public void putDetailedVersionInfo(String filename, File file) {
this.putDetailedVersionInfo(filename, readFile(file.getAbsolutePath()));
public void putDetailedDebugInfo(String filename, File file) {
this.putDetailedDebugInfo(filename, readFile(file.getAbsolutePath()));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
/**
* Called when a player is respawning.
*/
// todo: remove or update its usage. The respawnMethod is always "compatibility" for some reason
@Deprecated

Check warning on line 19 in src/main/java/org/mvplugins/multiverse/core/event/MVRespawnEvent.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description. Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/event/MVRespawnEvent.java:19:0: warning: Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description. (com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecatedCheck)
public class MVRespawnEvent extends Event {
private Player player;
private final Player player;
private final String respawnMethod;
private Location location;
private String respawnMethod;


public MVRespawnEvent(Location spawningAt, Player p, String respawnMethod) {
this.player = p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
Expand All @@ -18,20 +19,18 @@
import org.mvplugins.multiverse.core.teleportation.AsyncSafetyTeleporter;

/**
* Event that gets called when a player use the /mvtp command.
* Event that gets called when a player teleports to a {@link DestinationInstance} with {@link AsyncSafetyTeleporter}.
*/
public class MVTeleportEvent extends Event implements Cancellable {
private Player teleportee;
private CommandSender teleporter;
private DestinationInstance<?, ?> dest;
private boolean useSafeTeleport;
public class MVTeleportDestinationEvent extends Event implements Cancellable {
private final Entity teleportee;
private final CommandSender teleporter;
private final DestinationInstance<?, ?> dest;
private boolean isCancelled;

public MVTeleportEvent(DestinationInstance<?, ?> dest, Player teleportee, CommandSender teleporter, boolean safeTeleport) {
public MVTeleportDestinationEvent(DestinationInstance<?, ?> dest, Entity teleportee, CommandSender teleporter) {

Check warning on line 30 in src/main/java/org/mvplugins/multiverse/core/event/MVTeleportDestinationEvent.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/event/MVTeleportDestinationEvent.java:30:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
this.teleportee = teleportee;
this.teleporter = teleporter;
this.dest = dest;
this.useSafeTeleport = safeTeleport;
}

private static final HandlerList HANDLERS = new HandlerList();
Expand All @@ -57,7 +56,7 @@
*
* @return The player who will be teleported by this event.
*/
public Player getTeleportee() {
public Entity getTeleportee() {
return this.teleportee;
}

Expand Down Expand Up @@ -88,14 +87,6 @@
return this.dest;
}

/**
* Looks if this {@link MVTeleportEvent} is using the {@link AsyncSafetyTeleporter}.
* @return True if this {@link MVTeleportEvent} is using the {@link AsyncSafetyTeleporter}.
*/
public boolean isUsingSafeTTeleporter() {
return useSafeTeleport;
}

@Override
public boolean isCancelled() {
return this.isCancelled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

import org.jetbrains.annotations.NotNull;

Check warning on line 7 in src/main/java/org/mvplugins/multiverse/core/event/MVWorldDeleteEvent.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Extra separation in import group before 'org.jetbrains.annotations.NotNull' Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/event/MVWorldDeleteEvent.java:7:1: warning: Extra separation in import group before 'org.jetbrains.annotations.NotNull' (com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck)
import org.mvplugins.multiverse.core.world.LoadedMultiverseWorld;
import org.mvplugins.multiverse.core.world.MultiverseWorld;

/**
* Called when a world is about to be deleted by Multiverse.
Expand All @@ -14,14 +14,9 @@
private boolean cancelled = false;

private final LoadedMultiverseWorld world;
private final boolean removeFromConfig;

public MVWorldDeleteEvent(LoadedMultiverseWorld world, boolean removeFromConfig) {
if (world == null) {
throw new IllegalArgumentException("world can't be null!");
}
public MVWorldDeleteEvent(@NotNull LoadedMultiverseWorld world) {

Check warning on line 18 in src/main/java/org/mvplugins/multiverse/core/event/MVWorldDeleteEvent.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/event/MVWorldDeleteEvent.java:18:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
this.world = world;
this.removeFromConfig = removeFromConfig;
}

private static final HandlerList HANDLERS = new HandlerList();
Expand Down Expand Up @@ -61,19 +56,9 @@
/**
* Gets the world that's about to be deleted.
*
* @return That {@link MultiverseWorld}.
* @return That {@link LoadedMultiverseWorld}.
*/
public LoadedMultiverseWorld getWorld() {
return world;
}

/**
* Is the world about to be removed from the config?
*
* @return True if yes, false if no.
*/
public boolean removeWorldFromConfig() {
return removeFromConfig;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* To get the new value, use {@link #getTheNewValue()}. To change it, use {@link #setTheNewValue(Object)}.
* @param <T> The type of the property that was set.
*/
// todo: Implement or remove this
@Deprecated

Check warning on line 29 in src/main/java/org/mvplugins/multiverse/core/event/MVWorldPropertyChangeEvent.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description. Raw Output: /github/workspace/./src/main/java/org/mvplugins/multiverse/core/event/MVWorldPropertyChangeEvent.java:29:0: warning: Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description. (com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecatedCheck)
public class MVWorldPropertyChangeEvent<T> extends Event implements Cancellable {
private MultiverseWorld world;
private CommandSender changer;
Expand Down
Loading
Loading