Some changes to manual mana pool handling.

This commit is contained in:
LevelX2 2014-05-27 08:37:16 +02:00
parent 5481841b9f
commit d9e4e99a0f
13 changed files with 33 additions and 24 deletions

View file

@ -520,7 +520,10 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
}
} else if (response.getManaType() != null) {
// this mana type can be paid once from pool
this.getManaPool().unlockManaType(response.getManaType());
if (response.getResponseManaTypePlayerId().equals(this.getId())) {
this.getManaPool().unlockManaType(response.getManaType());
}
// TODO: Handle if mana pool
}
return true;
}
@ -965,9 +968,10 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
}
@Override
public void setResponseManaType(ManaType manaType) {
public void setResponseManaType(UUID playerId, ManaType manaType) {
synchronized(response) {
response.setManaType(manaType);
response.setResponseManaTypePlayerId(playerId);
response.notify();
log.debug("Got response mana type from player: " + getId());
}

View file

@ -43,6 +43,7 @@ public class PlayerResponse implements Serializable {
private Boolean responseBoolean;
private Integer responseInteger;
private ManaType responseManaType;
private UUID responseManaTypePlayerId;
public void clear() {
responseString = null;
@ -50,6 +51,7 @@ public class PlayerResponse implements Serializable {
responseBoolean = null;
responseInteger = null;
responseManaType = null;
responseManaTypePlayerId = null;
}
public String getString() {
@ -92,4 +94,12 @@ public class PlayerResponse implements Serializable {
this.responseManaType = responseManaType;
}
public UUID getResponseManaTypePlayerId() {
return responseManaTypePlayerId;
}
public void setResponseManaTypePlayerId(UUID responseManaTypePlayerId) {
this.responseManaTypePlayerId = responseManaTypePlayerId;
}
}