mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 08:59:01 +00:00
Changed alcohol calculation
This commit is contained in:
+13
-7
@@ -6,7 +6,7 @@
|
|||||||
# age: Zeit in Minecraft-Tagen, die das Getränk im Fass reifen muss 0= kein reifen
|
# age: Zeit in Minecraft-Tagen, die das Getränk im Fass reifen muss 0= kein reifen
|
||||||
# color: Farbe des Getränks nach destillieren/reifen
|
# color: Farbe des Getränks nach destillieren/reifen
|
||||||
# difficulty: 1-10 Genauigkeit der Einhaltung der Vorgaben (1 = ungenau/einfach 10 = sehr genau/schwer)
|
# 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.)
|
#cooked: Auflistung ALLER möglichen Zutaten und die daraus entstehenden Tranknamen: (leer für undef.)
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ recipes:
|
|||||||
age: 4
|
age: 4
|
||||||
color: ORANGE
|
color: ORANGE
|
||||||
difficulty: 2
|
difficulty: 2
|
||||||
alcohol: 10
|
alcohol: 9
|
||||||
5:
|
5:
|
||||||
name: Apfelmet/Süßer Apfelmet/Goldensüßer Apfelmet
|
name: Apfelmet/Süßer Apfelmet/Goldensüßer Apfelmet
|
||||||
ingredients:
|
ingredients:
|
||||||
@@ -76,7 +76,7 @@ recipes:
|
|||||||
difficulty: 4
|
difficulty: 4
|
||||||
alcohol: 12
|
alcohol: 12
|
||||||
6:
|
6:
|
||||||
name: Rum/Goldener Rum/Perfekter Rum
|
name: Leichter Rum/Goldener Rum/Perfekter Rum
|
||||||
ingredients:
|
ingredients:
|
||||||
- SUGAR_CANE/14
|
- SUGAR_CANE/14
|
||||||
cookingtime: 5
|
cookingtime: 5
|
||||||
@@ -85,7 +85,7 @@ recipes:
|
|||||||
age: 14
|
age: 14
|
||||||
color: DARK_RED
|
color: DARK_RED
|
||||||
difficulty: 6
|
difficulty: 6
|
||||||
alcohol: 60
|
alcohol: 30
|
||||||
7:
|
7:
|
||||||
name: Abgeranzter Vodka/Vodka/Russischer Vodka
|
name: Abgeranzter Vodka/Vodka/Russischer Vodka
|
||||||
ingredients:
|
ingredients:
|
||||||
@@ -95,7 +95,7 @@ recipes:
|
|||||||
age: 0
|
age: 0
|
||||||
color: BRIGHT_GREY
|
color: BRIGHT_GREY
|
||||||
difficulty: 4
|
difficulty: 4
|
||||||
alcohol: 40
|
alcohol: 20
|
||||||
8:
|
8:
|
||||||
name: minderwertiger Absinth/Absinth/Starker Absinth
|
name: minderwertiger Absinth/Absinth/Starker Absinth
|
||||||
ingredients:
|
ingredients:
|
||||||
@@ -104,6 +104,7 @@ recipes:
|
|||||||
distillruns: 6
|
distillruns: 6
|
||||||
color: GREEN
|
color: GREEN
|
||||||
difficulty: 8
|
difficulty: 8
|
||||||
|
alcohol: 45
|
||||||
9:
|
9:
|
||||||
name: Kartoffelsuppe
|
name: Kartoffelsuppe
|
||||||
ingredients:
|
ingredients:
|
||||||
@@ -193,12 +194,12 @@ words:
|
|||||||
|
|
||||||
- replace: -start
|
- replace: -start
|
||||||
to: dssho
|
to: dssho
|
||||||
percentage: 20
|
percentage: 15
|
||||||
alcohol: 50
|
alcohol: 50
|
||||||
|
|
||||||
- replace: -start
|
- replace: -start
|
||||||
to: hhng
|
to: hhng
|
||||||
percentage: 30
|
percentage: 10
|
||||||
alcohol: 50
|
alcohol: 50
|
||||||
|
|
||||||
- replace: -random
|
- replace: -random
|
||||||
@@ -229,6 +230,11 @@ words:
|
|||||||
to: ''
|
to: ''
|
||||||
percentage: 30
|
percentage: 30
|
||||||
|
|
||||||
|
- replace: -random
|
||||||
|
to: ''
|
||||||
|
percentage: 50
|
||||||
|
alcohol: 50
|
||||||
|
|
||||||
- replace: -random
|
- replace: -random
|
||||||
to: ''
|
to: ''
|
||||||
percentage: 50
|
percentage: 50
|
||||||
|
|||||||
@@ -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;
|
int id = 0;
|
||||||
for (BCauldron cauldron : bcauldrons) {
|
for (BCauldron cauldron : bcauldrons) {
|
||||||
// cauldrons are sorted in worldUUID.randomId
|
// cauldrons are sorted in worldUUID.randomId
|
||||||
@@ -128,9 +128,11 @@ public class BCauldron {
|
|||||||
id++;
|
id++;
|
||||||
}
|
}
|
||||||
// copy cauldrons that are not loaded
|
// copy cauldrons that are not loaded
|
||||||
for (String uuid : oldConfig.getKeys(false)) {
|
if (oldData != null){
|
||||||
|
for (String uuid : oldData.getKeys(false)) {
|
||||||
if (!config.contains(uuid)) {
|
if (!config.contains(uuid)) {
|
||||||
config.set(uuid, oldConfig.get(uuid));
|
config.set(uuid, oldData.get(uuid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,10 +101,12 @@ public class BPlayer {
|
|||||||
// decreasing drunkeness over time
|
// decreasing drunkeness over time
|
||||||
public static void onUpdate() {
|
public static void onUpdate() {
|
||||||
if (!players.isEmpty()) {
|
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;
|
bplayer.drunkeness -= 2;
|
||||||
if (bplayer.drunkeness <= 0) {
|
if (bplayer.drunkeness <= 0) {
|
||||||
players.remove(bplayer);
|
players.remove(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class Barrel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Saves all data
|
// Saves all data
|
||||||
public static void save(ConfigurationSection config, ConfigurationSection oldConfig) {
|
public static void save(ConfigurationSection config, ConfigurationSection oldData) {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
for (Barrel barrel : barrels) {
|
for (Barrel barrel : barrels) {
|
||||||
// barrels are sorted in worldUUID.randomId
|
// barrels are sorted in worldUUID.randomId
|
||||||
@@ -187,9 +187,11 @@ public class Barrel {
|
|||||||
id++;
|
id++;
|
||||||
}
|
}
|
||||||
// also save barrels that are not loaded
|
// also save barrels that are not loaded
|
||||||
for (String uuid : oldConfig.getKeys(false)) {
|
if (oldData != null){
|
||||||
|
for (String uuid : oldData.getKeys(false)) {
|
||||||
if (!config.contains(uuid)) {
|
if (!config.contains(uuid)) {
|
||||||
config.set(uuid, oldConfig.get(uuid));
|
config.set(uuid, oldData.get(uuid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,8 +111,10 @@ public class Brew {
|
|||||||
if (distillRuns == 0) {
|
if (distillRuns == 0) {
|
||||||
distillRuns = 1;
|
distillRuns = 1;
|
||||||
}
|
}
|
||||||
alc /= distillRuns;
|
alc *= ((float) quality / 10.0);
|
||||||
alc *= distillRuns * ((float) quality / 10.0);
|
if (distillRuns > 1) {
|
||||||
|
alc *= (float) distillRuns / 2.0;
|
||||||
|
}
|
||||||
return alc;
|
return alc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +123,10 @@ public class Brew {
|
|||||||
// calculate quality from all of the factors
|
// calculate quality from all of the factors
|
||||||
float quality = (
|
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;
|
quality /= 4;
|
||||||
return (int) Math.round(quality);
|
return (int) Math.round(quality);
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public class P extends JavaPlugin {
|
|||||||
public void saveData() {
|
public void saveData() {
|
||||||
File datafile = new File(p.getDataFolder(), "data.yml");
|
File datafile = new File(p.getDataFolder(), "data.yml");
|
||||||
|
|
||||||
FileConfiguration oldConfig = YamlConfiguration.loadConfiguration(datafile);
|
FileConfiguration oldData = YamlConfiguration.loadConfiguration(datafile);
|
||||||
|
|
||||||
if (datafile.exists()) {
|
if (datafile.exists()) {
|
||||||
if (lastBackup > 10) {
|
if (lastBackup > 10) {
|
||||||
@@ -249,11 +249,11 @@ public class P extends JavaPlugin {
|
|||||||
Brew.save(configFile.createSection("Brew"));
|
Brew.save(configFile.createSection("Brew"));
|
||||||
}
|
}
|
||||||
if (!BCauldron.bcauldrons.isEmpty()) {
|
if (!BCauldron.bcauldrons.isEmpty()) {
|
||||||
BCauldron.save(configFile.createSection("BCauldron"), oldConfig.getConfigurationSection("BCauldron"));
|
BCauldron.save(configFile.createSection("BCauldron"), oldData.getConfigurationSection("BCauldron"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Barrel.barrels.isEmpty()) {
|
if (!Barrel.barrels.isEmpty()) {
|
||||||
Barrel.save(configFile.createSection("Barrel"), oldConfig.getConfigurationSection("Barrel"));
|
Barrel.save(configFile.createSection("Barrel"), oldData.getConfigurationSection("Barrel"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BPlayer.players.isEmpty()) {
|
if (!BPlayer.players.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user