diff --git a/src/main/java/cactusServer/entities/Player.java b/src/main/java/cactusServer/entities/Player.java index 4120783..82b391f 100644 --- a/src/main/java/cactusServer/entities/Player.java +++ b/src/main/java/cactusServer/entities/Player.java @@ -17,7 +17,7 @@ private Quaternion3D angle; private CameraState cameraState; private EmoteState emoteState; - private long lastOperateTime = System.nanoTime(); + private long lastUpdateTime = System.nanoTime(); @JSONHint(ignore = true) public static final int UNIQUE_ID_LENGTH = 12; @JSONHint(ignore = true) @@ -42,7 +42,7 @@ setEmoteState(new EmoteState()); } Character character = getCharacter(); - readCharacterData(); + readCharacterData(character); initPlaceable(character.getModelID()); } @@ -85,8 +85,8 @@ } @JSONHint(ignore = true) - public long getLastOperateTime() { - return lastOperateTime; + public long getLastUpdateTime() { + return lastUpdateTime; } public void setInstanceID(String instanceID) { @@ -122,15 +122,17 @@ } @JSONHint(ignore = true) - public void setLastOperateTime(long lastOperateTime) { - this.lastOperateTime = lastOperateTime; + public void setLastUpdateTime(long lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; } public Player update(String characterID, Position3D position, Quaternion3D angle, CameraState cameraState, EmoteState.EmoteType animationClassToStart) { - setCharacterID(characterID); setPosition(position); setAngle(angle); + if (!this.characterID.equals(characterID)) { + changeCharacter(characterID); + } setCameraState(cameraState); updateEmoteType(animationClassToStart); // updateAreaURI(); @@ -169,7 +171,9 @@ public void changeCharacter(String characterID) { writeCharacterData(); setCharacterID(characterID); - readCharacterData(); + Character character = getCharacter(); + readCharacterData(character); + initPlaceable(character.getModelID()); } public void destroy() { @@ -186,13 +190,14 @@ setAreaURI(character.getAreaURI()); } - private void readCharacterData() { - Character character = getCharacter(); - readCharacterData(character); - } +// private void readCharacterData() { +// Character character = getCharacter(); +// readCharacterData(character); +// } private void writeCharacterData() { Character character = getCharacter(); +// if (character == null) return; character.update(position, angle, areaURI); } }