Skip to content

Commit

Permalink
change BRecipe to use maps, cauldron updates on Folia, and bump versi…
Browse files Browse the repository at this point in the history
…on for release
  • Loading branch information
Jsinco committed Sep 13, 2024
1 parent 2ee851d commit c5fce5e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
val langVersion: Int = 17

group = "com.dre.brewery"
version = "3.2.7"
version = "3.2.8"

repositories {
mavenCentral()
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/dre/brewery/BreweryPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import java.util.Iterator;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public class BreweryPlugin extends JavaPlugin {

Expand Down Expand Up @@ -491,18 +490,18 @@ public class BreweryRunnable implements Runnable {
public void run() {
long start = System.currentTimeMillis();
BConfig.reloader = null;

// runs every min to update cooking time
Iterator<BCauldron> bCauldronsToRemove = BCauldron.bcauldrons.values().iterator();
while (bCauldronsToRemove.hasNext()) {
// runs every min to update cooking time
BCauldron bCauldron = bCauldronsToRemove.next();

for (BCauldron bCauldron : BCauldron.bcauldrons.values()) {
BreweryPlugin.getScheduler().runTask(bCauldron.getBlock().getLocation(), () -> {
if (!bCauldron.onUpdate()) {
bCauldronsToRemove.remove();
BCauldron.bcauldrons.remove(bCauldron.getBlock());
}
});
}


Barrel.onUpdate();// runs every min to check and update ageing time

if (getMCVersion().isOrLater(MinecraftVersion.V1_14)) MCBarrel.onUpdate();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/dre/brewery/recipe/BCauldronRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public static BCauldronRecipe fromConfig(ConfigurationSection cfg, String id) {
}


List<Tuple<Integer,String>> lore = BRecipe.loadQualityStringList(cfg, id + ".lore", StringParser.ParseType.LORE);
Map<Integer, String> lore = BRecipe.loadQualityStringList(cfg, id + ".lore", StringParser.ParseType.LORE);
if (lore != null && !lore.isEmpty()) {
recipe.lore = lore.stream().map(Tuple::second).collect(Collectors.toList());
recipe.lore = lore.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
}

recipe.cmData = cfg.getInt(id + ".customModelData", 0);
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/com/dre/brewery/recipe/BRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
public class BRecipe {

private static List<BRecipe> recipes = new ArrayList<>();
private static final List<BRecipe> recipes = new ArrayList<>();
public static int numConfigRecipes; // The number of recipes in the list that are from config

// info
Expand Down Expand Up @@ -813,6 +813,21 @@ public static List<BRecipe> getAllRecipes() {
return recipes;
}



public String[] getName() {
return name;
}

public boolean isGlint() {
return glint;
}


public byte getDistillruns() {
return distillruns;
}

/**
* Get the BRecipe that has the given name as one of its quality names.
*/
Expand Down

0 comments on commit c5fce5e

Please sign in to comment.