mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 07:49:03 +00:00
Fix enableWake config option being always on
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<Wakeup> 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<Wakeup> worldWakes) {
|
||||
public static Wakeup calcRandom(List<Wakeup> worldWakes) {
|
||||
if (worldWakes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user