Skip to content

Commit

Permalink
fuck the migration
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Oct 12, 2024
1 parent d015646 commit 5061d78
Showing 1 changed file with 0 additions and 65 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.badbones69.crazyauctions;

import com.badbones69.crazyauctions.api.CrazyManager;
import com.badbones69.crazyauctions.api.enums.misc.Files;
import com.badbones69.crazyauctions.api.enums.Messages;
import com.badbones69.crazyauctions.api.enums.other.Permissions;
import com.badbones69.crazyauctions.api.guis.types.AuctionsMenu;
Expand All @@ -19,17 +18,13 @@
import com.badbones69.crazyauctions.tasks.InventoryManager;
import com.ryderbelserion.vital.paper.Vital;
import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.Base64;

public class CrazyAuctions extends Vital {

Expand Down Expand Up @@ -60,66 +55,6 @@ public void onEnable() {

this.crazyManager = new CrazyManager();

FileConfiguration configuration = Files.data.getConfiguration();

if (configuration.contains("OutOfTime/Cancelled")) {
for (String key : configuration.getConfigurationSection("OutOfTime/Cancelled").getKeys(false)) {
final ItemStack itemStack = configuration.getItemStack("OutOfTime/Cancelled." + key + ".Item");

if (itemStack != null) {
configuration.set("OutOfTime/Cancelled." + key + ".Item", Base64.getEncoder().encodeToString(itemStack.serializeAsBytes()));

Files.data.save();
}

final String uuid = configuration.getString("OutOfTime/Cancelled." + key + ".Seller");

if (uuid != null) {
OfflinePlayer player = Methods.getOfflinePlayer(uuid, false);

configuration.set("OutOfTime/Cancelled." + key + ".Seller", player.getUniqueId().toString());

Files.data.save();
}
}
}

if (configuration.contains("Items")) {
for (String key : configuration.getConfigurationSection("Items").getKeys(false)) {
final ItemStack itemStack = configuration.getItemStack("Items." + key + ".Item");

if (itemStack != null) {
configuration.set("Items." + key + ".Item", Base64.getEncoder().encodeToString(itemStack.serializeAsBytes()));

Files.data.save();
}

final String uuid = configuration.getString("Items." + key + ".Seller");

if (uuid != null) {
OfflinePlayer player = Methods.getOfflinePlayer(uuid, false);

if (!uuid.equals(player.getUniqueId().toString())) {
configuration.set("Items." + key + ".Seller", player.getUniqueId().toString());

Files.data.save();
}
}

final String bidder = configuration.getString("Items." + key + ".TopBidder");

if (bidder != null && !bidder.equals("None")) {
OfflinePlayer player = Methods.getOfflinePlayer(bidder, false);

if (!bidder.equals(player.getUniqueId().toString())) {
configuration.set("Items." + key + ".TopBidder", player.getUniqueId().toString());

Files.data.save();
}
}
}
}

this.crazyManager.load();

final PluginManager manager = getServer().getPluginManager();
Expand Down

0 comments on commit 5061d78

Please sign in to comment.