mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Merge pull request #156 from ryleykimmel/issue155
Closes #155, closes #154 and closes #107
This commit is contained in:
@@ -2,11 +2,11 @@ package org.apollo.game.model.area;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class Region {
|
||||
/**
|
||||
* The Map of Positions to Entities in that Position.
|
||||
*/
|
||||
private final Map<Position, Set<Entity>> entities = new HashMap<>();
|
||||
private final Map<Position, Set<Entity>> entities = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* A List of RegionListeners registered to this Region.
|
||||
|
||||
@@ -119,7 +119,7 @@ public final class GameService extends Service {
|
||||
*
|
||||
* @param player The player.
|
||||
*/
|
||||
public void finalizePlayerRegistration(Player player) {
|
||||
public synchronized void finalizePlayerRegistration(Player player) {
|
||||
world.register(player);
|
||||
Region region = world.getRegionRepository().fromPosition(player.getPosition());
|
||||
region.addEntity(player);
|
||||
@@ -150,7 +150,7 @@ public final class GameService extends Service {
|
||||
/**
|
||||
* Called every pulse.
|
||||
*/
|
||||
public void pulse() {
|
||||
public synchronized void pulse() {
|
||||
finalizeRegistrations();
|
||||
finalizeUnregistrations();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user