diff --git a/resources/languages/en.yml b/resources/languages/en.yml index da6c41c..ef03808 100644 --- a/resources/languages/en.yml +++ b/resources/languages/en.yml @@ -102,7 +102,7 @@ Player_WakeCreated: '&aWakeup Point with id: &6&v1 &awas created successfully!' Player_WakeDeleted: '&aThe Wakeup Point with the id: &6&v1 &awas successfully deleted!' Player_WakeFilled: '&cThe Wakeup Point with the id: &6&v1&c at position &6&v2 &v3, &v4, &v5&c is filled with Blocks!' Player_WakeHint1: 'To Next Wakeup Point: Punch your fist in the air' -Player_WakeHint2: 'To Cancel: &9/br wakeup cancel' +Player_WakeHint2: 'To Cancel: &9/brew wakeup cancel' Player_WakeLast: '&aThis was the last Wakeup Point' Player_WakeNoCheck: '&cNo Wakeup Point Check is currently active' Player_WakeNoPoints: '&cThere are no Wakeup Points!' diff --git a/resources/languages/es.yml b/resources/languages/es.yml index 7e09418..d58313b 100644 --- a/resources/languages/es.yml +++ b/resources/languages/es.yml @@ -103,7 +103,7 @@ Player_WakeCreated: '&a¡Punto de activación con id: &6&v1 &afue creado con éx Player_WakeDeleted: '&aEl punto de activación con la id: &6&v1 &a¡ha sido eliminado con éxito!' Player_WakeFilled: '&cEl punto de activación con la id: &6&v1&c en la posición &6&v2 &v3, &v4, &v5&c ¡está lleno de bloques!' Player_WakeHint1: 'Al siguiente punto de activación: golpea el puño en el aire' -Player_WakeHint2: 'Para cancelar: &9/br wakeup cancel' +Player_WakeHint2: 'Para cancelar: &9/brew wakeup cancel' Player_WakeLast: '&aEste fue el último punto de activación' Player_WakeNoCheck: '&cNinguna verificación de punto de activación está activa actualmente' Player_WakeNoPoints: '&c¡No hay puntos de activación!' diff --git a/resources/languages/it.yml b/resources/languages/it.yml index cc15611..751c5ef 100755 --- a/resources/languages/it.yml +++ b/resources/languages/it.yml @@ -102,7 +102,7 @@ Player_WakeCreated: '&aIl punto di risveglio con id &6&v1 &aè stato creato con Player_WakeDeleted: '&aIl punto di risveglio con id &6&v1 &aè stato rimosso con successo!' Player_WakeFilled: '&cIl punto di risveglio con id &6&v1&c alla posizione &6&v2 &v3, &v4, &v5&c è stato coperto da dei blocchi!' Player_WakeHint1: 'Per andare al prossimo punto di risveglio dai un pugno nell''aria o ripeti il comando' -Player_WakeHint2: 'Per rimuoverlo: &9/br wakeup cancel' +Player_WakeHint2: 'Per rimuoverlo: &9/brew wakeup cancel' Player_WakeLast: '&aQuesto era l''ultimo punto di risveglio.' Player_WakeNoCheck: '&cNessun punto di risveglio attivo al momento.' Player_WakeNoPoints: '&cNon ci sono punti di risveglio!' diff --git a/resources/languages/ru.yml b/resources/languages/ru.yml index acb8968..e429553 100644 --- a/resources/languages/ru.yml +++ b/resources/languages/ru.yml @@ -102,7 +102,7 @@ Player_WakeCreated: '&aТочка пробуждения под номером: Player_WakeDeleted: '&aТочка Пробуждения под номером: &6&v1 &aбыла удалена!' Player_WakeFilled: '&cТочка Пробуждения под номером: &6&v1&c в точку &6&v2 &v3, &v4, &v5&c заполнена блоками!' Player_WakeHint1: 'Для следующей точки пробуждения: Ударь кулаком в воздух' -Player_WakeHint2: 'Для отмены: &9/br wakeup cancel' +Player_WakeHint2: 'Для отмены: &9/brew wakeup cancel' Player_WakeLast: '&aЭто была последняя точка пробуждения' Player_WakeNoCheck: '&cНет активных проверок Точек Пробуждения' Player_WakeNoPoints: '&cЗдесь нет Точки Пробуждения!' diff --git a/resources/languages/tw.yml b/resources/languages/tw.yml index 4e91c3c..39734e8 100644 --- a/resources/languages/tw.yml +++ b/resources/languages/tw.yml @@ -102,7 +102,7 @@ Player_WakeCreated: '&a這個喚醒點 id: &6&v1 &a成功創建!' Player_WakeDeleted: '&a這個喚醒點 id: &6&v1 &a成功刪除!' Player_WakeFilled: '&c這個喚醒點 id: &6&v1&c 在位置 &6&v2 &v3, &v4, &v5&c 充滿了方塊!' Player_WakeHint1: '到下一個喚醒點:把拳頭打在空中' -Player_WakeHint2: '取消: &9/br wakeup cancel' +Player_WakeHint2: '取消: &9/brew wakeup cancel' Player_WakeLast: '&a這是最後一個喚醒點' Player_WakeNoCheck: '&c目前沒有喚醒點是處於活動狀態' Player_WakeNoPoints: '&c沒有喚醒點!' diff --git a/resources/languages/zh.yml b/resources/languages/zh.yml index 4fd4a54..396ceaf 100644 --- a/resources/languages/zh.yml +++ b/resources/languages/zh.yml @@ -102,7 +102,7 @@ Player_WakeCreated: '&aid为: &6&v1 &a的苏醒处被成功创建!' Player_WakeDeleted: '&aid为: &6&v1 &a的苏醒处被成功删除!' Player_WakeFilled: '&cid为: &6&v1 &c所在方位为: &6&v2 &v3, &v4, &v5 &c被填充了方块!' Player_WakeHint1: '前往下一个苏醒处, 请对空打拳.' -Player_WakeHint2: '取消检查: &9/br wakeup cancel' +Player_WakeHint2: '取消检查: &9/brew wakeup cancel' Player_WakeLast: '&a这是最后一个苏醒处了.' Player_WakeNoCheck: '&c目前没有执行苏醒处检查.' Player_WakeNoPoints: '&c目前没有设定任何一个苏醒处!' diff --git a/src/com/dre/brewery/BPlayer.java b/src/com/dre/brewery/BPlayer.java index bcede88..36dd99a 100644 --- a/src/com/dre/brewery/BPlayer.java +++ b/src/com/dre/brewery/BPlayer.java @@ -489,16 +489,17 @@ public class BPlayer { showDrunkeness(player); } if (drunkeness <= 0) { - // wird der spieler noch gebraucht? remove(player); } } else if (offlineDrunk - drunkeness >= 30) { - Location randomLoc = Wakeup.getRandom(player.getLocation()); - if (randomLoc != null) { - if (!player.hasPermission("brewery.bypass.teleport")) { - player.teleport(randomLoc); - P.p.msg(player, P.p.languageReader.get("Player_Wake")); + if (BConfig.enableWake) { + Location randomLoc = Wakeup.getRandom(player.getLocation()); + if (randomLoc != null) { + if (!player.hasPermission("brewery.bypass.teleport")) { + player.teleport(randomLoc); + P.p.msg(player, P.p.languageReader.get("Player_Wake")); + } } } offlineDrunk = 0; diff --git a/src/com/dre/brewery/Wakeup.java b/src/com/dre/brewery/Wakeup.java index d577318..069c80a 100644 --- a/src/com/dre/brewery/Wakeup.java +++ b/src/com/dre/brewery/Wakeup.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.stream.Collectors; public class Wakeup { @@ -31,15 +32,10 @@ public class Wakeup { return null; } - ArrayList worldWakes = new ArrayList<>(); - - for (Wakeup wakeup : wakeups) { - if (wakeup.active) { - if (wakeup.loc.getWorld().equals(playerLoc.getWorld())) { - worldWakes.add(wakeup); - } - } - } + List worldWakes = wakeups.stream() + .filter(w -> w.active) + .filter(w -> w.loc.getWorld().equals(playerLoc.getWorld())) + .collect(Collectors.toList()); if (worldWakes.isEmpty()) { return null; @@ -74,14 +70,14 @@ public class Wakeup { } - if (w1.loc.distance(playerLoc) > w2.loc.distance(playerLoc)) { + if (w1.loc.distanceSquared(playerLoc) > w2.loc.distanceSquared(playerLoc)) { return w2.loc; } } return w1.loc; } - public static Wakeup calcRandom(ArrayList worldWakes) { + public static Wakeup calcRandom(List worldWakes) { if (worldWakes.isEmpty()) { return null; } diff --git a/src/com/dre/brewery/filedata/BConfig.java b/src/com/dre/brewery/filedata/BConfig.java index 8444ea6..44db141 100644 --- a/src/com/dre/brewery/filedata/BConfig.java +++ b/src/com/dre/brewery/filedata/BConfig.java @@ -82,6 +82,7 @@ public class BConfig { public static boolean enableLoginDisallow; public static boolean enablePuke; public static String homeType; + public static boolean enableWake; //Brew public static boolean colorInBarrels; // color the Lore while in Barrels @@ -229,6 +230,7 @@ public class BConfig { stumbleModifier = ((float) config.getInt("stumblePercent", 100)) / 100f; showStatusOnDrink = config.getBoolean("showStatusOnDrink", false); homeType = config.getString("homeType", null); + enableWake = config.getBoolean("enableWake", false); craftSealingTable = config.getBoolean("craftSealingTable", false); enableSealingTable = config.getBoolean("enableSealingTable", false); colorInBarrels = config.getBoolean("colorInBarrels", false); diff --git a/src/com/dre/brewery/listeners/CommandListener.java b/src/com/dre/brewery/listeners/CommandListener.java index 5f799aa..e2357d5 100644 --- a/src/com/dre/brewery/listeners/CommandListener.java +++ b/src/com/dre/brewery/listeners/CommandListener.java @@ -512,7 +512,8 @@ public class CommandListener implements CommandExecutor { int ingQ = ingredients.getIngredientQuality(recipe); int cookQ = ingredients.getCookingQuality(recipe, false); int cookDistQ = ingredients.getCookingQuality(recipe, true); - P.p.log(recipe.getRecipeName() + ": ingQlty: " + ingQ + ", cookQlty:" + cookQ + ", cook+DistQlty: " + cookDistQ); + int ageQ = ingredients.getAgeQuality(recipe, brew.getAgeTime()); + P.p.log(recipe.getRecipeName() + ": ingQlty: " + ingQ + ", cookQlty:" + cookQ + ", cook+DistQlty: " + cookDistQ + ", ageQlty: " + ageQ); } BRecipe distill = ingredients.getBestRecipe(brew.getWood(), brew.getAgeTime(), true); BRecipe nonDistill = ingredients.getBestRecipe(brew.getWood(), brew.getAgeTime(), false); @@ -535,7 +536,8 @@ public class CommandListener implements CommandExecutor { int ingQ = ingredients.getIngredientQuality(recipe); int cookQ = ingredients.getCookingQuality(recipe, false); int cookDistQ = ingredients.getCookingQuality(recipe, true); - P.p.log("ingQlty: " + ingQ + ", cookQlty:" + cookQ + ", cook+DistQlty: " + cookDistQ); + int ageQ = ingredients.getAgeQuality(recipe, brew.getAgeTime()); + P.p.log("ingQlty: " + ingQ + ", cookQlty:" + cookQ + ", cook+DistQlty: " + cookDistQ + ", ageQlty: " + ageQ); } P.p.msg(player, "Debug Info for item written into Log");