mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2025-02-14 00:51:21 +01:00
Disable Debug Messages
This commit is contained in:
parent
a549280ee6
commit
ef7293883f
@ -64,7 +64,7 @@ public class BIngredients {
|
|||||||
if (cookRecipe != null) {
|
if (cookRecipe != null) {
|
||||||
// Potion is best with cooking only
|
// Potion is best with cooking only
|
||||||
int quality = (int) Math.round((getIngredientQuality(cookRecipe) + getCookingQuality(cookRecipe, false)) / 2.0);
|
int quality = (int) Math.round((getIngredientQuality(cookRecipe) + getCookingQuality(cookRecipe, false)) / 2.0);
|
||||||
P.p.log("cooked potion has Quality: " + quality);
|
P.p.debugLog("cooked potion has Quality: " + quality);
|
||||||
Brew brew = new Brew(uid, quality, cookRecipe, this);
|
Brew brew = new Brew(uid, quality, cookRecipe, this);
|
||||||
Brew.addOrReplaceEffects(potionMeta, brew.getEffects());
|
Brew.addOrReplaceEffects(potionMeta, brew.getEffects());
|
||||||
|
|
||||||
@ -135,8 +135,8 @@ public class BIngredients {
|
|||||||
// needs riping in barrel
|
// needs riping in barrel
|
||||||
ageQuality = getAgeQuality(recipe, time);
|
ageQuality = getAgeQuality(recipe, time);
|
||||||
woodQuality = getWoodQuality(recipe, wood);
|
woodQuality = getWoodQuality(recipe, wood);
|
||||||
P.p.log("Ingredient Quality: " + ingredientQuality + " Cooking Quality: " + cookingQuality + " Wood Quality: " + woodQuality +
|
P.p.debugLog("Ingredient Quality: " + ingredientQuality + " Cooking Quality: " + cookingQuality +
|
||||||
" age Quality: " + ageQuality + " for " + recipe.getName(5));
|
" Wood Quality: " + woodQuality + " age Quality: " + ageQuality + " for " + recipe.getName(5));
|
||||||
|
|
||||||
// is this recipe better than the previous best?
|
// is this recipe better than the previous best?
|
||||||
if ((((float) ingredientQuality + cookingQuality + woodQuality + ageQuality) / 4) > quality) {
|
if ((((float) ingredientQuality + cookingQuality + woodQuality + ageQuality) / 4) > quality) {
|
||||||
@ -144,7 +144,7 @@ public class BIngredients {
|
|||||||
bestRecipe = recipe;
|
bestRecipe = recipe;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
P.p.log("Ingredient Quality: " + ingredientQuality + " Cooking Quality: " + cookingQuality + " for " + recipe.getName(5));
|
P.p.debugLog("Ingredient Quality: " + ingredientQuality + " Cooking Quality: " + cookingQuality + " for " + recipe.getName(5));
|
||||||
// calculate quality without age and barrel
|
// calculate quality without age and barrel
|
||||||
if ((((float) ingredientQuality + cookingQuality) / 2) > quality) {
|
if ((((float) ingredientQuality + cookingQuality) / 2) > quality) {
|
||||||
quality = ((float) ingredientQuality + cookingQuality) / 2;
|
quality = ((float) ingredientQuality + cookingQuality) / 2;
|
||||||
@ -154,7 +154,7 @@ public class BIngredients {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bestRecipe != null) {
|
if (bestRecipe != null) {
|
||||||
P.p.log("best recipe: " + bestRecipe.getName(5) + " has Quality= " + quality);
|
P.p.debugLog("best recipe: " + bestRecipe.getName(5) + " has Quality= " + quality);
|
||||||
}
|
}
|
||||||
return bestRecipe;
|
return bestRecipe;
|
||||||
}
|
}
|
||||||
@ -269,7 +269,6 @@ public class BIngredients {
|
|||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
int quality = 10 - Math.round(recipe.getWoodDiff(wood) * recipe.getDifficulty());
|
int quality = 10 - Math.round(recipe.getWoodDiff(wood) * recipe.getDifficulty());
|
||||||
P.p.log("wood: " + wood + " needed: " + recipe.getWood() + " diff: " + recipe.getWoodDiff(wood));
|
|
||||||
|
|
||||||
if (quality > 0) {
|
if (quality > 0) {
|
||||||
return quality;
|
return quality;
|
||||||
|
@ -109,7 +109,6 @@ public class BPlayer {
|
|||||||
} else {
|
} else {
|
||||||
bPlayer.drinkCap(player);
|
bPlayer.drinkCap(player);
|
||||||
}
|
}
|
||||||
P.p.msg(player, "Du bist nun " + bPlayer.drunkeness + "% betrunken, mit einer Qualität von " + bPlayer.getQuality());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -93,7 +93,7 @@ public class Barrel {
|
|||||||
}
|
}
|
||||||
loadTime = System.nanoTime() - loadTime;
|
loadTime = System.nanoTime() - loadTime;
|
||||||
float ftime = (float) (loadTime / 1000000.0);
|
float ftime = (float) (loadTime / 1000000.0);
|
||||||
P.p.log("opening Barrel with potions (" + ftime + "ms)");
|
P.p.debugLog("opening Barrel with potions (" + ftime + "ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,7 +375,6 @@ public class Barrel {
|
|||||||
int x = startX;
|
int x = startX;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int z = startZ;
|
int z = startZ;
|
||||||
// P.p.log("startX="+startX+" startZ="+startZ+" endX="+endX+" endZ="+endZ+" direction="+direction);
|
|
||||||
while (y <= 1) {
|
while (y <= 1) {
|
||||||
while (x <= endX) {
|
while (x <= endX) {
|
||||||
while (z <= endZ) {
|
while (z <= endZ) {
|
||||||
@ -441,12 +440,10 @@ public class Barrel {
|
|||||||
int x = startX;
|
int x = startX;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int z = startZ;
|
int z = startZ;
|
||||||
// P.p.log("startX="+startX+" startZ="+startZ+" endX="+endX+" endZ="+endZ+" direction="+direction);
|
|
||||||
while (y <= 2) {
|
while (y <= 2) {
|
||||||
while (x <= endX) {
|
while (x <= endX) {
|
||||||
while (z <= endZ) {
|
while (z <= endZ) {
|
||||||
typeId = spigot.getRelative(x, y, z).getTypeId();
|
typeId = spigot.getRelative(x, y, z).getTypeId();
|
||||||
// spigot.getRelative(x,y,z).setTypeId(1);
|
|
||||||
if (direction == 1 || direction == 2) {
|
if (direction == 1 || direction == 2) {
|
||||||
if (y == 1 && z == 0) {
|
if (y == 1 && z == 0) {
|
||||||
if (x == -2 || x == -3 || x == 2 || x == 3) {
|
if (x == -2 || x == -3 || x == 2 || x == 3) {
|
||||||
|
@ -285,7 +285,6 @@ public class Brew {
|
|||||||
// distillRuns will have an effect on the amount of alcohol, not the quality
|
// distillRuns will have an effect on the amount of alcohol, not the quality
|
||||||
currentRecipe = recipe;
|
currentRecipe = recipe;
|
||||||
quality = calcQuality();
|
quality = calcQuality();
|
||||||
P.p.log("destilled " + recipe.getName(5) + " has Quality: " + quality + ", alc: " + calcAlcohol());
|
|
||||||
|
|
||||||
addOrReplaceEffects(potionMeta, getEffects());
|
addOrReplaceEffects(potionMeta, getEffects());
|
||||||
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(quality)));
|
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(quality)));
|
||||||
@ -330,7 +329,6 @@ public class Brew {
|
|||||||
if (recipe != null) {
|
if (recipe != null) {
|
||||||
currentRecipe = recipe;
|
currentRecipe = recipe;
|
||||||
quality = calcQuality();
|
quality = calcQuality();
|
||||||
P.p.log("Final " + recipe.getName(5) + " has Quality: " + quality + ", alc: " + calcAlcohol());
|
|
||||||
|
|
||||||
addOrReplaceEffects(potionMeta, getEffects());
|
addOrReplaceEffects(potionMeta, getEffects());
|
||||||
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(quality)));
|
potionMeta.setDisplayName(P.p.color("&f" + recipe.getName(quality)));
|
||||||
|
@ -29,6 +29,7 @@ import com.dre.brewery.listeners.*;
|
|||||||
|
|
||||||
public class P extends JavaPlugin {
|
public class P extends JavaPlugin {
|
||||||
public static P p;
|
public static P p;
|
||||||
|
public static boolean debug;
|
||||||
public static int lastBackup = 0;
|
public static int lastBackup = 0;
|
||||||
public static int lastSave = 1;
|
public static int lastSave = 1;
|
||||||
public static int autosave = 3;
|
public static int autosave = 3;
|
||||||
@ -125,6 +126,12 @@ public class P extends JavaPlugin {
|
|||||||
this.msg(Bukkit.getConsoleSender(), msg);
|
this.msg(Bukkit.getConsoleSender(), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void debugLog(String msg) {
|
||||||
|
if (debug) {
|
||||||
|
this.msg(Bukkit.getConsoleSender(), "&2[Debug] &f" + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void errorLog(String msg) {
|
public void errorLog(String msg) {
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[Brewery] " + ChatColor.DARK_RED + "ERROR: " + ChatColor.RED + msg);
|
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "[Brewery] " + ChatColor.DARK_RED + "ERROR: " + ChatColor.RED + msg);
|
||||||
}
|
}
|
||||||
@ -146,6 +153,7 @@ public class P extends JavaPlugin {
|
|||||||
|
|
||||||
// various Settings
|
// various Settings
|
||||||
autosave = config.getInt("autosave", 3);
|
autosave = config.getInt("autosave", 3);
|
||||||
|
debug = config.getBoolean("debug", false);
|
||||||
BPlayer.pukeItemId = Material.matchMaterial(config.getString("pukeItem", "SOUL_SAND")).getId();
|
BPlayer.pukeItemId = Material.matchMaterial(config.getString("pukeItem", "SOUL_SAND")).getId();
|
||||||
BPlayer.hangoverTime = config.getInt("hangoverDays", 0) * 24 * 60;
|
BPlayer.hangoverTime = config.getInt("hangoverDays", 0) * 24 * 60;
|
||||||
BPlayer.overdrinkKick = config.getBoolean("enableKickOnOverdrink", false);
|
BPlayer.overdrinkKick = config.getBoolean("enableKickOnOverdrink", false);
|
||||||
@ -411,56 +419,26 @@ public class P extends JavaPlugin {
|
|||||||
|
|
||||||
FileConfiguration configFile = new YamlConfiguration();
|
FileConfiguration configFile = new YamlConfiguration();
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
|
||||||
float ftime = (float) (time / 1000000.0);
|
|
||||||
p.log("Creating a savefile (" + ftime + "ms)");
|
|
||||||
time = System.nanoTime();
|
|
||||||
|
|
||||||
if (!Brew.potions.isEmpty()) {
|
if (!Brew.potions.isEmpty()) {
|
||||||
Brew.save(configFile.createSection("Brew"));
|
Brew.save(configFile.createSection("Brew"));
|
||||||
}
|
}
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
|
||||||
ftime = (float) (time / 1000000.0);
|
|
||||||
p.log("Saving Brew (" + ftime + "ms)");
|
|
||||||
time = System.nanoTime();
|
|
||||||
|
|
||||||
if (!BCauldron.bcauldrons.isEmpty() || oldData.contains("BCauldron")) {
|
if (!BCauldron.bcauldrons.isEmpty() || oldData.contains("BCauldron")) {
|
||||||
BCauldron.save(configFile.createSection("BCauldron"), oldData.getConfigurationSection("BCauldron"));
|
BCauldron.save(configFile.createSection("BCauldron"), oldData.getConfigurationSection("BCauldron"));
|
||||||
}
|
}
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
|
||||||
ftime = (float) (time / 1000000.0);
|
|
||||||
p.log("Saving BCauldrons (" + ftime + "ms)");
|
|
||||||
time = System.nanoTime();
|
|
||||||
|
|
||||||
if (!Barrel.barrels.isEmpty() || oldData.contains("Barrel")) {
|
if (!Barrel.barrels.isEmpty() || oldData.contains("Barrel")) {
|
||||||
Barrel.save(configFile.createSection("Barrel"), oldData.getConfigurationSection("Barrel"));
|
Barrel.save(configFile.createSection("Barrel"), oldData.getConfigurationSection("Barrel"));
|
||||||
}
|
}
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
|
||||||
ftime = (float) (time / 1000000.0);
|
|
||||||
p.log("Saving Barrels (" + ftime + "ms)");
|
|
||||||
time = System.nanoTime();
|
|
||||||
|
|
||||||
if (!BPlayer.players.isEmpty()) {
|
if (!BPlayer.players.isEmpty()) {
|
||||||
BPlayer.save(configFile.createSection("Player"));
|
BPlayer.save(configFile.createSection("Player"));
|
||||||
}
|
}
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
|
||||||
ftime = (float) (time / 1000000.0);
|
|
||||||
p.log("Saving players (" + ftime + "ms)");
|
|
||||||
time = System.nanoTime();
|
|
||||||
|
|
||||||
if (!Wakeup.wakeups.isEmpty() || oldData.contains("Wakeup")) {
|
if (!Wakeup.wakeups.isEmpty() || oldData.contains("Wakeup")) {
|
||||||
Wakeup.save(configFile.createSection("Wakeup"), oldData.getConfigurationSection("Wakeup"));
|
Wakeup.save(configFile.createSection("Wakeup"), oldData.getConfigurationSection("Wakeup"));
|
||||||
}
|
}
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
|
||||||
ftime = (float) (time / 1000000.0);
|
|
||||||
p.log("Saving Wakeups (" + ftime + "ms)");
|
|
||||||
time = System.nanoTime();
|
|
||||||
|
|
||||||
saveWorldNames(configFile, oldData.getConfigurationSection("Worlds"));
|
saveWorldNames(configFile, oldData.getConfigurationSection("Worlds"));
|
||||||
|
|
||||||
configFile.set("Version", "0.5");
|
configFile.set("Version", "0.5");
|
||||||
@ -474,8 +452,8 @@ public class P extends JavaPlugin {
|
|||||||
lastSave = 1;
|
lastSave = 1;
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
time = System.nanoTime() - time;
|
||||||
ftime = (float) (time / 1000000.0);
|
float ftime = (float) (time / 1000000.0);
|
||||||
p.log("Writing Data to File (" + ftime + "ms)");
|
p.debugLog("Writing Data to File (" + ftime + "ms)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveWorldNames(FileConfiguration root, ConfigurationSection old) {
|
public void saveWorldNames(FileConfiguration root, ConfigurationSection old) {
|
||||||
@ -604,26 +582,18 @@ public class P extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
long time = System.nanoTime();
|
|
||||||
|
|
||||||
for (BCauldron cauldron : BCauldron.bcauldrons) {
|
for (BCauldron cauldron : BCauldron.bcauldrons) {
|
||||||
cauldron.onUpdate();// runs every min to update cooking time
|
cauldron.onUpdate();// runs every min to update cooking time
|
||||||
}
|
}
|
||||||
Barrel.onUpdate();// runs every min to check and update ageing time
|
Barrel.onUpdate();// runs every min to check and update ageing time
|
||||||
BPlayer.onUpdate();// updates players drunkeness
|
BPlayer.onUpdate();// updates players drunkeness
|
||||||
|
|
||||||
|
debugLog("Update");
|
||||||
|
|
||||||
if (lastSave >= autosave) {
|
if (lastSave >= autosave) {
|
||||||
saveData();// save all data
|
saveData();// save all data
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
|
||||||
float ftime = (float) (time / 1000000.0);
|
|
||||||
p.log("Update and saving (" + ftime + "ms)");
|
|
||||||
} else {
|
} else {
|
||||||
lastSave++;
|
lastSave++;
|
||||||
|
|
||||||
time = System.nanoTime() - time;
|
|
||||||
float ftime = (float) (time / 1000000.0);
|
|
||||||
p.log("Update (" + ftime + "ms)");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user