mirror of
https://github.com/songoda/EpicFurnaces.git
synced 2025-02-03 05:01:23 +01:00
Fix to level not loading
This commit is contained in:
parent
4aab730dc1
commit
ab6e982040
@ -223,7 +223,20 @@ public class EpicFurnaces extends SongodaPlugin {
|
||||
Bukkit.getConsoleSender().sendMessage("[" + getDescription().getName() + "] " + ChatColor.GREEN + "Conversion complete :)");
|
||||
}
|
||||
|
||||
//Load tolevel
|
||||
Map<Integer, Map<XMaterial, Integer>> toLevel = new HashMap<>();
|
||||
this.dataManager.getDatabaseConnector().connectDSL(dslContext -> {
|
||||
dslContext.select().from(getDataManager().getTablePrefix() + "to_level_new").fetch().forEach(record -> {
|
||||
int furnaceId = record.get("furnace_id", Integer.class);
|
||||
XMaterial material = CompatibleMaterial.getMaterial(record.get("item", String.class)).get();
|
||||
int amount = record.get("amount", Integer.class);
|
||||
toLevel.computeIfAbsent(furnaceId, k -> new HashMap<>()).put(material, amount);
|
||||
});
|
||||
});
|
||||
|
||||
this.dataManager.loadBatch(Furnace.class, "active_furnaces").forEach((furnace) -> {
|
||||
Furnace furnace1 = (Furnace) furnace;
|
||||
furnace1.setToLevel(toLevel.getOrDefault(furnace1.getId(), new HashMap<>()));
|
||||
this.furnaceManager.addFurnace((Furnace) furnace);
|
||||
this.boostManager.addBoosts(this.dataManager.loadBatch(BoostData.class, "boosted_players"));
|
||||
});
|
||||
|
@ -80,6 +80,11 @@ public class Furnace implements Data {
|
||||
this.location = SerializedLocation.of(map);
|
||||
}
|
||||
|
||||
public void setToLevel(Map<XMaterial, Integer> toLevel) {
|
||||
this.toLevel.clear();
|
||||
this.toLevel.putAll(toLevel);
|
||||
}
|
||||
|
||||
public void overview(GuiManager guiManager, Player player) {
|
||||
if (this.placedBy == null) {
|
||||
this.placedBy = player.getUniqueId();
|
||||
|
Loading…
Reference in New Issue
Block a user