mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Merge branch 'cleanup' into 'master'
Code cleanup See merge request core-developers/forge!4248
This commit is contained in:
@@ -90,9 +90,8 @@ public class AutoUpdater {
|
||||
int option = SOptionPane.showOptionDialog(message, localizer.getMessage("lblManualCheck"), null, options, 0);
|
||||
if (option < 1) {
|
||||
return false;
|
||||
} else {
|
||||
updateChannel = options.get(option);
|
||||
}
|
||||
updateChannel = options.get(option);
|
||||
}
|
||||
|
||||
if (buildVersion.contains("SNAPSHOT")) {
|
||||
|
||||
@@ -327,17 +327,15 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
// Don't immediately close, wait for win/lose screen
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// since the nextGameDecision might come from somewhere else it will try and concede too
|
||||
ignoreConcedeChain = true;
|
||||
for (PlayerView player : getLocalPlayers()) {
|
||||
if (!player.isAI()) {
|
||||
getGameController(player).nextGameDecision(NextGameDecision.QUIT);
|
||||
}
|
||||
// since the nextGameDecision might come from somewhere else it will try and concede too
|
||||
ignoreConcedeChain = true;
|
||||
for (PlayerView player : getLocalPlayers()) {
|
||||
if (!player.isAI()) {
|
||||
getGameController(player).nextGameDecision(NextGameDecision.QUIT);
|
||||
}
|
||||
ignoreConcedeChain = false;
|
||||
return false;
|
||||
}
|
||||
ignoreConcedeChain = false;
|
||||
return false;
|
||||
}
|
||||
else if (spectator == null) {
|
||||
return true; //if no local players or spectator, just quit
|
||||
|
||||
@@ -28,21 +28,20 @@ public class CompatibleObjectDecoder extends LengthFieldBasedFrameDecoder {
|
||||
ByteBuf frame = (ByteBuf)super.decode(ctx, in);
|
||||
if (frame == null) {
|
||||
return null;
|
||||
} else {
|
||||
ObjectInputStream ois = GuiBase.hasPropertyConfig() ?
|
||||
new ObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true))):
|
||||
}
|
||||
ObjectInputStream ois = GuiBase.hasPropertyConfig() ?
|
||||
new ObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true))):
|
||||
new CObjectInputStream(new LZ4BlockInputStream(new ByteBufInputStream(frame, true)),this.classResolver);
|
||||
|
||||
Object var5 = null;
|
||||
try {
|
||||
var5 = ois.readObject();
|
||||
} catch (StreamCorruptedException e) {
|
||||
System.err.println(String.format("Version Mismatch: %s", e.getMessage()));
|
||||
} finally {
|
||||
ois.close();
|
||||
}
|
||||
|
||||
return var5;
|
||||
Object var5 = null;
|
||||
try {
|
||||
var5 = ois.readObject();
|
||||
} catch (StreamCorruptedException e) {
|
||||
System.err.println(String.format("Version Mismatch: %s", e.getMessage()));
|
||||
} finally {
|
||||
ois.close();
|
||||
}
|
||||
|
||||
return var5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ public class FControlGameEventHandler extends IGameEventVisitor.Base<Void> {
|
||||
@Override
|
||||
public Void visit(final GameEventCardAttachment event) {
|
||||
final Game game = event.equipment.getGame();
|
||||
final Zone zEq = (Zone)game.getZoneOf(event.equipment);
|
||||
final Zone zEq = game.getZoneOf(event.equipment);
|
||||
if (event.oldEntiy instanceof Card) {
|
||||
updateZone(game.getZoneOf((Card)event.oldEntiy));
|
||||
}
|
||||
|
||||
@@ -393,14 +393,13 @@ public abstract class GuiDownloadService implements Runnable {
|
||||
protected Proxy getProxy() {
|
||||
if (type == 0) {
|
||||
return Proxy.NO_PROXY;
|
||||
} else {
|
||||
try {
|
||||
return new Proxy(TYPES[type], new InetSocketAddress(txtAddress.getText(), Integer.parseInt(txtPort.getText())));
|
||||
} catch (final Exception ex) {
|
||||
BugReporter.reportException(ex,
|
||||
"Proxy connection could not be established!\nProxy address: %s\nProxy port: %s",
|
||||
txtAddress.getText(), txtPort.getText());
|
||||
}
|
||||
}
|
||||
try {
|
||||
return new Proxy(TYPES[type], new InetSocketAddress(txtAddress.getText(), Integer.parseInt(txtPort.getText())));
|
||||
} catch (final Exception ex) {
|
||||
BugReporter.reportException(ex,
|
||||
"Proxy connection could not be established!\nProxy address: %s\nProxy port: %s",
|
||||
txtAddress.getText(), txtPort.getText());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -725,17 +725,15 @@ public class HumanPlay {
|
||||
if (ability.getSacrificedAsOffering() == null) {
|
||||
System.out.println("Sacrifice input for Offering cancelled");
|
||||
return false;
|
||||
} else {
|
||||
offering = ability.getSacrificedAsOffering();
|
||||
}
|
||||
offering = ability.getSacrificedAsOffering();
|
||||
}
|
||||
if (ability.isEmerge()) {
|
||||
if (ability.getSacrificedAsEmerge() == null) {
|
||||
System.out.println("Sacrifice input for Emerge cancelled");
|
||||
return false;
|
||||
} else {
|
||||
emerge = ability.getSacrificedAsEmerge();
|
||||
}
|
||||
emerge = ability.getSacrificedAsEmerge();
|
||||
}
|
||||
if (!toPay.isPaid()) {
|
||||
// Input is somehow clearing out the offering card?
|
||||
|
||||
@@ -694,12 +694,10 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (sa != null) {
|
||||
tempShowCard(show);
|
||||
boolean result = InputConfirm.confirm(this, ((Card) sa.getHostCard().getFirstRemembered()).getView(), message);
|
||||
endTempShowCards();
|
||||
return result;
|
||||
}
|
||||
tempShowCard(show);
|
||||
boolean result = InputConfirm.confirm(this, ((Card) sa.getHostCard().getFirstRemembered()).getView(), message);
|
||||
endTempShowCards();
|
||||
return result;
|
||||
}
|
||||
|
||||
// The general case: display the source of the SA in the prompt on mouse over
|
||||
|
||||
@@ -318,17 +318,15 @@ public class TargetSelection {
|
||||
// Not enough targets, cancel targeting
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Object madeChoice = mandatory ? controller.getGui().one(message, selectOptions) : controller.getGui().oneOrNone(message, selectOptions);
|
||||
if (madeChoice == null) {
|
||||
return false;
|
||||
}
|
||||
if (madeChoice instanceof StackItemView) {
|
||||
ability.getTargets().add(stackItemViewCache.get(madeChoice).getSpellAbility(true));
|
||||
}
|
||||
else {// 'FINISH TARGETING' chosen
|
||||
bTargetingDone = true;
|
||||
}
|
||||
Object madeChoice = mandatory ? controller.getGui().one(message, selectOptions) : controller.getGui().oneOrNone(message, selectOptions);
|
||||
if (madeChoice == null) {
|
||||
return false;
|
||||
}
|
||||
if (madeChoice instanceof StackItemView) {
|
||||
ability.getTargets().add(stackItemViewCache.get(madeChoice).getSpellAbility(true));
|
||||
}
|
||||
else {// 'FINISH TARGETING' chosen
|
||||
bTargetingDone = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user