From 184f2d4f329bc646fb3df9debda5d2cbd98471bd Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 11 Apr 2018 16:28:11 +0000 Subject: [PATCH] Prevent null elements in GameTimeController list. --- .../com/l2jmobius/gameserver/GameTimeController.java | 7 ++++++- .../com/l2jmobius/gameserver/GameTimeController.java | 7 ++++++- .../com/l2jmobius/gameserver/GameTimeController.java | 7 ++++++- .../com/l2jmobius/gameserver/GameTimeController.java | 7 ++++++- .../com/l2jmobius/gameserver/GameTimeController.java | 9 +++++++-- .../com/l2jmobius/gameserver/GameTimeController.java | 7 ++++++- .../com/l2jmobius/gameserver/GameTimeController.java | 7 ++++++- 7 files changed, 43 insertions(+), 8 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameTimeController.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameTimeController.java index 7810d20b9f..f5804aac4a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameTimeController.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameTimeController.java @@ -17,6 +17,7 @@ package com.l2jmobius.gameserver; import java.util.Calendar; +import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -109,7 +110,10 @@ public final class GameTimeController extends Thread return; } - _movingObjects.add(cha); + if (!_movingObjects.contains(cha)) + { + _movingObjects.add(cha); + } } /** @@ -125,6 +129,7 @@ public final class GameTimeController extends Thread */ private void moveObjects() { + _movingObjects.removeAll(Collections.singleton(null)); _movingObjects.removeIf(L2Character::updatePosition); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameTimeController.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameTimeController.java index 7810d20b9f..f5804aac4a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameTimeController.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameTimeController.java @@ -17,6 +17,7 @@ package com.l2jmobius.gameserver; import java.util.Calendar; +import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -109,7 +110,10 @@ public final class GameTimeController extends Thread return; } - _movingObjects.add(cha); + if (!_movingObjects.contains(cha)) + { + _movingObjects.add(cha); + } } /** @@ -125,6 +129,7 @@ public final class GameTimeController extends Thread */ private void moveObjects() { + _movingObjects.removeAll(Collections.singleton(null)); _movingObjects.removeIf(L2Character::updatePosition); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameTimeController.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameTimeController.java index 7810d20b9f..f5804aac4a 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameTimeController.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameTimeController.java @@ -17,6 +17,7 @@ package com.l2jmobius.gameserver; import java.util.Calendar; +import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -109,7 +110,10 @@ public final class GameTimeController extends Thread return; } - _movingObjects.add(cha); + if (!_movingObjects.contains(cha)) + { + _movingObjects.add(cha); + } } /** @@ -125,6 +129,7 @@ public final class GameTimeController extends Thread */ private void moveObjects() { + _movingObjects.removeAll(Collections.singleton(null)); _movingObjects.removeIf(L2Character::updatePosition); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameTimeController.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameTimeController.java index 7810d20b9f..f5804aac4a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameTimeController.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameTimeController.java @@ -17,6 +17,7 @@ package com.l2jmobius.gameserver; import java.util.Calendar; +import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -109,7 +110,10 @@ public final class GameTimeController extends Thread return; } - _movingObjects.add(cha); + if (!_movingObjects.contains(cha)) + { + _movingObjects.add(cha); + } } /** @@ -125,6 +129,7 @@ public final class GameTimeController extends Thread */ private void moveObjects() { + _movingObjects.removeAll(Collections.singleton(null)); _movingObjects.removeIf(L2Character::updatePosition); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameTimeController.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameTimeController.java index ebefb16876..15c06f11cf 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameTimeController.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameTimeController.java @@ -17,6 +17,7 @@ package com.l2jmobius.gameserver; import java.util.Calendar; +import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -109,7 +110,10 @@ public final class GameTimeController extends Thread return; } - _movingObjects.add(cha); + if (!_movingObjects.contains(cha)) + { + _movingObjects.add(cha); + } } /** @@ -123,8 +127,9 @@ public final class GameTimeController extends Thread *
  • Create a task to update the _knownObject and _knowPlayers of each L2Character that finished its movement and of their already known L2Object then notify AI with EVT_ARRIVED
  • * */ - private final void moveObjects() + private void moveObjects() { + _movingObjects.removeAll(Collections.singleton(null)); _movingObjects.removeIf(L2Character::updatePosition); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameTimeController.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameTimeController.java index 7810d20b9f..f5804aac4a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameTimeController.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameTimeController.java @@ -17,6 +17,7 @@ package com.l2jmobius.gameserver; import java.util.Calendar; +import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -109,7 +110,10 @@ public final class GameTimeController extends Thread return; } - _movingObjects.add(cha); + if (!_movingObjects.contains(cha)) + { + _movingObjects.add(cha); + } } /** @@ -125,6 +129,7 @@ public final class GameTimeController extends Thread */ private void moveObjects() { + _movingObjects.removeAll(Collections.singleton(null)); _movingObjects.removeIf(L2Character::updatePosition); } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameTimeController.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameTimeController.java index 7810d20b9f..f5804aac4a 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameTimeController.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameTimeController.java @@ -17,6 +17,7 @@ package com.l2jmobius.gameserver; import java.util.Calendar; +import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -109,7 +110,10 @@ public final class GameTimeController extends Thread return; } - _movingObjects.add(cha); + if (!_movingObjects.contains(cha)) + { + _movingObjects.add(cha); + } } /** @@ -125,6 +129,7 @@ public final class GameTimeController extends Thread */ private void moveObjects() { + _movingObjects.removeAll(Collections.singleton(null)); _movingObjects.removeIf(L2Character::updatePosition); }