diff --git a/config.yml b/config.yml index e4e8207..832e8e4 100644 --- a/config.yml +++ b/config.yml @@ -6,7 +6,7 @@ # age: Zeit in Minecraft-Tagen, die das Getränk im Fass reifen muss 0= kein reifen # color: Farbe des Getränks nach destillieren/reifen # difficulty: 1-10 Genauigkeit der Einhaltung der Vorgaben (1 = ungenau/einfach 10 = sehr genau/schwer) -# alcohol: Alkoholgehalt 0-100 in Vol.% bei perfektem Getränk +# alcohol: Alkoholgehalt 0-100 in absoluter Menge bei perfektem Getränk (wird dem Spieler hinzugefügt, bei 100 = tot) #cooked: Auflistung ALLER möglichen Zutaten und die daraus entstehenden Tranknamen: (leer für undef.) @@ -62,7 +62,7 @@ recipes: age: 4 color: ORANGE difficulty: 2 - alcohol: 10 + alcohol: 9 5: name: Apfelmet/Süßer Apfelmet/Goldensüßer Apfelmet ingredients: @@ -76,7 +76,7 @@ recipes: difficulty: 4 alcohol: 12 6: - name: Rum/Goldener Rum/Perfekter Rum + name: Leichter Rum/Goldener Rum/Perfekter Rum ingredients: - SUGAR_CANE/14 cookingtime: 5 @@ -85,7 +85,7 @@ recipes: age: 14 color: DARK_RED difficulty: 6 - alcohol: 60 + alcohol: 30 7: name: Abgeranzter Vodka/Vodka/Russischer Vodka ingredients: @@ -95,7 +95,7 @@ recipes: age: 0 color: BRIGHT_GREY difficulty: 4 - alcohol: 40 + alcohol: 20 8: name: minderwertiger Absinth/Absinth/Starker Absinth ingredients: @@ -104,6 +104,7 @@ recipes: distillruns: 6 color: GREEN difficulty: 8 + alcohol: 45 9: name: Kartoffelsuppe ingredients: @@ -193,12 +194,12 @@ words: - replace: -start to: dssho - percentage: 20 + percentage: 15 alcohol: 50 - replace: -start to: hhng - percentage: 30 + percentage: 10 alcohol: 50 - replace: -random @@ -229,6 +230,11 @@ words: to: '' percentage: 30 + - replace: -random + to: '' + percentage: 50 + alcohol: 50 + - replace: -random to: '' percentage: 50 diff --git a/src/com/dre/brewery/BCauldron.java b/src/com/dre/brewery/BCauldron.java index d8299ee..7302526 100644 --- a/src/com/dre/brewery/BCauldron.java +++ b/src/com/dre/brewery/BCauldron.java @@ -114,7 +114,7 @@ public class BCauldron { } } - public static void save(ConfigurationSection config, ConfigurationSection oldConfig) { + public static void save(ConfigurationSection config, ConfigurationSection oldData) { int id = 0; for (BCauldron cauldron : bcauldrons) { // cauldrons are sorted in worldUUID.randomId @@ -128,9 +128,11 @@ public class BCauldron { id++; } // copy cauldrons that are not loaded - for (String uuid : oldConfig.getKeys(false)) { - if (!config.contains(uuid)) { - config.set(uuid, oldConfig.get(uuid)); + if (oldData != null){ + for (String uuid : oldData.getKeys(false)) { + if (!config.contains(uuid)) { + config.set(uuid, oldData.get(uuid)); + } } } } diff --git a/src/com/dre/brewery/BPlayer.java b/src/com/dre/brewery/BPlayer.java index 0b32fb2..a8cd37f 100644 --- a/src/com/dre/brewery/BPlayer.java +++ b/src/com/dre/brewery/BPlayer.java @@ -101,10 +101,12 @@ public class BPlayer { // decreasing drunkeness over time public static void onUpdate() { if (!players.isEmpty()) { - for (BPlayer bplayer : players.values()) { + for (String name : players.keySet()) { + BPlayer bplayer = players.get(name); + bplayer.quality -= bplayer.getQuality(); bplayer.drunkeness -= 2; if (bplayer.drunkeness <= 0) { - players.remove(bplayer); + players.remove(name); } } } diff --git a/src/com/dre/brewery/Barrel.java b/src/com/dre/brewery/Barrel.java index 23662e7..e1ddc86 100644 --- a/src/com/dre/brewery/Barrel.java +++ b/src/com/dre/brewery/Barrel.java @@ -151,7 +151,7 @@ public class Barrel { } // Saves all data - public static void save(ConfigurationSection config, ConfigurationSection oldConfig) { + public static void save(ConfigurationSection config, ConfigurationSection oldData) { int id = 0; for (Barrel barrel : barrels) { // barrels are sorted in worldUUID.randomId @@ -187,9 +187,11 @@ public class Barrel { id++; } // also save barrels that are not loaded - for (String uuid : oldConfig.getKeys(false)) { - if (!config.contains(uuid)) { - config.set(uuid, oldConfig.get(uuid)); + if (oldData != null){ + for (String uuid : oldData.getKeys(false)) { + if (!config.contains(uuid)) { + config.set(uuid, oldData.get(uuid)); + } } } } diff --git a/src/com/dre/brewery/Brew.java b/src/com/dre/brewery/Brew.java index 3823074..2add42b 100644 --- a/src/com/dre/brewery/Brew.java +++ b/src/com/dre/brewery/Brew.java @@ -111,8 +111,10 @@ public class Brew { if (distillRuns == 0) { distillRuns = 1; } - alc /= distillRuns; - alc *= distillRuns * ((float) quality / 10.0); + alc *= ((float) quality / 10.0); + if (distillRuns > 1) { + alc *= (float) distillRuns / 2.0; + } return alc; } @@ -121,7 +123,10 @@ public class Brew { // calculate quality from all of the factors float quality = ( - ingredients.getIngredientQuality(recipe) + ingredients.getCookingQuality(recipe) + ingredients.getWoodQuality(recipe, wood) + ingredients.getAgeQuality(recipe, ageTime)); + ingredients.getIngredientQuality(recipe) + + ingredients.getCookingQuality(recipe) + + ingredients.getWoodQuality(recipe, wood) + + ingredients.getAgeQuality(recipe, ageTime)); quality /= 4; return (int) Math.round(quality); diff --git a/src/com/dre/brewery/P.java b/src/com/dre/brewery/P.java index 9f63600..0b89f1b 100644 --- a/src/com/dre/brewery/P.java +++ b/src/com/dre/brewery/P.java @@ -232,7 +232,7 @@ public class P extends JavaPlugin { public void saveData() { File datafile = new File(p.getDataFolder(), "data.yml"); - FileConfiguration oldConfig = YamlConfiguration.loadConfiguration(datafile); + FileConfiguration oldData = YamlConfiguration.loadConfiguration(datafile); if (datafile.exists()) { if (lastBackup > 10) { @@ -249,11 +249,11 @@ public class P extends JavaPlugin { Brew.save(configFile.createSection("Brew")); } if (!BCauldron.bcauldrons.isEmpty()) { - BCauldron.save(configFile.createSection("BCauldron"), oldConfig.getConfigurationSection("BCauldron")); + BCauldron.save(configFile.createSection("BCauldron"), oldData.getConfigurationSection("BCauldron")); } if (!Barrel.barrels.isEmpty()) { - Barrel.save(configFile.createSection("Barrel"), oldConfig.getConfigurationSection("Barrel")); + Barrel.save(configFile.createSection("Barrel"), oldData.getConfigurationSection("Barrel")); } if (!BPlayer.players.isEmpty()) {