* Added to all toUpperCase/toLowerCase calls the Locale.ENGLISH to prevent problems with some languages (e.g. Turkish). Removed some unused import statements. (#4634).

This commit is contained in:
LevelX2 2018-03-18 18:18:54 +01:00
parent 03ebdc17d8
commit b073ce1c42
147 changed files with 1419 additions and 1496 deletions

View file

@ -1217,7 +1217,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
String searchStr = "";
if (searchByTextField.getText().length() >= 3) {
useText = true;
searchStr = searchByTextField.getText().toLowerCase();
searchStr = searchByTextField.getText().toLowerCase(Locale.ENGLISH);
}
for (CardType cardType : selectByTypeButtons.keySet()) {
@ -1267,20 +1267,20 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
boolean s = card.isSelected();
// Name
if (!s) {
s |= card.getName().toLowerCase().contains(searchStr);
s |= card.getName().toLowerCase(Locale.ENGLISH).contains(searchStr);
}
// Sub & Super Types
if (!s) {
for (SuperType str : card.getSuperTypes()) {
s |= str.toString().toLowerCase().contains(searchStr);
s |= str.toString().toLowerCase(Locale.ENGLISH).contains(searchStr);
}
for (SubType str : card.getSubTypes()) {
s |= str.toString().toLowerCase().contains(searchStr);
s |= str.toString().toLowerCase(Locale.ENGLISH).contains(searchStr);
}
}
// Rarity
if (!s) {
s |= card.getRarity().toString().toLowerCase().contains(searchStr);
s |= card.getRarity().toString().toLowerCase(Locale.ENGLISH).contains(searchStr);
}
// Type line
if (!s) {
@ -1288,7 +1288,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
for (CardType type : card.getCardTypes()) {
t += ' ' + type.toString();
}
s |= t.toLowerCase().contains(searchStr);
s |= t.toLowerCase(Locale.ENGLISH).contains(searchStr);
}
// Casting cost
if (!s) {
@ -1296,12 +1296,12 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
for (String m : card.getManaCost()) {
mc += m;
}
s |= mc.toLowerCase().contains(searchStr);
s |= mc.toLowerCase(Locale.ENGLISH).contains(searchStr);
}
// Rules
if (!s) {
for (String str : card.getRules()) {
s |= str.toLowerCase().contains(searchStr);
s |= str.toLowerCase(Locale.ENGLISH).contains(searchStr);
}
}
card.setSelected(s);
@ -1348,21 +1348,21 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
}
// Sub & Super Types
for (SuperType type : card.getSuperTypes()) {
t += ' ' + type.toString().toLowerCase();
t += ' ' + type.toString().toLowerCase(Locale.ENGLISH);
}
for (SubType str : card.getSubTypes()) {
t += " " + str.toString().toLowerCase();
t += " " + str.toString().toLowerCase(Locale.ENGLISH);
}
for (String qty : qtys.keySet()) {
int value = qtys.get(qty);
if (t.toLowerCase().contains(qty)) {
if (t.toLowerCase(Locale.ENGLISH).contains(qty)) {
qtys.put(qty, ++value);
}
// Rules
for (String str : card.getRules()) {
if (str.toLowerCase().contains(qty)) {
if (str.toLowerCase(Locale.ENGLISH).contains(qty)) {
qtys.put(qty, ++value);
}
}
@ -1380,10 +1380,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
}
mc = mc.replaceAll("\\{([WUBRG]).([WUBRG])\\}", "{$1}{$2}");
mc = mc.replaceAll("\\{", "#");
mc = mc.toLowerCase();
mc = mc.toLowerCase(Locale.ENGLISH);
for (String pip : pips.keySet()) {
int value = pips.get(pip);
while (mc.toLowerCase().contains(pip)) {
while (mc.toLowerCase(Locale.ENGLISH).contains(pip)) {
pips.put(pip, ++value);
mc = mc.replaceFirst(pip, "");
}

View file

@ -39,6 +39,7 @@ import java.awt.Font;
import java.awt.event.KeyEvent;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -196,15 +197,15 @@ public class ChatPanelBasic extends javax.swing.JPanel {
Pattern profanityPattern = Pattern.compile(".*(1ab1a|1d1ot|13p3r|13sb1ans|13sbo|13s13|13sb1an|13sbo|13sy|1nbr3d|1nc3st|1njun|1ub3|\\Wbj|\\Wcum|\\Wdum|\\Wfag|\\Wfap|\\W[sf]uk|\\Wj1s|\\Wp3do|\\Wp33|\\Wpoo\\W|\\Wt1t|aho13|an1ngu|ana1|anus|ar3o1a|ar3o13|ary1an|axyx|axyxhat|axyxho13|axyxmast3r|axyxmunch|axyxw1p3|b1atch|b1gt1t|b1mbo|b1ow|b1tch|ba1s|bab3|bang|barf|bastard|bawdy|b3an3r|b3ard3dc1am|b3ast1a1ty|b3atch|b3at3r|b3av3r|b3otch|b3yotch|bo1nk|bod1y|bon3d|bon3r|bon3|bob|bot13|boty|bow31|br3ast|bug3r|bukak3|bung|busty|buxyx|c1t|caca|cahon3|cam31to3|carp3tmunch3r|cawk|c3rv1x|ch1nc|ch1nk|chod3|co1ta1|cockb1ock|cockho1st3r|cocknock3r|cocksmok3r|cocksuck3r|cock|condom|corksuck3r|crabs|cums1ut|cumshot|cumsta1n|cnt|cun1ngus|cuntfac3|cunthunt3r|cunt|d1ck|d1k3|d1do|d1mw1t|d1ng13|d1psh1p|dago|dam1t|damn1t|damn3d|damn|dawg13sty13|dog13sty13|dogysty13|dong|dop3y|douch3|drunk|dumb|dumas|dum|dumbas|dumy|dyk3|3jacu1at3|3n1arg3m3nt|3r3ct1on|3r3ct|3rot1c|3xtacy|3xtasy|f.ck|f1osy|f1st3d|f1st1ng|f1sty|fa1gt|fa1g|fack|fag1t|fag3d|fagot|fag|[sf]cuk|f31at1o|f31at3|f31ch1ng|f31ch3r|f31ch|f31tch3r|f31tch|foad|fobar|fond13|for3sk1n|fu.k|fudg3pack3r|[sf]uk|g1ans|g1go1o|ganja|ghay|gh3y|go1d3nshow3r|gonad|gok|gr1ngo|h1t13r|handjob|hardon|hokah|hok3r|homo|honky|hor|hotch|hot3r|horny|hump1ng|hump3d|hump|hym3n|j1sm|j1s3d|j1sm|j1s|jackas|jackho13|jackof|j3rk3d|j3rkof|j3rk|junk13|junky|k1an|k1k3|k1nky|knob3nd|kyk3|mams|masa|mast3rba|masturba|max1|m3ns3s|m3nstruat|m[sf]uck1ng|mofo|moron|moth3rf|mthrf|muf|n1ger|n1ga|n1mrod|n1ny|n1p13|nak3d|napa1m|napy|nas1|n3gro|noky|nympho|op1at3|op1um|ora1y|ora1|org13s|organ|orgasm|orgy|ovary|ovum|p1owb1t3r|p1mp|p1nko|p1s3d|p1sof|p1s|pak1|pant13|panty|past13|pasty|p3ck3r|p3doph1|p3p3|p3n1a1|p3n13|p3n1s|p3n3trat1on|p3n3trat3|p3rv3rs1on|p3yot3|pha1c|phuck|po1ack|po1ock|pontang|pop|pr1ck|pr1g|pron|pub1|pub3|punkas|punky|pus1|pusy|puto|qu1cky|qu1ck13|qu1m|qu3af|qu3ro|qu3rs|qu3r|r1mjob|r1tard|racy|rap1st|rap3d|rap3r|rap3|raunch|r31ch|r3cta1|r3ctum|r3ctus|r3tard|r3tar|rtard|rumpram3r|rump|s1av3|s13as|s1ut|sack|sad1s|scag|sch1ong|sch1so|scr3w|scrog|scrot|scrud|scum|s3aman|s3am3n|s3duc3|s3m3n|s3xua1|sh1t|skag|skank|sm3gma|smut|sn1p3r|snatch|sodom|sp1ck|sp1c|sp1k|sp3rm|spunk|st3amy|stfu|ston3d|str1p|strok3|stup1d|suck|sumofab1atch|t1nk13|t1t[sf]uck|tampon|tard|t3abag1ng|t3at|t3st1|t3st3|t3urd|thrust|tramp|trans|trashy|twat|ug1y|unw3d|ur1n3a|ut3rus|vag1na|vu1gar|vu1va|w1g3r|wang|wank3r|wank|w31n3r|w31rdo|w3dg13|w3n13|w3tback|w3w3|wh1t3y|wh1s|whor3).*");
Pattern profanity2Pattern = Pattern.compile(".*(1ab1a|1d1ot|13p3r|13sb1ans|13sbo|13s13|13sb1an|13sbo|13sy|1nbr3d|1nc3st|1njun|1ub3|\\Wbj|\\Wcum|\\Wdum|\\Wfag|\\Wfap|\\W[sf]uk|\\Wj1s|\\Wp3do|\\Wp3|\\Wpo\\W|\\Wt1t|aho13|an1ngu|ana1|anus|ar3o1a|ar3o13|ary1an|axyx|axyxhat|axyxho13|axyxmast3r|axyxmunch|axyxw1p3|b1atch|b1gt1t|b1mbo|b1ow|b1tch|ba1s|bab3|bang|barf|bastard|bawdy|b3an3r|b3ard3dc1am|b3ast1a1ty|b3atch|b3at3r|b3av3r|b3otch|b3yotch|bo1nk|bod1y|bon3d|bon3r|bon3|bob|bot13|boty|bow31|br3ast|bug3r|bukak3|bung|busty|buxyx|c1t|caca|cahon3|cam31to3|carp3tmunch3r|cawk|c3rv1x|ch1nc|ch1nk|chod3|co1ta1|cockb1ock|cockho1st3r|cocknock3r|cocksmok3r|cocksuck3r|cock|condom|corksuck3r|crabs|cums1ut|cumshot|cumsta1n|cnt|cun1ngus|cuntfac3|cunthunt3r|cunt|d1ck|d1k3|d1do|d1mw1t|d1ng13|d1psh1p|dago|dam1t|damn1t|damn3d|damn|dawg13sty13|dog13sty13|dogysty13|dong|dop3y|douch3|drunk|dumb|dum|dumas|dumbas|dumy|dyk3|3jacu1at3|3n1arg3m3nt|3r3ct1on|3r3ct|3rot1c|3xtacy|3xtasy|f.ck|f1osy|f1st3d|f1st1ng|f1sty|fa1gt|fa1g|fack|fag1t|fag3d|fagot|fag|[sf]cuk|f31at1o|f31at3|f31ch1ng|f31ch3r|f31ch|f31tch3r|f31tch|foad|fobar|fond13|for3sk1n|fu.k|fudg3pack3r|[sf]uk|g1ans|g1go1o|ganja|ghay|gh3y|go1d3nshow3r|gonad|gr1ngo|h1t13r|handjob|hardon|hokah|hok3r|homo|honky|hor|hotch|hot3r|horny|hump1ng|hump3d|hump|hym3n|j1sm|j1s3d|j1sm|j1s|jackas|jackho13|jackof|j3rk3d|j3rkof|j3rk|junk13|junky|k1an|k1k3|k1nky|knob3nd|kyk3|mams|masa|mast3rba|masturba|max1|m3ns3s|m3nstruat|m[sf]uck1ng|mofo|moron|moth3rf|mthrf|muf|n1ga|n1ger|n1mrod|n1ny|n1p13|nak3d|napa1m|napy|nas1|n3gro|noky|nympho|op1at3|op1um|ora1y|ora1|org13s|organ|orgasm|orgy|ovary|ovum|p1owb1t3r|p1mp|p1nko|p1s3d|p1sof|p1s|pak1|pant13|panty|past13|pasty|p3ck3r|p3doph1|p3p3|p3n1a1|p3n13|p3n1s|p3n3trat1on|p3n3trat3|p3rv3rs1on|p3yot3|pha1c|phuck|po1ack|po1ock|pontang|pop|porno|porn|pr1ck|pr1g|pron|pub1|pub3|punkas|punky|pus1|pusy|puto|qu1cky|qu1ck13|qu1m|qu3af|qu3ro|qu3rs|qu3r|r1mjob|r1tard|racy|rap1st|rap3d|rap3r|rap3|raunch|r31ch|r3cta1|r3ctum|r3ctus|r3tard|r3tar|rtard|rumpram3r|rump|s1av3|s13as|s1ut|sack|sad1s|scag|sch1ong|sch1so|scr3w|scrog|scrot|scrud|scum|s3aman|s3am3n|s3duc3|s3m3n|s3xua1|sh1t|skag|skank|sm3gma|smut|sn1p3r|snatch|sodom|sp1ck|sp1c|sp1k|sp3rm|spunk|st3amy|stfu|ston3d|str1p|strok3|stup1d|suck|sumofab1atch|t1nk13|t1t[sf]uck|tampon|tard|t3abag1ng|t3at|t3st1|t3st3|t3urd|thrust|tramp|trans|trashy|twat|ug1y|unw3d|ur1n3a|ut3rus|vag1na|vu1gar|vu1va|w1g3r|wang|wank3r|wank|w31n3r|w31rdo|w3dg13|w3n13|w3tback|w3w3|wh1t3y|wh1s|whor3).*");
private boolean containsSwearing(String message, String level) {
if (level.equals("0")) {
return false;
}
message = '.' + message + '.';
message = message.toLowerCase();
message = message.toLowerCase(Locale.ENGLISH);
message = message.replaceAll("[a@]([s5][s5]+)", "axyx");
message = message.replaceAll("b.([t\\+][t\\+]+)", "buxyx");
message = message.replaceAll("(.)(\\1{1,})", "$1");
@ -280,11 +281,11 @@ public class ChatPanelBasic extends javax.swing.JPanel {
}
if (messageType == MessageType.WHISPER_FROM) {
if (username.equalsIgnoreCase(SessionHandler.getUserName())) {
if (message.toLowerCase().startsWith("profanity 0")) {
if (message.toLowerCase(Locale.ENGLISH).startsWith("profanity 0")) {
PreferencesDialog.saveValue(PreferencesDialog.KEY_GAME_USE_PROFANITY_FILTER, "0");
} else if (message.toLowerCase().startsWith("profanity 1")) {
} else if (message.toLowerCase(Locale.ENGLISH).startsWith("profanity 1")) {
PreferencesDialog.saveValue(PreferencesDialog.KEY_GAME_USE_PROFANITY_FILTER, "1");
} else if (message.toLowerCase().startsWith("profanity 2")) {
} else if (message.toLowerCase(Locale.ENGLISH).startsWith("profanity 2")) {
PreferencesDialog.saveValue(PreferencesDialog.KEY_GAME_USE_PROFANITY_FILTER, "2");
}
}
@ -435,7 +436,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
this.txtMessage.repaint();
}
}
public void enableHyperlinks() {
txtConversation.enableHyperlinks();
}

View file

@ -438,7 +438,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
return choice;
}
choice = Jsoup.parse(choice).text(); // decode HTML entities and strip tags
return choice.substring(0, 1).toUpperCase() + choice.substring(1);
return choice.substring(0, 1).toUpperCase(Locale.ENGLISH) + choice.substring(1);
}
@Override

View file

@ -30,6 +30,7 @@ package mage.client.deck.generator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import mage.cards.Card;
@ -86,7 +87,7 @@ public final class DeckGenerator {
String selectedColors = genDialog.getSelectedColors();
List<ColoredManaSymbol> allowedColors = new ArrayList<>();
selectedColors = selectedColors != null ? selectedColors.toUpperCase() : getRandomColors("X");
selectedColors = selectedColors != null ? selectedColors.toUpperCase(Locale.ENGLISH) : getRandomColors("X");
String format = genDialog.getSelectedFormat();
List<String> setsToUse = ConstructedFormats.getSetsByFormat(format);

View file

@ -25,13 +25,13 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.client.deck.generator;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import javax.swing.*;
/**
* @author Simown
@ -74,23 +74,24 @@ public class RatioAdjustingSliderPanel extends JPanel {
}
private static class AdjustingSliderGroup
{
private static class AdjustingSliderGroup {
private final ArrayList<JStorageSlider> storageSliders;
private int sliderIndex = 0;
AdjustingSliderGroup(JStorageSlider... sliders)
{
AdjustingSliderGroup(JStorageSlider... sliders) {
storageSliders = new ArrayList<>();
for(JStorageSlider slider: sliders) {
for (JStorageSlider slider : sliders) {
storageSliders.add(slider);
slider.addChangeListener(e -> fireSliderChangedEvent((JStorageSlider) e.getSource()));
}
}
public void fireSliderChangedEvent(JStorageSlider source) {
// We don't want to do anything if the value isn't changing
if(!source.getValueIsAdjusting())
if (!source.getValueIsAdjusting()) {
return;
}
// Update the slider depending on how much it's changed relative to its previous position
int change = (source.getValue() - source.getPreviousValue());
updateSliderPosition(change, source);
@ -98,11 +99,11 @@ public class RatioAdjustingSliderPanel extends JPanel {
private void updateSliderPosition(int change, JStorageSlider source) {
int remaining = change;
while (remaining != 0) {
while (remaining != 0) {
// Get the currently indexed slider
JStorageSlider slider = storageSliders.get(sliderIndex);
// If it's not the slider that fired the event
if (slider != source) {
if (slider != source) {
// Check we don't go over the upper and lower bounds
if (remaining < 0 || (remaining > 0 && slider.getValue() > 0)) {
// Adjust the currently selected slider by +/- 1
@ -114,7 +115,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
// Select the next slider in the list of sliders
sliderIndex = (sliderIndex + 1) % storageSliders.size();
}
for (JStorageSlider slider : storageSliders) {
for (JStorageSlider slider : storageSliders) {
slider.setPreviousValue(slider.getValue());
}
}
@ -156,7 +157,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
textLabels.add(titleLabel);
sliderPanel.add(titleLabel, BorderLayout.WEST);
// Slider
slider.setToolTipText("Percentage of " + label.trim().toLowerCase() + " in the generated deck.");
slider.setToolTipText("Percentage of " + label.trim().toLowerCase(Locale.ENGLISH) + " in the generated deck.");
sliderPanel.add(slider, BorderLayout.CENTER);
// Percentage
JLabel percentageLabel = createChangingPercentageLabel(slider);
@ -166,7 +167,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
return sliderPanel;
}
private static JLabel createChangingPercentageLabel(final JSlider slider) {
private static JLabel createChangingPercentageLabel(final JSlider slider) {
final JLabel label = new JLabel(" " + String.valueOf(slider.getValue()) + '%');
@ -174,7 +175,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
String value = String.valueOf(slider.getValue());
StringBuilder labelBuilder = new StringBuilder();
// Pad with spaces so all percentage labels are of equal size
for(int i = 0; i < (5-value.length()); i++) {
for (int i = 0; i < (5 - value.length()); i++) {
labelBuilder.append(" ");
}
labelBuilder.append(value);
@ -186,16 +187,16 @@ public class RatioAdjustingSliderPanel extends JPanel {
@Override
public void setEnabled(boolean enabled) {
for(JStorageSlider slider: sg.getSliders()) {
for (JStorageSlider slider : sg.getSliders()) {
slider.setEnabled(enabled);
}
for(JLabel label: textLabels) {
for (JLabel label : textLabels) {
label.setEnabled(enabled);
}
}
public void resetValues() {
for(JStorageSlider slider: sg.getSliders()) {
for (JStorageSlider slider : sg.getSliders()) {
slider.resetDefault();
}
}
@ -227,7 +228,4 @@ public class RatioAdjustingSliderPanel extends JPanel {
landSlider.previousValue = percentage;
}
}

View file

@ -1125,7 +1125,7 @@ class DeckFilter extends FileFilter {
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i + 1).toLowerCase();
ext = s.substring(i + 1).toLowerCase(Locale.ENGLISH);
}
return (ext == null) ? false : ext.equals("dck");
}
@ -1149,10 +1149,10 @@ class ImportFilter extends FileFilter {
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i + 1).toLowerCase();
ext = s.substring(i + 1).toLowerCase(Locale.ENGLISH);
}
if (ext != null) {
if (ext.toLowerCase().equals("dec") || ext.toLowerCase().equals("mwdeck") || ext.toLowerCase().equals("txt") || ext.toLowerCase().equals("dek")) {
if (ext.toLowerCase(Locale.ENGLISH).equals("dec") || ext.toLowerCase(Locale.ENGLISH).equals("mwdeck") || ext.toLowerCase(Locale.ENGLISH).equals("txt") || ext.toLowerCase(Locale.ENGLISH).equals("dek")) {
return true;
}
}

View file

@ -37,6 +37,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import javax.imageio.ImageIO;
import javax.swing.*;
@ -500,10 +501,10 @@ public class MageBook extends JComponent {
className = className.replaceAll("[^a-zA-Z0-9]", "");
className = "mage.game.permanent.token." + className + "Token";
if (token.getTokenClassName() != null && token.getTokenClassName().length() > 0) {
if (token.getTokenClassName().toLowerCase().matches(".*token.*")) {
if (token.getTokenClassName().toLowerCase(Locale.ENGLISH).matches(".*token.*")) {
className = token.getTokenClassName();
className = "mage.game.permanent.token." + className;
} else if (token.getTokenClassName().toLowerCase().matches(".*emblem.*")) {
} else if (token.getTokenClassName().toLowerCase(Locale.ENGLISH).matches(".*emblem.*")) {
continue;
}
}
@ -541,7 +542,7 @@ public class MageBook extends JComponent {
try {
String className = emblem.getName();
if (emblem.getTokenClassName() != null && emblem.getTokenClassName().length() > 0) {
if (emblem.getTokenClassName().toLowerCase().matches(".*emblem.*")) {
if (emblem.getTokenClassName().toLowerCase(Locale.ENGLISH).matches(".*emblem.*")) {
className = emblem.getTokenClassName();
className = "mage.game.command.emblems." + className;
}

View file

@ -44,7 +44,6 @@ import mage.view.CardsView;
import org.apache.log4j.Logger;
import org.jdesktop.swingx.JXPanel;
import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;

View file

@ -37,7 +37,6 @@ import java.awt.Dimension;
import java.awt.Point;
import java.beans.PropertyVetoException;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.swing.ImageIcon;

View file

@ -51,11 +51,9 @@ import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@ -723,14 +721,14 @@ public class ConnectDialog extends MageDialog {
}//GEN-LAST:event_btnFind2findPublicServerActionPerformed
private void connectXmageus(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connecXmageusW
private void connectXmageus(java.awt.event.ActionEvent evt) {
String serverAddress = "xmage.us";
this.txtServer.setText(serverAddress);
this.txtPort.setText("17171");
// Update userName and password according to the chosen server.
this.txtUserName.setText(MagePreferences.getUserName(serverAddress));
this.txtPassword.setText(MagePreferences.getPassword(serverAddress));
}//GEN-LAST:event_connectXmageus
}
private void btnFlagSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFlagSearchActionPerformed
doFastFlagSearch();

View file

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
@ -7,6 +7,7 @@
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>

View file

@ -24,15 +24,14 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
package mage.client.dialog;
import java.util.Locale;
import javax.swing.*;
import mage.client.SessionHandler;
import org.apache.log4j.Logger;
import javax.swing.*;
/**
* Feedback dialog.
*
@ -47,17 +46,19 @@ public class FeedbackDialog extends javax.swing.JDialog {
"Thank you or \"Devs, you are so cool!\"",
"Question or \"I'm so curious about\""};
/** Creates new form PreferencesDialog */
/**
* Creates new form PreferencesDialog
*/
public FeedbackDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
cbFeedbackType.setModel(new DefaultComboBoxModel(feedbackTypes));
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@ -259,16 +260,16 @@ public class FeedbackDialog extends javax.swing.JDialog {
if (type == null || type.isEmpty()) {
return "";
}
if (type.toLowerCase().startsWith("bug")) {
if (type.toLowerCase(Locale.ENGLISH).startsWith("bug")) {
return "bug";
}
if (type.toLowerCase().startsWith("feature")) {
if (type.toLowerCase(Locale.ENGLISH).startsWith("feature")) {
return "feature";
}
if (type.toLowerCase().startsWith("thank")) {
if (type.toLowerCase(Locale.ENGLISH).startsWith("thank")) {
return "thank";
}
if (type.toLowerCase().startsWith("question")) {
if (type.toLowerCase(Locale.ENGLISH).startsWith("question")) {
return "question";
}
return "";

View file

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
@ -1264,7 +1265,7 @@ class DeckFilter extends FileFilter {
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i + 1).toLowerCase();
ext = s.substring(i + 1).toLowerCase(Locale.ENGLISH);
}
return (ext == null) ? false : ext.equals("dck");
}

View file

@ -210,11 +210,11 @@ public class PickChoiceDialog extends MageDialog {
// load data to datamodel after filter or on startup
String filter = choice.getSearchText();
if (filter == null){ filter = ""; }
filter = filter.toLowerCase();
filter = filter.toLowerCase(Locale.ENGLISH);
this.dataModel.clear();
for(KeyValueItem item: this.allItems){
if(!choice.isSearchEnabled() || item.Value.toLowerCase().contains(filter)){
if(!choice.isSearchEnabled() || item.Value.toLowerCase(Locale.ENGLISH).contains(filter)){
this.dataModel.addElement(item);
}
}

View file

@ -35,8 +35,6 @@
package mage.client.dialog;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.*;

View file

@ -45,6 +45,7 @@ import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
@ -3492,7 +3493,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
}
private static void loadProxySettings(Preferences prefs) {
dialog.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(MageFrame.getPreferences().get(KEY_PROXY_TYPE, "NONE").toUpperCase()));
dialog.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(MageFrame.getPreferences().get(KEY_PROXY_TYPE, "NONE").toUpperCase(Locale.ENGLISH)));
load(prefs, dialog.txtProxyServer, KEY_PROXY_ADDRESS, Config.serverName);
load(prefs, dialog.txtProxyPort, KEY_PROXY_PORT, Integer.toString(Config.port));

View file

@ -52,7 +52,6 @@ import mage.client.util.gui.ArrowBuilder;
import mage.client.util.gui.MageDialogState;
import mage.constants.*;
import mage.game.events.PlayerQueryEvent;
import mage.game.turn.Phase;
import mage.view.*;
import org.apache.log4j.Logger;
import org.mage.card.arcane.CardPanel;

View file

@ -45,7 +45,6 @@ import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import mage.client.SessionHandler;
import mage.client.components.MageTextArea;

View file

@ -24,25 +24,24 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
/*
/*
* NewPlayerPanel.java
*
* Created on 15-Dec-2009, 10:09:46 PM
*/
package mage.client.table;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import mage.client.MageFrame;
import mage.client.deck.generator.DeckGenerator;
import mage.client.util.Config;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.io.File;
import java.io.IOException;
/**
*
* @author BetaSteward_at_googlemail.com
@ -51,7 +50,9 @@ public class NewPlayerPanel extends javax.swing.JPanel {
private final JFileChooser fcSelectDeck;
/** Creates new form NewPlayerPanel */
/**
* Creates new form NewPlayerPanel
*/
public NewPlayerPanel() {
initComponents();
fcSelectDeck = new JFileChooser();
@ -86,7 +87,8 @@ public class NewPlayerPanel extends javax.swing.JPanel {
this.txtPlayerDeck.setText(file.getPath());
try {
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
} catch (IOException ex) { }
} catch (IOException ex) {
}
}
fcSelectDeck.setSelectedFile(null);
}
@ -111,9 +113,8 @@ public class NewPlayerPanel extends javax.swing.JPanel {
this.txtPlayerDeck.setText(deckFile);
}
public int getLevel() {
return (Integer)spnLevel.getValue();
return (Integer) spnLevel.getValue();
}
public void showLevel(boolean show) {
@ -128,10 +129,10 @@ public class NewPlayerPanel extends javax.swing.JPanel {
this.btnPlayerDeck.setVisible(show);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@ -211,7 +212,6 @@ public class NewPlayerPanel extends javax.swing.JPanel {
generateDeck();
}//GEN-LAST:event_btnGenerateActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnGenerate;
private javax.swing.JButton btnPlayerDeck;
@ -237,10 +237,10 @@ class DeckFilter extends FileFilter {
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i+1).toLowerCase();
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i + 1).toLowerCase(Locale.ENGLISH);
}
return (ext==null)?false:ext.equals("dck");
return (ext == null) ? false : ext.equals("dck");
}
@Override
@ -248,4 +248,4 @@ class DeckFilter extends FileFilter {
return "Deck Files";
}
}
}

View file

@ -28,6 +28,7 @@
package mage.client.util;
import java.util.Comparator;
import java.util.Locale;
import mage.view.CardView;
/**
@ -99,7 +100,7 @@ public class CardViewEDHPowerLevelComparator implements Comparator<CardView> {
boolean whenYouCast = false;
for (String str : card.getRules()) {
String s = str.toLowerCase();
String s = str.toLowerCase(Locale.ENGLISH);
annihilator |= s.contains("annihilator");
anyNumberOfTarget |= s.contains("any number");
buyback |= s.contains("buyback");
@ -332,16 +333,16 @@ public class CardViewEDHPowerLevelComparator implements Comparator<CardView> {
}
if (card.getCardTypes().contains("Plainswalker")) {
if (card.getName().toLowerCase().equals("jace, the mind sculptor")) {
if (card.getName().toLowerCase(Locale.ENGLISH).equals("jace, the mind sculptor")) {
thisMaxPower = Math.max(thisMaxPower, 6);
}
if (card.getName().toLowerCase().equals("ugin, the spirit dragon")) {
if (card.getName().toLowerCase(Locale.ENGLISH).equals("ugin, the spirit dragon")) {
thisMaxPower = Math.max(thisMaxPower, 5);
}
thisMaxPower = Math.max(thisMaxPower, 4);
}
String cn = card.getName().toLowerCase();
String cn = card.getName().toLowerCase(Locale.ENGLISH);
if (cn.equals("ancient tomb")
|| cn.equals("anafenza, the foremost")
|| cn.equals("arcum dagsson")

View file

@ -1,6 +1,5 @@
package mage.client.util;
import java.awt.event.MouseEvent;
import java.util.UUID;
import mage.client.SessionHandler;

View file

@ -1,13 +1,12 @@
package mage.client.util;
import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
import java.util.Set;
import mage.client.MageFrame;
import mage.client.preference.MagePreferences;
import mage.view.ChatMessage;
import java.util.Arrays;
import java.util.Set;
public final class IgnoreList {
private static final String USAGE = "<br/><font color=yellow>\\ignore - shows current ignore list on this server."
@ -15,8 +14,8 @@ public final class IgnoreList {
+ "<br/>\\unignore [username] - remove a username from your ignore list on this server.</font>";
public static final int MAX_IGNORE_LIST_SIZE = 50;
public static Set<ChatMessage.MessageType> IGNORED_MESSAGE_TYPES =
ImmutableSet.of(ChatMessage.MessageType.TALK,
public static Set<ChatMessage.MessageType> IGNORED_MESSAGE_TYPES
= ImmutableSet.of(ChatMessage.MessageType.TALK,
ChatMessage.MessageType.WHISPER_FROM);
public static String usage() {
@ -45,22 +44,13 @@ public final class IgnoreList {
}
if (userIsIgnored(serverAddress, user)) {
return new StringBuilder()
.append(user)
.append(" is already on your ignore list on ")
.append(serverAddress)
.toString();
return user + " is already on your ignore list on " + serverAddress;
}
MagePreferences.addIgnoredUser(serverAddress, user);
updateTablesTable();
return new StringBuilder()
.append("Added ")
.append(user)
.append(" to your ignore list on ")
.append(serverAddress)
.toString();
return "Added " + user + " to your ignore list on " + serverAddress;
}
private static void updateTablesTable() {
@ -76,19 +66,9 @@ public final class IgnoreList {
}
if (MagePreferences.removeIgnoredUser(serverAddress, user)) {
updateTablesTable();
return new StringBuilder()
.append("Removed ")
.append(user)
.append(" from your ignore list on ")
.append(serverAddress)
.toString();
return "Removed " + user + " from your ignore list on " + serverAddress;
} else {
return new StringBuilder()
.append("No such user \"")
.append(user)
.append("\" on your ignore list on ")
.append(serverAddress)
.toString();
return "No such user \"" + user + "\" on your ignore list on " + serverAddress;
}
}

View file

@ -2,6 +2,7 @@ package mage.client.util.audio;
import java.awt.List;
import java.io.File;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import javax.sound.sampled.*;
import mage.client.constants.Constants;
@ -38,7 +39,7 @@ public class MusicPlayer {
}
String filename;
for (File f : fileread) {
filename = f.getName().toLowerCase();
filename = f.getName().toLowerCase(Locale.ENGLISH);
if (filename.endsWith(".mp3") || filename.endsWith(".wav")) {
filelist.add(filename);
}

View file

@ -6,6 +6,7 @@ import java.awt.FlowLayout;
import java.awt.Image;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
@ -77,7 +78,7 @@ public class ColorsChooser extends JComboBox implements ListCellRenderer {
private void drawOn(JPanel panel, String value) {
List<Image> images = new ArrayList<>();
value = value.toUpperCase();
value = value.toUpperCase(Locale.ENGLISH);
for (int i = 0; i < value.length(); i++) {
char symbol = value.charAt(i);
Image image = ManaSymbols.getSizedManaSymbol(String.valueOf(symbol));

View file

@ -2,6 +2,7 @@ package mage.client.util.gui;
import java.awt.*;
import java.util.ArrayList;
import java.util.Locale;
import javax.swing.*;
import mage.client.MageFrame;
import mage.client.util.GUISizeHelper;
@ -65,7 +66,7 @@ public final class GuiDisplayUtil {
out.append(c);
}
}
return out.toString().toLowerCase();
return out.toString().toLowerCase(Locale.ENGLISH);
}
public static void keepComponentInsideScreen(int centerX, int centerY, Component component) {
@ -256,7 +257,7 @@ public final class GuiDisplayUtil {
rarity = card.getRarity().getCode();
}
if (card.getExpansionSetCode() != null) {
buffer.append(ManaSymbols.replaceSetCodeWithHTML(card.getExpansionSetCode().toUpperCase(), rarity, GUISizeHelper.symbolTooltipSize));
buffer.append(ManaSymbols.replaceSetCodeWithHTML(card.getExpansionSetCode().toUpperCase(Locale.ENGLISH), rarity, GUISizeHelper.symbolTooltipSize));
}
buffer.append("</td></tr></table>");

View file

@ -9,16 +9,13 @@ import mage.view.CardView;
import mage.view.CounterView;
import mage.view.PermanentView;
import mage.view.StackAbilityView;
import net.java.truevfs.access.TFile;
import org.apache.log4j.Logger;
import org.jdesktop.swingx.graphics.GraphicsUtilities;
import org.mage.plugins.card.dl.sources.DirectLinksForDownload;
import org.mage.plugins.card.images.ImageCache;
import mage.client.constants.Constants;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Map;
import java.util.UUID;

View file

@ -396,7 +396,7 @@ public abstract class CardRenderer {
/*
// Just draw the as a code
String code = cardView.getExpansionSetCode();
code = (code != null) ? code.toUpperCase() : "";
code = (code != null) ? code.toUpperCase(Locale.ENGLISH) : "";
FontMetrics metrics = g.getFontMetrics();
setSymbolWidth = metrics.stringWidth(code);
if (cardView.getRarity() == Rarity.COMMON) {

View file

@ -13,7 +13,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.view.CardView;
import org.apache.log4j.Logger;
import org.apache.log4j.jmx.LoggerDynamicMBean;
/**
*

View file

@ -7,6 +7,7 @@ import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Locale;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
@ -16,8 +17,8 @@ import javax.swing.SwingUtilities;
@SuppressWarnings({"rawtypes", "unchecked"})
public final class Util {
public static final boolean isMac = System.getProperty("os.name").toLowerCase().contains("mac");
public static final boolean isWindows = !System.getProperty("os.name").toLowerCase().contains("windows");
public static final boolean isMac = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("mac");
public static final boolean isWindows = !System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows");
public static final ThreadPoolExecutor threadPool;
static private int threadCount;

View file

@ -3,6 +3,7 @@ package org.mage.plugins.card.dl.sources;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import mage.client.dialog.PreferencesDialog;
@ -368,7 +369,7 @@ public enum MagicCardsImageSource implements CardImageSource {
String preferedLanguage = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PREF_LANGUAGE, "en");
StringBuilder url = new StringBuilder("http://magiccards.info/scans/").append(preferedLanguage).append('/');
url.append(set.toLowerCase()).append('/').append(collectorId);
url.append(set.toLowerCase(Locale.ENGLISH)).append('/').append(collectorId);
if (card.isTwoFacedCard()) {
url.append(card.isSecondSide() ? "b" : "a");
@ -395,7 +396,7 @@ public enum MagicCardsImageSource implements CardImageSource {
if (card.getType() > 0) {
name = name + ' ' + card.getType();
}
name = name.replaceAll(" ", "-").replace(",", "").toLowerCase();
name = name.replaceAll(" ", "-").replace(",", "").toLowerCase(Locale.ENGLISH);
String set = "not-supported-set";
if (setNameTokenReplacement.containsKey(card.getSet())) {
set = setNameTokenReplacement.get(card.getSet());

View file

@ -31,6 +31,7 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.mage.plugins.card.images.CardDownloadData;
@ -257,7 +258,7 @@ public enum MagidexImageSource implements CardImageSource {
@Override
public String generateURL(CardDownloadData card) throws Exception {
String cardDownloadName = card.getDownloadName().toLowerCase();
String cardDownloadName = card.getDownloadName().toLowerCase(Locale.ENGLISH);
String cardSet = card.getSet();
if (cardDownloadName == null || cardSet == null) {

View file

@ -24,35 +24,34 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
package org.mage.plugins.card.dl.sources;
import java.util.Locale;
import org.mage.plugins.card.images.CardDownloadData;
/**
* Site was shutdown by wizards Feb. 2015
*
*
*
*
*
*
*
*
* @author LevelX2
*/
public enum MtgImageSource implements CardImageSource {
public enum MtgImageSource implements CardImageSource {
instance;
instance;
@Override
public String getSourceName() {
return "mtgimage.com";
}
@Override
public String getNextHttpImageUrl() {
return null;
}
@Override
public String getFileForHttpImage(String httpImageUrl) {
return null;
@ -66,9 +65,9 @@ public enum MtgImageSource implements CardImageSource {
throw new Exception("Wrong parameters for image: collector id: " + collectorId + ",card set: " + cardSet);
}
StringBuilder url = new StringBuilder("http://mtgimage.com/set/");
url.append(cardSet.toUpperCase()).append('/');
url.append(cardSet.toUpperCase(Locale.ENGLISH)).append('/');
if (card.isSplitCard()) {
if (card.isSplitCard()) {
url.append(card.getDownloadName().replaceAll(" // ", ""));
} else {
url.append(card.getDownloadName().replaceAll(" ", "%20"));
@ -98,12 +97,12 @@ public enum MtgImageSource implements CardImageSource {
public float getAverageSize() {
return 70.0f;
}
@Override
public int getTotalImages() {
return -1;
}
@Override
public boolean isTokenSource() {
return false;
@ -112,4 +111,4 @@ public enum MtgImageSource implements CardImageSource {
@Override
public void doPause(String httpImageUrl) {
}
}
}

View file

@ -40,6 +40,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.prefs.Preferences;
@ -317,13 +318,13 @@ public enum MythicspoilerComSource implements CardImageSource {
private Map<String, String> getSetLinks(String cardSet) {
Map<String, String> setLinks = new HashMap<>();
try {
String setNames = setsAliases.get(cardSet.toLowerCase());
String setNames = setsAliases.get(cardSet.toLowerCase(Locale.ENGLISH));
Set<String> aliasesStart = new HashSet<>();
if (cardNameAliasesStart.containsKey(cardSet)) {
aliasesStart.addAll(cardNameAliasesStart.get(cardSet));
}
if (setNames == null) {
setNames = cardSet.toLowerCase();
setNames = cardSet.toLowerCase(Locale.ENGLISH);
}
Preferences prefs = MageFrame.getPreferences();
Connection.ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None"));
@ -423,7 +424,7 @@ public enum MythicspoilerComSource implements CardImageSource {
return null;
}
Map<String, String> setLinks = sets.computeIfAbsent(cardSet, k -> getSetLinks(cardSet));
String searchName = card.getDownloadName().toLowerCase()
String searchName = card.getDownloadName().toLowerCase(Locale.ENGLISH)
.replaceAll(" ", "")
.replaceAll("\\.", "")
.replaceAll("&", "and")

View file

@ -3,6 +3,7 @@ package org.mage.plugins.card.dl.sources;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import org.mage.plugins.card.images.CardDownloadData;
@ -280,7 +281,7 @@ public enum ScryfallImageSource implements CardImageSource {
if (setNameReplacement.containsKey(setName)) {
setName = setNameReplacement.get(setName);
}
return setName.toLowerCase();
return setName.toLowerCase(Locale.ENGLISH);
}
private static final Map<String, String> setNameReplacement = new HashMap<String, String>() {

View file

@ -38,6 +38,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
@ -97,7 +98,7 @@ public enum TokensMtgImageSource implements CardImageSource {
private String getEmblemName(String originalName) {
for (SubType subType : SubType.getPlaneswalkerTypes(true)) {
if (originalName.toLowerCase().contains(subType.toString().toLowerCase())) {
if (originalName.toLowerCase(Locale.ENGLISH).contains(subType.toString().toLowerCase(Locale.ENGLISH))) {
return subType.getDescription() + " Emblem";
}
}
@ -111,13 +112,13 @@ public enum TokensMtgImageSource implements CardImageSource {
int type = card.getType();
// handle emblems
if (name.toLowerCase().contains("emblem")) {
if (name.toLowerCase(Locale.ENGLISH).contains("emblem")) {
name = getEmblemName(name);
}
// we should replace some set names
if (SET_NAMES_REPLACEMENT.containsKey(set.toLowerCase())) {
set = SET_NAMES_REPLACEMENT.get(set.toLowerCase());
if (SET_NAMES_REPLACEMENT.containsKey(set.toLowerCase(Locale.ENGLISH))) {
set = SET_NAMES_REPLACEMENT.get(set.toLowerCase(Locale.ENGLISH));
}
// Image URL contains token number
@ -187,7 +188,7 @@ public enum TokensMtgImageSource implements CardImageSource {
@Override
public boolean isImageProvided(String setCode, String cardName) {
String searchName = cardName;
if (cardName.toLowerCase().contains("emblem")) {
if (cardName.toLowerCase(Locale.ENGLISH).contains("emblem")) {
searchName = getEmblemName(cardName);
}
try {

View file

@ -39,6 +39,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
@ -493,7 +494,7 @@ public enum WizardCardsImageSource implements CardImageSource {
if (setLinks == null || setLinks.isEmpty()) {
return null;
}
String searchKey = card.getDownloadName().toLowerCase().replace(" ", "").replace("&", "//");
String searchKey = card.getDownloadName().toLowerCase(Locale.ENGLISH).replace(" ", "").replace("&", "//");
String link = setLinks.get(searchKey);
if (link == null) {
int length = collectorId.length();
@ -576,7 +577,7 @@ public enum WizardCardsImageSource implements CardImageSource {
}
}
Integer preferedMultiverseId = getLocalizedMultiverseId(preferedLanguage, multiverseId);
setLinks.put(cardName.toLowerCase() + numberChar, generateLink(preferedMultiverseId));
setLinks.put(cardName.toLowerCase(Locale.ENGLISH) + numberChar, generateLink(preferedMultiverseId));
}
}
}
@ -652,11 +653,11 @@ public enum WizardCardsImageSource implements CardImageSource {
}
}
Integer landMultiverseId = Integer.parseInt(variation.attr("href").replaceAll("[^\\d]", ""));
setLinks.put((cardName).toLowerCase() + colNumb, generateLink(landMultiverseId));
setLinks.put((cardName).toLowerCase(Locale.ENGLISH) + colNumb, generateLink(landMultiverseId));
iteration++;
}
} else {
setLinks.put(cardName.toLowerCase(), generateLink(multiverseId));
setLinks.put(cardName.toLowerCase(Locale.ENGLISH), generateLink(multiverseId));
}
}
@ -758,7 +759,7 @@ public enum WizardCardsImageSource implements CardImageSource {
// setLinks.putAll(getLandVariations(multiverseId, cardName));
// } else {
// Integer preferedMultiverseId = getLocalizedMultiverseId(preferedLanguage, multiverseId);
// setLinks.put(cardName.toLowerCase(), generateLink(preferedMultiverseId));
// setLinks.put(cardName.toLowerCase(Locale.ENGLISH), generateLink(preferedMultiverseId));
// }
// } catch (IOException | NumberFormatException ex) {
// logger.error("Exception when parsing the wizards page: " + ex.getMessage());

View file

@ -1,8 +1,8 @@
package org.mage.plugins.card.images;
import mage.util.CardUtil;
import java.util.Locale;
import java.util.Objects;
import mage.util.CardUtil;
/**
*
@ -134,7 +134,7 @@ public class CardDownloadData {
return CardUtil.parseCardNumberAsInt(collectorId);
}
public boolean isCollectorIdWithStr(){
public boolean isCollectorIdWithStr() {
// card have special numbers like "103a", "180b" (scryfall style)
return !getCollectorId().equals(getCollectorIdAsInt().toString());
}
@ -190,7 +190,7 @@ public class CardDownloadData {
private String lastDitchTokenDescriptor() {
String tmpName = this.name.replaceAll("[^a-zA-Z0-9]", "");
String descriptor = tmpName + "....";
descriptor = descriptor.toUpperCase();
descriptor = descriptor.toUpperCase(Locale.ENGLISH);
return descriptor;
}

View file

@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -504,23 +505,23 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
tokenClassName = params[6].trim();
}
if (params[1].toLowerCase().equals("generate") && params[2].startsWith("TOK:")) {
if (params[1].toLowerCase(Locale.ENGLISH).equals("generate") && params[2].startsWith("TOK:")) {
String set = params[2].substring(4);
CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true);
card.setTokenClassName(tokenClassName);
list.add(card);
// logger.debug("Token: " + set + "/" + card.getName() + " type: " + type);
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM:")) {
} else if (params[1].toLowerCase(Locale.ENGLISH).equals("generate") && params[2].startsWith("EMBLEM:")) {
String set = params[2].substring(7);
CardDownloadData card = new CardDownloadData("Emblem " + params[3], set, "0", false, type, "", "", true, fileName);
card.setTokenClassName(tokenClassName);
list.add(card);
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM-:")) {
} else if (params[1].toLowerCase(Locale.ENGLISH).equals("generate") && params[2].startsWith("EMBLEM-:")) {
String set = params[2].substring(8);
CardDownloadData card = new CardDownloadData(params[3] + " Emblem", set, "0", false, type, "", "", true, fileName);
card.setTokenClassName(tokenClassName);
list.add(card);
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM!:")) {
} else if (params[1].toLowerCase(Locale.ENGLISH).equals("generate") && params[2].startsWith("EMBLEM!:")) {
String set = params[2].substring(8);
CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true, fileName);
card.setTokenClassName(tokenClassName);

View file

@ -4,6 +4,7 @@ import java.io.File;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.util.HashMap;
import java.util.Locale;
import java.util.prefs.Preferences;
import mage.client.MageFrame;
import mage.client.constants.Constants;
@ -116,7 +117,7 @@ public final class CardImageUtils {
}
public static String updateSet(String cardSet, boolean forUrl) {
String set = cardSet.toLowerCase();
String set = cardSet.toLowerCase(Locale.ENGLISH);
if (set.equals("con")) {
set = "cfx";
}
@ -172,7 +173,7 @@ public final class CardImageUtils {
throw new IllegalArgumentException("Card " + card.getName() + " have empty set.");
}
String set = updateSet(card.getSet(), false).toUpperCase(); // TODO: research auto-replace... old code?
String set = updateSet(card.getSet(), false).toUpperCase(Locale.ENGLISH); // TODO: research auto-replace... old code?
if (card.isToken()) {
return buildImagePathToSetAsToken(set);
@ -236,7 +237,7 @@ public final class CardImageUtils {
if (dirFile.exists() && !imageFile.exists()) {
// search like names
for (String fileName : dirFile.list()) {
if (fileName.toLowerCase().equals(finalFileName.toLowerCase())) {
if (fileName.toLowerCase(Locale.ENGLISH).equals(finalFileName.toLowerCase(Locale.ENGLISH))) {
finalFileName = fileName;
break;
}

View file

@ -11,6 +11,7 @@ import java.awt.image.FilteredImageSource;
import java.awt.image.WritableRaster;
import java.net.URL;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.imageio.ImageIO;
import mage.client.util.gui.BufferedImageBuilder;
@ -20,18 +21,17 @@ import org.mage.plugins.card.utils.Transparency;
public enum ImageManagerImpl implements ImageManager {
instance;
ImageManagerImpl() {
init();
}
public void init() {
String[] phases = {"Untap", "Upkeep", "Draw", "Main1",
"Combat_Start", "Combat_Attack", "Combat_Block", "Combat_Damage", "Combat_End",
"Main2", "Cleanup", "Next_Turn"};
"Combat_Start", "Combat_Attack", "Combat_Block", "Combat_Damage", "Combat_End",
"Main2", "Cleanup", "Next_Turn"};
phasesImages = new HashMap<>();
for (String name : phases) {
Image image = getImageFromResource("/phases/phase_" + name.toLowerCase() + ".png", new Rectangle(36, 36));
Image image = getImageFromResource("/phases/phase_" + name.toLowerCase(Locale.ENGLISH) + ".png", new Rectangle(36, 36));
phasesImages.put(name, image);
}
}
@ -339,10 +339,10 @@ public enum ImageManagerImpl implements ImageManager {
}
return imageSkipYourNextTurnButton;
}
@Override
public Image getToggleRecordMacroButtonImage() {
if(imageToggleRecordMacroButton == null) {
if (imageToggleRecordMacroButton == null) {
imageToggleRecordMacroButton = getBufferedImageFromResource("/buttons/toggle_macro.png");
}
return imageToggleRecordMacroButton;
@ -414,7 +414,7 @@ public enum ImageManagerImpl implements ImageManager {
private static BufferedImage triggeredAbilityIcon;
private static BufferedImage activatedAbilityIcon;
private static BufferedImage lookedAtIcon;
private static BufferedImage revealedIcon;
private static BufferedImage revealedIcon;
private static BufferedImage exileIcon;
private static BufferedImage imageCopyIcon;
private static BufferedImage imageCounterGreen;

View file

@ -3,6 +3,7 @@ package org.mage.plugins.theme;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Locale;
import java.util.Map;
import javax.imageio.ImageIO;
import javax.swing.*;
@ -49,7 +50,7 @@ public class ThemePluginImpl implements ThemePlugin {
return false;
}
for (File f : filelist) {
String filename = f.getName().toLowerCase();
String filename = f.getName().toLowerCase(Locale.ENGLISH);
if (filename != null && (filename.endsWith(".png") || filename.endsWith(".jpg")
|| filename.endsWith(".bmp"))) {
flist.add(filename);

View file

@ -988,7 +988,7 @@ public class CardView extends SimpleCardView {
public String getColorText() {
String color = getColor().getDescription();
return color.substring(0, 1).toUpperCase() + color.substring(1);
return color.substring(0, 1).toUpperCase(Locale.ENGLISH) + color.substring(1);
}
public String getTypeText() {

View file

@ -24,21 +24,15 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
/*
/*
* ConnectDialog.java
*
* Created on 20-Jan-2010, 9:37:07 PM
*/
package mage.server.console;
import mage.remote.Connection;
import mage.remote.Connection.ProxyType;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.awt.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@ -46,8 +40,13 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import javax.swing.*;
import mage.remote.Connection;
import mage.remote.Connection.ProxyType;
import org.apache.log4j.Logger;
/**
*
@ -60,9 +59,11 @@ public class ConnectDialog extends JDialog {
private Connection connection;
private ConnectTask task;
/** Creates new form ConnectDialog */
/**
* Creates new form ConnectDialog
*/
public ConnectDialog() {
initComponents();
initComponents();
cbProxyType.setModel(new DefaultComboBoxModel(Connection.ProxyType.values()));
}
@ -73,7 +74,7 @@ public class ConnectDialog extends JDialog {
this.chkAutoConnect.setSelected(Boolean.parseBoolean(ConsoleFrame.getPreferences().get("autoConnect", "false")));
this.txtProxyServer.setText(ConsoleFrame.getPreferences().get("proxyAddress", "localhost"));
this.txtProxyPort.setText(ConsoleFrame.getPreferences().get("proxyPort", Integer.toString(17171)));
this.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(ConsoleFrame.getPreferences().get("proxyType", "NONE").toUpperCase()));
this.cbProxyType.setSelectedItem(Connection.ProxyType.valueOf(ConsoleFrame.getPreferences().get("proxyType", "NONE").toUpperCase(Locale.ENGLISH)));
this.txtProxyUserName.setText(ConsoleFrame.getPreferences().get("proxyUsername", ""));
this.txtPasswordField.setText(ConsoleFrame.getPreferences().get("proxyPassword", ""));
this.showProxySettings();
@ -87,13 +88,11 @@ public class ConnectDialog extends JDialog {
this.pnlProxy.setVisible(true);
this.pnlProxyAuth.setVisible(false);
this.pnlProxySettings.setVisible(true);
}
else if (cbProxyType.getSelectedItem() == Connection.ProxyType.HTTP) {
} else if (cbProxyType.getSelectedItem() == Connection.ProxyType.HTTP) {
this.pnlProxy.setVisible(true);
this.pnlProxyAuth.setVisible(true);
this.pnlProxySettings.setVisible(true);
}
else if (cbProxyType.getSelectedItem() == Connection.ProxyType.NONE) {
} else if (cbProxyType.getSelectedItem() == Connection.ProxyType.NONE) {
this.pnlProxy.setVisible(false);
this.pnlProxyAuth.setVisible(false);
this.pnlProxySettings.setVisible(false);
@ -115,10 +114,10 @@ public class ConnectDialog extends JDialog {
Arrays.fill(input, '0');
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@ -377,7 +376,7 @@ public class ConnectDialog extends JDialog {
JOptionPane.showMessageDialog(rootPane, "Please provide a port number");
return;
}
if (Integer.valueOf(txtPort.getText()) < 1 || Integer.valueOf(txtPort.getText()) > 65535 ) {
if (Integer.valueOf(txtPort.getText()) < 1 || Integer.valueOf(txtPort.getText()) > 65535) {
JOptionPane.showMessageDialog(rootPane, "Invalid port number");
txtPort.setText(ConsoleFrame.getPreferences().get("serverPort", Integer.toString(17171)));
return;
@ -424,15 +423,15 @@ public class ConnectDialog extends JDialog {
if (result) {
lblStatus.setText("");
connected();
}
else {
} else {
lblStatus.setText("Could not connect");
}
} catch (InterruptedException ex) {
logger.fatal("Update Players Task error", ex);
} catch (ExecutionException ex) {
logger.fatal("Update Players Task error", ex);
} catch (CancellationException ex) {}
} catch (CancellationException ex) {
}
}
}
@ -441,7 +440,6 @@ public class ConnectDialog extends JDialog {
this.setVisible(false);
}
private void keyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_keyTyped
char c = evt.getKeyChar();
if (!Character.isDigit(c)) {
@ -467,7 +465,7 @@ public class ConnectDialog extends JDialog {
List<String> servers = new ArrayList<>();
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println("Found server: "+inputLine);
System.out.println("Found server: " + inputLine);
servers.add(inputLine);
}
@ -491,11 +489,14 @@ public class ConnectDialog extends JDialog {
}
in.close();
} catch(Exception ex) {
logger.error(ex,ex);
} catch (Exception ex) {
logger.error(ex, ex);
} finally {
if (in != null) {
try { in.close(); } catch (Exception e) {}
try {
in.close();
} catch (Exception e) {
}
}
}
}//GEN-LAST:event_jButton1ActionPerformed
@ -505,10 +506,9 @@ public class ConnectDialog extends JDialog {
}//GEN-LAST:event_cbProxyTypeActionPerformed
private void txtPasswordFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPasswordFieldActionPerformed
// TODO add your handling code here:
// TODO add your handling code here:
}//GEN-LAST:event_txtPasswordFieldActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnConnect;

View file

@ -608,7 +608,7 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
if (!panel.getjUserName().getText().equals("")) {
List<UserView> users2 = new ArrayList<>();
for (UserView user : users) {
if (user.getUserName().toUpperCase().matches(".*" + panel.getjUserName().getText().toUpperCase() + ".*")) {
if (user.getUserName().toUpperCase(Locale.ENGLISH).matches(".*" + panel.getjUserName().getText().toUpperCase(Locale.ENGLISH) + ".*")) {
users2.add(user);
}
}
@ -697,7 +697,7 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
if (!panel.getjUserName().getText().equals("")) {
Collection<TableView> tableViews2 = new ArrayList<>();
for (TableView table : tableViews) {
if (table.getControllerName().toUpperCase().matches(".*" + panel.getjUserName().getText().toUpperCase() + ".*")) {
if (table.getControllerName().toUpperCase(Locale.ENGLISH).matches(".*" + panel.getjUserName().getText().toUpperCase(Locale.ENGLISH) + ".*")) {
tableViews2.add(table);
}
}

View file

@ -275,7 +275,7 @@ public class Commander extends Constructed {
boolean whenYouCast = false;
for (String str : card.getRules()) {
String s = str.toLowerCase();
String s = str.toLowerCase(Locale.ENGLISH);
annihilator |= s.contains("annihilator");
anyNumberOfTarget |= s.contains("any number");
buyback |= s.contains("buyback");
@ -521,16 +521,16 @@ public class Commander extends Constructed {
}
if (card.isPlaneswalker()) {
if (card.getName().toLowerCase().equals("jace, the mind sculptor")) {
if (card.getName().toLowerCase(Locale.ENGLISH).equals("jace, the mind sculptor")) {
thisMaxPower = Math.max(thisMaxPower, 6);
}
if (card.getName().toLowerCase().equals("ugin, the spirit dragon")) {
if (card.getName().toLowerCase(Locale.ENGLISH).equals("ugin, the spirit dragon")) {
thisMaxPower = Math.max(thisMaxPower, 5);
}
thisMaxPower = Math.max(thisMaxPower, 4);
}
String cn = card.getName().toLowerCase();
String cn = card.getName().toLowerCase(Locale.ENGLISH);
if (cn.equals("ancient tomb")
|| cn.equals("anafenza, the foremost")
|| cn.equals("arcum dagsson")
@ -678,7 +678,7 @@ public class Commander extends Constructed {
ObjectColor color = null;
for (Card commander : deck.getSideboard()) {
int thisMaxPower = 0;
String cn = commander.getName().toLowerCase();
String cn = commander.getName().toLowerCase(Locale.ENGLISH);
if (color == null) {
color = commander.getColor(null);
} else {

View file

@ -245,7 +245,7 @@ public enum ChatManager {
return true;
}
if (command.startsWith("CARD ")) {
Matcher matchPattern = getCardTextPattern.matcher(message.toLowerCase());
Matcher matchPattern = getCardTextPattern.matcher(message.toLowerCase(Locale.ENGLISH));
if (matchPattern.find()) {
String cardName = matchPattern.group(1);
CardInfo cardInfo = CardRepository.instance.findPreferedCoreExpansionCard(cardName, true);

View file

@ -27,6 +27,7 @@
*/
package mage.server;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
@ -297,7 +298,7 @@ public class TableController {
// Check power level for table (currently only used for EDH/Commander table)
int edhPowerLevel = table.getMatch().getOptions().getEdhPowerLevel();
if (edhPowerLevel > 0 && table.getValidator().getName().toLowerCase().equals("commander")) {
if (edhPowerLevel > 0 && table.getValidator().getName().toLowerCase(Locale.ENGLISH).equals("commander")) {
int deckEdhPowerLevel = table.getValidator().getEdhPowerLevel(deck);
if (deckEdhPowerLevel % 100 > edhPowerLevel) {
String message = new StringBuilder("Your deck appears to be too powerful for this table.\n\nReduce the number of extra turn cards, infect, counters, fogs, reconsider your commander. ")

View file

@ -28,6 +28,7 @@
package mage.cards.a;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
@ -121,7 +122,7 @@ class AngelicSkirmisherEffect extends OneShotEffect {
if (ability != null) {
GainAbilityControlledEffect effect = new GainAbilityControlledEffect(ability, Duration.EndOfTurn, new FilterControlledCreaturePermanent());
game.addEffect(effect, source);
game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " has chosen " + abilityChoice.getChoice().toLowerCase());
game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " has chosen " + abilityChoice.getChoice().toLowerCase(Locale.ENGLISH));
return true;
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.c;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
@ -113,7 +114,7 @@ public class ConfusionInTheRanks extends CardImpl {
if (!message.isEmpty()) {
message += "or ";
}
message += cardTypeEntering.toString().toLowerCase() + ' ';
message += cardTypeEntering.toString().toLowerCase(Locale.ENGLISH) + ' ';
}
filterTarget.add(Predicates.or(cardTypesPredicates));
message += "you don't control";

View file

@ -27,6 +27,7 @@
*/
package mage.cards.c;
import java.util.Locale;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
@ -38,8 +39,8 @@ import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -52,7 +53,7 @@ import mage.players.Player;
public class CosmicHorror extends CardImpl {
public CosmicHorror(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}{B}");
this.subtype.add(SubType.HORROR);
this.power = new MageInt(7);
this.toughness = new MageInt(7);
@ -95,7 +96,7 @@ class CosmicHorrorEffect extends OneShotEffect {
Permanent cosmicHorror = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && cosmicHorror != null) {
StringBuilder sb = new StringBuilder(cost.getText()).append('?');
if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) {
if (!sb.toString().toLowerCase(Locale.ENGLISH).startsWith("exile ") && !sb.toString().toLowerCase(Locale.ENGLISH).startsWith("return ")) {
sb.insert(0, "Pay ");
}
if (controller.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {

View file

@ -27,6 +27,7 @@
*/
package mage.cards.d;
import java.util.Locale;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
@ -40,8 +41,8 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
@ -61,7 +62,7 @@ import mage.target.common.TargetOpponent;
public class DemonicHordes extends CardImpl {
public DemonicHordes(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}{B}");
this.subtype.add(SubType.DEMON);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
@ -106,7 +107,7 @@ class DemonicHordesEffect extends OneShotEffect {
Permanent demonicHordes = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && demonicHordes != null) {
StringBuilder sb = new StringBuilder(cost.getText()).append('?');
if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) {
if (!sb.toString().toLowerCase(Locale.ENGLISH).startsWith("exile ") && !sb.toString().toLowerCase(Locale.ENGLISH).startsWith("return ")) {
sb.insert(0, "Pay ");
}
if (controller.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {

View file

@ -28,6 +28,7 @@
package mage.cards.d;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
@ -145,7 +146,7 @@ public class DustOfMoments extends CardImpl {
if (!game.isSimulation()) {
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
.append(controller.getLogName()).append(getActionStr()).append('s')
.append(counter.getCount()).append(' ').append(counterName.toLowerCase())
.append(counter.getCount()).append(' ').append(counterName.toLowerCase(Locale.ENGLISH))
.append(" counter on ").append(card.getName()).toString());
}
}
@ -170,7 +171,7 @@ public class DustOfMoments extends CardImpl {
if (!game.isSimulation()) {
game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
.append(controller.getLogName()).append(getActionStr()).append("s ")
.append(counter.getCount()).append(' ').append(counterName.toLowerCase())
.append(counter.getCount()).append(' ').append(counterName.toLowerCase(Locale.ENGLISH))
.append(" counter on ").append(card.getName()).toString());
}
}
@ -185,9 +186,9 @@ public class DustOfMoments extends CardImpl {
StringBuilder sb = new StringBuilder();
sb.append(getActionStr());
if (counter.getCount() > 1) {
sb.append(Integer.toString(counter.getCount())).append(' ').append(counter.getName().toLowerCase()).append(" counters on each ");
sb.append(Integer.toString(counter.getCount())).append(' ').append(counter.getName().toLowerCase(Locale.ENGLISH)).append(" counters on each ");
} else {
sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each ");
sb.append("a ").append(counter.getName().toLowerCase(Locale.ENGLISH)).append(" counter on each ");
}
sb.append(permFilter.getMessage());
staticText = sb.toString();

View file

@ -27,7 +27,7 @@
*/
package mage.cards.e;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.UUID;
import mage.abilities.Ability;
@ -44,7 +44,6 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent;
@ -113,7 +112,7 @@ class EquipoiseEffect extends OneShotEffect {
int numberTargetPlayer = game.getBattlefield().count(filter, source.getSourceId(), targetPlayer.getId(), game);
int excess = numberTargetPlayer - numberController;
if (excess > 0) {
FilterPermanent filterChoose = new FilterPermanent(cardType.toString().toLowerCase() + (excess > 1 ? "s" : "") + " of target player");
FilterPermanent filterChoose = new FilterPermanent(cardType.toString().toLowerCase(Locale.ENGLISH) + (excess > 1 ? "s" : "") + " of target player");
filterChoose.add(new ControllerIdPredicate(targetPlayer.getId()));
filterChoose.add(new CardTypePredicate(cardType));
Target target = new TargetPermanent(excess, excess, filterChoose, true);

View file

@ -28,6 +28,7 @@
package mage.cards.f;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
@ -108,7 +109,7 @@ class FatespinnerChooseEffect extends OneShotEffect {
return false;
}
String chosenPhase = choice.getChoice();
game.informPlayers(player.getLogName() + " has chosen to skip " + chosenPhase.toLowerCase() + '.');
game.informPlayers(player.getLogName() + " has chosen to skip " + chosenPhase.toLowerCase(Locale.ENGLISH) + '.');
game.addEffect(new FatespinnerSkipEffect(chosenPhase), source);
return true;
}

View file

@ -27,6 +27,7 @@
*/
package mage.cards.m;
import java.util.Locale;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
@ -153,9 +154,9 @@ class DoUnlessTargetPaysCost extends OneShotEffect {
StringBuilder sb = new StringBuilder();
String costText = cost.getText();
if (costText != null
&& !costText.toLowerCase().startsWith("discard")
&& !costText.toLowerCase().startsWith("sacrifice")
&& !costText.toLowerCase().startsWith("remove")) {
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("discard")
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("sacrifice")
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("remove")) {
sb.append("pay ");
}
return sb.append(costText).toString();

View file

@ -27,6 +27,7 @@
*/
package mage.cards.t;
import java.util.Locale;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -93,14 +94,14 @@ class TabletOfTheGuildsEntersBattlefieldEffect extends OneShotEffect {
return false;
}
game.getState().setValue(permanent.getId() + "_color1", colorChoice.getColor().toString());
colors = colorChoice.getChoice().toLowerCase() + " and ";
colors = colorChoice.getChoice().toLowerCase(Locale.ENGLISH) + " and ";
colorChoice.getChoices().remove(colorChoice.getChoice());
colorChoice.setMessage("Choose the second color");
if (!player.choose(Outcome.GainLife, colorChoice, game) && player.canRespond()) {
return false;
}
game.getState().setValue(permanent.getId() + "_color2", colorChoice.getColor().toString());
colors = colors + colorChoice.getChoice().toLowerCase();
colors = colors + colorChoice.getChoice().toLowerCase(Locale.ENGLISH);
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + colors);
return true;
}

View file

@ -1,5 +1,11 @@
package org.mage.test.serverside;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import mage.cards.Card;
import mage.cards.Sets;
import mage.cards.decks.Deck;
@ -17,12 +23,6 @@ import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.MageTestBase;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
/**
* @author ayratn
*/
@ -61,7 +61,6 @@ public class PlayGameTest extends MageTestBase {
// game.cheat(playerA.getId(), libraryCardsA, handCardsA, battlefieldCardsA, graveyardCardsA);
// game.cheat(playerB.getId(), commandsB);
// game.cheat(playerB.getId(), libraryCardsB, handCardsB, battlefieldCardsB, graveyardCardsB);
//boolean testMode = false;
boolean testMode = true;
@ -80,7 +79,7 @@ public class PlayGameTest extends MageTestBase {
}
private Deck generateRandomDeck() {
String selectedColors = colorChoices.get(new Random().nextInt(colorChoices.size())).toUpperCase();
String selectedColors = colorChoices.get(new Random().nextInt(colorChoices.size())).toUpperCase(Locale.ENGLISH);
List<ColoredManaSymbol> allowedColors = new ArrayList<>();
logger.info("Building deck with colors: " + selectedColors);
for (int i = 0; i < selectedColors.length(); i++) {

View file

@ -1,5 +1,11 @@
package org.mage.test.serverside;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import mage.cards.Card;
import mage.cards.Sets;
import mage.cards.decks.Deck;
@ -16,12 +22,6 @@ import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.MageTestBase;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
/**
* @author ayratn
*/
@ -70,7 +70,7 @@ public class TestPlayRandomGame extends MageTestBase {
}
private Deck generateRandomDeck() {
String selectedColors = colorChoices.get(new Random().nextInt(colorChoices.size())).toUpperCase();
String selectedColors = colorChoices.get(new Random().nextInt(colorChoices.size())).toUpperCase(Locale.ENGLISH);
List<ColoredManaSymbol> allowedColors = new ArrayList<>();
logger.info("Building deck with colors: " + selectedColors);
for (int i = 0; i < selectedColors.length(); i++) {

View file

@ -277,8 +277,8 @@ public class VerifyCardDataTest {
for (String token : tokens) {
if (!(token.equals(card.getName())
|| containsInTypesOrText(ref, token)
|| containsInTypesOrText(ref, token.toLowerCase())
|| (ref2 != null && (containsInTypesOrText(ref2, token) || containsInTypesOrText(ref2, token.toLowerCase()))))) {
|| containsInTypesOrText(ref, token.toLowerCase(Locale.ENGLISH))
|| (ref2 != null && (containsInTypesOrText(ref2, token) || containsInTypesOrText(ref2, token.toLowerCase(Locale.ENGLISH)))))) {
System.out.println("unexpected token " + token + " in " + card);
}
}

View file

@ -28,7 +28,6 @@
package mage.abilities;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.UUID;

View file

@ -27,6 +27,7 @@
*/
package mage.abilities;
import java.util.Locale;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.effects.Effect;
@ -124,7 +125,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
String superRule = super.getRule(true);
StringBuilder sb = new StringBuilder();
if (!superRule.isEmpty()) {
String ruleLow = superRule.toLowerCase();
String ruleLow = superRule.toLowerCase(Locale.ENGLISH);
if (isOptional()) {
if (ruleLow.startsWith("you ")) {
if (!ruleLow.startsWith("you may")) {

View file

@ -30,7 +30,6 @@ package mage.abilities.abilityword;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.common;
import java.util.Locale;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.AttachmentType;
@ -88,7 +89,7 @@ public class AttacksAttachedTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
StringBuilder sb = new StringBuilder("Whenever ");
sb.append(attachmentType.verb().toLowerCase());
sb.append(attachmentType.verb().toLowerCase(Locale.ENGLISH));
return sb.append(" creature attacks, ").append(super.getRule()).toString();
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.common;
import java.util.Locale;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.condition.Condition;
import mage.abilities.effects.Effect;
@ -129,9 +130,9 @@ public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
public String getRule() {
StringBuilder sb = new StringBuilder(getEffects().getText(modes.getMode()));
if (this.optional) {
if (sb.substring(0, 6).toLowerCase().equals("target")) {
if (sb.substring(0, 6).toLowerCase(Locale.ENGLISH).equals("target")) {
sb.insert(0, "you may have ");
} else if (!sb.substring(0, 4).toLowerCase().equals("you ")) {
} else if (!sb.substring(0, 4).toLowerCase(Locale.ENGLISH).equals("you ")) {
sb.insert(0, "you may ");
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.common;
import java.util.Locale;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.TargetController;
@ -141,9 +142,9 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl {
switch (targetController) {
case YOU:
if (this.optional) {
if (sb.substring(0, 6).toLowerCase().equals("target")) {
if (sb.substring(0, 6).toLowerCase(Locale.ENGLISH).equals("target")) {
sb.insert(0, "you may have ");
} else if (!sb.substring(0, 4).toLowerCase().equals("you ")) {
} else if (!sb.substring(0, 4).toLowerCase(Locale.ENGLISH).equals("you ")) {
sb.insert(0, "you may ");
}
}

View file

@ -29,7 +29,6 @@ package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.game.Game;

View file

@ -30,7 +30,6 @@ package mage.abilities.common;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.TriggeredManaAbility;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;

View file

@ -31,9 +31,6 @@ import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.players.Player;
import java.util.Map;
import java.util.UUID;
/**

View file

@ -28,7 +28,6 @@
package mage.abilities.condition.common;
import java.util.EnumSet;
import java.util.HashSet;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.cards.Card;

View file

@ -30,7 +30,6 @@ package mage.abilities.condition.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.CardType;
import mage.game.Game;
import mage.game.permanent.Permanent;

View file

@ -4,7 +4,6 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.CardType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;

View file

@ -28,7 +28,6 @@
package mage.abilities.condition.common;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import mage.constants.TurnPhase;

View file

@ -30,7 +30,6 @@ package mage.abilities.condition.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.CardType;
import mage.game.Game;
/**

View file

@ -10,7 +10,6 @@ import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;

View file

@ -36,7 +36,6 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.cards.Card;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.game.Game;
import mage.players.Player;

View file

@ -36,7 +36,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*

View file

@ -30,7 +30,6 @@ package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;

View file

@ -1,5 +1,6 @@
package mage.abilities.effects.common;
import java.util.Locale;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -88,8 +89,7 @@ public class DoIfCostPaid extends OneShotEffect {
}
}
player.resetStoredBookmark(game); // otherwise you can e.g. undo card drawn with Mentor of the Meek
}
else if (!otherwiseEffects.isEmpty()) {
} else if (!otherwiseEffects.isEmpty()) {
for (Effect effect : otherwiseEffects) {
effect.setTargetPointer(this.targetPointer);
if (effect instanceof OneShotEffect) {
@ -99,8 +99,7 @@ public class DoIfCostPaid extends OneShotEffect {
}
}
}
}
else if (!otherwiseEffects.isEmpty()) {
} else if (!otherwiseEffects.isEmpty()) {
for (Effect effect : otherwiseEffects) {
effect.setTargetPointer(this.targetPointer);
if (effect instanceof OneShotEffect) {
@ -135,12 +134,12 @@ public class DoIfCostPaid extends OneShotEffect {
StringBuilder sb = new StringBuilder();
String costText = cost.getText();
if (costText != null
&& !costText.toLowerCase().startsWith("put")
&& !costText.toLowerCase().startsWith("exile")
&& !costText.toLowerCase().startsWith("discard")
&& !costText.toLowerCase().startsWith("sacrifice")
&& !costText.toLowerCase().startsWith("remove")
&& !costText.toLowerCase().startsWith("pay")) {
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("put")
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("exile")
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("discard")
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("sacrifice")
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("remove")
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("pay")) {
sb.append("pay ");
}
return sb.append(costText).toString();

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.effects.common;
import java.util.Locale;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
@ -77,7 +78,7 @@ public class EnterBattlefieldPayCostOrPutGraveyardEffect extends ReplacementEffe
boolean replace = true;
if (cost.canPay(source, source.getSourceId(), player.getId(), game)) {
if (player.chooseUse(outcome,
cost.getText().substring(0, 1).toUpperCase() + cost.getText().substring(1)
cost.getText().substring(0, 1).toUpperCase(Locale.ENGLISH) + cost.getText().substring(1)
+ "? (otherwise " + sourceObject.getLogName() + " is put into graveyard)", source, game)) {
cost.clearPaid();
replace = !cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null);

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.effects.common;
import java.util.Locale;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -106,6 +107,6 @@ public class ExileFromZoneTargetEffect extends OneShotEffect {
}
private void setText() {
staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + ' ' + filter.getMessage() + " from his or her " + zone.toString().toLowerCase();
staticText = "target player exiles " + CardUtil.numberToText(amount, "a") + ' ' + filter.getMessage() + " from his or her " + zone.toString().toLowerCase(Locale.ENGLISH);
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.effects.common;
import java.util.Locale;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.costs.Cost;
@ -38,7 +39,7 @@ import mage.players.Player;
import mage.util.CardUtil;
/**
*
*
* @author fireshoes
*/
public class ExileSourceUnlessPaysEffect extends OneShotEffect {
@ -61,7 +62,7 @@ public class ExileSourceUnlessPaysEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
StringBuilder sb = new StringBuilder(cost.getText()).append('?');
if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) {
if (!sb.toString().toLowerCase(Locale.ENGLISH).startsWith("exile ") && !sb.toString().toLowerCase(Locale.ENGLISH).startsWith("return ")) {
sb.insert(0, "Pay ");
}
String message = CardUtil.replaceSourceName(sb.toString(), sourcePermanent.getLogName());
@ -91,12 +92,12 @@ public class ExileSourceUnlessPaysEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder("exile {this} unless you ");
String costText = cost.getText();
if (costText.toLowerCase().startsWith("discard")
|| costText.toLowerCase().startsWith("remove")
|| costText.toLowerCase().startsWith("return")
|| costText.toLowerCase().startsWith("exile")
|| costText.toLowerCase().startsWith("sacrifice")) {
sb.append(costText.substring(0, 1).toLowerCase());
if (costText.toLowerCase(Locale.ENGLISH).startsWith("discard")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("remove")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("return")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("exile")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("sacrifice")) {
sb.append(costText.substring(0, 1).toLowerCase(Locale.ENGLISH));
sb.append(costText.substring(1));
} else {
sb.append("pay ").append(costText);

View file

@ -31,7 +31,6 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;

View file

@ -30,7 +30,6 @@ package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.ExileZone;
import mage.game.Game;

View file

@ -30,6 +30,7 @@
package mage.abilities.effects.common;
import static java.lang.Integer.min;
import java.util.Locale;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
@ -291,7 +292,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
sb.append(" of them into your ");
}
sb.append(targetPickedCards.toString().toLowerCase());
sb.append(targetPickedCards.toString().toLowerCase(Locale.ENGLISH));
if (targetZoneLookedCards == Zone.LIBRARY) {
sb.append(". Put the rest ");

View file

@ -31,7 +31,6 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.PreventionEffectImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.events.GameEvent;

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,21 +20,20 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import java.util.Locale;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -103,6 +102,6 @@ public class RegenerateAttachedEffect extends ReplacementEffectImpl {
}
private void setText() {
staticText = "Regenerate " + attachmentType.verb().toLowerCase() + " creature";
staticText = "Regenerate " + attachmentType.verb().toLowerCase(Locale.ENGLISH) + " creature";
}
}

View file

@ -25,14 +25,14 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import mage.constants.Duration;
import mage.constants.Outcome;
import java.util.Locale;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -43,9 +43,9 @@ import mage.target.Target;
*
* @author maurer.it_at_gmail.com
*/
public class RegenerateTargetEffect extends ReplacementEffectImpl {
public class RegenerateTargetEffect extends ReplacementEffectImpl {
public RegenerateTargetEffect ( ) {
public RegenerateTargetEffect() {
super(Duration.EndOfTurn, Outcome.Regenerate);
}
@ -82,7 +82,7 @@ public class RegenerateTargetEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
//20110204 - 701.11c - event.getAmount() is used to signal if regeneration is allowed
return event.getAmount() == 0 && event.getTargetId().equals(targetPointer.getFirst(game, source)) && !this.used;
}
@ -95,7 +95,7 @@ public class RegenerateTargetEffect extends ReplacementEffectImpl {
sb.append("Regenerate ");
Target target = mode.getTargets().get(0);
if (target != null) {
if (!target.getTargetName().toLowerCase().startsWith("another")) {
if (!target.getTargetName().toLowerCase(Locale.ENGLISH).startsWith("another")) {
sb.append("target ");
}
sb.append(target.getTargetName());

View file

@ -5,7 +5,6 @@ import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;

View file

@ -30,7 +30,6 @@ package mage.abilities.effects.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
import mage.abilities.effects.OneShotEffect;

View file

@ -1,5 +1,6 @@
package mage.abilities.effects.common;
import java.util.Locale;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.costs.Cost;
@ -34,7 +35,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
StringBuilder sb = new StringBuilder(cost.getText()).append('?');
if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ")) {
if (!sb.toString().toLowerCase(Locale.ENGLISH).startsWith("exile ") && !sb.toString().toLowerCase(Locale.ENGLISH).startsWith("return ")) {
sb.insert(0, "Pay ");
}
String message = CardUtil.replaceSourceName(sb.toString(), sourcePermanent.getLogName());
@ -69,13 +70,13 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder("sacrifice {this} unless you ");
String costText = cost.getText();
if (costText.toLowerCase().startsWith("discard")
|| costText.toLowerCase().startsWith("remove")
|| costText.toLowerCase().startsWith("return")
|| costText.toLowerCase().startsWith("put")
|| costText.toLowerCase().startsWith("exile")
|| costText.toLowerCase().startsWith("sacrifice")) {
sb.append(costText.substring(0, 1).toLowerCase());
if (costText.toLowerCase(Locale.ENGLISH).startsWith("discard")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("remove")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("return")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("put")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("exile")
|| costText.toLowerCase(Locale.ENGLISH).startsWith("sacrifice")) {
sb.append(costText.substring(0, 1).toLowerCase(Locale.ENGLISH));
sb.append(costText.substring(1));
} else {
sb.append("pay ").append(costText);

View file

@ -25,15 +25,14 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common.combat;
import java.util.Locale;
import java.util.UUID;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.effects.RequirementEffect;
import mage.constants.AttachmentType;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -51,7 +50,7 @@ public class MustBeBlockedByAllAttachedEffect extends RequirementEffect {
public MustBeBlockedByAllAttachedEffect(Duration duration, AttachmentType attachmentType) {
super(duration);
this.attachmentType = attachmentType;
staticText = "All creatures able to block " + attachmentType.verb().toLowerCase() + " creature do so";
staticText = "All creatures able to block " + attachmentType.verb().toLowerCase(Locale.ENGLISH) + " creature do so";
}
public MustBeBlockedByAllAttachedEffect(final MustBeBlockedByAllAttachedEffect effect) {

View file

@ -28,6 +28,7 @@
package mage.abilities.effects.common.continuous;
import java.util.ArrayList;
import java.util.Locale;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -104,7 +105,7 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
}
article = true;
}
sb.append(cardType.toString().toLowerCase()).append(" ");
sb.append(cardType.toString().toLowerCase(Locale.ENGLISH)).append(" ");
}
sb.append(" in addition to its other types ").append(this.getDuration().toString());
return sb.toString();

View file

@ -28,6 +28,7 @@
package mage.abilities.effects.common.continuous;
import java.util.ArrayList;
import java.util.Locale;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -110,7 +111,7 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl {
}
article = true;
}
sb.append(cardType.toString().toLowerCase()).append(" ");
sb.append(cardType.toString().toLowerCase(Locale.ENGLISH)).append(" ");
}
sb.append("in addition to its other types");
if (getDuration().equals(Duration.EndOfTurn)) {

View file

@ -27,13 +27,13 @@
*/
package mage.abilities.effects.common.continuous;
import java.util.Locale;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
@ -126,7 +126,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl {
}
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" get ");
} else {
if (!target.getTargetName().toUpperCase().startsWith("ANOTHER")) {
if (!target.getTargetName().toUpperCase(Locale.ENGLISH).startsWith("ANOTHER")) {
sb.append("target ");
}
sb.append(target.getTargetName()).append(" gets ");

View file

@ -29,6 +29,7 @@ package mage.abilities.effects.common.continuous;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.UUID;
import mage.MageObject;
import mage.MageObjectReference;
@ -180,12 +181,12 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
}
sb.append(filter.getMessage());
if (duration == Duration.WhileOnBattlefield) {
if (filter.getMessage().toLowerCase().startsWith("each")) {
if (filter.getMessage().toLowerCase(Locale.ENGLISH).startsWith("each")) {
sb.append(" has ");
} else {
sb.append(" have ");
}
} else if (filter.getMessage().toLowerCase().startsWith("each")) {
} else if (filter.getMessage().toLowerCase(Locale.ENGLISH).startsWith("each")) {
sb.append(" gains ");
} else {
sb.append(" gain ");

View file

@ -170,7 +170,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
}
sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain ");
} else {
if (!target.getTargetName().toUpperCase().startsWith("ANOTHER")) {
if (!target.getTargetName().toUpperCase(Locale.ENGLISH).startsWith("ANOTHER")) {
sb.append("target ");
}
sb.append(target.getTargetName()).append(" gains ");

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.effects.common.counter;
import java.util.Locale;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -69,7 +70,7 @@ public class AddCountersAllEffect extends OneShotEffect {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.addCounters(counter.copy(), source, game);
if (!game.isSimulation()) {
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName().toLowerCase()
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName().toLowerCase(Locale.ENGLISH)
+ " counter on " + permanent.getLogName());
}
}
@ -83,9 +84,9 @@ public class AddCountersAllEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
sb.append("put ");
if (counter.getCount() > 1) {
sb.append(CardUtil.numberToText(counter.getCount(), "a")).append(' ').append(counter.getName().toLowerCase()).append(" counters on each ");
sb.append(CardUtil.numberToText(counter.getCount(), "a")).append(' ').append(counter.getName().toLowerCase(Locale.ENGLISH)).append(" counters on each ");
} else {
sb.append("a ").append(counter.getName().toLowerCase()).append(" counter on each ");
sb.append("a ").append(counter.getName().toLowerCase(Locale.ENGLISH)).append(" counter on each ");
}
sb.append(filter.getMessage());
staticText = sb.toString();

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.effects.common.counter;
import java.util.Locale;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
@ -41,7 +42,6 @@ import mage.util.CardUtil;
*
* @author LevelX2
*/
public class AddCountersAttachedEffect extends OneShotEffect {
private Counter counter;
@ -99,7 +99,7 @@ public class AddCountersAttachedEffect extends OneShotEffect {
} else {
sb.append("a ");
}
sb.append(counter.getName().toLowerCase()).append(" counter on ");
sb.append(counter.getName().toLowerCase(Locale.ENGLISH)).append(" counter on ");
sb.append(textEnchanted);
if (!amount.getMessage().isEmpty()) {
sb.append(" for each ").append(amount.getMessage());

View file

@ -28,6 +28,7 @@
package mage.abilities.effects.common.counter;
import java.util.ArrayList;
import java.util.Locale;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
@ -110,7 +111,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
if (informPlayers && !game.isSimulation()) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(player.getLogName() + " puts " + newCounter.getCount() + ' ' + newCounter.getName().toLowerCase() + " counter on " + card.getLogName());
game.informPlayers(player.getLogName() + " puts " + newCounter.getCount() + ' ' + newCounter.getName().toLowerCase(Locale.ENGLISH) + " counter on " + card.getLogName());
}
}
}
@ -137,7 +138,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
int amountAdded = permanent.getCounters(game).getCount(newCounter.getName()) - before;
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(player.getLogName() + " puts " + amountAdded + ' ' + newCounter.getName().toLowerCase() + " counter on " + permanent.getLogName());
game.informPlayers(player.getLogName() + " puts " + amountAdded + ' ' + newCounter.getName().toLowerCase(Locale.ENGLISH) + " counter on " + permanent.getLogName());
}
}
}
@ -161,7 +162,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
sb.append("a ");
plural = false;
}
sb.append(counter.getName().toLowerCase()).append(" counter");
sb.append(counter.getName().toLowerCase(Locale.ENGLISH)).append(" counter");
if (plural) {
sb.append('s');
}

Some files were not shown because too many files have changed in this diff Show more