Fix empty player name and optimization

This commit is contained in:
Marcel Konrad
2019-11-02 19:15:21 +01:00
parent f1900512b3
commit 730700ba00

View File

@@ -33,12 +33,12 @@ public abstract class CommandBuilder implements ICommandBuilderSyntax
protected void setNode(int index, String node)
{
this.set(index, node != null ? (node.isEmpty() ? null : node) : null, ArgumentType.STRING);
this.set(index, node != null && !node.isEmpty() ? node : null, ArgumentType.STRING);
}
protected void setNode(int index, GreedyString node)
{
this.set(index, node != null ? (node.isEmpty() ? null : node) : null, ArgumentType.GREEDY_STRING);
this.set(index, node != null && !node.isEmpty() ? node : null, ArgumentType.GREEDY_STRING);
}
protected void setNode(int index, boolean node)
@@ -113,7 +113,7 @@ public abstract class CommandBuilder implements ICommandBuilderSyntax
protected void setPlayerName(int index, String username)
{
this.set(index, username, ArgumentType.PLAYER);
this.set(index, username != null && !username.isEmpty() ? username : null, ArgumentType.PLAYER);
}
private void set(int index, Object value, ArgumentType type)