mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Fixed missing locale param in string operations (#4634)
This commit is contained in:
parent
da4a44445b
commit
e69a021c71
12 changed files with 30 additions and 18 deletions
|
@ -230,12 +230,12 @@ public class PickCheckBoxDialog extends MageDialog {
|
|||
if (filter == null) {
|
||||
filter = "";
|
||||
}
|
||||
filter = filter.toLowerCase();
|
||||
filter = filter.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
this.dataModel.clear();
|
||||
this.m_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);
|
||||
this.m_dataModel.addElement(item.getObjectValue());
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class JeganthaTheWellspringManaCondition extends ManaCondition {
|
|||
private final String manaSymbol;
|
||||
|
||||
JeganthaTheWellspringManaCondition(String manaSymbol) {
|
||||
this.manaSymbol = manaSymbol.toLowerCase();
|
||||
this.manaSymbol = manaSymbol.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,6 +132,6 @@ class JeganthaTheWellspringManaCondition extends ManaCondition {
|
|||
.getUnpaid()
|
||||
.getText()
|
||||
.split("[\\}\\{]")
|
||||
).map(String::toLowerCase).anyMatch(s -> s.contains(manaSymbol));
|
||||
).map(s -> s.toLowerCase(Locale.ENGLISH)).anyMatch(s -> s.contains(manaSymbol));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class MythosOfSnapdaxEffect extends OneShotEffect {
|
|||
for (Player player : playerList) {
|
||||
for (CardType cardType : cardTypes) {
|
||||
String message = cardType.toString().equals("Artifact") ? "an " : "a ";
|
||||
message += cardType.toString().toLowerCase();
|
||||
message += cardType.toString().toLowerCase(Locale.ENGLISH);
|
||||
message += (conditionMet && player != controller) ? " controlled by " + player.getName() : " you control";
|
||||
FilterPermanent filter = new FilterNonlandPermanent(message);
|
||||
filter.add(cardType.getPredicate());
|
||||
|
|
|
@ -29,6 +29,7 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -110,7 +111,7 @@ class VivienMonstersAdvocateTokenEffect extends OneShotEffect {
|
|||
player.choose(outcome, choice, game);
|
||||
String chosen = choice.getChoice();
|
||||
if (chosen != null) {
|
||||
permanent.addCounters(CounterType.findByName(chosen.toLowerCase()).createInstance(), source, game);
|
||||
permanent.addCounters(CounterType.findByName(chosen.toLowerCase(Locale.ENGLISH)).createInstance(), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -331,7 +331,7 @@ public class VerifyCardDataTest {
|
|||
// replace codes for aliases
|
||||
String searchSet = MtgJson.mtgJsonToXMageCodes.getOrDefault(refSet.code, refSet.code);
|
||||
|
||||
ExpansionSet mageSet = Sets.findSet(searchSet.toUpperCase());
|
||||
ExpansionSet mageSet = Sets.findSet(searchSet.toUpperCase(Locale.ENGLISH));
|
||||
if (mageSet == null) {
|
||||
totalMissingSets = totalMissingSets + 1;
|
||||
totalMissingCards = totalMissingCards + refSet.cards.size();
|
||||
|
|
|
@ -6,6 +6,8 @@ import mage.constants.Duration;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
|
@ -36,7 +38,7 @@ public class ReflexiveTriggeredAbility extends DelayedTriggeredAbility {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return text.substring(0, 1).toUpperCase() + text.substring(1) + '.';
|
||||
return text.substring(0, 1).toUpperCase(Locale.ENGLISH) + text.substring(1) + '.';
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
|
|
|
@ -11,6 +11,8 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author Plopman
|
||||
*/
|
||||
|
@ -25,7 +27,7 @@ public class ChooseColorEffect extends OneShotEffect {
|
|||
public ChooseColorEffect(Outcome outcome, String exceptColor) {
|
||||
super(outcome);
|
||||
this.exceptColor = exceptColor;
|
||||
staticText = "choose a color" + (exceptColor != null ? " other than " + exceptColor.toLowerCase() : "");
|
||||
staticText = "choose a color" + (exceptColor != null ? " other than " + exceptColor.toLowerCase(Locale.ENGLISH) : "");
|
||||
}
|
||||
|
||||
public ChooseColorEffect(final ChooseColorEffect effect) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import mage.target.Target;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -150,7 +151,7 @@ public class RollPlanarDieEffect extends OneShotEffect {
|
|||
if (effect != null) {
|
||||
try {
|
||||
String emode = effect.getText(mode);
|
||||
emode = emode.substring(0, 1).toLowerCase() + emode.substring(1);
|
||||
emode = emode.substring(0, 1).toLowerCase(Locale.ENGLISH) + emode.substring(1);
|
||||
sb.append(emode);
|
||||
} catch (Exception e) {
|
||||
sb.append("perform the CHAOS action");
|
||||
|
|
|
@ -9,6 +9,8 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
|
@ -50,7 +52,7 @@ public class AddCounterChoiceSourceEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
private static final String cap(String string) {
|
||||
return string != null ? string.substring(0, 1).toUpperCase() + string.substring(1) : null;
|
||||
return string != null ? string.substring(0, 1).toUpperCase(Locale.ENGLISH) + string.substring(1) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,8 @@ import mage.constants.SubType;
|
|||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
|
@ -69,7 +71,7 @@ public class BandsWithOtherAbility extends StaticAbility {
|
|||
if (subtype != null) {
|
||||
return sb.append(' ').append(subtype.getDescription()).append('s').toString();
|
||||
} else if (supertype != null) {
|
||||
return sb.append(' ').append(supertype.toString().toLowerCase()).append(" creatures").toString();
|
||||
return sb.append(' ').append(supertype.toString().toLowerCase(Locale.ENGLISH)).append(" creatures").toString();
|
||||
} else if (bandingName != null) {
|
||||
return sb.append(" creatures named ").append(bandingName).toString();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package mage.abilities.meta;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
@ -86,15 +87,15 @@ public class OrTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (triggeredAbilities[0].getRule().length() > 0) {
|
||||
sb.append(triggeredAbilities[0].getRule().substring(0, 1).toUpperCase())
|
||||
.append(triggeredAbilities[0].getRule().substring(1).toLowerCase());
|
||||
sb.append(triggeredAbilities[0].getRule().substring(0, 1).toUpperCase(Locale.ENGLISH))
|
||||
.append(triggeredAbilities[0].getRule().substring(1).toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
for (int i = 1; i < (triggeredAbilities.length - 1); i++) {
|
||||
sb.append(triggeredAbilities[i].getRule().toLowerCase());
|
||||
sb.append(triggeredAbilities[i].getRule().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
sb.append(" or ").append(triggeredAbilities[triggeredAbilities.length - 1].getRule().toLowerCase());
|
||||
sb.append(" or ").append(triggeredAbilities[triggeredAbilities.length - 1].getRule().toLowerCase(Locale.ENGLISH));
|
||||
return sb.toString() + super.getRule();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -23,8 +24,8 @@ public class DeckFormatsTest {
|
|||
}
|
||||
// 2. must work with files
|
||||
String fileName = "C:\\xmage\\deck" + "." + df.getExporter().getDefaultFileExt();
|
||||
Assert.assertTrue("Must support lower ext: " + df.getExporter().getDescription(), DeckFormats.getFormatForExtension(fileName.toLowerCase()).isPresent());
|
||||
Assert.assertTrue("Must support upper ext: " + df.getExporter().getDescription(), DeckFormats.getFormatForExtension(fileName.toUpperCase()).isPresent());
|
||||
Assert.assertTrue("Must support lower ext: " + df.getExporter().getDescription(), DeckFormats.getFormatForExtension(fileName.toLowerCase(Locale.ENGLISH)).isPresent());
|
||||
Assert.assertTrue("Must support upper ext: " + df.getExporter().getDescription(), DeckFormats.getFormatForExtension(fileName.toUpperCase(Locale.ENGLISH)).isPresent());
|
||||
}
|
||||
|
||||
// 3. wrong ext
|
||||
|
|
Loading…
Reference in a new issue