Skip to content

Commit

Permalink
Removed Unused Imports
Browse files Browse the repository at this point in the history
  • Loading branch information
rjhancock committed Sep 9, 2024
1 parent 30bd768 commit 3a7c308
Show file tree
Hide file tree
Showing 31 changed files with 607 additions and 597 deletions.
1 change: 0 additions & 1 deletion megamek/src/megamek/client/ui/swing/EditBotsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package megamek.client.ui.swing;

import megamek.client.AbstractClient;
import megamek.client.Client;
import megamek.client.bot.princess.BehaviorSettings;
import megamek.client.bot.princess.Princess;
import megamek.client.bot.princess.PrincessException;
Expand Down
10 changes: 5 additions & 5 deletions megamek/src/megamek/client/ui/swing/HelpDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.HyperlinkEvent;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.net.URL;

/**
* This is a basic help dialog that can display HTML pages and also reacts to hyperlink clicks.
* This is a basic help dialog that can display HTML pages and also reacts to
* hyperlink clicks.
*
* @author Deric "Netzilla" Page (deric dot page at usa dot net)
* @author Simon (Juliez)
*/
Expand All @@ -53,7 +53,7 @@ public HelpDialog(String title, URL helpURL, JFrame parent) {
JOptionPane.showMessageDialog(this, ex.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE);
}

//Listen for the user clicking on hyperlinks.
// Listen for the user clicking on hyperlinks.
mainView.addHyperlinkListener(e -> {
try {
if (HyperlinkEvent.EventType.ACTIVATED == e.getEventType()) {
Expand Down Expand Up @@ -81,4 +81,4 @@ public HelpDialog(String title, URL helpURL, JFrame parent) {
setSize(WIDTH, HEIGHT);
setLocationRelativeTo(null);
}
}
}
10 changes: 6 additions & 4 deletions megamek/src/megamek/client/ui/swing/IClientGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package megamek.client.ui.swing;

import megamek.client.IClient;
import megamek.common.InGameObject;

import javax.swing.*;

Expand All @@ -31,8 +30,10 @@ public interface IClientGUI {
JFrame getFrame();

/**
* Returns true if a dialog is visible on top of the ClientGUI. For example, the MegaMekController
* should ignore hotkeys if there is a dialog, like the CommonSettingsDialog, open.
* Returns true if a dialog is visible on top of the ClientGUI. For example, the
* MegaMekController
* should ignore hotkeys if there is a dialog, like the CommonSettingsDialog,
* open.
*
* @return True when hotkey events should not be forwarded to this ClientGUI
*/
Expand All @@ -45,7 +46,8 @@ public interface IClientGUI {
void initialize();

/**
* Performs shut down for threads and sockets and other things that can be disposed.
* Performs shut down for threads and sockets and other things that can be
* disposed.
*/
void die();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@

import megamek.client.ui.IDisplayable;
import megamek.client.ui.Messages;
import megamek.client.ui.SharedUtility;
import megamek.common.*;
import megamek.common.actions.ArtilleryAttackAction;
import megamek.common.actions.WeaponAttackAction;
import megamek.common.util.ImageUtil;
import megamek.common.util.fileUtils.MegaMekFile;
import megamek.common.weapons.bayweapons.BayWeapon;

import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down
615 changes: 308 additions & 307 deletions megamek/src/megamek/client/ui/swing/RandomMapPanelAdvanced.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import org.apache.commons.lang3.ArrayUtils;

import megamek.client.ui.baseComponents.AbstractButtonDialog;
import megamek.client.ui.swing.util.UIUtil.FixedYPanel;

Expand All @@ -48,29 +46,34 @@
public class MultiIntSelectorDialog extends AbstractButtonDialog {
private String description;
private JList<Integer> list;

/** Constructs a modal dialog with frame as parent. */
public MultiIntSelectorDialog(JFrame frame, String nameResourceID, String titleResourceID,
public MultiIntSelectorDialog(JFrame frame, String nameResourceID, String titleResourceID,
String descriptionResourceID, int maxValue, List<Integer> selectedItems) {
super(frame, nameResourceID, titleResourceID);
this.setResizable(false);

description = getString(descriptionResourceID);
ListModel<Integer> listData = new AbstractListModel<Integer>() {
public int getSize() { return maxValue; }
public Integer getElementAt(int index) { return index; }
public int getSize() {
return maxValue;
}

public Integer getElementAt(int index) {
return index;
}
};

list = new JList<>(listData);
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

int[] selectedItemArray = new int[selectedItems.size()];
for (int x = 0; x < selectedItems.size(); x++) {
selectedItemArray[x] = selectedItems.get(x);
}

list.setSelectedIndices(selectedItemArray);

initialize();
}

Expand All @@ -82,21 +85,23 @@ protected Container createCenterPane() {

JPanel listFieldPanel = new FixedYPanel();
listFieldPanel.add(list);
JLabel labInfo = new JLabel(scaleStringForGUI("<CENTER>" + description),

JLabel labInfo = new JLabel(scaleStringForGUI("<CENTER>" + description),
SwingConstants.CENTER);
labInfo.setAlignmentX(CENTER_ALIGNMENT);

result.add(Box.createVerticalGlue());
result.add(labInfo);
result.add(Box.createVerticalStrut(5));
result.add(listFieldPanel);
result.add(Box.createVerticalGlue());

return result;
}

/** Returns the level change entered by the user or 0, if it cannot be parsed. */

/**
* Returns the level change entered by the user or 0, if it cannot be parsed.
*/
public List<Integer> getSelectedItems() {
return list.getSelectedValuesList();
}
Expand Down
2 changes: 0 additions & 2 deletions megamek/src/megamek/common/ArtilleryTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package megamek.common;

import megamek.common.weapons.Weapon;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
Expand Down
12 changes: 6 additions & 6 deletions megamek/src/megamek/common/ConvFighter.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import megamek.client.ui.swing.calculationReport.CalculationReport;
import megamek.common.cost.ConvFighterCostCalculator;
import megamek.common.options.GameOptions;
import megamek.common.options.OptionsConstants;

/**
Expand Down Expand Up @@ -81,9 +80,9 @@ public int getFuelUsed(int thrust) {
}

protected static final TechAdvancement TA_CONV_FIGHTER = new TechAdvancement(TECH_BASE_ALL)
.setAdvancement(DATE_NONE, 2470, 2490).setProductionFactions(F_TH)
.setTechRating(RATING_D).setAvailability(RATING_C, RATING_D, RATING_C, RATING_B)
.setStaticTechLevel(SimpleTechLevel.STANDARD);
.setAdvancement(DATE_NONE, 2470, 2490).setProductionFactions(F_TH)
.setTechRating(RATING_D).setAvailability(RATING_C, RATING_D, RATING_C, RATING_B)
.setStaticTechLevel(SimpleTechLevel.STANDARD);

@Override
public TechAdvancement getConstructionTechAdvancement() {
Expand All @@ -103,7 +102,8 @@ public double getCost(CalculationReport calcReport, boolean ignoreAmmo) {
@Override
public double getPriceMultiplier() {
double priceMultiplier = 1.0;
// omni multiplier (leaving this in for now even though conventional fighters don't make for legal omnis)
// omni multiplier (leaving this in for now even though conventional fighters
// don't make for legal omnis)
if (isOmni()) {
priceMultiplier *= 1.25f;
}
Expand Down Expand Up @@ -134,6 +134,6 @@ public long getEntityType() {

@Override
public int getGenericBattleValue() {
return (int) Math.round(Math.exp(2.943 + 0.795*Math.log(getWeight())));
return (int) Math.round(Math.exp(2.943 + 0.795 * Math.log(getWeight())));
}
}
1 change: 0 additions & 1 deletion megamek/src/megamek/common/FixedWingSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import megamek.client.ui.swing.calculationReport.CalculationReport;
import megamek.common.cost.FixedWingSupportCostCalculator;
import megamek.common.equipment.ArmorType;
import megamek.common.options.OptionsConstants;

/**
* @author Jason Tighe
Expand Down
8 changes: 4 additions & 4 deletions megamek/src/megamek/common/GameReports.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
*/
package megamek.common;

import org.apache.logging.log4j.LogManager;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
Expand Down Expand Up @@ -64,14 +62,16 @@ public List<Report> get(int round) {
}

/**
* Returns the full set of reports. Note that the lists are fully modifiable and no copies.
* Returns the full set of reports. Note that the lists are fully modifiable and
* no copies.
*/
public List<List<Report>> get() {
return reports;
}

/**
* Replaces the entire contents of this FullGameReport with the given List of report lists.
* Replaces the entire contents of this FullGameReport with the given List of
* report lists.
*
* @param v The new contents
*/
Expand Down
1 change: 0 additions & 1 deletion megamek/src/megamek/common/IGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import megamek.common.event.GameListener;
import megamek.common.force.Forces;
import megamek.common.options.BasicGameOptions;
import megamek.server.scriptedevent.TriggeredActiveEvent;
import megamek.server.scriptedevent.TriggeredEvent;

import java.util.*;
Expand Down
19 changes: 12 additions & 7 deletions megamek/src/megamek/common/SpecialHexDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.io.Serializable;
import java.util.Objects;

import megamek.MegaMek;
import megamek.client.ui.swing.GUIPreferences;
import megamek.common.enums.GamePhase;
import megamek.common.util.ImageUtil;
Expand Down Expand Up @@ -244,7 +243,8 @@ public int getObscuredLevel() {
}

/**
* Determines whether this special hex should be obscured from the given <code>Player</code>.
* Determines whether this special hex should be obscured from the given
* <code>Player</code>.
*
* @param other
* @return
Expand All @@ -268,8 +268,11 @@ public void setObscured(int obscured) {

/**
* Determine whether the current SpecialHexDisplay should be displayed
* Note Artillery Hits and Bomb Hits (direct hits on their targets) will always display
* in the appropriate phase. Other bomb- or artillery-related graphics are optional.
* Note Artillery Hits and Bomb Hits (direct hits on their targets) will always
* display
* in the appropriate phase. Other bomb- or artillery-related graphics are
* optional.
*
* @param phase
* @param curRound
* @param playerChecking
Expand All @@ -289,7 +292,7 @@ public boolean drawNow(GamePhase phase, int curRound, Player playerChecking, GUI
}

// Arty icons for the owner are drawn in BoardView1.drawArtillery
// and shouldn't be drawn twice
// and shouldn't be drawn twice
if (isOwner(playerChecking)
&& (type == Type.ARTILLERY_AUTOHIT
|| type == Type.ARTILLERY_ADJUSTED
Expand All @@ -304,10 +307,12 @@ public boolean drawNow(GamePhase phase, int curRound, Player playerChecking, GUI
}

// Hide icons the player doesn't want to see
// Check user settings and Hide some "hits" because they are actually drifts that did damage
// Check user settings and Hide some "hits" because they are actually drifts
// that did damage
if (guiPref != null) {
switch (type) {
case ARTILLERY_HIT -> shouldDisplay &= !this.info.contains(Messages.getString("ArtilleryMessage.drifted"));
case ARTILLERY_HIT ->
shouldDisplay &= !this.info.contains(Messages.getString("ArtilleryMessage.drifted"));
case ARTILLERY_MISS -> shouldDisplay &= guiPref.getBoolean(GUIPreferences.SHOW_ARTILLERY_MISSES);
case ARTILLERY_DRIFT -> shouldDisplay &= guiPref.getBoolean(GUIPreferences.SHOW_ARTILLERY_DRIFTS);
case BOMB_MISS -> shouldDisplay &= guiPref.getBoolean(GUIPreferences.SHOW_BOMB_MISSES);
Expand Down
4 changes: 1 addition & 3 deletions megamek/src/megamek/common/actions/AbstractEntityAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*/
package megamek.common.actions;

import megamek.common.Game;

import java.io.Serializable;

/**
Expand All @@ -44,4 +42,4 @@ public int getEntityId() {
public String toString() {
return "[" + getClass().getSimpleName() + "]: Unit ID " + entityId;
}
}
}
Loading

0 comments on commit 3a7c308

Please sign in to comment.