Synchronizing on accessing a lock is pointless.

This commit is contained in:
dordsor21 2021-01-13 17:09:44 +00:00
parent f69b1bfb21
commit b1e8c6c3ba
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
2 changed files with 5 additions and 2 deletions

View File

@ -95,7 +95,7 @@ public class NMSRelighter implements Relighter {
}
@Override
public synchronized ReentrantLock getLock() {
public ReentrantLock getLock() {
return lightingLock;
}

View File

@ -1099,7 +1099,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
try {
if (relighter != null && !(relighter instanceof NullRelighter)) {
// Only relight once!
if (!relighter.getLock().tryLock()) {
if (Settings.IMP.LIGHTING.DELAY_PACKET_SENDING && !relighter.getLock().tryLock()) {
relighter.getLock().lock();
relighter.getLock().unlock();
} else {
@ -1109,6 +1109,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
relighter.fixSkyLighting();
relighter.fixBlockLighting();
}
if (Settings.IMP.LIGHTING.DELAY_PACKET_SENDING) {
relighter.getLock().unlock();
}
}
}
} catch (Throwable e) {