Skip to content

Commit

Permalink
Mark value changes to save. Closes #204
Browse files Browse the repository at this point in the history
  • Loading branch information
Artamedes committed May 25, 2020
1 parent ea46ed5 commit 9f714ad
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/java/me/ionar/salhack/managers/HudManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
import me.ionar.salhack.main.SalHack;
import me.ionar.salhack.main.Wrapper;
import me.ionar.salhack.module.Value;
import me.ionar.salhack.module.ValueListeners;
import net.minecraft.client.gui.GuiScreen;

public class HudManager
{
public HudManager()
{
}

public void Init()
{
Add(new WatermarkComponent());
Expand Down Expand Up @@ -86,7 +87,19 @@ public void Add(HudComponentItem p_Item)
{
field.setAccessible(true);
}

final Value val = (Value) field.get(p_Item);

ValueListeners listener = new ValueListeners()
{
@Override
public void OnValueChange(Value p_Val)
{
ScheduleSave(p_Item);
}
};

val.Listener = listener;
p_Item.ValueList.add(val);
}
}
Expand Down

0 comments on commit 9f714ad

Please sign in to comment.