Removal of scheduleAtFixedRate DecoyLifetime task.
This commit is contained in:
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -38,8 +38,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -55,9 +53,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(() -> unSummon(owner), totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(getOwner(), this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -78,42 +74,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon(_owner);
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Player _player;
|
|
||||||
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Player player, Decoy decoy)
|
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon(_player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -142,11 +107,6 @@ public class Decoy extends Creature
|
|||||||
|
|
||||||
public synchronized void unSummon(Player owner)
|
public synchronized void unSummon(Player owner)
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -159,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
owner.setDecoy(null);
|
owner.setDecoy(null);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -38,8 +38,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -55,9 +53,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(() -> unSummon(owner), totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(getOwner(), this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -78,42 +74,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon(_owner);
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Player _player;
|
|
||||||
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Player player, Decoy decoy)
|
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon(_player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -142,11 +107,6 @@ public class Decoy extends Creature
|
|||||||
|
|
||||||
public synchronized void unSummon(Player owner)
|
public synchronized void unSummon(Player owner)
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -159,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
owner.setDecoy(null);
|
owner.setDecoy(null);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -38,8 +38,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -55,9 +53,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(() -> unSummon(owner), totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(getOwner(), this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -78,42 +74,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon(_owner);
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Player _player;
|
|
||||||
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Player player, Decoy decoy)
|
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon(_player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -142,11 +107,6 @@ public class Decoy extends Creature
|
|||||||
|
|
||||||
public synchronized void unSummon(Player owner)
|
public synchronized void unSummon(Player owner)
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -159,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
owner.setDecoy(null);
|
owner.setDecoy(null);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -39,8 +39,6 @@ import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
|||||||
public class Decoy extends Creature
|
public class Decoy extends Creature
|
||||||
{
|
{
|
||||||
private final Player _owner;
|
private final Player _owner;
|
||||||
private int _totalLifeTime;
|
|
||||||
private int _timeRemaining;
|
|
||||||
private Future<?> _decoyLifeTask;
|
private Future<?> _decoyLifeTask;
|
||||||
private Future<?> _hateSpam;
|
private Future<?> _hateSpam;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ public class Decoy extends Creature
|
|||||||
_owner = owner;
|
_owner = owner;
|
||||||
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
|
||||||
setInvul(false);
|
setInvul(false);
|
||||||
_totalLifeTime = totalLifeTime;
|
_decoyLifeTask = ThreadPool.schedule(this::unSummon, totalLifeTime);
|
||||||
_timeRemaining = _totalLifeTime;
|
|
||||||
_decoyLifeTask = ThreadPool.scheduleAtFixedRate(new DecoyLifetime(this), 1000, 1000);
|
|
||||||
if (aggressive)
|
if (aggressive)
|
||||||
{
|
{
|
||||||
final int hateSpamSkillId = 5272;
|
final int hateSpamSkillId = 5272;
|
||||||
@@ -79,39 +75,11 @@ public class Decoy extends Creature
|
|||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
_hateSpam = null;
|
_hateSpam = null;
|
||||||
}
|
}
|
||||||
_totalLifeTime = 0;
|
unSummon();
|
||||||
DecayTaskManager.getInstance().add(this);
|
DecayTaskManager.getInstance().add(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DecoyLifetime implements Runnable
|
|
||||||
{
|
|
||||||
private final Decoy _decoy;
|
|
||||||
|
|
||||||
DecoyLifetime(Decoy decoy)
|
|
||||||
{
|
|
||||||
_decoy = decoy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_decoy.decTimeRemaining(1000);
|
|
||||||
final double newTimeRemaining = _decoy.getTimeRemaining();
|
|
||||||
if (newTimeRemaining < 0)
|
|
||||||
{
|
|
||||||
_decoy.unSummon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.SEVERE, "Decoy Error: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class HateSpam implements Runnable
|
private static class HateSpam implements Runnable
|
||||||
{
|
{
|
||||||
private final Decoy _player;
|
private final Decoy _player;
|
||||||
@@ -138,13 +106,8 @@ public class Decoy extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unSummon()
|
public synchronized void unSummon()
|
||||||
{
|
{
|
||||||
if (_decoyLifeTask != null)
|
|
||||||
{
|
|
||||||
_decoyLifeTask.cancel(true);
|
|
||||||
_decoyLifeTask = null;
|
|
||||||
}
|
|
||||||
if (_hateSpam != null)
|
if (_hateSpam != null)
|
||||||
{
|
{
|
||||||
_hateSpam.cancel(true);
|
_hateSpam.cancel(true);
|
||||||
@@ -156,21 +119,12 @@ public class Decoy extends Creature
|
|||||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||||
decayMe();
|
decayMe();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (_decoyLifeTask != null)
|
||||||
public void decTimeRemaining(int value)
|
{
|
||||||
{
|
_decoyLifeTask.cancel(false);
|
||||||
_timeRemaining -= value;
|
_decoyLifeTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeRemaining()
|
|
||||||
{
|
|
||||||
return _timeRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTotalLifeTime()
|
|
||||||
{
|
|
||||||
return _totalLifeTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user