mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2026-01-04 15:31:37 +00:00
General cleanup and optimisations
This commit is contained in:
@@ -2,7 +2,6 @@ package net.william278.husksync.command;
|
||||
|
||||
import net.william278.husksync.HuskSync;
|
||||
import net.william278.husksync.data.DataSaveCause;
|
||||
import net.william278.husksync.data.ItemData;
|
||||
import net.william278.husksync.data.UserData;
|
||||
import net.william278.husksync.data.UserDataSnapshot;
|
||||
import net.william278.husksync.editor.ItemEditorMenu;
|
||||
|
||||
@@ -71,8 +71,9 @@ public class HuskSyncCommand extends CommandBase implements TabCompletable, Cons
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "update", "version" ->
|
||||
new UpdateChecker(plugin.getPluginVersion(), plugin.getLoggingAdapter()).logToConsole();
|
||||
case "info", "about" -> plugin.getLoggingAdapter().log(Level.INFO, new MineDown(plugin.getLocales().stripMineDown(
|
||||
Locales.PLUGIN_INFORMATION.replace("%version%", plugin.getPluginVersion().toString()))));
|
||||
case "info", "about" ->
|
||||
plugin.getLoggingAdapter().log(Level.INFO, new MineDown(plugin.getLocales().stripMineDown(
|
||||
Locales.PLUGIN_INFORMATION.replace("%version%", plugin.getPluginVersion().toString()))));
|
||||
case "reload" -> {
|
||||
plugin.reload();
|
||||
plugin.getLoggingAdapter().log(Level.INFO, "Reloaded config & message files.");
|
||||
@@ -92,7 +93,13 @@ public class HuskSyncCommand extends CommandBase implements TabCompletable, Cons
|
||||
return;
|
||||
}
|
||||
switch (args[2]) {
|
||||
case "start" -> migrator.start();
|
||||
case "start" -> migrator.start().thenAccept(succeeded -> {
|
||||
if (succeeded) {
|
||||
plugin.getLoggingAdapter().log(Level.INFO, "Migration completed successfully!");
|
||||
} else {
|
||||
plugin.getLoggingAdapter().log(Level.WARNING, "Migration failed!");
|
||||
}
|
||||
});
|
||||
case "set" -> migrator.handleConfigurationCommand(Arrays.copyOfRange(args, 3, args.length));
|
||||
default -> plugin.getLoggingAdapter().log(Level.INFO,
|
||||
"Invalid syntax. Console usage: \"husksync migrate " + args[1] + " <start/set>");
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.william278.husksync.command;
|
||||
|
||||
import net.william278.husksync.HuskSync;
|
||||
import net.william278.husksync.data.DataSaveCause;
|
||||
import net.william278.husksync.data.ItemData;
|
||||
import net.william278.husksync.data.UserData;
|
||||
import net.william278.husksync.data.UserDataSnapshot;
|
||||
import net.william278.husksync.editor.ItemEditorMenu;
|
||||
|
||||
@@ -12,7 +12,7 @@ public interface TabCompletable {
|
||||
/**
|
||||
* What should be returned when the player or console attempts to TAB-complete a command
|
||||
*
|
||||
* @param args Current command argumentsrf
|
||||
* @param args Current command arguments
|
||||
* @return List of String arguments to offer TAB suggestions
|
||||
*/
|
||||
List<String> onTabComplete(@NotNull String[] args);
|
||||
|
||||
@@ -106,6 +106,7 @@ public abstract class Database {
|
||||
* @return Array of string-formatted table creation schema statements
|
||||
* @throws IOException if the resource could not be read
|
||||
*/
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
protected final String[] getSchemaStatements(@NotNull String schemaFileName) throws IOException {
|
||||
return formatStatementTables(new String(resourceReader.getResource(schemaFileName)
|
||||
.readAllBytes(), StandardCharsets.UTF_8)).split(";");
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ItemEditorMenu {
|
||||
public final ItemData itemData;
|
||||
public final ItemEditorMenuType itemEditorMenuType;
|
||||
public final MineDown menuTitle;
|
||||
public boolean canEdit;
|
||||
public final boolean canEdit;
|
||||
|
||||
private CompletableFuture<ItemData> inventoryDataCompletableFuture;
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ package net.william278.husksync.event;
|
||||
|
||||
public interface CancellableEvent extends Event {
|
||||
|
||||
boolean isCancelled();
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
default boolean isCancelled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void setCancelled(boolean cancelled);
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.william278.husksync.util.Version;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@@ -12,12 +12,12 @@ public class User {
|
||||
/**
|
||||
* The user's unique account ID
|
||||
*/
|
||||
public UUID uuid;
|
||||
public final UUID uuid;
|
||||
|
||||
/**
|
||||
* The user's username
|
||||
*/
|
||||
public String username;
|
||||
public final String username;
|
||||
|
||||
public User(@NotNull UUID uuid, @NotNull String username) {
|
||||
this.username = username;
|
||||
|
||||
Reference in New Issue
Block a user