mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 23:12:10 -08:00
* Fixed that mana auto-payment settings were not correctly set from previous settings on game start.
This commit is contained in:
parent
049f9aca7b
commit
0cbe590cac
9 changed files with 45 additions and 9 deletions
|
|
@ -1155,6 +1155,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
public synchronized void setManaPaymentMode(UUID playerId, boolean autoPayment) {
|
||||
Player player = state.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.getUserData().setManaPoolAutomatic(autoPayment);
|
||||
player.getManaPool().setAutoPayment(autoPayment);
|
||||
}
|
||||
}
|
||||
|
|
@ -1163,6 +1164,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
public synchronized void setManaPaymentModeRestricted(UUID playerId, boolean autoPaymentRestricted) {
|
||||
Player player = state.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.getUserData().setManaPoolAutomaticRestricted(autoPaymentRestricted);
|
||||
player.getManaPool().setAutoPaymentRestricted(autoPaymentRestricted);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2716,6 +2716,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
@Override
|
||||
public void setUserData(UserData userData) {
|
||||
this.userData = userData;
|
||||
getManaPool().setAutoPayment(userData.isManaPoolAutomatic());
|
||||
getManaPool().setAutoPaymentRestricted(userData.isManaPoolAutomaticRestricted());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ public class UserData implements Serializable {
|
|||
protected UserSkipPrioritySteps userSkipPrioritySteps;
|
||||
protected String flagName;
|
||||
protected boolean askMoveToGraveOrder;
|
||||
protected boolean manaPoolAutomatic;
|
||||
protected boolean manaPoolAutomaticRestricted;
|
||||
|
||||
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced,
|
||||
boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps,
|
||||
String flagName, boolean askMoveToGraveOrder) {
|
||||
String flagName, boolean askMoveToGraveOrder, boolean manaPoolAutomatic, boolean manaPoolAutomaticRestricted) {
|
||||
this.groupId = userGroup.getGroupId();
|
||||
this.avatarId = avatarId;
|
||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||
|
|
@ -29,6 +31,8 @@ public class UserData implements Serializable {
|
|||
this.confirmEmptyManaPool = confirmEmptyManaPool;
|
||||
this.flagName = flagName;
|
||||
this.askMoveToGraveOrder = askMoveToGraveOrder;
|
||||
this.manaPoolAutomatic = manaPoolAutomatic;
|
||||
this.manaPoolAutomaticRestricted = manaPoolAutomaticRestricted;
|
||||
}
|
||||
|
||||
public void update(UserData userData) {
|
||||
|
|
@ -40,10 +44,12 @@ public class UserData implements Serializable {
|
|||
this.confirmEmptyManaPool = userData.confirmEmptyManaPool;
|
||||
this.flagName = userData.flagName;
|
||||
this.askMoveToGraveOrder = userData.askMoveToGraveOrder;
|
||||
this.manaPoolAutomatic = userData.manaPoolAutomatic;
|
||||
this.manaPoolAutomaticRestricted = userData.manaPoolAutomaticRestricted;
|
||||
}
|
||||
|
||||
public static UserData getDefaultUserDataView() {
|
||||
return new UserData(UserGroup.DEFAULT, 0, false, false, true, null, "world.png", false);
|
||||
return new UserData(UserGroup.DEFAULT, 0, false, false, true, null, "world.png", false, true, true);
|
||||
}
|
||||
|
||||
public void setGroupId(int groupId) {
|
||||
|
|
@ -98,6 +104,10 @@ public class UserData implements Serializable {
|
|||
return flagName;
|
||||
}
|
||||
|
||||
public void setFlagName(String flagName) {
|
||||
this.flagName = flagName;
|
||||
}
|
||||
|
||||
public boolean askMoveToGraveOrder() {
|
||||
return askMoveToGraveOrder;
|
||||
}
|
||||
|
|
@ -106,4 +116,20 @@ public class UserData implements Serializable {
|
|||
this.askMoveToGraveOrder = askMoveToGraveOrder;
|
||||
}
|
||||
|
||||
public boolean isManaPoolAutomatic() {
|
||||
return manaPoolAutomatic;
|
||||
}
|
||||
|
||||
public void setManaPoolAutomatic(boolean manaPoolAutomatic) {
|
||||
this.manaPoolAutomatic = manaPoolAutomatic;
|
||||
}
|
||||
|
||||
public boolean isManaPoolAutomaticRestricted() {
|
||||
return manaPoolAutomaticRestricted;
|
||||
}
|
||||
|
||||
public void setManaPoolAutomaticRestricted(boolean manaPoolAutomaticRestricted) {
|
||||
this.manaPoolAutomaticRestricted = manaPoolAutomaticRestricted;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue