Cleaner solution for starting listener once.
This commit is contained in:
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,6 @@ package handlers.effecthandlers;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.StatModifierType;
|
import org.l2jmobius.gameserver.enums.StatModifierType;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
@@ -41,10 +40,11 @@ import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
|||||||
*/
|
*/
|
||||||
public class NightStatModify extends AbstractEffect
|
public class NightStatModify extends AbstractEffect
|
||||||
{
|
{
|
||||||
private static final AtomicBoolean DAY_TIME = new AtomicBoolean(GameTimeTaskManager.getInstance().isNight());
|
|
||||||
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
private static final Set<Creature> NIGHT_STAT_CHARACTERS = ConcurrentHashMap.newKeySet();
|
||||||
private static final int SHADOW_SENSE = 294;
|
private static final int SHADOW_SENSE = 294;
|
||||||
|
|
||||||
|
private static boolean START_LISTENER = true;
|
||||||
|
|
||||||
private final Stat _stat;
|
private final Stat _stat;
|
||||||
private final int _amount;
|
private final int _amount;
|
||||||
protected final StatModifierType _mode;
|
protected final StatModifierType _mode;
|
||||||
@@ -55,9 +55,15 @@ public class NightStatModify extends AbstractEffect
|
|||||||
_amount = params.getInt("amount");
|
_amount = params.getInt("amount");
|
||||||
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
_mode = params.getEnum("mode", StatModifierType.class, StatModifierType.DIFF);
|
||||||
|
|
||||||
// Init a global day-night change listener.
|
// Run only once per daytime change.
|
||||||
final ListenersContainer container = Containers.Global();
|
if (START_LISTENER)
|
||||||
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
{
|
||||||
|
START_LISTENER = false;
|
||||||
|
|
||||||
|
// Init a global day-night change listener.
|
||||||
|
final ListenersContainer container = Containers.Global();
|
||||||
|
container.addListener(new ConsumerEventListener(container, EventType.ON_DAY_NIGHT_CHANGE, (OnDayNightChange event) -> onDayNightChange(event), this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,31 +105,19 @@ public class NightStatModify extends AbstractEffect
|
|||||||
|
|
||||||
public void onDayNightChange(OnDayNightChange event)
|
public void onDayNightChange(OnDayNightChange event)
|
||||||
{
|
{
|
||||||
synchronized (DAY_TIME)
|
// System message for Shadow Sense.
|
||||||
|
final SystemMessage msg = new SystemMessage(event.isNight() ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
||||||
|
msg.addSkillName(SHADOW_SENSE);
|
||||||
|
|
||||||
|
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
||||||
{
|
{
|
||||||
final boolean isNight = event.isNight();
|
// Pump again.
|
||||||
|
creature.getStat().recalculateStats(true);
|
||||||
|
|
||||||
// Run only once per daytime change.
|
// Send Shadow Sense message when player has skill.
|
||||||
if (isNight == DAY_TIME.get())
|
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
||||||
{
|
{
|
||||||
return;
|
creature.sendPacket(msg);
|
||||||
}
|
|
||||||
DAY_TIME.set(isNight);
|
|
||||||
|
|
||||||
// System message for Shadow Sense.
|
|
||||||
final SystemMessage msg = new SystemMessage(isNight ? SystemMessageId.IT_IS_NOW_MIDNIGHT_AND_THE_EFFECT_OF_S1_CAN_BE_FELT : SystemMessageId.IT_IS_DAWN_AND_THE_EFFECT_OF_S1_WILL_NOW_DISAPPEAR);
|
|
||||||
msg.addSkillName(SHADOW_SENSE);
|
|
||||||
|
|
||||||
for (Creature creature : NIGHT_STAT_CHARACTERS)
|
|
||||||
{
|
|
||||||
// Pump again.
|
|
||||||
creature.getStat().recalculateStats(true);
|
|
||||||
|
|
||||||
// Send Shadow Sense message when player has skill.
|
|
||||||
if (creature.getKnownSkill(SHADOW_SENSE) != null)
|
|
||||||
{
|
|
||||||
creature.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user