Compare commits

...

2 Commits

Author SHA1 Message Date
Brianna O'Keefe d5a293c08a version 5.1.2 2024-03-23 13:35:18 -05:00
ceze88 ab6e982040 Fix to level not loading 2024-03-23 13:32:34 -05:00
3 changed files with 19 additions and 1 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.craftaro</groupId>
<artifactId>EpicFurnaces</artifactId>
<version>5.1.1</version>
<version>5.1.2</version>
<name>EpicFurnaces</name>
<description>EpicFurnaces allows you to upgrade basic Minecraft features to make the game way more entertaining</description>

View File

@ -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"));
});

View File

@ -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();