Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit 593c2ba

Browse files
committed
0.2.1
1 parent eb6e524 commit 593c2ba

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ minecraft_version=1.20.4
77
parchment_version=2024.04.14
88

99
# Plugin Properties
10-
plugin_version=0.2.0
10+
plugin_version=0.2.1
1111
maven_group=com.shaybox.rushertweaks
1212
archives_base_name=shays-rusher-plugin

src/main/java/com/shaybox/rushertweaks/NightVision.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class NightVision implements EventListener {
2222
/* Custom Settings */
2323
private final BooleanSetting nightVisionSetting = new BooleanSetting("NightVision", "Client Side Night Vision Effect", false);
2424

25+
private final MobEffectInstance nightVisionEffect = new MobEffectInstance(MobEffects.NIGHT_VISION, -1, 0, true, false, false);
26+
2527
public NightVision() {
2628
this.fullBright.registerSettings(this.nightVisionSetting);
2729
}
@@ -31,24 +33,18 @@ public boolean isListening() {
3133
return this.fullBright.isToggled() || this.nightVisionSetting.getValue();
3234
}
3335

34-
boolean isApplied = false;
36+
private boolean isApplied = false;
3537

3638
@Subscribe
3739
private void onUpdate(EventPlayerUpdate event) {
3840
LocalPlayer player = event.getPlayer();
41+
boolean hasNightVision = player.hasEffect(MobEffects.NIGHT_VISION);
3942
boolean isFullBright = this.fullBright.isToggled();
4043
boolean isNightVision = this.nightVisionSetting.getValue();
4144

42-
if (!isApplied && (isFullBright && isNightVision)) {
45+
if (!hasNightVision && (isFullBright && isNightVision)) {
4346
isApplied = true;
44-
player.addEffect(new MobEffectInstance(
45-
MobEffects.NIGHT_VISION,
46-
-1,
47-
1,
48-
true,
49-
false,
50-
false
51-
));
47+
player.addEffect(this.nightVisionEffect);
5248
} else if (isApplied && (!isFullBright || !isNightVision)) {
5349
isApplied = false;
5450
player.removeEffect(MobEffects.NIGHT_VISION);

0 commit comments

Comments
 (0)