Add extra sector functionality.

This commit is contained in:
Major-
2014-03-06 18:27:43 +00:00
parent 92f4c7daf5
commit d98c176585
3 changed files with 23 additions and 17 deletions
@@ -18,11 +18,6 @@ public final class StaticObject extends Entity {
*/
private final ObjectDefinition definition;
/**
* The object's id.
*/
private final int id;
/**
* The object's rotation.
*/
@@ -36,14 +31,13 @@ public final class StaticObject extends Entity {
/**
* Creates a new static object.
*
* @param def The object's id.
* @param id The object's id.
* @param position The position.
* @param type The type code of the object.
* @param rotation The rotation of the object.
*/
public StaticObject(int id, Position position, int type, int rotation) {
super(position);
this.id = id;
this.type = type;
this.rotation = rotation;
definition = ObjectDefinition.lookup(id);
@@ -63,15 +57,6 @@ public final class StaticObject extends Entity {
return EntityType.STATIC_OBJECT;
}
/**
* Gets the id of the object.
*
* @return The object id.
*/
public int getId() {
return id;
}
/**
* Gets the object's rotation.
*
@@ -92,7 +77,8 @@ public final class StaticObject extends Entity {
@Override
public String toString() {
return StaticObject.class.getName() + " [id=" + id + ", type=" + type + ", rotation=" + rotation + "]";
return StaticObject.class.getName() + " [id=" + definition.getId() + ", type=" + type + ", rotation="
+ rotation + "]";
}
}
@@ -75,6 +75,15 @@ public final class Sector {
return coordinates;
}
/**
* Gets the {@link List} of {@link Entity}s.
*
* @return The list.
*/
public List<Entity> getEntities() {
return new ArrayList<>(entities);
}
/**
* Notifies the listeners registered to this sector that an update has occurred.
*
@@ -1,6 +1,8 @@
package org.apollo.game.model.sector;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@@ -84,6 +86,15 @@ public final class SectorRepository {
return sector;
}
/**
* Gets the {@link List} of {@link Sector}s.
*
* @return The list.
*/
public List<Sector> getSectors() {
return new ArrayList<>(sectors.values());
}
/**
* Removes a {@link Sector} from the repository, if permitted.
*