mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08: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
|
|
@ -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…
Add table
Add a link
Reference in a new issue