forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -15,88 +15,88 @@ import engine.gameManager.DbManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class GuildAlliances {
|
||||
public class GuildAlliances {
|
||||
|
||||
private int sourceGuild;
|
||||
private int allianceGuild;
|
||||
private boolean isRecommended;
|
||||
private boolean isAlly;
|
||||
private String recommender;
|
||||
private int sourceGuild;
|
||||
private int allianceGuild;
|
||||
private boolean isRecommended;
|
||||
private boolean isAlly;
|
||||
private String recommender;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
|
||||
public GuildAlliances(ResultSet rs) throws SQLException {
|
||||
this.sourceGuild = rs.getInt("GuildID");
|
||||
this.allianceGuild = rs.getInt("OtherGuildID");
|
||||
this.isRecommended = rs.getBoolean("isRecommended");
|
||||
this.isAlly = rs.getBoolean("isAlliance");
|
||||
this.recommender =rs.getString("recommender");
|
||||
}
|
||||
public GuildAlliances(ResultSet rs) throws SQLException {
|
||||
this.sourceGuild = rs.getInt("GuildID");
|
||||
this.allianceGuild = rs.getInt("OtherGuildID");
|
||||
this.isRecommended = rs.getBoolean("isRecommended");
|
||||
this.isAlly = rs.getBoolean("isAlliance");
|
||||
this.recommender = rs.getString("recommender");
|
||||
}
|
||||
|
||||
public GuildAlliances(int sourceGuild, int allianceGuild, boolean isRecommended, boolean isAlly,
|
||||
String recommender) {
|
||||
super();
|
||||
this.sourceGuild = sourceGuild;
|
||||
this.allianceGuild = allianceGuild;
|
||||
this.isRecommended = isRecommended;
|
||||
this.isAlly = isAlly;
|
||||
this.recommender = recommender;
|
||||
}
|
||||
public GuildAlliances(int sourceGuild, int allianceGuild, boolean isRecommended, boolean isAlly,
|
||||
String recommender) {
|
||||
super();
|
||||
this.sourceGuild = sourceGuild;
|
||||
this.allianceGuild = allianceGuild;
|
||||
this.isRecommended = isRecommended;
|
||||
this.isAlly = isAlly;
|
||||
this.recommender = recommender;
|
||||
}
|
||||
|
||||
public int getSourceGuild() {
|
||||
return sourceGuild;
|
||||
}
|
||||
public int getSourceGuild() {
|
||||
return sourceGuild;
|
||||
}
|
||||
|
||||
public int getAllianceGuild() {
|
||||
return allianceGuild;
|
||||
}
|
||||
public int getAllianceGuild() {
|
||||
return allianceGuild;
|
||||
}
|
||||
|
||||
public boolean isRecommended() {
|
||||
return isRecommended;
|
||||
}
|
||||
public boolean isRecommended() {
|
||||
return isRecommended;
|
||||
}
|
||||
|
||||
public boolean isAlly() {
|
||||
return isAlly;
|
||||
}
|
||||
public boolean isAlly() {
|
||||
return isAlly;
|
||||
}
|
||||
|
||||
public String getRecommender() {
|
||||
return recommender;
|
||||
}
|
||||
public String getRecommender() {
|
||||
return recommender;
|
||||
}
|
||||
|
||||
public synchronized boolean UpdateAlliance(final AllianceType allianceType, boolean updateRecommended){
|
||||
switch (allianceType){
|
||||
case Ally:
|
||||
if (updateRecommended){
|
||||
if (!DbManager.GuildQueries.UPDATE_ALLIANCE_AND_RECOMMENDED(this.sourceGuild, this.allianceGuild, true))
|
||||
return false;
|
||||
this.isAlly = true;
|
||||
this.isRecommended = false;
|
||||
}else{
|
||||
if (!DbManager.GuildQueries.UPDATE_ALLIANCE(this.sourceGuild, this.allianceGuild, true))
|
||||
return false;
|
||||
this.isAlly = true;
|
||||
this.isRecommended = false;
|
||||
}
|
||||
break;
|
||||
case Enemy:
|
||||
public synchronized boolean UpdateAlliance(final AllianceType allianceType, boolean updateRecommended) {
|
||||
switch (allianceType) {
|
||||
case Ally:
|
||||
if (updateRecommended) {
|
||||
if (!DbManager.GuildQueries.UPDATE_ALLIANCE_AND_RECOMMENDED(this.sourceGuild, this.allianceGuild, true))
|
||||
return false;
|
||||
this.isAlly = true;
|
||||
this.isRecommended = false;
|
||||
} else {
|
||||
if (!DbManager.GuildQueries.UPDATE_ALLIANCE(this.sourceGuild, this.allianceGuild, true))
|
||||
return false;
|
||||
this.isAlly = true;
|
||||
this.isRecommended = false;
|
||||
}
|
||||
break;
|
||||
case Enemy:
|
||||
|
||||
if (updateRecommended){
|
||||
if (!DbManager.GuildQueries.UPDATE_ALLIANCE_AND_RECOMMENDED(this.sourceGuild, this.allianceGuild, false))
|
||||
return false;
|
||||
this.isAlly = false;
|
||||
this.isRecommended = false;
|
||||
}else{
|
||||
if (!DbManager.GuildQueries.UPDATE_ALLIANCE(this.sourceGuild, this.allianceGuild, false))
|
||||
return false;
|
||||
this.isAlly = false;
|
||||
this.isRecommended = false;
|
||||
}
|
||||
break;
|
||||
if (updateRecommended) {
|
||||
if (!DbManager.GuildQueries.UPDATE_ALLIANCE_AND_RECOMMENDED(this.sourceGuild, this.allianceGuild, false))
|
||||
return false;
|
||||
this.isAlly = false;
|
||||
this.isRecommended = false;
|
||||
} else {
|
||||
if (!DbManager.GuildQueries.UPDATE_ALLIANCE(this.sourceGuild, this.allianceGuild, false))
|
||||
return false;
|
||||
this.isAlly = false;
|
||||
this.isRecommended = false;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user