File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
src/main/java/io/luna/game/model/mob Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -312,8 +312,6 @@ public ByteBuf acquireCachedBlock() {
312312 public boolean cacheBlockIfAbsent (ByteMessage msg ) {
313313 ByteBuf cachedMsg = msg .getBuffer ().retainedDuplicate ();
314314 if (cachedBlock .compareAndSet (null , cachedMsg )) {
315- if (this instanceof Npc && asNpc ().getIndex () == 1 )
316- System .err .println ("cached block , won by " + Thread .currentThread ().getName () + ", refs: " + cachedMsg .refCnt ());
317315 return true ;
318316 }
319317 cachedMsg .release ();
@@ -335,8 +333,6 @@ public boolean cacheBlockIfAbsent(ByteMessage msg) {
335333 public void clearCachedBlock () {
336334 ByteBuf old = cachedBlock .getAndSet (null );
337335 if (old != null ) {
338- if (this instanceof Npc && asNpc ().getIndex () == 1 )
339- System .err .println ("About to clear old block, refs: " + old .refCnt ());
340336 old .release ();
341337 }
342338 }
Original file line number Diff line number Diff line change @@ -32,13 +32,15 @@ public final class PlayerUpdateBlockSet extends AbstractUpdateBlockSet<Player> {
3232 @ Override
3333 public void addBlockSet (Player player , ByteMessage msg , UpdateState state ) {
3434 // The block has already been encoded for someone this cycle; reuse it.
35- ByteBuf cachedBlock = player .acquireCachedBlock ();
36- if (state == UpdateState .UPDATE_LOCAL && cachedBlock != null ) {
37- try {
38- msg .putBytes (cachedBlock );
39- return ;
40- } finally {
41- cachedBlock .release ();
35+ if (state == UpdateState .UPDATE_LOCAL ) {
36+ ByteBuf cachedBlock = player .acquireCachedBlock ();
37+ if (cachedBlock != null ) {
38+ try {
39+ msg .putBytes (cachedBlock );
40+ return ;
41+ } finally {
42+ cachedBlock .release ();
43+ }
4244 }
4345 }
4446
You can’t perform that action at this time.
0 commit comments