World level updates without needing to restart

This commit is contained in:
Melledy 2022-04-26 19:20:55 -07:00
parent be307fe5f0
commit 2b69978327
2 changed files with 6 additions and 1 deletions

View File

@ -29,7 +29,7 @@ public final class SetWorldLevelCommand implements CommandHandler {
// Set in both world and player props // Set in both world and player props
sender.getWorld().setWorldLevel(level); sender.getWorld().setWorldLevel(level);
sender.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level); sender.setWorldLevel(level);
sender.dropMessage("World level set to " + level + "."); sender.dropMessage("World level set to " + level + ".");
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {

View File

@ -267,6 +267,11 @@ public class GenshinPlayer {
public int getWorldLevel() { public int getWorldLevel() {
return this.getProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL); return this.getProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL);
} }
public void setWorldLevel(int level) {
this.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level);
this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_WORLD_LEVEL));
}
public int getPrimogems() { public int getPrimogems() {
return this.getProperty(PlayerProperty.PROP_PLAYER_HCOIN); return this.getProperty(PlayerProperty.PROP_PLAYER_HCOIN);