static void warp(Character ptr, MapComposite map, int x, int y)
{
//TODO DEBUG555 entfernen
int debug=555;
remove(ptr);
ptr.setMap(map);
ptr.setPosition(new Point(x, y));
ptr.clearDestination();
/* Force update of persistent data on map change, so that
characters can respawn at the start of the map after a death or
a disconnection. */
Program.accountHandler.sendCharacterData(ptr);
if(map.isActive())
{
if(!insert(ptr))
{
ptr.disconnected();
Program.gameHandler.kill(ptr);
}
}
else
{
MessageOut msg=new MessageOut(Protocol.GAMSG_REDIRECT);
msg.writeInt32(ptr.getDatabaseID());
Program.accountHandler.send(msg);
Program.gameHandler.prepareServerChange(ptr);
}
}