Addition of AutoPlay and AutoUse task pools.
This commit is contained in:
parent
800c42fd4e
commit
99c556eade
@ -38,26 +38,29 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
private static boolean _working = false;
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -198,40 +201,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -245,6 +214,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
|
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -53,27 +53,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -354,8 +357,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -423,13 +424,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -437,7 +456,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,26 +38,29 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
private static boolean _working = false;
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -198,40 +201,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -245,6 +214,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
|
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -53,27 +53,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -354,8 +357,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -423,13 +424,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -437,7 +456,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,26 +38,29 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
private static boolean _working = false;
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -198,40 +201,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -245,6 +214,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
|
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -53,27 +53,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -354,8 +357,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -423,13 +424,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -437,7 +456,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,26 +38,29 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
private static boolean _working = false;
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -198,40 +201,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -245,6 +214,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
|
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -53,27 +53,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -354,8 +357,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -423,13 +424,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -437,7 +456,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,26 +38,29 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
private static boolean _working = false;
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -198,40 +201,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -245,6 +214,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
|
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -53,27 +53,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -354,8 +357,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -423,13 +424,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -437,7 +456,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,26 +38,29 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
private static boolean _working = false;
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -198,23 +201,47 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
{
|
{
|
||||||
if (!PLAYERS.contains(player))
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
{
|
{
|
||||||
player.onActionRequest();
|
player.onActionRequest();
|
||||||
PLAYERS.add(player);
|
pool.add(player);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
public void stopAutoPlay(Player player)
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
// Pets must follow their owner.
|
// Pets must follow their owner.
|
||||||
if (player.hasServitors())
|
if (player.hasServitors())
|
||||||
{
|
{
|
||||||
@ -227,16 +254,21 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
{
|
{
|
||||||
player.getPet().followOwner();
|
player.getPet().followOwner();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
public boolean isAutoPlay(Player player)
|
||||||
{
|
{
|
||||||
return PLAYERS.contains(player);
|
for (Set<Player> pool : POOLS)
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
|
||||||
{
|
{
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
|
@ -53,27 +53,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -354,8 +357,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -423,13 +424,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -437,7 +456,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,26 +38,29 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
private static boolean _working = false;
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -198,23 +201,47 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
{
|
{
|
||||||
if (!PLAYERS.contains(player))
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
{
|
{
|
||||||
player.onActionRequest();
|
player.onActionRequest();
|
||||||
PLAYERS.add(player);
|
pool.add(player);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
public void stopAutoPlay(Player player)
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
// Pets must follow their owner.
|
// Pets must follow their owner.
|
||||||
if (player.hasServitors())
|
if (player.hasServitors())
|
||||||
{
|
{
|
||||||
@ -227,16 +254,21 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
{
|
{
|
||||||
player.getPet().followOwner();
|
player.getPet().followOwner();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
public boolean isAutoPlay(Player player)
|
||||||
{
|
{
|
||||||
return PLAYERS.contains(player);
|
for (Set<Player> pool : POOLS)
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
|
||||||
{
|
{
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
|
@ -53,27 +53,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -354,8 +357,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -423,13 +424,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -437,7 +456,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,27 +38,30 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final Integer AUTO_ATTACK_ACTION = 2;
|
private static final Integer AUTO_ATTACK_ACTION = 2;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -199,40 +202,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -246,6 +215,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
// Non Essence like.
|
// Non Essence like.
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -54,27 +54,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -387,8 +390,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -456,13 +457,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -470,7 +489,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,27 +38,30 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final Integer AUTO_ATTACK_ACTION = 2;
|
private static final Integer AUTO_ATTACK_ACTION = 2;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -199,40 +202,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -246,6 +215,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
// Non Essence like.
|
// Non Essence like.
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -54,27 +54,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -387,8 +390,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -456,13 +457,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -470,7 +489,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,27 +38,30 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final Integer AUTO_ATTACK_ACTION = 2;
|
private static final Integer AUTO_ATTACK_ACTION = 2;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -199,40 +202,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -246,6 +215,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
// Non Essence like.
|
// Non Essence like.
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -54,27 +54,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -387,8 +390,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -456,13 +457,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -470,7 +489,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,27 +38,30 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoPlayTaskManager implements Runnable
|
public class AutoPlayTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final Integer AUTO_ATTACK_ACTION = 2;
|
private static final Integer AUTO_ATTACK_ACTION = 2;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoPlayTaskManager()
|
protected AutoPlayTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoPlay implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoPlay(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
PLAY: for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
PLAY: for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
if (!player.isOnline() || player.isInOfflineMode() || !Config.ENABLE_AUTO_PLAY)
|
||||||
{
|
{
|
||||||
@ -199,40 +202,6 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
player.sendPacket(ExAutoPlayDoMacro.STATIC_PACKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
player.onActionRequest();
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
PLAYERS.remove(player);
|
|
||||||
|
|
||||||
// Pets must follow their owner.
|
|
||||||
if (player.hasServitors())
|
|
||||||
{
|
|
||||||
for (Summon summon : player.getServitors().values())
|
|
||||||
{
|
|
||||||
summon.followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPet())
|
|
||||||
{
|
|
||||||
player.getPet().followOwner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoPlay(Player player)
|
|
||||||
{
|
|
||||||
return PLAYERS.contains(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMageCaster(Player player)
|
private boolean isMageCaster(Player player)
|
||||||
@ -246,6 +215,69 @@ public class AutoPlayTaskManager implements Runnable
|
|||||||
// Non Essence like.
|
// Non Essence like.
|
||||||
return player.isMageClass() && (player.getRace() != Race.ORC);
|
return player.isMageClass() && (player.getRace() != Race.ORC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void doAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
player.onActionRequest();
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoPlay(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
// Pets must follow their owner.
|
||||||
|
if (player.hasServitors())
|
||||||
|
{
|
||||||
|
for (Summon summon : player.getServitors().values())
|
||||||
|
{
|
||||||
|
summon.followOwner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (player.hasPet())
|
||||||
|
{
|
||||||
|
player.getPet().followOwner();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAutoPlay(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static AutoPlayTaskManager getInstance()
|
public static AutoPlayTaskManager getInstance()
|
||||||
{
|
{
|
||||||
|
@ -54,27 +54,30 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
|||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
*/
|
*/
|
||||||
public class AutoUseTaskManager implements Runnable
|
public class AutoUseTaskManager
|
||||||
{
|
{
|
||||||
private static final Set<Player> PLAYERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Set<Player>> POOLS = ConcurrentHashMap.newKeySet();
|
||||||
|
private static final int POOL_SIZE = 300;
|
||||||
|
private static final int TASK_DELAY = 300;
|
||||||
private static final int REUSE_MARGIN_TIME = 3;
|
private static final int REUSE_MARGIN_TIME = 3;
|
||||||
private static boolean _working = false;
|
|
||||||
|
|
||||||
protected AutoUseTaskManager()
|
protected AutoUseTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(this, 500, 500);
|
}
|
||||||
|
|
||||||
|
private class AutoUse implements Runnable
|
||||||
|
{
|
||||||
|
private final Set<Player> _players;
|
||||||
|
|
||||||
|
public AutoUse(Set<Player> players)
|
||||||
|
{
|
||||||
|
_players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_working)
|
for (Player player : _players)
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_working = true;
|
|
||||||
|
|
||||||
for (Player player : PLAYERS)
|
|
||||||
{
|
{
|
||||||
if (!player.isOnline() || player.isInOfflineMode())
|
if (!player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
@ -387,8 +390,6 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_working = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
private boolean canCastBuff(Player player, WorldObject target, Skill skill)
|
||||||
@ -456,13 +457,31 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
|
|
||||||
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
return !player.isSkillDisabled(skill) && skill.checkCondition(player, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAutoUseTask(Player player)
|
|
||||||
{
|
|
||||||
if (!PLAYERS.contains(player))
|
|
||||||
{
|
|
||||||
PLAYERS.add(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void startAutoUseTask(Player player)
|
||||||
|
{
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.contains(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.size() < POOL_SIZE)
|
||||||
|
{
|
||||||
|
pool.add(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Set<Player> pool = ConcurrentHashMap.newKeySet(POOL_SIZE);
|
||||||
|
pool.add(player);
|
||||||
|
ThreadPool.scheduleAtFixedRate(new AutoUse(pool), TASK_DELAY, TASK_DELAY);
|
||||||
|
POOLS.add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAutoUseTask(Player player)
|
public void stopAutoUseTask(Player player)
|
||||||
@ -470,7 +489,13 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
player.getAutoUseSettings().resetSkillOrder();
|
player.getAutoUseSettings().resetSkillOrder();
|
||||||
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
if (player.getAutoUseSettings().isEmpty() || !player.isOnline() || player.isInOfflineMode())
|
||||||
{
|
{
|
||||||
PLAYERS.remove(player);
|
for (Set<Player> pool : POOLS)
|
||||||
|
{
|
||||||
|
if (pool.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user