From 023194794af1effc135946c548280cb0ecf5e060 Mon Sep 17 00:00:00 2001 From: Jsinco Date: Fri, 30 Aug 2024 06:10:07 -0400 Subject: [PATCH] stream duplicate block issue --- .../java/com/dre/brewery/BreweryPlugin.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/dre/brewery/BreweryPlugin.java b/src/main/java/com/dre/brewery/BreweryPlugin.java index 93f99aae..39b0164f 100644 --- a/src/main/java/com/dre/brewery/BreweryPlugin.java +++ b/src/main/java/com/dre/brewery/BreweryPlugin.java @@ -162,14 +162,20 @@ public void onEnable() { DataManager.loadMiscData(dataManager.getBreweryMiscData()); Barrel.getBarrels().addAll(dataManager.getAllBarrels()); - if (!isFolia){ - BCauldron.getBcauldrons().putAll(dataManager.getAllCauldrons().stream().collect(Collectors.toMap(BCauldron::getBlock, Function.identity()))); - } else { - for (BCauldron bCauldron : dataManager.getAllCauldrons()) { - getScheduler().runTask(bCauldron.getBlock().getLocation(), () -> BCauldron.getBcauldrons().put(bCauldron.getBlock(), bCauldron)); - } - } + // Stream error? - https://gist.github.com/TomLewis/413212bd3df6cb745412475128e01e92w + // Apparently there's 2 CraftBlocks trying to be put under the same identifier in the map and it's throwing an err + // I'll fix the stream issues in the next version but I have to release this fix ASAP so I'm leaving it like this for now. - Jsinco + + /* + BCauldron.getBcauldrons().putAll(dataManager.getAllCauldrons().stream().collect(Collectors.toMap(BCauldron::getBlock, Function.identity()))); BPlayer.getPlayers().putAll(dataManager.getAllPlayers().stream().collect(Collectors.toMap(BPlayer::getUuid, Function.identity()))); + */ + for (BCauldron cauldron : dataManager.getAllCauldrons()) { + BCauldron.getBcauldrons().put(cauldron.getBlock(), cauldron); + } + for (BPlayer player : dataManager.getAllPlayers()) { + BPlayer.getPlayers().put(player.getUuid(), player); + } Wakeup.getWakeups().addAll(dataManager.getAllWakeups());