if (player.name.length() > 16) player.name.substring(0, 16) else player.name
=>
player.name.take(16)
で問題なく動くよー