File tree Expand file tree Collapse file tree
src/main/java/org/mvplugins/multiverse/inventories/share Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -232,22 +232,22 @@ public void updateProfile(ProfileData profile, Player player) {
232232 @ Override
233233 public boolean updatePlayer (Player player , ProfileData profile ) {
234234 Double value = profile .get (HEALTH );
235- if (value == null ) {
236- player .setHealth (PlayerStats .HEALTH );
237- return false ;
238- }
239235 try {
236+ if (value == null ) {
237+ player .setHealth (PlayerStats .HEALTH );
238+ return false ;
239+ }
240240 double maxHealth = getMaxHealth (player );
241241 // This share may handled before MAX_HEALTH.
242242 // Thus this is needed to ensure there is no loss in health stored
243243 if (value > maxHealth ) {
244244 Option .of (maxHealthAttr ).map (player ::getAttribute )
245- .peek (attr -> attr .setBaseValue (maxHealth ));
245+ .peek (attr -> attr .setBaseValue (value ));
246246 }
247247 player .setHealth (value );
248248 } catch (IllegalArgumentException e ) {
249- Logging .fine ("Invalid value '" + value + "': " + e .getMessage ());
250- player .setHealth (PlayerStats . HEALTH );
249+ Logging .warning ("Invalid value '" + value + "': " + e .getMessage ());
250+ player .setHealth (getMaxHealth ( player ) );
251251 return false ;
252252 }
253253 return true ;
You can’t perform that action at this time.
0 commit comments