Skip to content

Commit

Permalink
Added option to toggle flask for food or health
Browse files Browse the repository at this point in the history
  • Loading branch information
Mowstyl committed Jul 21, 2022
1 parent 836b013 commit c398f75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/java/com/clanjhoo/vampire/cmd/CmdVampire.java
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,11 @@ public void onFlask(Player sender, @Default("4") Integer amount) {
} else {
// ... create a blood flask!
if (BloodFlaskUtil.fillBottle(vme, amount)) {
/*
if (vme.isVampire()) {
if (VampireRevamp.getVampireConfig().general.vampiricFlaskConsumeFood && vme.isVampire()) {
vme.addFood(-amount);
} else {
sender.setHealth(sender.getHealth() - amount);
}
*/
sender.setHealth(sender.getHealth() - amount);
// Inform
VampireRevamp.sendMessage(sender,
MessageType.INFO,
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/clanjhoo/vampire/config/GeneralConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class GeneralConfig {
public final boolean useOldFoodFormula;
private final Set<String> worldBlacklist;
public final Locale defaultLocale;
public final boolean vampiricFlaskConsumeFood;

public GeneralConfig() {
debug = false;
Expand All @@ -30,6 +31,7 @@ public GeneralConfig() {
useOldFoodFormula = false;
worldBlacklist = new HashSet<>();
defaultLocale = Locale.ENGLISH;
vampiricFlaskConsumeFood = false;
}

public GeneralConfig(@NotNull ConfigurationSection cs) {
Expand Down Expand Up @@ -60,6 +62,7 @@ public GeneralConfig(@NotNull ConfigurationSection cs) {

String locstring = cs.getString("defaultLocale");
defaultLocale = cs.contains("defaultLocale") && locstring != null && !locstring.isEmpty() ? new Locale(locstring) : def.defaultLocale;
vampiricFlaskConsumeFood = cs.getBoolean("vampiricFlaskConsumeFood", def.vampiricFlaskConsumeFood);
}

public boolean isBlacklisted(World world) {
Expand All @@ -81,6 +84,8 @@ protected boolean saveConfigToFile(BufferedWriter configWriter, String indent, i
result = result && PluginConfig.writeCollection(configWriter, "worldBlacklist:", this.worldBlacklist, indent, level);
result = result && PluginConfig.writeLine(configWriter, "# The default language to load. It has to exist in locales folder", indent, level);
result = result && PluginConfig.writeLine(configWriter, "defaultLocale: \"" + this.defaultLocale + "\"", indent, level);
result = result && PluginConfig.writeLine(configWriter, "# If vampires use their food level to create a blood flask or not (using their health instead)", indent, level);
result = result && PluginConfig.writeLine(configWriter, "vampiricFlaskConsumeFood: " + this.vampiricFlaskConsumeFood, indent, level);

return result;
}
Expand All @@ -95,6 +100,7 @@ public String toString() {
", useOldFoodFormula=" + useOldFoodFormula +
", worldBlacklist=" + worldBlacklist +
", defaultLocale=" + defaultLocale +
", vampiricFlaskConsumeFood=" + vampiricFlaskConsumeFood +
'}';
}
}

0 comments on commit c398f75

Please sign in to comment.