Removed player reentrant locks.
This commit is contained in:
@@ -78,38 +78,31 @@ public class BlessedSoulShots implements IItemHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
player.soulShotLock.lock();
|
||||
try
|
||||
// Check if Soul shot is already active
|
||||
if (player.isChargedShot(ShotType.BLESSED_SOULSHOTS))
|
||||
{
|
||||
// Check if Soul shot is already active
|
||||
if (player.isChargedShot(ShotType.BLESSED_SOULSHOTS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Consume Soul shots if player has enough of them
|
||||
int ssCount = weaponItem.getSoulShotCount();
|
||||
if ((weaponItem.getReducedSoulShot() > 0) && (Rnd.get(100) < weaponItem.getReducedSoulShotChance()))
|
||||
{
|
||||
ssCount = weaponItem.getReducedSoulShot();
|
||||
}
|
||||
|
||||
if (!player.destroyItemWithoutTrace("Consume", item.getObjectId(), ssCount, null, false))
|
||||
{
|
||||
if (!player.disableAutoShot(itemId))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_SOULSHOTS_FOR_THAT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Charge soul shot
|
||||
player.chargeShot(ShotType.BLESSED_SOULSHOTS);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
// Consume Soul shots if player has enough of them
|
||||
int ssCount = weaponItem.getSoulShotCount();
|
||||
if ((weaponItem.getReducedSoulShot() > 0) && (Rnd.get(100) < weaponItem.getReducedSoulShotChance()))
|
||||
{
|
||||
player.soulShotLock.unlock();
|
||||
ssCount = weaponItem.getReducedSoulShot();
|
||||
}
|
||||
|
||||
if (!player.destroyItemWithoutTrace("Consume", item.getObjectId(), ssCount, null, false))
|
||||
{
|
||||
if (!player.disableAutoShot(itemId))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_SOULSHOTS_FOR_THAT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Charge soul shot
|
||||
player.chargeShot(ShotType.BLESSED_SOULSHOTS);
|
||||
|
||||
// Send message to client
|
||||
if (!player.getAutoSoulShot().contains(item.getId()))
|
||||
{
|
||||
|
||||
@@ -75,38 +75,31 @@ public class SoulShots implements IItemHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
player.soulShotLock.lock();
|
||||
try
|
||||
// Check if Soul shot is already active
|
||||
if (player.isChargedShot(ShotType.SOULSHOTS))
|
||||
{
|
||||
// Check if Soul shot is already active
|
||||
if (player.isChargedShot(ShotType.SOULSHOTS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Consume Soul shots if player has enough of them
|
||||
int ssCount = weaponItem.getSoulShotCount();
|
||||
if ((weaponItem.getReducedSoulShot() > 0) && (Rnd.get(100) < weaponItem.getReducedSoulShotChance()))
|
||||
{
|
||||
ssCount = weaponItem.getReducedSoulShot();
|
||||
}
|
||||
|
||||
if (!player.destroyItemWithoutTrace("Consume", item.getObjectId(), ssCount, null, false))
|
||||
{
|
||||
if (!player.disableAutoShot(itemId))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_SOULSHOTS_FOR_THAT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Charge soul shot
|
||||
player.chargeShot(ShotType.SOULSHOTS);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
|
||||
// Consume Soul shots if player has enough of them
|
||||
int ssCount = weaponItem.getSoulShotCount();
|
||||
if ((weaponItem.getReducedSoulShot() > 0) && (Rnd.get(100) < weaponItem.getReducedSoulShotChance()))
|
||||
{
|
||||
player.soulShotLock.unlock();
|
||||
ssCount = weaponItem.getReducedSoulShot();
|
||||
}
|
||||
|
||||
if (!player.destroyItemWithoutTrace("Consume", item.getObjectId(), ssCount, null, false))
|
||||
{
|
||||
if (!player.disableAutoShot(itemId))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_SOULSHOTS_FOR_THAT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Charge soul shot
|
||||
player.chargeShot(ShotType.SOULSHOTS);
|
||||
|
||||
// Send message to client
|
||||
if (!player.getAutoSoulShot().contains(item.getId()))
|
||||
{
|
||||
|
||||
@@ -40,7 +40,6 @@ import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -431,7 +430,7 @@ public class PlayerInstance extends Playable
|
||||
private long _lastAccess;
|
||||
private long _uptime;
|
||||
|
||||
private final ReentrantLock _subclassLock = new ReentrantLock();
|
||||
private boolean _subclassLock = false;
|
||||
protected int _baseClass;
|
||||
protected int _activeClass;
|
||||
protected int _classIndex = 0;
|
||||
@@ -711,8 +710,6 @@ public class PlayerInstance extends Playable
|
||||
private BroochJewel _activeRubyJewel = null;
|
||||
private BroochJewel _activeShappireJewel = null;
|
||||
|
||||
public ReentrantLock soulShotLock = new ReentrantLock();
|
||||
|
||||
/** Event parameters */
|
||||
private PlayerEventHolder eventStatus = null;
|
||||
|
||||
@@ -2341,10 +2338,11 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void setClassId(int id)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_subclassLock = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -2426,7 +2424,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
finally
|
||||
{
|
||||
_subclassLock.unlock();
|
||||
_subclassLock = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9415,10 +9413,11 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean addSubClass(int classId, int classIndex, boolean isDualClass)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_subclassLock = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -9490,7 +9489,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
finally
|
||||
{
|
||||
_subclassLock.unlock();
|
||||
_subclassLock = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9505,10 +9504,11 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean modifySubClass(int classIndex, int newClassId, boolean isDualClass)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_subclassLock = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -9584,7 +9584,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
finally
|
||||
{
|
||||
_subclassLock.unlock();
|
||||
_subclassLock = false;
|
||||
}
|
||||
|
||||
return addSubClass(newClassId, classIndex, isDualClass);
|
||||
@@ -9691,10 +9691,11 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void setActiveClass(int classIndex)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_subclassLock = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -9838,13 +9839,13 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
finally
|
||||
{
|
||||
_subclassLock.unlock();
|
||||
_subclassLock = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSubclassLocked()
|
||||
{
|
||||
return _subclassLock.isLocked();
|
||||
return _subclassLock;
|
||||
}
|
||||
|
||||
public void stopWarnUserTakeBreak()
|
||||
|
||||
Reference in New Issue
Block a user