mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-29 00:50:12 +07:00
Fixed CvarManager cleanup
Fixed an issue where removing a Cvar from a CvarManager was not removing its state listener
This commit is contained in:
parent
bb5351646f
commit
e550bdab55
@ -43,7 +43,10 @@ public class CvarManager implements Cvar.StateListener, Iterable<Cvar> {
|
||||
if (cvar == null) return false;
|
||||
String alias = cvar.ALIAS.toLowerCase();
|
||||
Cvar queriedCvar = CVARS.get(alias);
|
||||
return Objects.equals(queriedCvar, cvar) && CVARS.remove(alias) != null;
|
||||
boolean removed = Objects.equals(queriedCvar, cvar)
|
||||
&& CVARS.remove(alias) != null;
|
||||
if (removed) queriedCvar.removeStateListener(this);
|
||||
return removed;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
Loading…
Reference in New Issue
Block a user