mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Update object/region code.
This commit is contained in:
@@ -170,7 +170,6 @@ public final class Server {
|
||||
*/
|
||||
public void start() throws Exception {
|
||||
PluginManager mgr = new PluginManager(new PluginContext(context));
|
||||
mgr.start(); // TODO move this?
|
||||
|
||||
serviceManager.startAll();
|
||||
|
||||
|
||||
@@ -12,6 +12,15 @@ public abstract class Entity {
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -89,7 +89,7 @@ public abstract class Mob extends Entity {
|
||||
* @param position The initial position.
|
||||
*/
|
||||
public Mob(Position position) {
|
||||
this.position = position;
|
||||
super(position);
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -315,9 +315,9 @@ public abstract class Mob extends Entity {
|
||||
* player.
|
||||
*
|
||||
* @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));
|
||||
}
|
||||
|
||||
|
||||
@@ -623,10 +623,10 @@ public final class Player extends Mob {
|
||||
/**
|
||||
* 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) {
|
||||
this.designedAvatar = designed;
|
||||
public void setDesigned(boolean designedAvatar) {
|
||||
this.designedAvatar = designedAvatar;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -717,8 +717,8 @@ public final class Player extends Mob {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shout(String message, boolean chatBox) {
|
||||
blockSet.add(SynchronizationBlock.createForceChatBlock(chatBox ? '~' + message : message));
|
||||
public void shout(String message, boolean chatOnly) {
|
||||
blockSet.add(SynchronizationBlock.createForceChatBlock(chatOnly ? message : '~' + message));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -740,8 +740,8 @@ public final class Player extends Mob {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Player.class.getName() + " [username=" + credentials.getUsername() + ", privilegeLevel="
|
||||
+ privilegeLevel + "]";
|
||||
return Player.class.getName() + " [username=" + credentials.getUsername() + ", privilege=" + privilegeLevel
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public final class World {
|
||||
* @param manager The plugin manager. TODO move this.
|
||||
* @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;
|
||||
ItemDefinitionDecoder itemDefParser = new ItemDefinitionDecoder(fs);
|
||||
ItemDefinition[] itemDefs = itemDefParser.decode();
|
||||
@@ -224,6 +224,7 @@ public final class World {
|
||||
placeEntities(objects);
|
||||
logger.info("Loaded " + objects.length + " static objects.");
|
||||
|
||||
manager.start();
|
||||
pluginManager = manager; // TODO move!!
|
||||
}
|
||||
|
||||
@@ -268,9 +269,9 @@ public final class World {
|
||||
public boolean register(final Npc npc) {
|
||||
boolean success = npcRepository.add(npc);
|
||||
if (success) {
|
||||
logger.info("Registered npc: " + npc + " [online=" + npcRepository.size() + "]");
|
||||
logger.info("Registered npc: " + npc + " [count=" + npcRepository.size() + "]");
|
||||
} 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;
|
||||
}
|
||||
@@ -288,10 +289,10 @@ public final class World {
|
||||
|
||||
boolean success = playerRepository.add(player) & players.put(player.getName(), player) == null;
|
||||
if (success) {
|
||||
logger.info("Registered player: " + player + " [online=" + playerRepository.size() + "]");
|
||||
logger.info("Registered player: " + player + " [count=" + playerRepository.size() + "]");
|
||||
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;
|
||||
}
|
||||
@@ -325,7 +326,7 @@ public final class World {
|
||||
*/
|
||||
public void unregister(Player 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 {
|
||||
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.
|
||||
*/
|
||||
public GameObject(ObjectDefinition definition, Position position) {
|
||||
super(position);
|
||||
this.definition = definition;
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,8 +42,8 @@ public final class StaticObject extends Entity {
|
||||
* @param rotation The rotation of the object.
|
||||
*/
|
||||
public StaticObject(int id, Position position, int type, int rotation) {
|
||||
super(position);
|
||||
this.id = id;
|
||||
this.position = position;
|
||||
this.type = type;
|
||||
this.rotation = rotation;
|
||||
definition = ObjectDefinition.lookup(id);
|
||||
|
||||
Reference in New Issue
Block a user