Skip to content

Commit

Permalink
stream duplicate block issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jsinco committed Aug 30, 2024
1 parent 9d19b66 commit 0231947
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/main/java/com/dre/brewery/BreweryPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());


Expand Down

0 comments on commit 0231947

Please sign in to comment.