9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-29 19:49:13 +00:00

Minor legacy migrator fix, about menu link and text tweaks, minor version checker fixes, fix TAB completion in console

This commit is contained in:
William
2022-07-11 01:15:16 +01:00
parent 6bfbeec74d
commit b0e0b9c435
16 changed files with 48 additions and 44 deletions

View File

@@ -63,7 +63,7 @@ public class BukkitCommand implements CommandExecutor, TabExecutor {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command,
@NotNull String alias, @NotNull String[] args) {
if (this.command instanceof TabCompletable tabCompletable) {
return tabCompletable.onTabComplete(BukkitPlayer.adapt((Player) sender), args);
return tabCompletable.onTabComplete(args);
}
return Collections.emptyList();
}

View File

@@ -44,7 +44,7 @@ public class LegacyMigrator extends Migrator {
this.sourceDatabase = plugin.getSettings().getStringValue(Settings.ConfigOption.DATABASE_NAME);
this.sourcePlayersTable = "husksync_players";
this.sourceDataTable = "husksync_data";
this.minecraftVersion = plugin.getMinecraftVersion().getWithoutMeta();
this.minecraftVersion = plugin.getMinecraftVersion().toString();
}
@Override
@@ -72,7 +72,7 @@ public class LegacyMigrator extends Migrator {
final List<LegacyData> dataToMigrate = new ArrayList<>();
try (final Connection connection = connectionPool.getConnection()) {
try (final PreparedStatement statement = connection.prepareStatement("""
SELECT `uuid`, `name`, `inventory`, `ender_chest`, `health`, `max_health`, `health_scale`, `hunger`, `saturation`, `saturation_exhaustion`, `selected_slot`, `status_effects`, `total_experience`, `exp_level`, `exp_progress`, `game_mode`, `statistics`, `is_flying`, `advancements`, `location`
SELECT `uuid`, `username`, `inventory`, `ender_chest`, `health`, `max_health`, `health_scale`, `hunger`, `saturation`, `saturation_exhaustion`, `selected_slot`, `status_effects`, `total_experience`, `exp_level`, `exp_progress`, `game_mode`, `statistics`, `is_flying`, `advancements`, `location`
FROM `%source_players_table%`
INNER JOIN `%source_data_table%`
ON `%source_players_table%`.`id` = `%source_data_table%`.`player_id`;
@@ -83,7 +83,7 @@ public class LegacyMigrator extends Migrator {
while (resultSet.next()) {
dataToMigrate.add(new LegacyData(
new User(UUID.fromString(resultSet.getString("uuid")),
resultSet.getString("name")),
resultSet.getString("username")),
resultSet.getString("inventory"),
resultSet.getString("ender_chest"),
resultSet.getDouble("health"),

View File

@@ -48,7 +48,7 @@ public class MpdbMigrator extends Migrator {
this.sourceInventoryTable = "mpdb_inventory";
this.sourceEnderChestTable = "mpdb_enderchest";
this.sourceExperienceTable = "mpdb_experience";
this.minecraftVersion = plugin.getMinecraftVersion().getWithoutMeta();
this.minecraftVersion = plugin.getMinecraftVersion().toString();
}

View File

@@ -1,7 +1,11 @@
package net.william278.husksync.util;
import de.themoep.minedown.MineDown;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.TextComponent;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.logging.Level;
public class BukkitLogger extends Logger {
@@ -22,6 +26,11 @@ public class BukkitLogger extends Logger {
logger.log(level, message);
}
@Override
public void log(@NotNull Level level, @NotNull MineDown mineDown) {
logger.log(level, TextComponent.toLegacyText(mineDown.toComponent()));
}
@Override
public void info(@NotNull String message) {
logger.info(message);