forked from External/mage
Mostly code format fixes.
This commit is contained in:
parent
7cf4ca3cae
commit
f99cd21275
37 changed files with 226 additions and 189 deletions
|
|
@ -1443,7 +1443,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
((MagePane) component).changeGUISize();
|
||||
}
|
||||
}
|
||||
for (ChatPanelBasic chatPanel : getChatPanels().values()) {
|
||||
for (ChatPanelBasic chatPanel : CHATS.values()) {
|
||||
chatPanel.changeGUISize(GUISizeHelper.chatFont);
|
||||
}
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1718,8 +1718,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
|
||||
private void updateCounts() {
|
||||
deckNameAndCountLabel.setText(role.getName() + " - " + allCards.size());
|
||||
creatureCountLabel.setText("" + creatureCounter.get());
|
||||
landCountLabel.setText("" + landCounter.get());
|
||||
creatureCountLabel.setText(String.valueOf(creatureCounter.get()));
|
||||
landCountLabel.setText(String.valueOf(landCounter.get()));
|
||||
for (CardType cardType : selectByTypeButtons.keySet()) {
|
||||
AbstractButton button = selectByTypeButtons.get(cardType);
|
||||
String text = cardType.toString();
|
||||
|
|
@ -2058,7 +2058,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (stack.isEmpty()) {
|
||||
countLabel.setVisible(false);
|
||||
} else {
|
||||
countLabel.setText("" + stack.size());
|
||||
countLabel.setText(String.valueOf(stack.size()));
|
||||
countLabel.setLocation(GRID_PADDING + (cardWidth + GRID_PADDING) * colIndex, currentY - COUNT_LABEL_HEIGHT);
|
||||
countLabel.setSize(cardWidth, COUNT_LABEL_HEIGHT);
|
||||
countLabel.setVisible(true);
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
if (level.equals("0")) {
|
||||
return false;
|
||||
}
|
||||
message = "." + message + ".";
|
||||
message = '.' + message + '.';
|
||||
|
||||
message = message.toLowerCase();
|
||||
message = message.replaceAll("[a@]([s5][s5]+)", "axyx");
|
||||
|
|
@ -217,7 +217,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
|
|||
|
||||
if (level.equals("2")) {
|
||||
message = message.replaceAll("\\.", "");
|
||||
message = "." + message + ".";
|
||||
message = '.' + message + '.';
|
||||
matchPattern = profanity2Pattern.matcher(message);
|
||||
if (matchPattern.find()) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ public class KeyBindButton extends JButton implements ActionListener {
|
|||
private void applyNewKeycode(int code) {
|
||||
preferences.getKeybindButtons().stream()
|
||||
.filter(b -> b != KeyBindButton.this)
|
||||
.filter(b -> b.getKeyCode() == code)
|
||||
.filter(b -> {
|
||||
return b.keyCode == code;
|
||||
})
|
||||
.forEach(b -> b.setKeyCode(0));
|
||||
|
||||
setKeyCode(code);
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
synchronized (dialogManagers) {
|
||||
if (!dialogManagers.containsKey(gameId)) {
|
||||
DialogManager dialogManager = new DialogManager();
|
||||
dialogManager.setScreenWidth(768);
|
||||
dialogManager.setScreenHeight(1024);
|
||||
dialogManager.screen_width = 768;
|
||||
dialogManager.screen_height = 1024;
|
||||
dialogManager.setBounds(0, 0, 768, 1024);
|
||||
dialogManager.setVisible(false);
|
||||
dialogManagers.put(gameId, dialogManager);
|
||||
|
|
@ -96,8 +96,8 @@ public class DialogManager extends JComponent implements MouseListener,
|
|||
public static void updateParams(int width, int height, boolean isVisible) {
|
||||
synchronized (dialogManagers) {
|
||||
for (DialogManager dialogManager : dialogManagers.values()) {
|
||||
dialogManager.setScreenWidth(width);
|
||||
dialogManager.setScreenHeight(height);
|
||||
dialogManager.screen_width = width;
|
||||
dialogManager.screen_height = height;
|
||||
dialogManager.setBounds(0, 0, width, height);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,8 +141,7 @@ public class ChoiceDialog extends IDialogPanel {
|
|||
remove(toRemove.get(i));
|
||||
}
|
||||
|
||||
java.util.List<CardView> cardList = new ArrayList<CardView>();
|
||||
cardList.addAll(cards.values());
|
||||
java.util.List<CardView> cardList = new ArrayList<CardView>(cards.values());
|
||||
|
||||
int width = SettingsManager.getInstance().getCardSize().width;
|
||||
int height = SettingsManager.getInstance().getCardSize().height;
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
deck.getSideboard().add(card);
|
||||
cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), getBigCard());
|
||||
cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), this.bigCard);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.getLimitedOptions().setIsRandom(tournamentType.isRandom());
|
||||
if (tournamentType.isCubeBooster()) {
|
||||
tOptions.getLimitedOptions().setDraftCubeName(this.cbDraftCube.getSelectedItem().toString());
|
||||
if (!(cubeFromDeckFilename.equals(""))) {
|
||||
if (!(cubeFromDeckFilename.isEmpty())) {
|
||||
Deck cubeFromDeck = new Deck();
|
||||
try {
|
||||
cubeFromDeck = Deck.load(DeckImporterUtil.importDeck(cubeFromDeckFilename), true, true);
|
||||
|
|
@ -828,8 +828,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, "");
|
||||
if (!randomPrefs.isEmpty()) {
|
||||
txtRandomPacks.setText(randomPrefs);
|
||||
ArrayList<String> theList = new ArrayList<>();
|
||||
theList.addAll(Arrays.asList(randomPrefs.split(";")));
|
||||
ArrayList<String> theList = new ArrayList<>(Arrays.asList(randomPrefs.split(";")));
|
||||
randomPackSelector.setSelectedPacks(theList);
|
||||
} else {
|
||||
ExpansionInfo[] allExpansions = ExpansionRepository.instance.getWithBoostersSortedByReleaseDate();
|
||||
|
|
|
|||
|
|
@ -162,8 +162,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
if (s1 != s2) {
|
||||
changed = true;
|
||||
} else if (s1 > 0) {
|
||||
Set<UUID> attachmentIds = new HashSet<>();
|
||||
attachmentIds.addAll(permanent.getAttachments());
|
||||
Set<UUID> attachmentIds = new HashSet<>(permanent.getAttachments());
|
||||
for (MagePermanent magePermanent : oldMagePermanent.getLinks()) {
|
||||
if (!attachmentIds.contains(magePermanent.getOriginalPermanent().getId())) {
|
||||
// that means that the amount of attachments is the same
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (!SessionHandler.watchGame(gameId)) {
|
||||
removeGame();
|
||||
}
|
||||
for (PlayAreaPanel panel : getPlayers().values()) {
|
||||
for (PlayAreaPanel panel : players.values()) {
|
||||
panel.setPlayingMode(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -553,7 +553,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
if (!SessionHandler.startReplay(gameId)) {
|
||||
removeGame();
|
||||
}
|
||||
for (PlayAreaPanel panel : getPlayers().values()) {
|
||||
for (PlayAreaPanel panel : players.values()) {
|
||||
panel.setPlayingMode(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -815,7 +815,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
logger.warn(" uuid:" + player.getPlayerId());
|
||||
logger.warn(" players:");
|
||||
for (PlayAreaPanel p : players.values()) {
|
||||
logger.warn("" + p);
|
||||
logger.warn(String.valueOf(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class ButtonColumn extends AbstractCellEditor implements TableCellRendere
|
|||
if (table.getRowCount() > 0 && table.getRowCount() >= table.getEditingRow() && table.getEditingRow() >= 0) {
|
||||
int row = table.convertRowIndexToModel(table.getEditingRow());
|
||||
fireEditingStopped();
|
||||
ActionEvent event = new ActionEvent(table, ActionEvent.ACTION_PERFORMED, "" + row);
|
||||
ActionEvent event = new ActionEvent(table, ActionEvent.ACTION_PERFORMED, String.valueOf(row));
|
||||
action.actionPerformed(event);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,70 +68,70 @@ public class AudioManager {
|
|||
if (audioManager.nextPageClip == null) {
|
||||
audioManager.nextPageClip = new MageClip(Constants.BASE_SOUND_PATH + "OnPrevPage.wav", AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().nextPageClip);
|
||||
checkAndPlayClip(audioManager.nextPageClip);
|
||||
}
|
||||
|
||||
public static void playPrevPage() {
|
||||
if (audioManager.prevPageClip == null) {
|
||||
audioManager.prevPageClip = new MageClip(Constants.BASE_SOUND_PATH + "OnPrevPage.wav", AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().prevPageClip);
|
||||
checkAndPlayClip(audioManager.prevPageClip);
|
||||
}
|
||||
|
||||
public static void playAnotherTab() {
|
||||
if (audioManager.anotherTabClip == null) {
|
||||
audioManager.anotherTabClip = new MageClip(Constants.BASE_SOUND_PATH + "OnNextPage.wav", AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().anotherTabClip);
|
||||
checkAndPlayClip(audioManager.anotherTabClip);
|
||||
}
|
||||
|
||||
public static void playNextPhase() {
|
||||
if (audioManager.nextPhaseClip == null) {
|
||||
audioManager.nextPhaseClip = new MageClip(Constants.BASE_SOUND_PATH + "OnNextPhase.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().nextPhaseClip);
|
||||
checkAndPlayClip(audioManager.nextPhaseClip);
|
||||
}
|
||||
|
||||
public static void playEndTurn() {
|
||||
if (audioManager.endTurnClip == null) {
|
||||
audioManager.endTurnClip = new MageClip(Constants.BASE_SOUND_PATH + "OnEndTurn.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().endTurnClip);
|
||||
checkAndPlayClip(audioManager.endTurnClip);
|
||||
}
|
||||
|
||||
public static void playTapPermanent() {
|
||||
if (audioManager.tapPermanentClip == null) {
|
||||
audioManager.tapPermanentClip = new MageClip(Constants.BASE_SOUND_PATH + "OnTapPermanent.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().tapPermanentClip);
|
||||
checkAndPlayClip(audioManager.tapPermanentClip);
|
||||
}
|
||||
|
||||
public static void playSummon() {
|
||||
if (audioManager.summonClip == null) {
|
||||
audioManager.summonClip = new MageClip(Constants.BASE_SOUND_PATH + "OnSummon.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().summonClip);
|
||||
checkAndPlayClip(audioManager.summonClip);
|
||||
}
|
||||
|
||||
public static void playDiedCreature() {
|
||||
if (audioManager.diedCreatureClip == null) {
|
||||
audioManager.diedCreatureClip = new MageClip(Constants.BASE_SOUND_PATH + "OnSummon-.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().diedCreatureClip);
|
||||
checkAndPlayClip(audioManager.diedCreatureClip);
|
||||
}
|
||||
|
||||
public static void playDraw() {
|
||||
if (audioManager.drawClip == null) {
|
||||
audioManager.drawClip = new MageClip(Constants.BASE_SOUND_PATH + "OnDraw.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().drawClip);
|
||||
checkAndPlayClip(audioManager.drawClip);
|
||||
}
|
||||
|
||||
public static void playButtonOk() {
|
||||
if (audioManager.buttonOkClip == null) {
|
||||
audioManager.buttonOkClip = new MageClip(Constants.BASE_SOUND_PATH + "OnButtonOk.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().buttonOkClip);
|
||||
checkAndPlayClip(audioManager.buttonOkClip);
|
||||
}
|
||||
|
||||
public static void playButtonCancel() {
|
||||
|
|
@ -139,105 +139,105 @@ public class AudioManager {
|
|||
audioManager.buttonCancelClip = new MageClip(Constants.BASE_SOUND_PATH + "OnButtonCancel.wav", AudioGroup.SkipSounds);
|
||||
|
||||
}
|
||||
checkAndPlayClip(getManager().buttonCancelClip);
|
||||
checkAndPlayClip(audioManager.buttonCancelClip);
|
||||
}
|
||||
|
||||
public static void playAttack() {
|
||||
if (audioManager.attackClip == null) {
|
||||
audioManager.attackClip = new MageClip(Constants.BASE_SOUND_PATH + "OnAttack.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().attackClip);
|
||||
checkAndPlayClip(audioManager.attackClip);
|
||||
}
|
||||
|
||||
public static void playBlock() {
|
||||
if (audioManager.blockClip == null) {
|
||||
audioManager.blockClip = new MageClip(Constants.BASE_SOUND_PATH + "OnBlock.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().blockClip);
|
||||
checkAndPlayClip(audioManager.blockClip);
|
||||
}
|
||||
|
||||
public static void playAddPermanent() {
|
||||
if (audioManager.addPermanentClip == null) {
|
||||
audioManager.addPermanentClip = new MageClip(Constants.BASE_SOUND_PATH + "OnAddPermanent.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().addPermanentClip);
|
||||
checkAndPlayClip(audioManager.addPermanentClip);
|
||||
}
|
||||
|
||||
public static void playAddArtifact() {
|
||||
if (audioManager.addArtifactClip == null) {
|
||||
audioManager.addArtifactClip = new MageClip(Constants.BASE_SOUND_PATH + "OnAddArtifact.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().addArtifactClip);
|
||||
checkAndPlayClip(audioManager.addArtifactClip);
|
||||
}
|
||||
|
||||
public static void playStackNew() {
|
||||
if (audioManager.updateStackClip == null) {
|
||||
audioManager.updateStackClip = new MageClip(Constants.BASE_SOUND_PATH + "OnStackNew.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().updateStackClip);
|
||||
checkAndPlayClip(audioManager.updateStackClip);
|
||||
}
|
||||
|
||||
public static void playOnHover() {
|
||||
if (audioManager.onHover == null) {
|
||||
audioManager.onHover = new MageClip(Constants.BASE_SOUND_PATH + "OnHover.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().onHover);
|
||||
checkAndPlayClip(audioManager.onHover);
|
||||
}
|
||||
|
||||
public static void playOnCountdown1() {
|
||||
if (audioManager.onCountdown1 == null) {
|
||||
audioManager.onCountdown1 = new MageClip(Constants.BASE_SOUND_PATH + "OnCountdown1.wav", AudioGroup.DraftSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().onCountdown1);
|
||||
checkAndPlayClip(audioManager.onCountdown1);
|
||||
}
|
||||
|
||||
public static void playOnDraftSelect() {
|
||||
if (audioManager.onDraftSelect == null) {
|
||||
audioManager.onDraftSelect = new MageClip(Constants.BASE_SOUND_PATH + "OnDraftSelect.wav", AudioGroup.DraftSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().onDraftSelect);
|
||||
checkAndPlayClip(audioManager.onDraftSelect);
|
||||
}
|
||||
|
||||
public static void playOnSkipButton() {
|
||||
if (audioManager.onSkipButton == null) {
|
||||
audioManager.onSkipButton = new MageClip(Constants.BASE_SOUND_PATH + "OnSkipButton.wav", AudioGroup.SkipSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().onSkipButton);
|
||||
checkAndPlayClip(audioManager.onSkipButton);
|
||||
}
|
||||
|
||||
public static void playOnSkipButtonCancel() {
|
||||
if (audioManager.onSkipButtonCancel == null) {
|
||||
audioManager.onSkipButtonCancel = new MageClip(Constants.BASE_SOUND_PATH + "OnSkipButtonCancel.wav", AudioGroup.SkipSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().onSkipButtonCancel);
|
||||
checkAndPlayClip(audioManager.onSkipButtonCancel);
|
||||
}
|
||||
|
||||
public static void playPlayerJoinedTable() {
|
||||
if (audioManager.playerJoinedTable == null) {
|
||||
audioManager.playerJoinedTable = new MageClip(Constants.BASE_SOUND_PATH + "OnPlayerJoined.wav", AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().playerJoinedTable);
|
||||
checkAndPlayClip(audioManager.playerJoinedTable);
|
||||
}
|
||||
|
||||
public static void playYourGameStarted() {
|
||||
if (audioManager.yourGameStarted == null) {
|
||||
audioManager.yourGameStarted = new MageClip(Constants.BASE_SOUND_PATH + "OnGameStart.wav", AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().yourGameStarted);
|
||||
checkAndPlayClip(audioManager.yourGameStarted);
|
||||
}
|
||||
|
||||
public static void playTournamentStarted() {
|
||||
if (audioManager.tournamentStarted == null) {
|
||||
audioManager.tournamentStarted = new MageClip(Constants.BASE_SOUND_PATH + "OnTournamentStart.wav", AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().tournamentStarted);
|
||||
checkAndPlayClip(audioManager.tournamentStarted);
|
||||
}
|
||||
|
||||
public static void playPlayerWhispered() {
|
||||
if (audioManager.playerWhispered == null) {
|
||||
audioManager.playerWhispered = new MageClip(Constants.BASE_SOUND_PATH + "OnPlayerWhispered.wav", AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().playerWhispered);
|
||||
checkAndPlayClip(audioManager.playerWhispered);
|
||||
}
|
||||
|
||||
public static void playPlayerSubmittedDeck() {
|
||||
|
|
@ -245,14 +245,14 @@ public class AudioManager {
|
|||
audioManager.playerSubmittedDeck = new MageClip(Constants.BASE_SOUND_PATH + "OnPlayerSubmittedDeck.wav",
|
||||
AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().playerSubmittedDeck);
|
||||
checkAndPlayClip(audioManager.playerSubmittedDeck);
|
||||
}
|
||||
|
||||
public static void playPlayerLeft() {
|
||||
if (audioManager.playerLeft == null) {
|
||||
audioManager.playerLeft = new MageClip(Constants.BASE_SOUND_PATH + "OnPlayerLeft.wav", AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().playerLeft);
|
||||
checkAndPlayClip(audioManager.playerLeft);
|
||||
}
|
||||
|
||||
public static void playPlayerQuitTournament() {
|
||||
|
|
@ -260,21 +260,21 @@ public class AudioManager {
|
|||
audioManager.playerQuitTournament = new MageClip(Constants.BASE_SOUND_PATH + "OnPlayerQuitTournament.wav",
|
||||
AudioGroup.OtherSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().playerQuitTournament);
|
||||
checkAndPlayClip(audioManager.playerQuitTournament);
|
||||
}
|
||||
|
||||
public static void playPlayerLost() {
|
||||
if (audioManager.playerLost == null) {
|
||||
audioManager.playerLost = new MageClip(Constants.BASE_SOUND_PATH + "OnPlayerLost.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().playerLost);
|
||||
checkAndPlayClip(audioManager.playerLost);
|
||||
}
|
||||
|
||||
public static void playPlayerWon() {
|
||||
if (audioManager.playerWon == null) {
|
||||
audioManager.playerWon = new MageClip(Constants.BASE_SOUND_PATH + "OnPlayerWon.wav", AudioGroup.GameSounds);
|
||||
}
|
||||
checkAndPlayClip(getManager().playerWon);
|
||||
checkAndPlayClip(audioManager.playerWon);
|
||||
}
|
||||
|
||||
private static boolean audioGroupEnabled(AudioGroup audioGroup) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue