Skip to content

Commit

Permalink
Add RequireSneaking option to Ender
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo56958 committed Sep 27, 2023
1 parent 18ca2cd commit e7e510c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class Ender extends Modifier implements Listener {
private boolean giveNauseaOnUse;
private int nauseaDuration;
private boolean giveBlindnessOnUse;
private boolean requireSneaking;
private int blindnessDuration;

private Ender() {
Expand Down Expand Up @@ -81,6 +82,7 @@ public void reload() {
config.addDefault("EnchantCost", 10);
config.addDefault("Enchantable", false);
config.addDefault("MinimumToolLevelRequirement", 1);
config.addDefault("RequireSneaking", true);

config.addDefault("Recipe.Enabled", true);
config.addDefault("Recipe.Top", "PPP");
Expand All @@ -104,6 +106,7 @@ public void reload() {
this.nauseaDuration = config.getInt("NauseaDuration", 5) * 20;
this.giveBlindnessOnUse = config.getBoolean("GiveBlindnessOnUse", true);
this.blindnessDuration = config.getInt("BlindnessDuration", 3) * 20;
this.requireSneaking = config.getBoolean("RequireSneaking", true);
}

@EventHandler(ignoreCancelled = true)
Expand All @@ -125,7 +128,7 @@ public void effect(ProjectileLaunchEvent event) {
return;
}

if (!player.isSneaking()) {
if (this.requireSneaking && !player.isSneaking()) {
return;
}

Expand Down

0 comments on commit e7e510c

Please sign in to comment.