mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-12-26 11:08:12 +01:00
Removed the ReadWriteLock as it's superseeded by the BlockingHashMap.
This commit is contained in:
parent
c49b1ddc02
commit
d53b6dbee1
@ -1,9 +1,6 @@
|
||||
package com.comphenix.protocol.injector.player;
|
||||
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -29,8 +26,6 @@ class NetLoginInjector {
|
||||
// The current error rerporter
|
||||
private ErrorReporter reporter;
|
||||
|
||||
private ReadWriteLock injectionLock = new ReentrantReadWriteLock();
|
||||
|
||||
// Used to create fake players
|
||||
private TemporaryPlayerFactory tempPlayerFactory = new TemporaryPlayerFactory();
|
||||
|
||||
@ -46,9 +41,6 @@ class NetLoginInjector {
|
||||
* @return An injected NetLoginHandler, or the original object.
|
||||
*/
|
||||
public Object onNetLoginCreated(Object inserting) {
|
||||
|
||||
injectionLock.writeLock().lock();
|
||||
|
||||
try {
|
||||
// Make sure we actually need to inject during this phase
|
||||
if (!injectionHandler.isInjectionNecessary(GamePhase.LOGIN))
|
||||
@ -73,19 +65,9 @@ class NetLoginInjector {
|
||||
reporter.reportDetailed(this, "Unable to hook NetLoginHandler.", e, inserting);
|
||||
return inserting;
|
||||
|
||||
} finally {
|
||||
injectionLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the lock used for reading.
|
||||
* @return Reading lock.
|
||||
*/
|
||||
public Lock getReadLock() {
|
||||
return injectionLock.readLock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when a NetLoginHandler should be reverted.
|
||||
* @param inserting - the original NetLoginHandler.
|
||||
|
@ -216,7 +216,7 @@ public class PlayerInjectionHandler {
|
||||
* @throws InterruptedException If the thread was interrupted during the wait.
|
||||
*/
|
||||
public Player getPlayerByConnection(DataInputStream inputStream, long playerTimeout, TimeUnit unit) throws InterruptedException {
|
||||
|
||||
// Wait until the connection owner has been established
|
||||
PlayerInjector injector = dataInputLookup.get(inputStream, playerTimeout, unit);
|
||||
|
||||
if (injector != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user