mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-25 12:25:20 +01:00
remove migrate command
This commit is contained in:
parent
84fc8af6f6
commit
6b30261a0d
@ -18,7 +18,6 @@ public enum Permissions {
|
||||
sell("sell", "Access to /crazyauctions sell", PermissionDefault.TRUE, false),
|
||||
bid("bid", "Access to /crazyauctions bid", PermissionDefault.TRUE, false),
|
||||
use("use", "Access to /crazyauctions", PermissionDefault.TRUE, false),
|
||||
migrate("migrate", "Access to /crazycrates migrate", PermissionDefault.OP, true),
|
||||
|
||||
bypass("bypass", "Bypasses most plugin restrictions", PermissionDefault.OP, true),
|
||||
|
||||
@ -36,7 +35,6 @@ public enum Permissions {
|
||||
put("crazyauctions.reload", true);
|
||||
put("crazyauctions.bypass", true);
|
||||
put("crazyauctions.view", true);
|
||||
put("crazyauctions.migrate", true);
|
||||
}}, true);
|
||||
|
||||
private final String node;
|
||||
|
@ -125,16 +125,6 @@ public class AuctionCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
case "migrate" -> {
|
||||
if (!Methods.hasPermission(sender, "migrate")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.plugin.getUserManager().migrateAuctions();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case "expired", "collect" -> {
|
||||
if (!Methods.hasPermission(sender, "access")) {
|
||||
return true;
|
||||
|
@ -32,7 +32,6 @@ public class AuctionTab implements TabCompleter {
|
||||
if (hasPermission(sender, "view")) completions.add("view");
|
||||
if (hasPermission(sender, "sell")) completions.add("sell");
|
||||
if (hasPermission(sender, "bid")) completions.add("bid");
|
||||
if (hasPermission(sender, "migrate")) completions.add("migrate");
|
||||
|
||||
return StringUtil.copyPartialMatches(args[0], completions, new ArrayList<>());
|
||||
} else if (args.length == 2) { // /crazyauctions arg0
|
||||
|
@ -93,63 +93,6 @@ public class UserManager {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void migrateAuctions() {
|
||||
final FileConfiguration data = Files.data.getConfiguration();
|
||||
|
||||
final ConfigurationSection section = data.getConfigurationSection("Items");
|
||||
|
||||
if (section == null) return;
|
||||
|
||||
boolean isSave = false;
|
||||
|
||||
for (String key : section.getKeys(false)) {
|
||||
final ConfigurationSection auction = section.getConfigurationSection(key);
|
||||
|
||||
if (auction == null) continue;
|
||||
|
||||
final String itemStack = auction.getString("Item");
|
||||
final long price = auction.getLong("Price");
|
||||
final String seller = auction.getString("Seller");
|
||||
|
||||
final String name = auction.getString("Name", Methods.getOfflinePlayer(seller).getName());
|
||||
|
||||
final String time_till_expire = auction.getString("Time-Till-Expire");
|
||||
final String full_time = auction.getString("Full-Time");
|
||||
|
||||
final String store_id = auction.getString("StoreID");
|
||||
|
||||
final boolean biddable = auction.getBoolean("Biddable", false);
|
||||
|
||||
final String top_bidder = auction.getString("TopBidder", "None");
|
||||
final String top_bidder_name = auction.getString("TopBidderName", "None");
|
||||
|
||||
data.set("active_auctions." + seller + "." + key + ".name", name);
|
||||
|
||||
final ConfigurationSection new_section = data.getConfigurationSection("active_auctions." + seller + "." + key);
|
||||
|
||||
if (new_section == null) return;
|
||||
|
||||
new_section.set("item", itemStack);
|
||||
new_section.set("store_id", store_id);
|
||||
new_section.set("price", price);
|
||||
|
||||
new_section.set("time.expire", time_till_expire);
|
||||
new_section.set("time.full", full_time);
|
||||
|
||||
new_section.set("status.biddable", biddable);
|
||||
new_section.set("status.top_bidder.uuid", top_bidder);
|
||||
new_section.set("status.top_bidder.name", top_bidder_name);
|
||||
|
||||
data.set("Items." + key, null);
|
||||
|
||||
isSave = true;
|
||||
}
|
||||
|
||||
if (isSave) {
|
||||
Files.data.save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item to the configuration section
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user