move characterService to serverState
This commit is contained in:
parent
5b8509a7f4
commit
d812d9eb47
@ -1813,6 +1813,7 @@ Move global cursor entities into cursorState
|
|||||||
Move lots of global state to clientState
|
Move lots of global state to clientState
|
||||||
Create ServerState global
|
Create ServerState global
|
||||||
Move realmManager to serverState
|
Move realmManager to serverState
|
||||||
|
Move characterService to serverState
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class ImGuiAI {
|
|||||||
if(ImGui.button("Send off map")){
|
if(ImGui.button("Send off map")){
|
||||||
Entity entity = ai.getParent();
|
Entity entity = ai.getParent();
|
||||||
ServerCharacterData serverCharacterData = ServerCharacterData.getServerCharacterData(entity);
|
ServerCharacterData serverCharacterData = ServerCharacterData.getServerCharacterData(entity);
|
||||||
Character character = Globals.characterService.getCharacter(serverCharacterData.getCharacterData().getId());
|
Character character = Globals.serverState.characterService.getCharacter(serverCharacterData.getCharacterData().getId());
|
||||||
CharacterGoal.setCharacterGoal(character, new CharacterGoal(CharacterGoalType.LEAVE_SIM_RANGE));
|
CharacterGoal.setCharacterGoal(character, new CharacterGoal(CharacterGoalType.LEAVE_SIM_RANGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,7 +107,7 @@ public class MenuGeneratorsInGame {
|
|||||||
//Save
|
//Save
|
||||||
{
|
{
|
||||||
Button button = Button.createButton("Save and Quit", () -> {
|
Button button = Button.createButton("Save and Quit", () -> {
|
||||||
SaveUtils.overwriteSave(Globals.currentSave.getName());
|
SaveUtils.overwriteSave(Globals.serverState.currentSave.getName());
|
||||||
Globals.signalSystem.post(SignalType.ENGINE_RETURN_TO_TITLE);
|
Globals.signalSystem.post(SignalType.ENGINE_RETURN_TO_TITLE);
|
||||||
});
|
});
|
||||||
button.setMarginTop(BUTTON_MARGIN);
|
button.setMarginTop(BUTTON_MARGIN);
|
||||||
|
|||||||
@ -61,7 +61,6 @@ import electrosphere.script.ScriptEngine;
|
|||||||
import electrosphere.server.ServerState;
|
import electrosphere.server.ServerState;
|
||||||
import electrosphere.server.db.DatabaseController;
|
import electrosphere.server.db.DatabaseController;
|
||||||
import electrosphere.server.entity.poseactor.PoseModel;
|
import electrosphere.server.entity.poseactor.PoseModel;
|
||||||
import electrosphere.server.saves.Save;
|
|
||||||
import electrosphere.server.service.CharacterService;
|
import electrosphere.server.service.CharacterService;
|
||||||
import electrosphere.server.service.StructureScanningService;
|
import electrosphere.server.service.StructureScanningService;
|
||||||
import electrosphere.server.simulation.MicroSimulation;
|
import electrosphere.server.simulation.MicroSimulation;
|
||||||
@ -85,7 +84,7 @@ public class Globals {
|
|||||||
//
|
//
|
||||||
//Service manager
|
//Service manager
|
||||||
//
|
//
|
||||||
static ServiceManager serviceManager;
|
public static ServiceManager serviceManager;
|
||||||
|
|
||||||
//
|
//
|
||||||
//Signal system
|
//Signal system
|
||||||
@ -181,12 +180,6 @@ public class Globals {
|
|||||||
public static CursorState cursorState = new CursorState();
|
public static CursorState cursorState = new CursorState();
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Game Save stuff
|
|
||||||
//
|
|
||||||
public static Save currentSave = null;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Game config
|
// Game config
|
||||||
//
|
//
|
||||||
@ -327,7 +320,6 @@ public class Globals {
|
|||||||
//services
|
//services
|
||||||
public static FileWatcherService fileWatcherService;
|
public static FileWatcherService fileWatcherService;
|
||||||
public static StructureScanningService structureScanningService;
|
public static StructureScanningService structureScanningService;
|
||||||
public static CharacterService characterService;
|
|
||||||
|
|
||||||
//collision world data
|
//collision world data
|
||||||
public static CollisionWorldData commonWorldData;
|
public static CollisionWorldData commonWorldData;
|
||||||
@ -400,11 +392,16 @@ public class Globals {
|
|||||||
RENDER_FLAG_RENDER_UI = true;
|
RENDER_FLAG_RENDER_UI = true;
|
||||||
RENDER_FLAG_RENDER_UI_BOUNDS = false;
|
RENDER_FLAG_RENDER_UI_BOUNDS = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
//Service manager
|
||||||
|
serviceManager = ServiceManager.create();
|
||||||
|
|
||||||
//client state
|
//client state
|
||||||
Globals.clientState = new ClientState();
|
Globals.clientState = new ClientState();
|
||||||
|
|
||||||
//server state
|
//server state
|
||||||
Globals.serverState = new ServerState();
|
Globals.serverState = new ServerState();
|
||||||
|
Globals.serverState.characterService = (CharacterService)serviceManager.registerService(new CharacterService());
|
||||||
|
|
||||||
//load in default texture map
|
//load in default texture map
|
||||||
textureMapDefault = TextureMap.construct("Textures/default_texture_map.json");
|
textureMapDefault = TextureMap.construct("Textures/default_texture_map.json");
|
||||||
@ -439,10 +436,7 @@ public class Globals {
|
|||||||
Globals.movementAudioService = new MovementAudioService();
|
Globals.movementAudioService = new MovementAudioService();
|
||||||
Globals.hitboxAudioService = new HitboxAudioService();
|
Globals.hitboxAudioService = new HitboxAudioService();
|
||||||
|
|
||||||
//
|
|
||||||
//Service manager
|
|
||||||
serviceManager = new ServiceManager();
|
|
||||||
serviceManager.init();
|
|
||||||
//add services here
|
//add services here
|
||||||
Globals.signalSystem = (SignalSystem)serviceManager.registerService(new SignalSystem());
|
Globals.signalSystem = (SignalSystem)serviceManager.registerService(new SignalSystem());
|
||||||
Globals.elementService = (ElementService)serviceManager.registerService(new ElementService());
|
Globals.elementService = (ElementService)serviceManager.registerService(new ElementService());
|
||||||
@ -451,7 +445,6 @@ public class Globals {
|
|||||||
Globals.mainThreadSignalService = (MainThreadSignalService)serviceManager.registerService(new MainThreadSignalService());
|
Globals.mainThreadSignalService = (MainThreadSignalService)serviceManager.registerService(new MainThreadSignalService());
|
||||||
Globals.fileWatcherService = (FileWatcherService)serviceManager.registerService(new FileWatcherService());
|
Globals.fileWatcherService = (FileWatcherService)serviceManager.registerService(new FileWatcherService());
|
||||||
Globals.structureScanningService = (StructureScanningService)serviceManager.registerService(new StructureScanningService());
|
Globals.structureScanningService = (StructureScanningService)serviceManager.registerService(new StructureScanningService());
|
||||||
Globals.characterService = (CharacterService)serviceManager.registerService(new CharacterService());
|
|
||||||
serviceManager.instantiate();
|
serviceManager.instantiate();
|
||||||
//
|
//
|
||||||
//End service manager
|
//End service manager
|
||||||
@ -619,6 +612,9 @@ public class Globals {
|
|||||||
Globals.playerManager = new PlayerManager();
|
Globals.playerManager = new PlayerManager();
|
||||||
Globals.clientState = new ClientState();
|
Globals.clientState = new ClientState();
|
||||||
Globals.serverState = new ServerState();
|
Globals.serverState = new ServerState();
|
||||||
|
if(Globals.serviceManager != null){
|
||||||
|
Globals.serverState.characterService = (CharacterService)Globals.serviceManager.registerService(new CharacterService());
|
||||||
|
}
|
||||||
Globals.dbController.disconnect();
|
Globals.dbController.disconnect();
|
||||||
Globals.serviceManager.unloadScene();
|
Globals.serviceManager.unloadScene();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,7 +180,7 @@ public class LoadingUtils {
|
|||||||
}
|
}
|
||||||
//set player character template
|
//set player character template
|
||||||
serverPlayerConnection.setCreatureTemplate(template);
|
serverPlayerConnection.setCreatureTemplate(template);
|
||||||
Character chara = Globals.characterService.createCharacter(template, serverPlayerConnection.getPlayerId());
|
Character chara = Globals.serverState.characterService.createCharacter(template, serverPlayerConnection.getPlayerId());
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestSpawnCharacterMessage(chara.getId() + ""));
|
Globals.clientState.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestSpawnCharacterMessage(chara.getId() + ""));
|
||||||
|
|
||||||
//set player world-space coordinates
|
//set player world-space coordinates
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import electrosphere.engine.signal.Signal.SignalType;
|
|||||||
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
||||||
import electrosphere.renderer.ui.elements.Window;
|
import electrosphere.renderer.ui.elements.Window;
|
||||||
import electrosphere.server.ServerState;
|
import electrosphere.server.ServerState;
|
||||||
|
import electrosphere.server.service.CharacterService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loading thread that returns the client to the main menu
|
* Loading thread that returns the client to the main menu
|
||||||
@ -62,6 +63,7 @@ public class MainMenuLoading {
|
|||||||
private static void resetServerState(){
|
private static void resetServerState(){
|
||||||
Globals.serverState.server.close();
|
Globals.serverState.server.close();
|
||||||
Globals.serverState = new ServerState();
|
Globals.serverState = new ServerState();
|
||||||
|
Globals.serverState.characterService = (CharacterService)Globals.serviceManager.registerService(new CharacterService());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -17,12 +17,19 @@ public class ServiceManager {
|
|||||||
*/
|
*/
|
||||||
public List<Service> trackedServices;
|
public List<Service> trackedServices;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private constructor
|
||||||
|
*/
|
||||||
|
private ServiceManager(){ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the service manager
|
* Initializes the service manager
|
||||||
*/
|
*/
|
||||||
public void init(){
|
public static ServiceManager create(){
|
||||||
LoggerInterface.loggerEngine.DEBUG("[ServiceManager] Init");
|
LoggerInterface.loggerEngine.DEBUG("[ServiceManager] Create");
|
||||||
trackedServices = new LinkedList<Service>();
|
ServiceManager rVal = new ServiceManager();
|
||||||
|
rVal.trackedServices = new LinkedList<Service>();
|
||||||
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +66,7 @@ public class ServiceManager {
|
|||||||
LoggerInterface.loggerEngine.DEBUG("[ServiceManager] Destroy service " + service.getName());
|
LoggerInterface.loggerEngine.DEBUG("[ServiceManager] Destroy service " + service.getName());
|
||||||
service.destroy();
|
service.destroy();
|
||||||
}
|
}
|
||||||
this.trackedServices = null;
|
this.trackedServices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -17,12 +17,12 @@ public class SignalServiceImpl implements SignalService {
|
|||||||
/**
|
/**
|
||||||
* Thread safe's the service
|
* Thread safe's the service
|
||||||
*/
|
*/
|
||||||
Semaphore threadLock;
|
Semaphore threadLock = new Semaphore(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of signals to handle
|
* The list of signals to handle
|
||||||
*/
|
*/
|
||||||
List<Signal> signals;
|
List<Signal> signals = new LinkedList<Signal>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the service
|
* The name of the service
|
||||||
@ -48,15 +48,12 @@ public class SignalServiceImpl implements SignalService {
|
|||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
LoggerInterface.loggerEngine.DEBUG("[" + this.getName() + "] Init");
|
LoggerInterface.loggerEngine.DEBUG("[" + this.getName() + "] Init");
|
||||||
threadLock = new Semaphore(1);
|
|
||||||
signals = new LinkedList<Signal>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
LoggerInterface.loggerEngine.DEBUG("[" + this.getName() + "] Destroy");
|
LoggerInterface.loggerEngine.DEBUG("[" + this.getName() + "] Destroy");
|
||||||
threadLock = null;
|
signals.clear();
|
||||||
signals = null;
|
|
||||||
serviceName = null;
|
serviceName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -168,7 +168,7 @@ public class ServerEntityUtils {
|
|||||||
Globals.serverState.aiManager.removeAI(entity);
|
Globals.serverState.aiManager.removeAI(entity);
|
||||||
}
|
}
|
||||||
if(ServerCharacterData.hasServerCharacterDataTree(entity)){
|
if(ServerCharacterData.hasServerCharacterDataTree(entity)){
|
||||||
Globals.characterService.removeEntity(ServerCharacterData.getServerCharacterData(entity).getCharacterData());
|
Globals.serverState.characterService.removeEntity(ServerCharacterData.getServerCharacterData(entity).getCharacterData());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public class ServerCharacterData {
|
|||||||
public static void attachServerCharacterData(Entity entity, Character charaData){
|
public static void attachServerCharacterData(Entity entity, Character charaData){
|
||||||
ServerCharacterData tree = new ServerCharacterData(entity, charaData);
|
ServerCharacterData tree = new ServerCharacterData(entity, charaData);
|
||||||
entity.putData(EntityDataStrings.TREE_SERVERCHARACTERDATA, tree);
|
entity.putData(EntityDataStrings.TREE_SERVERCHARACTERDATA, tree);
|
||||||
Globals.characterService.setEntity(charaData, entity);
|
Globals.serverState.characterService.setEntity(charaData, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class CharacterProtocol implements ServerProtocolTemplate<CharacterMessag
|
|||||||
switch(message.getMessageSubtype()){
|
switch(message.getMessageSubtype()){
|
||||||
case REQUESTCHARACTERLIST: {
|
case REQUESTCHARACTERLIST: {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
List<CharacterDescriptionDTO>characters = Globals.characterService.getCharacters(connectionHandler.getPlayer().getDBID()).stream().map((Character chara) -> {
|
List<CharacterDescriptionDTO>characters = Globals.serverState.characterService.getCharacters(connectionHandler.getPlayer().getDBID()).stream().map((Character chara) -> {
|
||||||
CharacterDescriptionDTO dtoObj = new CharacterDescriptionDTO();
|
CharacterDescriptionDTO dtoObj = new CharacterDescriptionDTO();
|
||||||
dtoObj.setId(chara.getId() + "");
|
dtoObj.setId(chara.getId() + "");
|
||||||
dtoObj.setTemplate(chara.getCreatureTemplate());
|
dtoObj.setTemplate(chara.getCreatureTemplate());
|
||||||
@ -69,7 +69,7 @@ public class CharacterProtocol implements ServerProtocolTemplate<CharacterMessag
|
|||||||
case REQUESTCREATECHARACTER: {
|
case REQUESTCREATECHARACTER: {
|
||||||
ObjectTemplate template = Utilities.deserialize(message.getdata(), ObjectTemplate.class);
|
ObjectTemplate template = Utilities.deserialize(message.getdata(), ObjectTemplate.class);
|
||||||
if(template != null){
|
if(template != null){
|
||||||
Character charaData = Globals.characterService.createCharacter(template, connectionHandler.getPlayer().getDBID());
|
Character charaData = Globals.serverState.characterService.createCharacter(template, connectionHandler.getPlayer().getDBID());
|
||||||
charaData.setPos(Globals.serverState.realmManager.first().getSpawnPoint());
|
charaData.setPos(Globals.serverState.realmManager.first().getSpawnPoint());
|
||||||
connectionHandler.setCreatureTemplate(Utilities.deserialize(message.getdata(), ObjectTemplate.class));
|
connectionHandler.setCreatureTemplate(Utilities.deserialize(message.getdata(), ObjectTemplate.class));
|
||||||
connectionHandler.setCharacterId(charaData.getId());
|
connectionHandler.setCharacterId(charaData.getId());
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import electrosphere.net.synchronization.server.ServerSynchronizationManager;
|
|||||||
import electrosphere.server.ai.AIManager;
|
import electrosphere.server.ai.AIManager;
|
||||||
import electrosphere.server.datacell.EntityDataCellMapper;
|
import electrosphere.server.datacell.EntityDataCellMapper;
|
||||||
import electrosphere.server.datacell.RealmManager;
|
import electrosphere.server.datacell.RealmManager;
|
||||||
|
import electrosphere.server.saves.Save;
|
||||||
|
import electrosphere.server.service.CharacterService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server state
|
* Server state
|
||||||
@ -36,4 +38,14 @@ public class ServerState {
|
|||||||
*/
|
*/
|
||||||
public final RealmManager realmManager = new RealmManager();
|
public final RealmManager realmManager = new RealmManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currently loaded save
|
||||||
|
*/
|
||||||
|
public Save currentSave = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service for managing characters
|
||||||
|
*/
|
||||||
|
public CharacterService characterService;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,9 +64,9 @@ public class ServerContentManager {
|
|||||||
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell");
|
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell");
|
||||||
String fullPath = "/content/" + cellKey + ".dat";
|
String fullPath = "/content/" + cellKey + ".dat";
|
||||||
if(generateContent){ //in other words, if not arena mode
|
if(generateContent){ //in other words, if not arena mode
|
||||||
if(FileUtils.checkSavePathExists(Globals.currentSave.getName(), fullPath)){
|
if(FileUtils.checkSavePathExists(Globals.serverState.currentSave.getName(), fullPath)){
|
||||||
//if on disk (has already been generated)
|
//if on disk (has already been generated)
|
||||||
ContentSerialization contentRaw = FileUtils.loadObjectFromSavePath(Globals.currentSave.getName(), fullPath, ContentSerialization.class);
|
ContentSerialization contentRaw = FileUtils.loadObjectFromSavePath(Globals.serverState.currentSave.getName(), fullPath, ContentSerialization.class);
|
||||||
contentRaw.hydrateRawContent(realm,cell);
|
contentRaw.hydrateRawContent(realm,cell);
|
||||||
} else {
|
} else {
|
||||||
//else create from scratch
|
//else create from scratch
|
||||||
@ -74,9 +74,9 @@ public class ServerContentManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//just because content wasn't generated doesn't mean there isn't data saved under that key
|
//just because content wasn't generated doesn't mean there isn't data saved under that key
|
||||||
if(FileUtils.checkSavePathExists(Globals.currentSave.getName(), fullPath)){
|
if(FileUtils.checkSavePathExists(Globals.serverState.currentSave.getName(), fullPath)){
|
||||||
//if on disk (has already been generated)
|
//if on disk (has already been generated)
|
||||||
ContentSerialization contentRaw = FileUtils.loadObjectFromSavePath(Globals.currentSave.getName(), fullPath, ContentSerialization.class);
|
ContentSerialization contentRaw = FileUtils.loadObjectFromSavePath(Globals.serverState.currentSave.getName(), fullPath, ContentSerialization.class);
|
||||||
contentRaw.hydrateRawContent(realm,cell);
|
contentRaw.hydrateRawContent(realm,cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ public class ServerContentManager {
|
|||||||
//ie, if we load an asset-defined (not save-defined) scene that does not have save data
|
//ie, if we load an asset-defined (not save-defined) scene that does not have save data
|
||||||
//ie, imagine a puzzle room or something like that
|
//ie, imagine a puzzle room or something like that
|
||||||
if(macroData != null){
|
if(macroData != null){
|
||||||
List<Character> nearbyCharacters = Globals.characterService.getCharacters(worldPos);
|
List<Character> nearbyCharacters = Globals.serverState.characterService.getCharacters(worldPos);
|
||||||
for(Character character : nearbyCharacters){
|
for(Character character : nearbyCharacters){
|
||||||
this.spawnMacroObject(realm, character);
|
this.spawnMacroObject(realm, character);
|
||||||
}
|
}
|
||||||
@ -100,14 +100,14 @@ public class ServerContentManager {
|
|||||||
public void saveContentToDisk(Long locationKey, Collection<Entity> entities){
|
public void saveContentToDisk(Long locationKey, Collection<Entity> entities){
|
||||||
//serialize all non-character entities
|
//serialize all non-character entities
|
||||||
ContentSerialization serialization = ContentSerialization.constructContentSerialization(entities);
|
ContentSerialization serialization = ContentSerialization.constructContentSerialization(entities);
|
||||||
String dirPath = SaveUtils.deriveSaveDirectoryPath(Globals.currentSave.getName());
|
String dirPath = SaveUtils.deriveSaveDirectoryPath(Globals.serverState.currentSave.getName());
|
||||||
String fullPath = dirPath + "/content/" + locationKey + ".dat";
|
String fullPath = dirPath + "/content/" + locationKey + ".dat";
|
||||||
FileUtils.serializeObjectToFilePath(fullPath, serialization);
|
FileUtils.serializeObjectToFilePath(fullPath, serialization);
|
||||||
|
|
||||||
//store all character entities in database
|
//store all character entities in database
|
||||||
for(Entity entity : entities){
|
for(Entity entity : entities){
|
||||||
if(ServerCharacterData.hasServerCharacterDataTree(entity)){
|
if(ServerCharacterData.hasServerCharacterDataTree(entity)){
|
||||||
Globals.characterService.saveCharacter(entity);
|
Globals.serverState.characterService.saveCharacter(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ public class ServerContentManager {
|
|||||||
* @param serialization The collection of entities to save
|
* @param serialization The collection of entities to save
|
||||||
*/
|
*/
|
||||||
public void saveSerializationToDisk(Long locationKey, ContentSerialization serialization){
|
public void saveSerializationToDisk(Long locationKey, ContentSerialization serialization){
|
||||||
String dirPath = SaveUtils.deriveSaveDirectoryPath(Globals.currentSave.getName());
|
String dirPath = SaveUtils.deriveSaveDirectoryPath(Globals.serverState.currentSave.getName());
|
||||||
String fullPath = dirPath + "/content/" + locationKey + ".dat";
|
String fullPath = dirPath + "/content/" + locationKey + ".dat";
|
||||||
FileUtils.serializeObjectToFilePath(fullPath, serialization);
|
FileUtils.serializeObjectToFilePath(fullPath, serialization);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -249,7 +249,7 @@ public class MacroData {
|
|||||||
LoggerInterface.loggerEngine.WARNING(race.getName());
|
LoggerInterface.loggerEngine.WARNING(race.getName());
|
||||||
int numCharsOfRace = 0;
|
int numCharsOfRace = 0;
|
||||||
//n*m complexity - yikes! - as long as we're not making a million chars at start this should be _ok_
|
//n*m complexity - yikes! - as long as we're not making a million chars at start this should be _ok_
|
||||||
for(Character chara : Globals.characterService.getAllCharacters()){
|
for(Character chara : Globals.serverState.characterService.getAllCharacters()){
|
||||||
if(chara.containsKey(CharacterDataStrings.RACE)){
|
if(chara.containsKey(CharacterDataStrings.RACE)){
|
||||||
if(Race.getRace(chara).equals(race)){
|
if(Race.getRace(chara).equals(race)){
|
||||||
numCharsOfRace++;
|
numCharsOfRace++;
|
||||||
|
|||||||
@ -94,7 +94,7 @@ public class CharacterUtils {
|
|||||||
public static Character spawnCharacter(Realm realm, Vector3d position, String race){
|
public static Character spawnCharacter(Realm realm, Vector3d position, String race){
|
||||||
Race raceData = Globals.gameConfigCurrent.getRaceMap().getRace(race);
|
Race raceData = Globals.gameConfigCurrent.getRaceMap().getRace(race);
|
||||||
String creatureType = raceData.getAssociatedCreature();
|
String creatureType = raceData.getAssociatedCreature();
|
||||||
Character rVal = Globals.characterService.createCharacter(ObjectTemplate.createDefault(EntityType.CREATURE, creatureType), CharacterService.NO_PLAYER);
|
Character rVal = Globals.serverState.characterService.createCharacter(ObjectTemplate.createDefault(EntityType.CREATURE, creatureType), CharacterService.NO_PLAYER);
|
||||||
rVal.setPos(position);
|
rVal.setPos(position);
|
||||||
Race.setRace(rVal, Race.create(race, creatureType));
|
Race.setRace(rVal, Race.create(race, creatureType));
|
||||||
realm.getDataCellManager().evaluateMacroObject(rVal);
|
realm.getDataCellManager().evaluateMacroObject(rVal);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class PlayerCharacterCreation {
|
|||||||
|
|
||||||
//
|
//
|
||||||
//get template
|
//get template
|
||||||
Character charaData = Globals.characterService.getCharacter(connectionHandler.getCharacterId());
|
Character charaData = Globals.serverState.characterService.getCharacter(connectionHandler.getCharacterId());
|
||||||
ObjectTemplate template = charaData.getCreatureTemplate();
|
ObjectTemplate template = charaData.getCreatureTemplate();
|
||||||
if(connectionHandler.getCharacterId() == CharacterProtocol.SPAWN_EXISTING_TEMPLATE){
|
if(connectionHandler.getCharacterId() == CharacterProtocol.SPAWN_EXISTING_TEMPLATE){
|
||||||
template = connectionHandler.getCurrentCreatureTemplate();
|
template = connectionHandler.getCurrentCreatureTemplate();
|
||||||
@ -90,7 +90,7 @@ public class PlayerCharacterCreation {
|
|||||||
*/
|
*/
|
||||||
static void addPlayerServerBTrees(Entity entity, ServerConnectionHandler serverConnectionHandler){
|
static void addPlayerServerBTrees(Entity entity, ServerConnectionHandler serverConnectionHandler){
|
||||||
ServerPlayerViewDirTree.attachServerPlayerViewDirTree(entity);
|
ServerPlayerViewDirTree.attachServerPlayerViewDirTree(entity);
|
||||||
ServerCharacterData.attachServerCharacterData(entity, Globals.characterService.getCharacter(serverConnectionHandler.getCharacterId()));
|
ServerCharacterData.attachServerCharacterData(entity, Globals.serverState.characterService.getCharacter(serverConnectionHandler.getCharacterId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +100,7 @@ public class PlayerCharacterCreation {
|
|||||||
* @return The spawn point for the player
|
* @return The spawn point for the player
|
||||||
*/
|
*/
|
||||||
public static Vector3d solveSpawnPoint(Realm realm, ServerConnectionHandler connectionHandler){
|
public static Vector3d solveSpawnPoint(Realm realm, ServerConnectionHandler connectionHandler){
|
||||||
Vector3d spawnPoint = Globals.characterService.getCharacter(connectionHandler.getCharacterId()).getPos();
|
Vector3d spawnPoint = Globals.serverState.characterService.getCharacter(connectionHandler.getCharacterId()).getPos();
|
||||||
if(spawnPoint == null){
|
if(spawnPoint == null){
|
||||||
spawnPoint = realm.getSpawnPoint();
|
spawnPoint = realm.getSpawnPoint();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,7 +104,7 @@ public class ServerBlockChunkDiskMap {
|
|||||||
* Saves the disk map to disk
|
* Saves the disk map to disk
|
||||||
*/
|
*/
|
||||||
public void save(){
|
public void save(){
|
||||||
FileUtils.serializeObjectToSavePath(Globals.currentSave.getName(), MAP_FILE_NAME, this);
|
FileUtils.serializeObjectToSavePath(Globals.serverState.currentSave.getName(), MAP_FILE_NAME, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,7 +136,7 @@ public class ServerBlockChunkDiskMap {
|
|||||||
if(this.containsBlocksAtPosition(worldX, worldY, worldZ)){
|
if(this.containsBlocksAtPosition(worldX, worldY, worldZ)){
|
||||||
//read file
|
//read file
|
||||||
String fileName = worldPosFileMap.get(getBlockChunkKey(worldX, worldY, worldZ));
|
String fileName = worldPosFileMap.get(getBlockChunkKey(worldX, worldY, worldZ));
|
||||||
byte[] rawDataCompressed = FileUtils.loadBinaryFromSavePath(Globals.currentSave.getName(), fileName);
|
byte[] rawDataCompressed = FileUtils.loadBinaryFromSavePath(Globals.serverState.currentSave.getName(), fileName);
|
||||||
//decompress
|
//decompress
|
||||||
byte[] rawData = null;
|
byte[] rawData = null;
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
@ -251,7 +251,7 @@ public class ServerBlockChunkDiskMap {
|
|||||||
deflaterInputStream.flush();
|
deflaterInputStream.flush();
|
||||||
deflaterInputStream.close();
|
deflaterInputStream.close();
|
||||||
//write to disk
|
//write to disk
|
||||||
FileUtils.saveBinaryToSavePath(Globals.currentSave.getName(), fileName, out.toByteArray());
|
FileUtils.saveBinaryToSavePath(Globals.serverState.currentSave.getName(), fileName, out.toByteArray());
|
||||||
//save to the map of filenames
|
//save to the map of filenames
|
||||||
worldPosFileMap.put(chunkKey,fileName);
|
worldPosFileMap.put(chunkKey,fileName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -59,7 +59,7 @@ public class FluidDiskMap {
|
|||||||
* Saves the disk map to disk
|
* Saves the disk map to disk
|
||||||
*/
|
*/
|
||||||
public void save(){
|
public void save(){
|
||||||
FileUtils.serializeObjectToSavePath(Globals.currentSave.getName(), "fluid.map", this);
|
FileUtils.serializeObjectToSavePath(Globals.serverState.currentSave.getName(), "fluid.map", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,7 +86,7 @@ public class FluidDiskMap {
|
|||||||
if(containsFluidAtPosition(worldX, worldY, worldZ)){
|
if(containsFluidAtPosition(worldX, worldY, worldZ)){
|
||||||
//read file
|
//read file
|
||||||
String fileName = worldPosFileMap.get(getFluidChunkKey(worldX, worldY, worldZ));
|
String fileName = worldPosFileMap.get(getFluidChunkKey(worldX, worldY, worldZ));
|
||||||
byte[] rawDataCompressed = FileUtils.loadBinaryFromSavePath(Globals.currentSave.getName(), fileName);
|
byte[] rawDataCompressed = FileUtils.loadBinaryFromSavePath(Globals.serverState.currentSave.getName(), fileName);
|
||||||
//decompress
|
//decompress
|
||||||
byte[] rawData = null;
|
byte[] rawData = null;
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
@ -192,7 +192,7 @@ public class FluidDiskMap {
|
|||||||
deflaterInputStream.flush();
|
deflaterInputStream.flush();
|
||||||
deflaterInputStream.close();
|
deflaterInputStream.close();
|
||||||
//write to disk
|
//write to disk
|
||||||
FileUtils.saveBinaryToSavePath(Globals.currentSave.getName(), fileName, out.toByteArray());
|
FileUtils.saveBinaryToSavePath(Globals.serverState.currentSave.getName(), fileName, out.toByteArray());
|
||||||
//save to the map of filenames
|
//save to the map of filenames
|
||||||
worldPosFileMap.put(chunkKey,fileName);
|
worldPosFileMap.put(chunkKey,fileName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -89,7 +89,7 @@ public class ChunkDiskMap {
|
|||||||
LoggerInterface.loggerEngine.DEBUG("POS FILE MAP: " + rVal.worldPosFileMap.keySet());
|
LoggerInterface.loggerEngine.DEBUG("POS FILE MAP: " + rVal.worldPosFileMap.keySet());
|
||||||
|
|
||||||
//make sure the subfolder for chunk files exists
|
//make sure the subfolder for chunk files exists
|
||||||
String dirPath = SaveUtils.deriveSaveDirectoryPath(Globals.currentSave.getName());
|
String dirPath = SaveUtils.deriveSaveDirectoryPath(Globals.serverState.currentSave.getName());
|
||||||
if(!Files.exists(new File(dirPath + VOXEL_DATA_DIR).toPath())){
|
if(!Files.exists(new File(dirPath + VOXEL_DATA_DIR).toPath())){
|
||||||
try {
|
try {
|
||||||
Files.createDirectories(new File(dirPath + VOXEL_DATA_DIR).toPath());
|
Files.createDirectories(new File(dirPath + VOXEL_DATA_DIR).toPath());
|
||||||
@ -115,7 +115,7 @@ public class ChunkDiskMap {
|
|||||||
* Saves the disk map to disk
|
* Saves the disk map to disk
|
||||||
*/
|
*/
|
||||||
public void save(){
|
public void save(){
|
||||||
FileUtils.serializeObjectToSavePath(Globals.currentSave.getName(), MAP_FILE_NAME, this);
|
FileUtils.serializeObjectToSavePath(Globals.serverState.currentSave.getName(), MAP_FILE_NAME, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,7 +167,7 @@ public class ChunkDiskMap {
|
|||||||
if(this.containsTerrainAtPosition(worldX, worldY, worldZ, stride)){
|
if(this.containsTerrainAtPosition(worldX, worldY, worldZ, stride)){
|
||||||
//read file
|
//read file
|
||||||
String fileName = worldPosFileMap.get(ChunkDiskMap.getTerrainChunkKey(worldX, worldY, worldZ));
|
String fileName = worldPosFileMap.get(ChunkDiskMap.getTerrainChunkKey(worldX, worldY, worldZ));
|
||||||
byte[] rawDataCompressed = FileUtils.loadBinaryFromSavePath(Globals.currentSave.getName(), fileName);
|
byte[] rawDataCompressed = FileUtils.loadBinaryFromSavePath(Globals.serverState.currentSave.getName(), fileName);
|
||||||
//decompress
|
//decompress
|
||||||
byte[] rawData = null;
|
byte[] rawData = null;
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
@ -262,7 +262,7 @@ public class ChunkDiskMap {
|
|||||||
deflaterInputStream.flush();
|
deflaterInputStream.flush();
|
||||||
deflaterInputStream.close();
|
deflaterInputStream.close();
|
||||||
//write to disk
|
//write to disk
|
||||||
FileUtils.saveBinaryToSavePath(Globals.currentSave.getName(), fileName, out.toByteArray());
|
FileUtils.saveBinaryToSavePath(Globals.serverState.currentSave.getName(), fileName, out.toByteArray());
|
||||||
//save to the map of filenames
|
//save to the map of filenames
|
||||||
worldPosFileMap.put(chunkKey,fileName);
|
worldPosFileMap.put(chunkKey,fileName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -101,7 +101,7 @@ public class SaveUtils {
|
|||||||
|
|
||||||
//create save file
|
//create save file
|
||||||
Save save = new Save(saveName);
|
Save save = new Save(saveName);
|
||||||
Globals.currentSave = save; //chunk map saving requires global save to be set
|
Globals.serverState.currentSave = save; //chunk map saving requires global save to be set
|
||||||
FileUtils.serializeObjectToSavePath(saveName, "/save.json", save);
|
FileUtils.serializeObjectToSavePath(saveName, "/save.json", save);
|
||||||
|
|
||||||
//write scene file
|
//write scene file
|
||||||
@ -160,13 +160,13 @@ public class SaveUtils {
|
|||||||
public static void overwriteSave(String saveName){
|
public static void overwriteSave(String saveName){
|
||||||
|
|
||||||
//write save file
|
//write save file
|
||||||
FileUtils.serializeObjectToSavePath(saveName, "/save.json", Globals.currentSave);
|
FileUtils.serializeObjectToSavePath(saveName, "/save.json", Globals.serverState.currentSave);
|
||||||
|
|
||||||
//write server structures
|
//write server structures
|
||||||
Globals.serverState.realmManager.save(saveName);
|
Globals.serverState.realmManager.save(saveName);
|
||||||
|
|
||||||
//store character service
|
//store character service
|
||||||
Globals.characterService.saveAll();
|
Globals.serverState.characterService.saveAll();
|
||||||
|
|
||||||
LoggerInterface.loggerEngine.WARNING("Finished saving " + saveName);
|
LoggerInterface.loggerEngine.WARNING("Finished saving " + saveName);
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ public class SaveUtils {
|
|||||||
String dirPath = deriveSaveDirectoryPath(saveName);
|
String dirPath = deriveSaveDirectoryPath(saveName);
|
||||||
|
|
||||||
//load save file
|
//load save file
|
||||||
Globals.currentSave = FileUtils.loadObjectFromSavePath(saveName, "/save.json", Save.class);
|
Globals.serverState.currentSave = FileUtils.loadObjectFromSavePath(saveName, "/save.json", Save.class);
|
||||||
|
|
||||||
|
|
||||||
//load world data
|
//load world data
|
||||||
|
|||||||
@ -22,16 +22,16 @@ public class MacroSimulation {
|
|||||||
* Iterates the macro simulation
|
* Iterates the macro simulation
|
||||||
*/
|
*/
|
||||||
public static void simulate(Realm realm){
|
public static void simulate(Realm realm){
|
||||||
List<Character> characters = Globals.characterService.getAllCharacters();
|
List<Character> characters = Globals.serverState.characterService.getAllCharacters();
|
||||||
if(characters != null && characters.size() > 0){
|
if(characters != null && characters.size() > 0){
|
||||||
for(Character character : Globals.characterService.getAllCharacters()){
|
for(Character character : Globals.serverState.characterService.getAllCharacters()){
|
||||||
if(character.getPlayerId() != CharacterService.NO_PLAYER){
|
if(character.getPlayerId() != CharacterService.NO_PLAYER){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//update the goal of the character
|
//update the goal of the character
|
||||||
CharaSimulation.setGoal(realm, character);
|
CharaSimulation.setGoal(realm, character);
|
||||||
//if the character doesn't have an entity, simulate it at the macro level
|
//if the character doesn't have an entity, simulate it at the macro level
|
||||||
if(Globals.characterService.getEntity(character) == null){
|
if(Globals.serverState.characterService.getEntity(character) == null){
|
||||||
CharaSimulation.performGoal(realm, character);
|
CharaSimulation.performGoal(realm, character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public class CharaInventoryUtils {
|
|||||||
public static List<EntitySerialization> getInventoryContents(Character chara){
|
public static List<EntitySerialization> getInventoryContents(Character chara){
|
||||||
ObjectTemplate template = chara.getCreatureTemplate();
|
ObjectTemplate template = chara.getCreatureTemplate();
|
||||||
if(CharaMacroUtils.isMicroSim(chara)){
|
if(CharaMacroUtils.isMicroSim(chara)){
|
||||||
Entity creature = Globals.characterService.getEntity(chara);
|
Entity creature = Globals.serverState.characterService.getEntity(chara);
|
||||||
template = CommonEntityUtils.getObjectTemplate(creature);
|
template = CommonEntityUtils.getObjectTemplate(creature);
|
||||||
}
|
}
|
||||||
ObjectInventoryData inventoryData = template.getInventoryData();
|
ObjectInventoryData inventoryData = template.getInventoryData();
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public class CharaMacroUtils {
|
|||||||
* @return true if it is being handled by micro simulation, false otherwise
|
* @return true if it is being handled by micro simulation, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isMicroSim(Character chara){
|
public static boolean isMicroSim(Character chara){
|
||||||
return Globals.characterService.getEntity(chara) != null;
|
return Globals.serverState.characterService.getEntity(chara) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,14 +21,12 @@ public class ServiceManagerTests {
|
|||||||
|
|
||||||
@UnitTest
|
@UnitTest
|
||||||
public void testInit(){
|
public void testInit(){
|
||||||
ServiceManager serviceManager = new ServiceManager();
|
ServiceManager.create();
|
||||||
serviceManager.init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@UnitTest
|
@UnitTest
|
||||||
public void testRegisterService(){
|
public void testRegisterService(){
|
||||||
ServiceManager serviceManager = new ServiceManager();
|
ServiceManager serviceManager = ServiceManager.create();
|
||||||
serviceManager.init();
|
|
||||||
Service service1Mock = Mockito.mock(Service.class);
|
Service service1Mock = Mockito.mock(Service.class);
|
||||||
Service service1 = serviceManager.registerService(service1Mock);
|
Service service1 = serviceManager.registerService(service1Mock);
|
||||||
assertEquals(service1Mock,service1);
|
assertEquals(service1Mock,service1);
|
||||||
@ -36,8 +34,7 @@ public class ServiceManagerTests {
|
|||||||
|
|
||||||
@UnitTest
|
@UnitTest
|
||||||
public void testRegisterTwoServices(){
|
public void testRegisterTwoServices(){
|
||||||
ServiceManager serviceManager = new ServiceManager();
|
ServiceManager serviceManager = ServiceManager.create();
|
||||||
serviceManager.init();
|
|
||||||
Service service1Mock = Mockito.mock(Service.class);
|
Service service1Mock = Mockito.mock(Service.class);
|
||||||
Service service1 = serviceManager.registerService(service1Mock);
|
Service service1 = serviceManager.registerService(service1Mock);
|
||||||
Service service2Mock = Mockito.mock(Service.class);
|
Service service2Mock = Mockito.mock(Service.class);
|
||||||
@ -48,8 +45,7 @@ public class ServiceManagerTests {
|
|||||||
|
|
||||||
@UnitTest
|
@UnitTest
|
||||||
public void testRegisterManyServices(){
|
public void testRegisterManyServices(){
|
||||||
ServiceManager serviceManager = new ServiceManager();
|
ServiceManager serviceManager = ServiceManager.create();
|
||||||
serviceManager.init();
|
|
||||||
for(int i = 0; i < 10; i++){
|
for(int i = 0; i < 10; i++){
|
||||||
serviceManager.registerService(Mockito.mock(Service.class));
|
serviceManager.registerService(Mockito.mock(Service.class));
|
||||||
}
|
}
|
||||||
@ -60,8 +56,7 @@ public class ServiceManagerTests {
|
|||||||
|
|
||||||
@UnitTest
|
@UnitTest
|
||||||
public void testInstantiate(){
|
public void testInstantiate(){
|
||||||
ServiceManager serviceManager = new ServiceManager();
|
ServiceManager serviceManager = ServiceManager.create();
|
||||||
serviceManager.init();
|
|
||||||
|
|
||||||
//register service
|
//register service
|
||||||
Service service1Mock = Mockito.spy(Service.class);
|
Service service1Mock = Mockito.spy(Service.class);
|
||||||
@ -77,8 +72,7 @@ public class ServiceManagerTests {
|
|||||||
|
|
||||||
@UnitTest
|
@UnitTest
|
||||||
public void testDestroy(){
|
public void testDestroy(){
|
||||||
ServiceManager serviceManager = new ServiceManager();
|
ServiceManager serviceManager = ServiceManager.create();
|
||||||
serviceManager.init();
|
|
||||||
|
|
||||||
//register service
|
//register service
|
||||||
Service service1Mock = Mockito.spy(Service.class);
|
Service service1Mock = Mockito.spy(Service.class);
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import electrosphere.test.annotations.UnitTest;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.server.ServerState;
|
import electrosphere.server.ServerState;
|
||||||
import electrosphere.server.datacell.Realm;
|
import electrosphere.server.datacell.Realm;
|
||||||
|
import electrosphere.server.service.CharacterService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the server entity utils
|
* Unit tests for the server entity utils
|
||||||
@ -18,6 +19,7 @@ public class ServerEntityUtilsUnitTests {
|
|||||||
public void destroyEntity_ValidEntity_NoRealm(){
|
public void destroyEntity_ValidEntity_NoRealm(){
|
||||||
//setup
|
//setup
|
||||||
Globals.serverState = new ServerState();
|
Globals.serverState = new ServerState();
|
||||||
|
Globals.serverState.characterService = (CharacterService)Globals.serviceManager.registerService(new CharacterService());
|
||||||
Realm realm = Globals.serverState.realmManager.createViewportRealm(new Vector3d(0,0,0), new Vector3d(1,1,1));
|
Realm realm = Globals.serverState.realmManager.createViewportRealm(new Vector3d(0,0,0), new Vector3d(1,1,1));
|
||||||
Entity entity = EntityCreationUtils.createServerEntity(realm, new Vector3d());
|
Entity entity = EntityCreationUtils.createServerEntity(realm, new Vector3d());
|
||||||
|
|
||||||
|
|||||||
@ -165,7 +165,7 @@ public class TestEngineUtils {
|
|||||||
ObjectTemplate creatureTemplate = ObjectTemplate.createDefault(EntityType.CREATURE, "human");
|
ObjectTemplate creatureTemplate = ObjectTemplate.createDefault(EntityType.CREATURE, "human");
|
||||||
ServerConnectionHandler serverConnection = Globals.serverState.server.getFirstConnection();
|
ServerConnectionHandler serverConnection = Globals.serverState.server.getFirstConnection();
|
||||||
serverConnection.setCreatureTemplate(creatureTemplate);
|
serverConnection.setCreatureTemplate(creatureTemplate);
|
||||||
Character chara = Globals.characterService.createCharacter(creatureTemplate, serverConnection.getPlayerId());
|
Character chara = Globals.serverState.characterService.createCharacter(creatureTemplate, serverConnection.getPlayerId());
|
||||||
serverConnection.setCharacterId(chara.getId());
|
serverConnection.setCharacterId(chara.getId());
|
||||||
PlayerCharacterCreation.spawnPlayerCharacter(serverConnection);
|
PlayerCharacterCreation.spawnPlayerCharacter(serverConnection);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user