forked from External/mage
introduced StringUtil class with .isEmpty(String input) and .isNotEmpty(String input), to replace str != null && str.length()>0 statements
This commit is contained in:
parent
fb15c79964
commit
f1cf9e7adb
47 changed files with 132 additions and 96 deletions
|
|
@ -37,6 +37,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.util.StringUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -142,7 +143,7 @@ public class DamageTargetEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
if (StringUtil.isNotEmpty(staticText)) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -152,12 +153,12 @@ public class DamageTargetEffect extends OneShotEffect {
|
|||
sb.append(amount);
|
||||
}
|
||||
sb.append(" damage to ");
|
||||
if (targetDescription.length() > 0) {
|
||||
if (StringUtil.isNotEmpty(targetDescription)){
|
||||
sb.append(targetDescription);
|
||||
} else {
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
}
|
||||
if (message.length() > 0) {
|
||||
if (StringUtil.isNotEmpty(message)) {
|
||||
if (message.equals("1")) {
|
||||
sb.append(" equal to the number of ");
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue