mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 23:32:43 +00:00
Fixed can set avatar level more than 90 and cause game to freeze
Limit the avatar level given by "/givechar" command. If avatar level >90, the game will freeze if open the character interface.
This commit is contained in:
parent
a8b808ba2e
commit
4adc983832
@ -73,6 +73,12 @@ public final class GiveCharCommand implements CommandHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check level.
|
||||||
|
if (level > 90) {
|
||||||
|
CommandHandler.sendMessage(sender, "Invalid avatar level.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate ascension level.
|
// Calculate ascension level.
|
||||||
if (level <= 40) {
|
if (level <= 40) {
|
||||||
ascension = (int) Math.ceil(level / 20f);
|
ascension = (int) Math.ceil(level / 20f);
|
||||||
@ -88,6 +94,6 @@ public final class GiveCharCommand implements CommandHandler {
|
|||||||
avatar.recalcStats();
|
avatar.recalcStats();
|
||||||
|
|
||||||
targetPlayer.addAvatar(avatar);
|
targetPlayer.addAvatar(avatar);
|
||||||
CommandHandler.sendMessage(sender, String.format("Given %s to %s.", avatarId, target));
|
CommandHandler.sendMessage(sender, String.format("Given %s with level %s to %s.", avatarId, level, target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user