Removed player reentrant locks.
This commit is contained in:
@@ -73,38 +73,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
|
||||
weaponInst.setChargedShot(ShotType.SOULSHOTS, true);
|
||||
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
|
||||
weaponInst.setChargedShot(ShotType.SOULSHOTS, true);
|
||||
|
||||
// Send message to client
|
||||
player.sendPacket(SystemMessageId.YOUR_SOULSHOTS_ARE_ENABLED);
|
||||
Broadcast.toSelfAndKnownPlayersInRadius(player, new MagicSkillUse(player, player, skills[0].getSkillId(), skills[0].getSkillLevel(), 0, 0), 600);
|
||||
|
||||
@@ -409,7 +409,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;
|
||||
@@ -2353,10 +2353,11 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void setClassId(int id)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_subclassLock = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -2433,7 +2434,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
finally
|
||||
{
|
||||
_subclassLock.unlock();
|
||||
_subclassLock = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8334,7 +8335,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public boolean canLogout()
|
||||
{
|
||||
if (_subclassLock.isLocked())
|
||||
if (_subclassLock)
|
||||
{
|
||||
LOGGER.warning("Player " + getName() + " tried to restart/logout during class change.");
|
||||
return false;
|
||||
@@ -10084,10 +10085,11 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean addSubClass(int classId, int classIndex)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_subclassLock = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -10150,7 +10152,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
finally
|
||||
{
|
||||
_subclassLock.unlock();
|
||||
_subclassLock = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10164,10 +10166,11 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean modifySubClass(int classIndex, int newClassId)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_subclassLock = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -10223,7 +10226,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
finally
|
||||
{
|
||||
_subclassLock.unlock();
|
||||
_subclassLock = false;
|
||||
}
|
||||
|
||||
return addSubClass(newClassId, classIndex);
|
||||
@@ -10284,10 +10287,11 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void setActiveClass(int classIndex)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_subclassLock = true;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -10436,13 +10440,13 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
finally
|
||||
{
|
||||
_subclassLock.unlock();
|
||||
_subclassLock = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLocked()
|
||||
{
|
||||
return _subclassLock.isLocked();
|
||||
return _subclassLock;
|
||||
}
|
||||
|
||||
public void stopWarnUserTakeBreak()
|
||||
@@ -13175,7 +13179,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public boolean isAllowedToEnchantSkills()
|
||||
{
|
||||
if (_subclassLock.isLocked())
|
||||
if (_subclassLock)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user