mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-06 08:40:03 +00:00
Update object/region code.
This commit is contained in:
@@ -170,7 +170,6 @@ public final class Server {
|
|||||||
*/
|
*/
|
||||||
public void start() throws Exception {
|
public void start() throws Exception {
|
||||||
PluginManager mgr = new PluginManager(new PluginContext(context));
|
PluginManager mgr = new PluginManager(new PluginContext(context));
|
||||||
mgr.start(); // TODO move this?
|
|
||||||
|
|
||||||
serviceManager.startAll();
|
serviceManager.startAll();
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ public abstract class Entity {
|
|||||||
*/
|
*/
|
||||||
protected Position position;
|
protected Position position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new entity with the specified position.
|
||||||
|
*
|
||||||
|
* @param position The position.
|
||||||
|
*/
|
||||||
|
public Entity(Position position) {
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link EntityType} of this entity.
|
* Gets the {@link EntityType} of this entity.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public abstract class Mob extends Entity {
|
|||||||
* @param position The initial position.
|
* @param position The initial position.
|
||||||
*/
|
*/
|
||||||
public Mob(Position position) {
|
public Mob(Position position) {
|
||||||
this.position = position;
|
super(position);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,9 +315,9 @@ public abstract class Mob extends Entity {
|
|||||||
* player.
|
* player.
|
||||||
*
|
*
|
||||||
* @param message The message.
|
* @param message The message.
|
||||||
* @param chatBox If the message should be shown in the player's chat box.
|
* @param chatOnly If the message should only be shown in the player's chat box, or above their head too.
|
||||||
*/
|
*/
|
||||||
public void shout(String message, boolean chatBox) {
|
public void shout(String message, boolean chatOnly) {
|
||||||
blockSet.add(SynchronizationBlock.createForceChatBlock(message));
|
blockSet.add(SynchronizationBlock.createForceChatBlock(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -623,10 +623,10 @@ public final class Player extends Mob {
|
|||||||
/**
|
/**
|
||||||
* Sets the design flag.
|
* Sets the design flag.
|
||||||
*
|
*
|
||||||
* @param designed A flag indicating if the player has been designed.
|
* @param designedAvatar A flag indicating if the player has designed their avatar.
|
||||||
*/
|
*/
|
||||||
public void setDesigned(boolean designed) {
|
public void setDesigned(boolean designedAvatar) {
|
||||||
this.designedAvatar = designed;
|
this.designedAvatar = designedAvatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -717,8 +717,8 @@ public final class Player extends Mob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shout(String message, boolean chatBox) {
|
public void shout(String message, boolean chatOnly) {
|
||||||
blockSet.add(SynchronizationBlock.createForceChatBlock(chatBox ? '~' + message : message));
|
blockSet.add(SynchronizationBlock.createForceChatBlock(chatOnly ? message : '~' + message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -740,8 +740,8 @@ public final class Player extends Mob {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Player.class.getName() + " [username=" + credentials.getUsername() + ", privilegeLevel="
|
return Player.class.getName() + " [username=" + credentials.getUsername() + ", privilege=" + privilegeLevel
|
||||||
+ privilegeLevel + "]";
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ public final class World {
|
|||||||
* @param manager The plugin manager. TODO move this.
|
* @param manager The plugin manager. TODO move this.
|
||||||
* @throws IOException If an I/O error occurs.
|
* @throws IOException If an I/O error occurs.
|
||||||
*/
|
*/
|
||||||
public void init(int release, IndexedFileSystem fs, PluginManager manager) throws IOException {
|
public void init(int release, IndexedFileSystem fs, PluginManager manager) throws Exception {
|
||||||
this.releaseNumber = release;
|
this.releaseNumber = release;
|
||||||
ItemDefinitionDecoder itemDefParser = new ItemDefinitionDecoder(fs);
|
ItemDefinitionDecoder itemDefParser = new ItemDefinitionDecoder(fs);
|
||||||
ItemDefinition[] itemDefs = itemDefParser.decode();
|
ItemDefinition[] itemDefs = itemDefParser.decode();
|
||||||
@@ -224,6 +224,7 @@ public final class World {
|
|||||||
placeEntities(objects);
|
placeEntities(objects);
|
||||||
logger.info("Loaded " + objects.length + " static objects.");
|
logger.info("Loaded " + objects.length + " static objects.");
|
||||||
|
|
||||||
|
manager.start();
|
||||||
pluginManager = manager; // TODO move!!
|
pluginManager = manager; // TODO move!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,9 +269,9 @@ public final class World {
|
|||||||
public boolean register(final Npc npc) {
|
public boolean register(final Npc npc) {
|
||||||
boolean success = npcRepository.add(npc);
|
boolean success = npcRepository.add(npc);
|
||||||
if (success) {
|
if (success) {
|
||||||
logger.info("Registered npc: " + npc + " [online=" + npcRepository.size() + "]");
|
logger.info("Registered npc: " + npc + " [count=" + npcRepository.size() + "]");
|
||||||
} else {
|
} else {
|
||||||
logger.warning("Failed to register npc, repository capacity reached: [online=" + npcRepository.size() + "]");
|
logger.warning("Failed to register npc, repository capacity reached: [count=" + npcRepository.size() + "]");
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -288,10 +289,10 @@ public final class World {
|
|||||||
|
|
||||||
boolean success = playerRepository.add(player) & players.put(player.getName(), player) == null;
|
boolean success = playerRepository.add(player) & players.put(player.getName(), player) == null;
|
||||||
if (success) {
|
if (success) {
|
||||||
logger.info("Registered player: " + player + " [online=" + playerRepository.size() + "]");
|
logger.info("Registered player: " + player + " [count=" + playerRepository.size() + "]");
|
||||||
return RegistrationStatus.OK;
|
return RegistrationStatus.OK;
|
||||||
}
|
}
|
||||||
logger.warning("Failed to register player (server full): " + player + " [online=" + playerRepository.size()
|
logger.warning("Failed to register player (server full): " + player + " [count=" + playerRepository.size()
|
||||||
+ "]");
|
+ "]");
|
||||||
return RegistrationStatus.WORLD_FULL;
|
return RegistrationStatus.WORLD_FULL;
|
||||||
}
|
}
|
||||||
@@ -325,7 +326,7 @@ public final class World {
|
|||||||
*/
|
*/
|
||||||
public void unregister(Player player) {
|
public void unregister(Player player) {
|
||||||
if (playerRepository.remove(player) & players.remove(player.getName()) == player) {
|
if (playerRepository.remove(player) & players.remove(player.getName()) == player) {
|
||||||
logger.info("Unregistered player: " + player + " [online=" + playerRepository.size() + "]");
|
logger.info("Unregistered player: " + player + " [count=" + playerRepository.size() + "]");
|
||||||
} else {
|
} else {
|
||||||
logger.warning("Could not find player " + player + " to unregister!");
|
logger.warning("Could not find player " + player + " to unregister!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public final class GameObject extends Entity {
|
|||||||
* @param definition The object's definition.
|
* @param definition The object's definition.
|
||||||
*/
|
*/
|
||||||
public GameObject(ObjectDefinition definition, Position position) {
|
public GameObject(ObjectDefinition definition, Position position) {
|
||||||
|
super(position);
|
||||||
this.definition = definition;
|
this.definition = definition;
|
||||||
this.position = position;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ public final class StaticObject extends Entity {
|
|||||||
* @param rotation The rotation of the object.
|
* @param rotation The rotation of the object.
|
||||||
*/
|
*/
|
||||||
public StaticObject(int id, Position position, int type, int rotation) {
|
public StaticObject(int id, Position position, int type, int rotation) {
|
||||||
|
super(position);
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.position = position;
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.rotation = rotation;
|
this.rotation = rotation;
|
||||||
definition = ObjectDefinition.lookup(id);
|
definition = ObjectDefinition.lookup(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user