diff --git a/src/main/java/cactusServer/entities/Player.java b/src/main/java/cactusServer/entities/Player.java index 4120783..4878612 100644 --- a/src/main/java/cactusServer/entities/Player.java +++ b/src/main/java/cactusServer/entities/Player.java @@ -17,11 +17,11 @@ 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) - public static final long STOP_TIME_LIMIT = (long)(30 * Math.pow(10, 9)); + public static final long STOP_TIME_LIMIT = (long)(30 * 1e+9); private Player() { // JSONDecode���̌Ăяo���p @@ -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); } }