i
hm
d
You have a couple of options here.
1) You could make
sleepers
a
val
instead of
var
.
2) You could do
sleepers = sleepers - player.uniqueId
3) You could do
sleepers.also { it -= player.uniqueId }
k
Or you know,
sleepers.remove(players.uniqueId)
could be what you want.
d
4) You could do
sleepers.remove(player.uniqueId)
, if you give up on operators.
s
@Iaroslav Postovalov What is the declared type of
sleepers
?
k
var sleepers: MutableSet<UUID>
s
How do you know that for sure, @karelpeeters?
k
There's a conflict between
Set<UUID>.minus
and
MutableCollection<UUID>.minusAssign
, so we need a type that's both: probably
MutableSet<UUID>
.
s
Probably, yes, but not necessarily...
k
I don't think I've ever come across another type that's both a set and mutable but not a mutableset.
s
Because if it is a MutableSet of UUID, it should not give this compiler error
k
This problem only happens when it's a
var
as well.
💯 1
s
Ah! I didn't see you wrote
var
... Yep, you're absolutely right, the
var
(instead of
val
) is the problem