{
return;
}
if(args.length != 1)
{
show(new CustomMessage("scripts.services.Rename.incorrectinput", player), player);
return;
}
if(player.getSiegeState() != 0)
{
show(new CustomMessage("scripts.services.Rename.SiegeNow", player), player);
return;
}
String name = args[0];
if(!Util.isMatchingRegexp(name, Config.CNAME_TEMPLATE))
{
show(new CustomMessage("scripts.services.Rename.incorrectinput", player), player);
return;
}
if(getItemCount(player, Config.SERVICES_CHANGE_NICK_ITEM) < Config.SERVICES_CHANGE_NICK_PRICE)
{
if(Config.SERVICES_CHANGE_NICK_ITEM == 57)
{
player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
}
else
{
player.sendPacket(Msg.INCORRECT_ITEM_COUNT);
}
return;
}
if(!Util.isCharNameAvail(name))
{
show(new CustomMessage("scripts.services.Rename.Thisnamealreadyexists", player), player);
return;
}
removeItem(player, Config.SERVICES_CHANGE_NICK_ITEM, Config.SERVICES_CHANGE_NICK_PRICE);
String oldName = player.getName();
player.reName(name, true);
Log.add("Character " + oldName + " renamed to " + name, "renames");
show(new CustomMessage("scripts.services.Rename.changedname", player).addString(oldName).addString(name), player);
}