3838import java .util .Objects ;
3939import java .util .Optional ;
4040import java .util .UUID ;
41- import java .util .WeakHashMap ;
4241import java .util .function .BiFunction ;
4342import lombok .Getter ;
4443import lombok .NonNull ;
@@ -55,7 +54,7 @@ public class OptionsImpl implements Options {
5554 private final Map <Option <?, ?, ?>, Object > options = Collections .synchronizedMap (new HashMap <>());
5655
5756 @ Getter
58- protected final Map <UUID , Map <Option <?, ?, ?>, Object >> playerOptions = Collections .synchronizedMap (new WeakHashMap <>());
57+ protected final Map <UUID , Map <Option <?, ?, ?>, Object >> playerOptions = Collections .synchronizedMap (new HashMap <>());
5958
6059 private final ApolloModule module ;
6160
@@ -138,10 +137,10 @@ public <T> void set(@NonNull ApolloPlayer player, @NonNull Option<?, ?, ?> optio
138137
139138 Object currentValue ;
140139 if (Objects .equals (value , globalValue )) {
141- currentValue = this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new WeakHashMap <>()))
140+ currentValue = this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new HashMap <>()))
142141 .remove (option );
143142 } else {
144- currentValue = this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new WeakHashMap <>()))
143+ currentValue = this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new HashMap <>()))
145144 .put (option , value );
146145 }
147146
@@ -169,7 +168,7 @@ public <T> void add(@NonNull ApolloPlayer player, @NonNull Option<?, ?, ?> optio
169168 return ;
170169 }
171170
172- Object currentValue = this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new WeakHashMap <>()))
171+ Object currentValue = this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new HashMap <>()))
173172 .put (option , value );
174173
175174 if (!Objects .equals (currentValue , value )) {
@@ -194,7 +193,7 @@ public <T> void remove(@NonNull ApolloPlayer player, @NonNull Option<?, ?, ?> op
194193 return ;
195194 }
196195
197- if (this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new WeakHashMap <>())).remove (option , compare )) {
196+ if (this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new HashMap <>())).remove (option , compare )) {
198197 this .postPacket (option , player , option .getDefaultValue ());
199198 }
200199 }
@@ -223,7 +222,7 @@ public <T> void replace(@NonNull Option<?, ?, ?> option, @NonNull BiFunction<Opt
223222 @ Override
224223 @ SuppressWarnings ("unchecked" )
225224 public <T > void replace (@ NonNull ApolloPlayer player , @ NonNull Option <?, ?, ?> option , @ NonNull BiFunction <Option <?, ?, ?>, T , T > remappingFunction ) {
226- this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new WeakHashMap <>()))
225+ this .playerOptions .computeIfAbsent (player .getUniqueId (), k -> Collections .synchronizedMap (new HashMap <>()))
227226 .replaceAll ((k , v ) -> {
228227 T value = remappingFunction .apply (option , (T ) v );
229228 if (value == null ) {
0 commit comments