Removed player reentrant locks.

This commit is contained in:
MobiusDevelopment
2020-03-30 19:03:16 +00:00
parent cdab936ea5
commit dff067c91e
51 changed files with 907 additions and 1121 deletions

View File

@@ -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()))
{

View File

@@ -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()))
{