Guest User

Untitled

a guest
Aug 27th, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1.     public void drawItems(byte[][] map, Location l, double rad, Role role) {
  2.         // items là một synchronizedList nên ta sẽ đưa nó vào khối lệnh synchronized khi thực hiện iterate
  3.         synchronized (items) {
  4.             Iterator<MapItem> i = items.iterator();
  5.             while (i.hasNext()) {
  6.                 MapItem item = i.next();
  7.                 if (item.isExpired()) {
  8.                     i.remove();
  9.                     continue;
  10.                 }
  11.                 if (item.getRole() == role || item.getRole() == null) {
  12.                     MapPosition mp = MapPosition.calculatedPos(l, item.getLocation(), rad);
  13.                     placeIcon(map, item.getIcon(), mp.x, mp.y);
  14.                 }
  15.             }
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment