Removed the ReadWriteLock as it's superseeded by the BlockingHashMap.
Dieser Commit ist enthalten in:
Ursprung
c49b1ddc02
Commit
d53b6dbee1
@ -1,9 +1,6 @@
|
|||||||
package com.comphenix.protocol.injector.player;
|
package com.comphenix.protocol.injector.player;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentMap;
|
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.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -29,8 +26,6 @@ class NetLoginInjector {
|
|||||||
// The current error rerporter
|
// The current error rerporter
|
||||||
private ErrorReporter reporter;
|
private ErrorReporter reporter;
|
||||||
|
|
||||||
private ReadWriteLock injectionLock = new ReentrantReadWriteLock();
|
|
||||||
|
|
||||||
// Used to create fake players
|
// Used to create fake players
|
||||||
private TemporaryPlayerFactory tempPlayerFactory = new TemporaryPlayerFactory();
|
private TemporaryPlayerFactory tempPlayerFactory = new TemporaryPlayerFactory();
|
||||||
|
|
||||||
@ -46,9 +41,6 @@ class NetLoginInjector {
|
|||||||
* @return An injected NetLoginHandler, or the original object.
|
* @return An injected NetLoginHandler, or the original object.
|
||||||
*/
|
*/
|
||||||
public Object onNetLoginCreated(Object inserting) {
|
public Object onNetLoginCreated(Object inserting) {
|
||||||
|
|
||||||
injectionLock.writeLock().lock();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Make sure we actually need to inject during this phase
|
// Make sure we actually need to inject during this phase
|
||||||
if (!injectionHandler.isInjectionNecessary(GamePhase.LOGIN))
|
if (!injectionHandler.isInjectionNecessary(GamePhase.LOGIN))
|
||||||
@ -73,19 +65,9 @@ class NetLoginInjector {
|
|||||||
reporter.reportDetailed(this, "Unable to hook NetLoginHandler.", e, inserting);
|
reporter.reportDetailed(this, "Unable to hook NetLoginHandler.", e, inserting);
|
||||||
return 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.
|
* Invoked when a NetLoginHandler should be reverted.
|
||||||
* @param inserting - the original NetLoginHandler.
|
* @param inserting - the original NetLoginHandler.
|
||||||
|
@ -216,7 +216,7 @@ public class PlayerInjectionHandler {
|
|||||||
* @throws InterruptedException If the thread was interrupted during the wait.
|
* @throws InterruptedException If the thread was interrupted during the wait.
|
||||||
*/
|
*/
|
||||||
public Player getPlayerByConnection(DataInputStream inputStream, long playerTimeout, TimeUnit unit) throws InterruptedException {
|
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);
|
PlayerInjector injector = dataInputLookup.get(inputStream, playerTimeout, unit);
|
||||||
|
|
||||||
if (injector != null) {
|
if (injector != null) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren