Prevent null elements in GameTimeController list.

This commit is contained in:
MobiusDev 2018-04-11 16:28:11 +00:00
parent ba17cc6753
commit 184f2d4f32
7 changed files with 43 additions and 8 deletions

View File

@ -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,8 +110,11 @@ public final class GameTimeController extends Thread
return;
}
if (!_movingObjects.contains(cha))
{
_movingObjects.add(cha);
}
}
/**
* Move all L2Characters contained in movingObjects of GameTimeController.<BR>
@ -125,6 +129,7 @@ public final class GameTimeController extends Thread
*/
private void moveObjects()
{
_movingObjects.removeAll(Collections.singleton(null));
_movingObjects.removeIf(L2Character::updatePosition);
}

View File

@ -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,8 +110,11 @@ public final class GameTimeController extends Thread
return;
}
if (!_movingObjects.contains(cha))
{
_movingObjects.add(cha);
}
}
/**
* Move all L2Characters contained in movingObjects of GameTimeController.<BR>
@ -125,6 +129,7 @@ public final class GameTimeController extends Thread
*/
private void moveObjects()
{
_movingObjects.removeAll(Collections.singleton(null));
_movingObjects.removeIf(L2Character::updatePosition);
}

View File

@ -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,8 +110,11 @@ public final class GameTimeController extends Thread
return;
}
if (!_movingObjects.contains(cha))
{
_movingObjects.add(cha);
}
}
/**
* Move all L2Characters contained in movingObjects of GameTimeController.<BR>
@ -125,6 +129,7 @@ public final class GameTimeController extends Thread
*/
private void moveObjects()
{
_movingObjects.removeAll(Collections.singleton(null));
_movingObjects.removeIf(L2Character::updatePosition);
}

View File

@ -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,8 +110,11 @@ public final class GameTimeController extends Thread
return;
}
if (!_movingObjects.contains(cha))
{
_movingObjects.add(cha);
}
}
/**
* Move all L2Characters contained in movingObjects of GameTimeController.<BR>
@ -125,6 +129,7 @@ public final class GameTimeController extends Thread
*/
private void moveObjects()
{
_movingObjects.removeAll(Collections.singleton(null));
_movingObjects.removeIf(L2Character::updatePosition);
}

View File

@ -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,8 +110,11 @@ public final class GameTimeController extends Thread
return;
}
if (!_movingObjects.contains(cha))
{
_movingObjects.add(cha);
}
}
/**
* Move all L2Characters contained in movingObjects of GameTimeController.<BR>
@ -123,8 +127,9 @@ public final class GameTimeController extends Thread
* <li>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</li>
* </ul>
*/
private final void moveObjects()
private void moveObjects()
{
_movingObjects.removeAll(Collections.singleton(null));
_movingObjects.removeIf(L2Character::updatePosition);
}

View File

@ -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,8 +110,11 @@ public final class GameTimeController extends Thread
return;
}
if (!_movingObjects.contains(cha))
{
_movingObjects.add(cha);
}
}
/**
* Move all L2Characters contained in movingObjects of GameTimeController.<BR>
@ -125,6 +129,7 @@ public final class GameTimeController extends Thread
*/
private void moveObjects()
{
_movingObjects.removeAll(Collections.singleton(null));
_movingObjects.removeIf(L2Character::updatePosition);
}

View File

@ -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,8 +110,11 @@ public final class GameTimeController extends Thread
return;
}
if (!_movingObjects.contains(cha))
{
_movingObjects.add(cha);
}
}
/**
* Move all L2Characters contained in movingObjects of GameTimeController.<BR>
@ -125,6 +129,7 @@ public final class GameTimeController extends Thread
*/
private void moveObjects()
{
_movingObjects.removeAll(Collections.singleton(null));
_movingObjects.removeIf(L2Character::updatePosition);
}