Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public void movePlayer(final MapleCharacter player, final Point newPosition) {
  2. player.setPosition(newPosition);
  3. if (!player.isClone()) {
  4. player.getVisibleMapObjectWriteLock().lock();
  5. try {
  6. final Collection<MapleMapObject> visibleObjects = player.getVisibleMapObjects_NoLock();
  7.  
  8. for (MapleMapObject mo : visibleObjects) {
  9. if (mo != null && getMapObject(mo.getObjectId()) == mo) {
  10. updateMapObjectVisibility_NoLock(player, mo);
  11. } else if (mo != null) {
  12. player.removeVisibleMapObject_NoLock(mo);
  13. }
  14. }
  15. for (MapleMapObject mo : getMapObjectsInRange(player.getPosition(), GameConstants.maxViewRangeSq())) {
  16. if (mo != null && !player.isMapObjectVisible_NoLock(mo)) {
  17. mo.sendSpawnData(player.getClient());
  18. player.addVisibleMapObject_NoLock(mo);
  19. }
  20. }
  21. } finally {
  22. player.getVisibleMapObjectWriteLock().unlock();
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement