From 3fe99f4f50fdbcbc502f29f95075f847d5d1650d Mon Sep 17 00:00:00 2001 From: thatnerd2 Date: Wed, 16 Apr 2014 15:41:40 -0400 Subject: [PATCH 01/20] Move and rotate camera fix --- .../mosstest/servercore/RenderProcessor.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/net/mosstest/servercore/RenderProcessor.java b/src/net/mosstest/servercore/RenderProcessor.java index f30253c..125e290 100644 --- a/src/net/mosstest/servercore/RenderProcessor.java +++ b/src/net/mosstest/servercore/RenderProcessor.java @@ -371,10 +371,10 @@ public class RenderProcessor extends SimpleApplication { } private void move(float cx, float cy, float cz) { - + Vector2f transVector = new Vector2f(cam.getDirection().x, - cam.getDirection().z); - + cam.getDirection().z).normalizeLocal(); + worldNode.setLocalTranslation(worldNode .getLocalTranslation() .addLocal( @@ -398,25 +398,26 @@ public class RenderProcessor extends SimpleApplication { player.setPositionOffsets (xoffset, yoffset, zoffset); } } - + private void rotateCamera(float value, Vector3f axis) { - + Matrix3f mat = new Matrix3f(); mat.fromAngleNormalAxis(ROTATION_SPEED * value, axis); - + Vector3f up = cam.getUp(); Vector3f left = cam.getLeft(); Vector3f dir = cam.getDirection(); - + mat.mult(up, up); mat.mult(left, left); mat.mult(dir, dir); - + Quaternion q = new Quaternion(); q.fromAxes(left, up, dir); q.normalizeLocal(); - - cam.setAxes(q); + if (up.angleBetween(Vector3f.UNIT_Y) <= FastMath.HALF_PI) { + cam.setAxes(q); + } spot.setDirection(cam.getDirection()); } From b5a63ad39571e0ca0796a29b5dea68bb82aedf81 Mon Sep 17 00:00:00 2001 From: thatnerd2 Date: Wed, 16 Apr 2014 16:36:42 -0400 Subject: [PATCH 02/20] Breaking event listeners out of RenderProcessor class. --- .../mosstest/servercore/ActivityListener.java | 60 +++++++ .../mosstest/servercore/RenderProcessor.java | 157 +++++------------- .../mosstest/servercore/RotationListener.java | 54 ++++++ 3 files changed, 156 insertions(+), 115 deletions(-) create mode 100644 src/net/mosstest/servercore/ActivityListener.java create mode 100644 src/net/mosstest/servercore/RotationListener.java diff --git a/src/net/mosstest/servercore/ActivityListener.java b/src/net/mosstest/servercore/ActivityListener.java new file mode 100644 index 0000000..d8a554b --- /dev/null +++ b/src/net/mosstest/servercore/ActivityListener.java @@ -0,0 +1,60 @@ +package net.mosstest.servercore; +import com.jme3.input.controls.ActionListener; + +public class ActivityListener implements ActionListener { + private final float SPEED; + private float[] velocities; + + public ActivityListener (float[] velocities, float speed) { + this.velocities = velocities; + SPEED = speed; + } + + @Override + public void onAction(String name, boolean keyPressed, float tpf) { + if (name.equals("Jump") && keyPressed/* && jumpSPEED == 0 */) { + velocities[1] = 2f; + } else if (name.equals("Jump") && !keyPressed) { + velocities[1] = 0f; + } + + if (name.equals("Down") && keyPressed) { + velocities[1] = -2f; + } else if (name.equals("Down") && !keyPressed) { + velocities[1] = 0f; + } + + if (name.equals("Left") && keyPressed) { + velocities[0] = SPEED; + } else if (name.equals("Left") && !keyPressed + && velocities[0] == SPEED) { + velocities[0] = 0; + } + + if (name.equals("Right") && keyPressed) { + velocities[0] = -SPEED; + } else if (name.equals("Right") && !keyPressed + && velocities[0] == -SPEED) { + velocities[0] = 0; + } + + if (name.equals("Forward") && keyPressed) { + velocities[2] = SPEED; + } else if (name.equals("Forward") && !keyPressed + && velocities[2] == SPEED) { + velocities[2] = 0; + } + + if (name.equals("Back") && keyPressed) { + velocities[2] = -SPEED; + } else if (name.equals("Back") && !keyPressed + && velocities[2] == -SPEED) { + velocities[2] = 0; + } + + if (name.equals("TestFeature") && keyPressed) { + System.err.println("\nDEBUGGING FEATURE\n"); + } + } + +} diff --git a/src/net/mosstest/servercore/RenderProcessor.java b/src/net/mosstest/servercore/RenderProcessor.java index 125e290..0a1f34d 100644 --- a/src/net/mosstest/servercore/RenderProcessor.java +++ b/src/net/mosstest/servercore/RenderProcessor.java @@ -51,12 +51,13 @@ public class RenderProcessor extends SimpleApplication { private float[] locChanges = { 0, 0, 0 }; private double lastTime; private boolean invertY = false; - private Vector3f initialUpVec; private Object renderKey; private Node worldNode; private SpotLight spot; private PointLight lamp; private DirectionalLight sun; + private ActivityListener activityListener; + private RotationListener rotationListener; //private HashMap allChunks = new HashMap(); public INodeManager nManager; public IRenderPreparator rPreparator; @@ -86,7 +87,6 @@ public class RenderProcessor extends SimpleApplication { private void initPreparator(IRenderPreparator prep) { rPreparator = prep; - logger.info("The renderer is starting its preparator, which is of type "+prep.getClass().getSimpleName()+"."); rPreparator.setRenderProcessor(this); rPreparator.start(); } @@ -103,13 +103,13 @@ public class RenderProcessor extends SimpleApplication { setupFlashlight(); setupSunlight(); setupLamplight(); - setupAssetManager(); setupPlayer(); + assetManager.registerLocator("scripts", LocalAssetLocator.class); + flyCam.setEnabled(false); + setupListeners(cam.getUp().clone()); + initKeyBindings(); preparatorChunkTest(); //blankChunkTest(); - flyCam.setEnabled(false); - initialUpVec = cam.getUp().clone(); - initKeyBindings(); } @Override @@ -129,17 +129,10 @@ public class RenderProcessor extends SimpleApplication { GeometryBatchFactory.optimize(worldNode); } } - - public void getChunk (Position pos) { - MapChunk maybe = null; - try {maybe = rPreparator.requestChunk(pos);} - catch (MapGeneratorException e) {e.printStackTrace();} - catch (InterruptedException e) {e.printStackTrace();} - if (maybe != null) {renderChunk(maybe, pos);} - } - +// public void renderChunk(MapChunk chk, Position pos) { int vertexIndexCounter = 0; + int[][][] nodes = chk.getNodes(); Mesh completeMesh = new Mesh (); FloatBuffer vertices = getDirectFloatBuffer(950000); FloatBuffer tex = getDirectFloatBuffer(950000); @@ -150,7 +143,6 @@ public class RenderProcessor extends SimpleApplication { for (byte j = 0; j < 16; j++) { for (byte k = 0; k < 16; k++) { if (isNodeVisible(chk.getNodes(), i, j, k)) { - int nVal = chk.getNodeId(i, j, k); //MapNode node = nManager.getNode((short) nVal); //Material mat = getMaterial((short) nVal); @@ -162,6 +154,12 @@ public class RenderProcessor extends SimpleApplication { float z = (float) ((pos.y - (CHUNK_SIZE * pos.y)) - BLOCK_OFFSET_FROM_CENTER + CHUNK_OFFSET + (j * BLOCK_SIZE)); float y = (float) ((pos.z + (CHUNK_SIZE * pos.z)) - BLOCK_OFFSET_FROM_CENTER + CHUNK_OFFSET + (k * BLOCK_SIZE)); + /*for (int l = 0; l < 6; l++) { + try { + if () + } + }*/ + /** * Vertices start at the top left corner and go clockwise around the face. */ @@ -261,6 +259,12 @@ public class RenderProcessor extends SimpleApplication { //allChunks.put(pos, currentChunk); } + private void createFace (FloatBuffer vBuffer, FloatBuffer tBuffer, FloatBuffer nBuffer, IntBuffer iBuffer, + int xPattern, int yPattern, int zPattern, int indexCounter) { + + + } + private Material getMaterial(short nodeType) { Material mat = null; switch (nodeType) { @@ -273,6 +277,14 @@ public class RenderProcessor extends SimpleApplication { return mat; } + public void getChunk (Position pos) { + MapChunk maybe = null; + try {maybe = rPreparator.requestChunk(pos);} + catch (MapGeneratorException e) {e.printStackTrace();} + catch (InterruptedException e) {e.printStackTrace();} + if (maybe != null) {renderChunk(maybe, pos);} + } + private void preparatorChunkTest() { Position p1 = new Position(0, 0, 0, 0); Position p2 = new Position(1, 0, 0, 0); @@ -366,10 +378,6 @@ public class RenderProcessor extends SimpleApplication { cam.setLocation(new Vector3f(0, 0, 0)); } - private void setupAssetManager () { - assetManager.registerLocator("scripts", LocalAssetLocator.class); - } - private void move(float cx, float cy, float cz) { Vector2f transVector = new Vector2f(cam.getDirection().x, @@ -399,27 +407,9 @@ public class RenderProcessor extends SimpleApplication { } } - private void rotateCamera(float value, Vector3f axis) { - - Matrix3f mat = new Matrix3f(); - mat.fromAngleNormalAxis(ROTATION_SPEED * value, axis); - - Vector3f up = cam.getUp(); - Vector3f left = cam.getLeft(); - Vector3f dir = cam.getDirection(); - - mat.mult(up, up); - mat.mult(left, left); - mat.mult(dir, dir); - - Quaternion q = new Quaternion(); - q.fromAxes(left, up, dir); - q.normalizeLocal(); - if (up.angleBetween(Vector3f.UNIT_Y) <= FastMath.HALF_PI) { - cam.setAxes(q); - } - - spot.setDirection(cam.getDirection()); + private void setupListeners (Vector3f initialUpVec) { + rotationListener = new RotationListener (initialUpVec, invertY, cam, ROTATION_SPEED); + activityListener = new ActivityListener (locChanges, SPEED); } private boolean isNodeVisible (int[][][] chunk, int i, int j, int k) { @@ -459,79 +449,16 @@ public class RenderProcessor extends SimpleApplication { inputManager.addMapping("CAM_Down", new MouseAxisTrigger( MouseInput.AXIS_Y, true), new KeyTrigger(KeyInput.KEY_DOWN)); - inputManager.addListener(actionListener, "Jump"); - inputManager.addListener(actionListener, "Down"); - inputManager.addListener(actionListener, "Left"); - inputManager.addListener(actionListener, "Right"); - inputManager.addListener(actionListener, "Forward"); - inputManager.addListener(actionListener, "Back"); - inputManager.addListener(analogListener, "CAM_Left"); - inputManager.addListener(analogListener, "CAM_Right"); - inputManager.addListener(analogListener, "CAM_Up"); - inputManager.addListener(analogListener, "CAM_Down"); - inputManager.addListener(actionListener, "TestFeature"); + inputManager.addListener(activityListener, "Jump"); + inputManager.addListener(activityListener, "Down"); + inputManager.addListener(activityListener, "Left"); + inputManager.addListener(activityListener, "Right"); + inputManager.addListener(activityListener, "Forward"); + inputManager.addListener(activityListener, "Back"); + inputManager.addListener(rotationListener, "CAM_Left"); + inputManager.addListener(rotationListener, "CAM_Right"); + inputManager.addListener(rotationListener, "CAM_Up"); + inputManager.addListener(rotationListener, "CAM_Down"); + inputManager.addListener(activityListener, "TestFeature"); } - - private AnalogListener analogListener = new AnalogListener() { - - public void onAnalog(String name, float value, float tpf) { - if (name.equals("CAM_Left")) { - rotateCamera(value, initialUpVec); - } else if (name.equals("CAM_Right")) { - rotateCamera(-value, initialUpVec); - } else if (name.equals("CAM_Up")) { - rotateCamera(-value * (invertY ? -1 : 1), cam.getLeft()); - } else if (name.equals("CAM_Down")) { - rotateCamera(value * (invertY ? -1 : 1), cam.getLeft()); - } - } - }; - - private ActionListener actionListener = new ActionListener() { - public void onAction(String name, boolean keyPressed, float tpf) { - if (name.equals("Jump") && keyPressed/* && jumpSPEED == 0 */) { - locChanges[1] = 2f; - } else if (name.equals("Jump") && !keyPressed) { - locChanges[1] = 0f; - } - - if (name.equals("Down") && keyPressed) { - locChanges[1] = -2f; - } else if (name.equals("Down") && !keyPressed) { - locChanges[1] = 0f; - } - - if (name.equals("Left") && keyPressed) { - locChanges[0] = SPEED; - } else if (name.equals("Left") && !keyPressed - && locChanges[0] == SPEED) { - locChanges[0] = 0; - } - - if (name.equals("Right") && keyPressed) { - locChanges[0] = -SPEED; - } else if (name.equals("Right") && !keyPressed - && locChanges[0] == -SPEED) { - locChanges[0] = 0; - } - - if (name.equals("Forward") && keyPressed) { - locChanges[2] = SPEED; - } else if (name.equals("Forward") && !keyPressed - && locChanges[2] == SPEED) { - locChanges[2] = 0; - } - - if (name.equals("Back") && keyPressed) { - locChanges[2] = -SPEED; - } else if (name.equals("Back") && !keyPressed - && locChanges[2] == -SPEED) { - locChanges[2] = 0; - } - - if (name.equals("TestFeature") && keyPressed) { - System.err.println("\nDEBUGGING FEATURE\n"); - } - } - }; } diff --git a/src/net/mosstest/servercore/RotationListener.java b/src/net/mosstest/servercore/RotationListener.java new file mode 100644 index 0000000..2da2ab5 --- /dev/null +++ b/src/net/mosstest/servercore/RotationListener.java @@ -0,0 +1,54 @@ +package net.mosstest.servercore; + +import com.jme3.input.controls.AnalogListener; +import com.jme3.math.FastMath; +import com.jme3.math.Matrix3f; +import com.jme3.math.Quaternion; +import com.jme3.math.Vector3f; +import com.jme3.renderer.Camera; + +public class RotationListener implements AnalogListener { + private final float ROTATION_SPEED; + private Vector3f axis; + private boolean invertY; + private Camera cam; + + public RotationListener (Vector3f v, boolean invert, Camera c, float rSpeed) { + axis = v; + System.out.println("AXIS: "+axis); + invertY = invert; + cam = c; + ROTATION_SPEED = rSpeed; + } + + public void onAnalog(String name, float value, float tpf) { + if (name.equals("CAM_Left")) { + rotateCamera(value, axis); + } else if (name.equals("CAM_Right")) { + rotateCamera(-value, axis); + } else if (name.equals("CAM_Up")) { + rotateCamera(-value * (invertY ? -1 : 1), cam.getLeft()); + } else if (name.equals("CAM_Down")) { + rotateCamera(value * (invertY ? -1 : 1), cam.getLeft()); + } + } + + private void rotateCamera(float value, Vector3f axis) { + Matrix3f mat = new Matrix3f(); + mat.fromAngleNormalAxis(ROTATION_SPEED * value, axis); + Vector3f up = cam.getUp(); + Vector3f left = cam.getLeft(); + Vector3f dir = cam.getDirection(); + + mat.mult(up, up); + mat.mult(left, left); + mat.mult(dir, dir); + + Quaternion q = new Quaternion(); + q.fromAxes(left, up, dir); + q.normalizeLocal(); + if (up.angleBetween(Vector3f.UNIT_Y) <= FastMath.HALF_PI) { + cam.setAxes(q); + } + } +} From 8d372484ff9f2f4cb8626adc82333a94c726074d Mon Sep 17 00:00:00 2001 From: thatnerd2 Date: Wed, 16 Apr 2014 16:39:31 -0400 Subject: [PATCH 03/20] Changing naming convention from "block" to "node" --- .../mosstest/servercore/RenderProcessor.java | 70 +++++++++---------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/src/net/mosstest/servercore/RenderProcessor.java b/src/net/mosstest/servercore/RenderProcessor.java index 0a1f34d..e364083 100644 --- a/src/net/mosstest/servercore/RenderProcessor.java +++ b/src/net/mosstest/servercore/RenderProcessor.java @@ -43,11 +43,11 @@ public class RenderProcessor extends SimpleApplication { static Logger logger = Logger.getLogger(RenderProcessor.class); private final float SPEED = 3f; - private final float BLOCK_SIZE = 20f; - private final float CHUNK_SIZE = 16*BLOCK_SIZE; + private final float NODE_SIZE = 20f; + private final float CHUNK_SIZE = 16*NODE_SIZE; private final float ROTATION_SPEED = 1f; - private final double BLOCK_OFFSET_FROM_CENTER = 8 * BLOCK_SIZE; - private final double CHUNK_OFFSET = 8 * BLOCK_SIZE; + private final double NODE_OFFSET_FROM_CENTER = 8 * NODE_SIZE; + private final double CHUNK_OFFSET = 8 * NODE_SIZE; private float[] locChanges = { 0, 0, 0 }; private double lastTime; private boolean invertY = false; @@ -150,9 +150,9 @@ public class RenderProcessor extends SimpleApplication { else { //z and y are switched on purpose. - float x = (float) ((pos.x + (CHUNK_SIZE * pos.x)) - BLOCK_OFFSET_FROM_CENTER + CHUNK_OFFSET + (i * BLOCK_SIZE)); - float z = (float) ((pos.y - (CHUNK_SIZE * pos.y)) - BLOCK_OFFSET_FROM_CENTER + CHUNK_OFFSET + (j * BLOCK_SIZE)); - float y = (float) ((pos.z + (CHUNK_SIZE * pos.z)) - BLOCK_OFFSET_FROM_CENTER + CHUNK_OFFSET + (k * BLOCK_SIZE)); + float x = (float) ((pos.x + (CHUNK_SIZE * pos.x)) - NODE_OFFSET_FROM_CENTER + CHUNK_OFFSET + (i * NODE_SIZE)); + float z = (float) ((pos.y - (CHUNK_SIZE * pos.y)) - NODE_OFFSET_FROM_CENTER + CHUNK_OFFSET + (j * NODE_SIZE)); + float y = (float) ((pos.z + (CHUNK_SIZE * pos.z)) - NODE_OFFSET_FROM_CENTER + CHUNK_OFFSET + (k * NODE_SIZE)); /*for (int l = 0; l < 6; l++) { try { @@ -164,54 +164,54 @@ public class RenderProcessor extends SimpleApplication { * Vertices start at the top left corner and go clockwise around the face. */ vertices.put(x).put(y).put(z); //FRONT - vertices.put(x + BLOCK_SIZE).put(y).put(z); - vertices.put(x + BLOCK_SIZE).put(y).put(z - BLOCK_SIZE); - vertices.put(x).put(y).put(z - BLOCK_SIZE); + vertices.put(x + NODE_SIZE).put(y).put(z); + vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); + vertices.put(x).put(y).put(z - NODE_SIZE); tex.put(0).put(0); tex.put(0).put(1); tex.put(1).put(1); tex.put(1).put(0); - vertices.put(x).put(y + BLOCK_SIZE).put(z); //TOP - vertices.put(x + BLOCK_SIZE).put(y + BLOCK_SIZE).put(z); - vertices.put(x + BLOCK_SIZE).put(y).put(z); + vertices.put(x).put(y + NODE_SIZE).put(z); //TOP + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z); + vertices.put(x + NODE_SIZE).put(y).put(z); vertices.put(x).put(y).put(z); tex.put(0).put(0); tex.put(0).put(1); tex.put(1).put(1); tex.put(1).put(0); - vertices.put(x + BLOCK_SIZE).put(y + BLOCK_SIZE).put(z);//BACK - vertices.put(x).put(y + BLOCK_SIZE).put(z); - vertices.put(x).put(y + BLOCK_SIZE).put(z - BLOCK_SIZE); - vertices.put(x + BLOCK_SIZE).put(y + BLOCK_SIZE).put(z - BLOCK_SIZE); + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z);//BACK + vertices.put(x).put(y + NODE_SIZE).put(z); + vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); tex.put(0).put(0); tex.put(0).put(1); tex.put(1).put(1); tex.put(1).put(0); - vertices.put(x + BLOCK_SIZE).put(y + BLOCK_SIZE).put(z - BLOCK_SIZE); - vertices.put(x).put(y + BLOCK_SIZE).put(z - BLOCK_SIZE); - vertices.put(x).put(y).put(z - BLOCK_SIZE); - vertices.put(x + BLOCK_SIZE).put(y).put(z - BLOCK_SIZE); + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); + vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); + vertices.put(x).put(y).put(z - NODE_SIZE); + vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); tex.put(0).put(0); tex.put(0).put(1); tex.put(1).put(1); tex.put(1).put(0); - vertices.put(x).put(y + BLOCK_SIZE).put(z); //LEFT + vertices.put(x).put(y + NODE_SIZE).put(z); //LEFT vertices.put(x).put(y).put(z); - vertices.put(x).put(y).put(z - BLOCK_SIZE); - vertices.put(x).put(y + BLOCK_SIZE).put(z - BLOCK_SIZE); + vertices.put(x).put(y).put(z - NODE_SIZE); + vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); tex.put(0).put(0); tex.put(0).put(1); tex.put(1).put(1); tex.put(1).put(0); - vertices.put(x + BLOCK_SIZE).put(y).put(z); //RIGHT - vertices.put(x + BLOCK_SIZE).put(y + BLOCK_SIZE).put(z); - vertices.put(x + BLOCK_SIZE).put(y + BLOCK_SIZE).put(z - BLOCK_SIZE); - vertices.put(x + BLOCK_SIZE).put(y).put(z - BLOCK_SIZE); + vertices.put(x + NODE_SIZE).put(y).put(z); //RIGHT + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z); + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); + vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); tex.put(0).put(0); tex.put(0).put(1); tex.put(1).put(1); @@ -238,7 +238,7 @@ public class RenderProcessor extends SimpleApplication { indices.put(vertexIndexCounter + 20).put(vertexIndexCounter + 22).put(vertexIndexCounter + 21);//right indices.put(vertexIndexCounter + 20).put(vertexIndexCounter + 23).put(vertexIndexCounter + 22); - //RenderNode geom = new RenderNode(mat, loc, BLOCK_SIZE, NodeManager.getNode((short)nVal)null); + //RenderNode geom = new RenderNode(mat, loc, NODE_SIZE, NodeManager.getNode((short)nVal)null); //renderNodes[i][j][k] = geom; vertexIndexCounter += 24; } @@ -259,12 +259,6 @@ public class RenderProcessor extends SimpleApplication { //allChunks.put(pos, currentChunk); } - private void createFace (FloatBuffer vBuffer, FloatBuffer tBuffer, FloatBuffer nBuffer, IntBuffer iBuffer, - int xPattern, int yPattern, int zPattern, int indexCounter) { - - - } - private Material getMaterial(short nodeType) { Material mat = null; switch (nodeType) { @@ -397,9 +391,9 @@ public class RenderProcessor extends SimpleApplication { int xchk = (int)Math.floor(xpos / (CHUNK_SIZE)); int ychk = (int)Math.floor(ypos / (CHUNK_SIZE)); int zchk = (int)Math.floor(zpos / (CHUNK_SIZE)); - double xoffset = (xpos % CHUNK_SIZE)/BLOCK_SIZE; - double yoffset = (ypos % CHUNK_SIZE)/BLOCK_SIZE; - double zoffset = (zpos % CHUNK_SIZE)/BLOCK_SIZE; + double xoffset = (xpos % CHUNK_SIZE)/NODE_SIZE; + double yoffset = (ypos % CHUNK_SIZE)/NODE_SIZE; + double zoffset = (zpos % CHUNK_SIZE)/NODE_SIZE; synchronized(player.antiCheatDataLock){ player.setChunkPosition (xchk, ychk, zchk); From cdcf2f2f7324009e14b4ab301fbc87690c62382a Mon Sep 17 00:00:00 2001 From: Aaron Chan Date: Sat, 26 Apr 2014 06:13:03 -0400 Subject: [PATCH 04/20] Created a FaceRenderer to assist in culling unnecessary node faces. --- src/net/mosstest/servercore/FaceRenderer.java | 95 ++++++++++++++++ .../mosstest/servercore/RenderProcessor.java | 105 +++--------------- 2 files changed, 110 insertions(+), 90 deletions(-) create mode 100644 src/net/mosstest/servercore/FaceRenderer.java diff --git a/src/net/mosstest/servercore/FaceRenderer.java b/src/net/mosstest/servercore/FaceRenderer.java new file mode 100644 index 0000000..12aa5b7 --- /dev/null +++ b/src/net/mosstest/servercore/FaceRenderer.java @@ -0,0 +1,95 @@ +package net.mosstest.servercore; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +public class FaceRenderer { + private static FloatBuffer vertices; + private static FloatBuffer textures; + private static FloatBuffer normals; + private static IntBuffer indices; + private static int vertexIndexCounter; + + public static void initialize (FloatBuffer verts, FloatBuffer tex, + FloatBuffer norms, IntBuffer inds) { + vertices = verts; + textures = tex; + normals = norms; + indices = inds; + vertexIndexCounter = 0; + } + + + + public static void populateBuffers(Face f, float x, float y, float z, final float NODE_SIZE) { + /*Vertices start at the top left corner and go clockwise around the face.*/ + if (f == Face.FRONT) { + vertices.put(x).put(y).put(z); + vertices.put(x + NODE_SIZE).put(y).put(z); + vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); + vertices.put(x).put(y).put(z - NODE_SIZE); + + } + else if (f == Face.TOP) { + vertices.put(x).put(y + NODE_SIZE).put(z); + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z); + vertices.put(x + NODE_SIZE).put(y).put(z); + vertices.put(x).put(y).put(z); + } + else if (f == Face.BACK) { + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z); + vertices.put(x).put(y + NODE_SIZE).put(z); + vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); + } + else if (f == Face.BOTTOM) { + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); + vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); + vertices.put(x).put(y).put(z - NODE_SIZE); + vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); + } + else if (f == Face.LEFT) { + vertices.put(x).put(y + NODE_SIZE).put(z); + vertices.put(x).put(y).put(z); + vertices.put(x).put(y).put(z - NODE_SIZE); + vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); + } + else if (f == Face.RIGHT) { + vertices.put(x + NODE_SIZE).put(y).put(z); + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z); + vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); + vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); + } + indices.put(vertexIndexCounter + 0).put(vertexIndexCounter + 2).put(vertexIndexCounter + 1); + indices.put(vertexIndexCounter + 0).put(vertexIndexCounter + 3).put(vertexIndexCounter + 2); + textures.put(0).put(0); + textures.put(0).put(1); + textures.put(1).put(1); + textures.put(1).put(0); + for(int m=0; m<4; m++) + normals.put(2).put(3).put(5); + vertexIndexCounter += 4; + } + + public enum Face { + FRONT, TOP, BACK, BOTTOM, LEFT, RIGHT + } + + + + public static FloatBuffer getVertices () { + return vertices; + } + + public static FloatBuffer getTextureCoordinates () { + return textures; + } + + public static FloatBuffer getNormals () { + return normals; + } + + public static IntBuffer getIndices () { + return indices; + } +} diff --git a/src/net/mosstest/servercore/RenderProcessor.java b/src/net/mosstest/servercore/RenderProcessor.java index e364083..d7c7ec2 100644 --- a/src/net/mosstest/servercore/RenderProcessor.java +++ b/src/net/mosstest/servercore/RenderProcessor.java @@ -10,14 +10,13 @@ import jme3tools.optimize.GeometryBatchFactory; import net.mosstest.scripting.MapChunk; import net.mosstest.scripting.Player; import net.mosstest.scripting.Position; +import net.mosstest.servercore.FaceRenderer.Face; import org.apache.log4j.Logger; import com.jme3.app.SimpleApplication; import com.jme3.input.KeyInput; import com.jme3.input.MouseInput; -import com.jme3.input.controls.ActionListener; -import com.jme3.input.controls.AnalogListener; import com.jme3.input.controls.KeyTrigger; import com.jme3.input.controls.MouseAxisTrigger; import com.jme3.light.DirectionalLight; @@ -26,8 +25,6 @@ import com.jme3.light.SpotLight; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.FastMath; -import com.jme3.math.Matrix3f; -import com.jme3.math.Quaternion; import com.jme3.math.Vector2f; import com.jme3.math.Vector3f; import com.jme3.renderer.queue.RenderQueue; @@ -131,18 +128,20 @@ public class RenderProcessor extends SimpleApplication { } // public void renderChunk(MapChunk chk, Position pos) { - int vertexIndexCounter = 0; - int[][][] nodes = chk.getNodes(); + //int vertexIndexCounter = 0; Mesh completeMesh = new Mesh (); FloatBuffer vertices = getDirectFloatBuffer(950000); FloatBuffer tex = getDirectFloatBuffer(950000); FloatBuffer normals = getDirectFloatBuffer(950000); IntBuffer indices = getDirectIntBuffer(950000); + FaceRenderer.initialize(vertices, tex, normals, indices); //RenderNode[][][] renderNodes = new RenderNode[16][16][16]; for (byte i = 0; i < 16; i++) { for (byte j = 0; j < 16; j++) { for (byte k = 0; k < 16; k++) { - if (isNodeVisible(chk.getNodes(), i, j, k)) { + int[][][] nodes = chk.getNodes(); + if (isNodeVisible(nodes, i, j, k)) { + int nVal = chk.getNodeId(i, j, k); //MapNode node = nManager.getNode((short) nVal); //Material mat = getMaterial((short) nVal); @@ -154,98 +153,23 @@ public class RenderProcessor extends SimpleApplication { float z = (float) ((pos.y - (CHUNK_SIZE * pos.y)) - NODE_OFFSET_FROM_CENTER + CHUNK_OFFSET + (j * NODE_SIZE)); float y = (float) ((pos.z + (CHUNK_SIZE * pos.z)) - NODE_OFFSET_FROM_CENTER + CHUNK_OFFSET + (k * NODE_SIZE)); - /*for (int l = 0; l < 6; l++) { - try { - if () - } - }*/ - /** - * Vertices start at the top left corner and go clockwise around the face. - */ - vertices.put(x).put(y).put(z); //FRONT - vertices.put(x + NODE_SIZE).put(y).put(z); - vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); - vertices.put(x).put(y).put(z - NODE_SIZE); - tex.put(0).put(0); - tex.put(0).put(1); - tex.put(1).put(1); - tex.put(1).put(0); - - vertices.put(x).put(y + NODE_SIZE).put(z); //TOP - vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z); - vertices.put(x + NODE_SIZE).put(y).put(z); - vertices.put(x).put(y).put(z); - tex.put(0).put(0); - tex.put(0).put(1); - tex.put(1).put(1); - tex.put(1).put(0); - - vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z);//BACK - vertices.put(x).put(y + NODE_SIZE).put(z); - vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); - vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); - tex.put(0).put(0); - tex.put(0).put(1); - tex.put(1).put(1); - tex.put(1).put(0); - - vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); - vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); - vertices.put(x).put(y).put(z - NODE_SIZE); - vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); - tex.put(0).put(0); - tex.put(0).put(1); - tex.put(1).put(1); - tex.put(1).put(0); - - vertices.put(x).put(y + NODE_SIZE).put(z); //LEFT - vertices.put(x).put(y).put(z); - vertices.put(x).put(y).put(z - NODE_SIZE); - vertices.put(x).put(y + NODE_SIZE).put(z - NODE_SIZE); - tex.put(0).put(0); - tex.put(0).put(1); - tex.put(1).put(1); - tex.put(1).put(0); - - vertices.put(x + NODE_SIZE).put(y).put(z); //RIGHT - vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z); - vertices.put(x + NODE_SIZE).put(y + NODE_SIZE).put(z - NODE_SIZE); - vertices.put(x + NODE_SIZE).put(y).put(z - NODE_SIZE); - tex.put(0).put(0); - tex.put(0).put(1); - tex.put(1).put(1); - tex.put(1).put(0); - - for(int m=0; m<24; m++) { - normals.put(2).put(3).put(5); + for (Face face : Face.values()) { + + FaceRenderer.populateBuffers(face, x, y, z, NODE_SIZE); } - - indices.put(vertexIndexCounter + 0).put(vertexIndexCounter + 2).put(vertexIndexCounter + 1);//front - indices.put(vertexIndexCounter + 0).put(vertexIndexCounter + 3).put(vertexIndexCounter + 2); - - indices.put(vertexIndexCounter + 4).put(vertexIndexCounter + 6).put(vertexIndexCounter + 5);//top - indices.put(vertexIndexCounter + 4).put(vertexIndexCounter + 7).put(vertexIndexCounter + 6); - - indices.put(vertexIndexCounter + 8).put(vertexIndexCounter + 10).put(vertexIndexCounter + 9);//back - indices.put(vertexIndexCounter + 8).put(vertexIndexCounter + 11).put(vertexIndexCounter + 10); - - indices.put(vertexIndexCounter + 12).put(vertexIndexCounter + 14).put(vertexIndexCounter + 13);//bottom - indices.put(vertexIndexCounter + 12).put(vertexIndexCounter + 15).put(vertexIndexCounter + 14); - - indices.put(vertexIndexCounter + 16).put(vertexIndexCounter + 18).put(vertexIndexCounter + 17);//left - indices.put(vertexIndexCounter + 16).put(vertexIndexCounter + 19).put(vertexIndexCounter + 18); - - indices.put(vertexIndexCounter + 20).put(vertexIndexCounter + 22).put(vertexIndexCounter + 21);//right - indices.put(vertexIndexCounter + 20).put(vertexIndexCounter + 23).put(vertexIndexCounter + 22); //RenderNode geom = new RenderNode(mat, loc, NODE_SIZE, NodeManager.getNode((short)nVal)null); //renderNodes[i][j][k] = geom; - vertexIndexCounter += 24; } } } } } + vertices = FaceRenderer.getVertices(); + tex = FaceRenderer.getTextureCoordinates(); + normals = FaceRenderer.getNormals(); + indices = FaceRenderer.getIndices(); + Material mat = getMaterial((short) 1); completeMesh.setBuffer(Type.Position, 3, vertices); completeMesh.setBuffer(Type.Normal, 3, normals); @@ -254,6 +178,7 @@ public class RenderProcessor extends SimpleApplication { completeMesh.updateBound(); Geometry geom = new Geometry("chunkMesh", completeMesh); geom.setMaterial(mat); + geom.setQueueBucket(RenderQueue.Bucket.Transparent); worldNode.attachChild(geom); //RenderMapChunk currentChunk = new RenderMapChunk(renderNodes); //allChunks.put(pos, currentChunk); From a86ab385a24e3092f2fb224ccc6bf77a1b74996c Mon Sep 17 00:00:00 2001 From: Aaron Chan Date: Sat, 26 Apr 2014 06:27:57 -0400 Subject: [PATCH 05/20] Starting isFaceVisible methods --- src/net/mosstest/servercore/FaceRenderer.java | 32 ++++++++++++----- .../mosstest/servercore/RenderProcessor.java | 34 +++++-------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/net/mosstest/servercore/FaceRenderer.java b/src/net/mosstest/servercore/FaceRenderer.java index 12aa5b7..69a727d 100644 --- a/src/net/mosstest/servercore/FaceRenderer.java +++ b/src/net/mosstest/servercore/FaceRenderer.java @@ -1,5 +1,6 @@ package net.mosstest.servercore; +import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; @@ -10,16 +11,20 @@ public class FaceRenderer { private static IntBuffer indices; private static int vertexIndexCounter; - public static void initialize (FloatBuffer verts, FloatBuffer tex, - FloatBuffer norms, IntBuffer inds) { - vertices = verts; - textures = tex; - normals = norms; - indices = inds; + public static void initialize () { + vertices = getDirectFloatBuffer(950000); + textures = getDirectFloatBuffer(950000); + normals = getDirectFloatBuffer(950000); + indices = getDirectIntBuffer(950000); vertexIndexCounter = 0; } - + public static boolean isFaceVisible (Face f, int[][][] nodes, byte i, byte j, byte k) { + switch (f) { + case FRONT: + } + return true; + } public static void populateBuffers(Face f, float x, float y, float z, final float NODE_SIZE) { /*Vertices start at the top left corner and go clockwise around the face.*/ @@ -74,21 +79,32 @@ public class FaceRenderer { public enum Face { FRONT, TOP, BACK, BOTTOM, LEFT, RIGHT } - + private static FloatBuffer getDirectFloatBuffer (int size) { + ByteBuffer temp = ByteBuffer.allocateDirect(size); + return temp.asFloatBuffer(); + } + + private static IntBuffer getDirectIntBuffer (int size) { + ByteBuffer temp = ByteBuffer.allocateDirect(size); + return temp.asIntBuffer(); + } public static FloatBuffer getVertices () { return vertices; } + public static FloatBuffer getTextureCoordinates () { return textures; } + public static FloatBuffer getNormals () { return normals; } + public static IntBuffer getIndices () { return indices; } diff --git a/src/net/mosstest/servercore/RenderProcessor.java b/src/net/mosstest/servercore/RenderProcessor.java index d7c7ec2..6c3771a 100644 --- a/src/net/mosstest/servercore/RenderProcessor.java +++ b/src/net/mosstest/servercore/RenderProcessor.java @@ -128,20 +128,14 @@ public class RenderProcessor extends SimpleApplication { } // public void renderChunk(MapChunk chk, Position pos) { - //int vertexIndexCounter = 0; Mesh completeMesh = new Mesh (); - FloatBuffer vertices = getDirectFloatBuffer(950000); - FloatBuffer tex = getDirectFloatBuffer(950000); - FloatBuffer normals = getDirectFloatBuffer(950000); - IntBuffer indices = getDirectIntBuffer(950000); - FaceRenderer.initialize(vertices, tex, normals, indices); + FaceRenderer.initialize(); //RenderNode[][][] renderNodes = new RenderNode[16][16][16]; for (byte i = 0; i < 16; i++) { for (byte j = 0; j < 16; j++) { for (byte k = 0; k < 16; k++) { int[][][] nodes = chk.getNodes(); if (isNodeVisible(nodes, i, j, k)) { - int nVal = chk.getNodeId(i, j, k); //MapNode node = nManager.getNode((short) nVal); //Material mat = getMaterial((short) nVal); @@ -155,8 +149,9 @@ public class RenderProcessor extends SimpleApplication { for (Face face : Face.values()) { - - FaceRenderer.populateBuffers(face, x, y, z, NODE_SIZE); + if (FaceRenderer.isFaceVisible(face, nodes, i, j, k)) { + FaceRenderer.populateBuffers(face, x, y, z, NODE_SIZE); + } } //RenderNode geom = new RenderNode(mat, loc, NODE_SIZE, NodeManager.getNode((short)nVal)null); //renderNodes[i][j][k] = geom; @@ -165,18 +160,17 @@ public class RenderProcessor extends SimpleApplication { } } } - vertices = FaceRenderer.getVertices(); - tex = FaceRenderer.getTextureCoordinates(); - normals = FaceRenderer.getNormals(); - indices = FaceRenderer.getIndices(); - - Material mat = getMaterial((short) 1); + FloatBuffer vertices = FaceRenderer.getVertices(); + FloatBuffer tex = FaceRenderer.getTextureCoordinates(); + FloatBuffer normals = FaceRenderer.getNormals(); + IntBuffer indices = FaceRenderer.getIndices(); completeMesh.setBuffer(Type.Position, 3, vertices); completeMesh.setBuffer(Type.Normal, 3, normals); completeMesh.setBuffer(Type.Index, 3, indices); completeMesh.setBuffer(Type.TexCoord, 2, tex); completeMesh.updateBound(); Geometry geom = new Geometry("chunkMesh", completeMesh); + Material mat = getMaterial((short) 1); geom.setMaterial(mat); geom.setQueueBucket(RenderQueue.Bucket.Transparent); worldNode.attachChild(geom); @@ -248,16 +242,6 @@ public class RenderProcessor extends SimpleApplication { //renderChunk(c2, p2); } - - private FloatBuffer getDirectFloatBuffer (int size) { - ByteBuffer temp = ByteBuffer.allocateDirect(size); - return temp.asFloatBuffer(); - } - - private IntBuffer getDirectIntBuffer (int size) { - ByteBuffer temp = ByteBuffer.allocateDirect(size); - return temp.asIntBuffer(); - } private void setupFlashlight () { spot = new SpotLight(); From 4cf56430e78112901ddfd5f9dc53ff1846565f84 Mon Sep 17 00:00:00 2001 From: rarkenin Date: Sat, 26 Apr 2014 18:32:32 -0400 Subject: [PATCH 06/20] begin actual network client work (file management) --- mosstest.iml | 3 +- src/net/mosstest/client/MossClient.java | 9 + .../mosstest/client/RemoteFileManager.java | 277 ++++++++++++++++++ .../servercore/AbstractMossScript.java | 8 +- src/net/mosstest/servercore/IFileManager.java | 49 +++- src/net/mosstest/servercore/IMossFile.java | 4 + src/net/mosstest/servercore/LocalFile.java | 13 +- .../mosstest/servercore/LocalFileManager.java | 41 +-- 8 files changed, 355 insertions(+), 49 deletions(-) create mode 100644 src/net/mosstest/client/MossClient.java create mode 100644 src/net/mosstest/client/RemoteFileManager.java diff --git a/mosstest.iml b/mosstest.iml index 5f67b13..33bf98b 100644 --- a/mosstest.iml +++ b/mosstest.iml @@ -1,6 +1,6 @@ - + @@ -10,7 +10,6 @@ - diff --git a/src/net/mosstest/client/MossClient.java b/src/net/mosstest/client/MossClient.java new file mode 100644 index 0000000..171fd37 --- /dev/null +++ b/src/net/mosstest/client/MossClient.java @@ -0,0 +1,9 @@ +package net.mosstest.client; + +/** + * Created by hexafraction on 4/26/14. + */ +public class MossClient { + RemoteFileManager fileManager; + +} diff --git a/src/net/mosstest/client/RemoteFileManager.java b/src/net/mosstest/client/RemoteFileManager.java new file mode 100644 index 0000000..8edf3b5 --- /dev/null +++ b/src/net/mosstest/client/RemoteFileManager.java @@ -0,0 +1,277 @@ +package net.mosstest.client; + +import com.jme3.asset.*; +import net.mosstest.servercore.*; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration.XMLConfiguration; +import org.apache.log4j.Logger; + +import java.io.*; +import java.nio.ByteBuffer; +import java.security.NoSuchAlgorithmException; +import java.text.MessageFormat; +import java.util.*; + +/** + * Created by hexafraction on 4/26/14. + */ +public class RemoteFileManager implements IFileManager { + private static final String XML_DEPENDENCY_KEY = "dependencies.dependency"; + private static volatile RemoteFileManager instance = null; + private HashSet visitedScripts; + + protected HashSet executed = new HashSet<>(); + + public static RemoteFileManager getInstance() { + if (instance == null) { + synchronized (RemoteFileManager.class) { + if (instance == null) { + instance = new RemoteFileManager(); + } + } + } + return instance; + + } + + private static final Logger logger = Logger.getLogger(RemoteFileManager.class); + private HashMap knownByName = new HashMap<>(); + + private HashMap knownByHash = new HashMap<>(); + private File cacheBasedir; + // used to request files + private MossClient client; + + @Override + public RemoteFile getFile(String name) throws IOException { + return knownByName.get(name); + } + + @Override + public void registerFile(String name, String sha256, long size) throws IOException { + logger.info(MessageFormat.format("Registered {0} with hash {1}, and a size of {2} bytes", name, sha256, size)); + RemoteFile rmf = new RemoteFile(sha256, name, size); + knownByName.put(name, rmf); + knownByHash.put(sha256, rmf); + } + + @Override + public void receiveFileChunk(String sha256, int chunkId, ByteBuffer buf) throws IOException { + RemoteFile rmf = this.knownByHash.get(sha256); + if (rmf == null) { + logger.warn(MessageFormat.format("The server tried to send a file chunk for a file with hash {0} that we don't know about.", sha256)); + return; + } + + rmf.writeChunk(chunkId, buf.array()); + } + + + @Override + public Class getAssetLocatorClass() { + return RemoteAssetLocator.class; + } + + @Override + public List getFiles() { + return null; + } + + @Override + public AbstractMossScript getScript(String name) throws IOException, MossWorldLoadException { + List dependencies = new ArrayList<>(); + try { + File scriptXml = this.getFile(name + "/script.xml").file; + + + XMLConfiguration scriptCfg = new XMLConfiguration(scriptXml); + String[] scNames = scriptCfg.getStringArray(XML_DEPENDENCY_KEY); + for (String sc : scNames) { + if (sc.equals(name)) continue; + if (visitedScripts.contains(sc)) { + logger.fatal(MessageFormat.format(Messages.getString("CIRCULAR_DEPENDENCY_ISSUE"), name, sc)); + throw new MossWorldLoadException(MessageFormat.format(Messages.getString("CIRCULAR_DEPENDENCY_ISSUE"), name, sc)); + } + try { + dependencies.add(this.getScript(sc)); + } catch (StackOverflowError e) { + // should never happen + logger.fatal(Messages.getString("DEPFIND_STACK_OVERFLOW")); + throw new MossWorldLoadException("FIXME The stack overflowed while resolving dependencies. Either there is an undetected dependency issue, or there is simply an extreme number of dependencies."); + } + } + } catch (ConfigurationException | FileNotFoundException e) { + logger.warn(Messages.getString("SCRIPT_XML_MISSING")); + } + + return new RemoteScript(name, dependencies); + } + + + public class RemoteFile implements IMossFile { + private final long size; + + private final File file; + + private final RandomAccessFile rFile; + + private final BitSet completedChunks; + + private final String sha256; + + private final int numChunks; + + private final String name; + + RemoteFile(String sha256, String name, long size) throws IOException { + this.sha256 = sha256; + this.name = name; + numChunks = (int) Math.ceil(size / IMossFile.CHUNK_SIZE); + if (!sha256.matches("[0-9A-Za-z]{32}")) + throw new MosstestFatalDeathException("A file SHA256 was invalid, and could not be used for caching."); + this.file = new File(RemoteFileManager.this.cacheBasedir, sha256); + this.file.createNewFile(); + this.rFile = new RandomAccessFile(this.file, "rw"); + this.size = size; + try { + completedChunks = new BitSet(numChunks); + + String actualSha = IFileManager.getHash(file); + if (actualSha.equalsIgnoreCase(sha256)) { + completedChunks.set(0, numChunks); + } + + } catch (NoSuchAlgorithmException e) { + throw new MosstestFatalDeathException("The SHA-256 algorithm could not be found, but is required to cache files."); + } + + } + + @Override + public Reader getReader() throws FileNotFoundException { + return new FileReader(this.file); + } + + @Override + public InputStream getInputStream() throws FileNotFoundException { + return new FileInputStream(this.file); + } + + @Override + public byte[] readChunk(int chunkId) throws IOException { + this.rFile.seek(chunkId * IMossFile.CHUNK_SIZE); + byte[] buf = new byte[(int) (chunkId == (this.numChunks - 1) ? (this.size % IMossFile.CHUNK_SIZE) + : IMossFile.CHUNK_SIZE)]; + this.rFile.readFully(buf); + return buf; + } + + @Override + public void writeChunk(int chunkId, byte[] buf) throws IOException { + this.rFile.seek(chunkId * IMossFile.CHUNK_SIZE); + if (((chunkId == (this.numChunks - 1) ? (this.size % IMossFile.CHUNK_SIZE) : IMossFile.CHUNK_SIZE)) != buf.length) + throw new MosstestFatalDeathException(MessageFormat.format("An inbound chunk for file {0} is not of the correct size. The server may be sending erroneous data.", this.name)); + this.completedChunks.set(chunkId); + if (isComplete()) { + logger.info(MessageFormat.format("Completed file {0}.", this.name)); + } + try { + String realHash = IFileManager.getHash(this.file); + if (!this.sha256.equalsIgnoreCase(realHash)) { + logger.warn(MessageFormat.format("File {0} expected with hash {1} but got reassembled as hash {2}", this.name, this.sha256, realHash)); + } + } catch (NoSuchAlgorithmException e) { + throw new MosstestFatalDeathException("The SHA-256 algorithm could not be found, but is required to cache files."); + } + } + + @Override + public String getSha256() { + return this.sha256; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public boolean isComplete() { + return (completedChunks.nextClearBit(0) == -1 || completedChunks.nextClearBit(0) == this.numChunks); + } + + @Override + public long getSize() { + return this.size; + } + } + + private static class RemoteAssetLocator implements AssetLocator { + private static final Logger logger = Logger.getLogger(RemoteAssetLocator.class); + + @Override + public void setRootPath(String s) { + // ignore + logger.warn(MessageFormat.format("Tried to set root path {0} for RemoteAssetLocator, which ignores the root path.", s)); + } + + @Override + public AssetInfo locate(AssetManager assetManager, AssetKey assetKey) { + try { + return new RemoteAssetInfo(assetManager, assetKey, + RemoteFileManager.getInstance().getFile(assetKey.getName())); + } catch (IOException ex) { + throw new AssetLoadException("Failed to open file: " + + assetKey.getName(), ex); + } + } + + private static class RemoteAssetInfo extends AssetInfo { + + private RemoteFile file; + + public RemoteAssetInfo(AssetManager manager, AssetKey key, RemoteFile file) { + super(manager, key); + this.file = file; + } + + @Override + public InputStream openStream() { + try { + return this.file.getInputStream(); + } catch (IOException ex) { + throw new AssetLoadException("Failed to open file: " + + this.file.getName(), ex); + } + } + } + } + + private class RemoteScript extends AbstractMossScript { + private final List dependencies; + + public RemoteScript(String name, List dependencies) { + super(name); + this.dependencies = dependencies; + } + + @Override + public void exec(ScriptEnv sEnv) throws IOException, MossWorldLoadException { + RemoteFileManager.this.executed.add(this); + for (AbstractMossScript sc : dependencies) { + sc.exec(sEnv); + } + sEnv.runScript(this.getInitFile()); + } + + @Override + public IMossFile getInitFile() throws IOException { + return RemoteFileManager.this.getFile(this.name + "/init.js"); + } + + @Override + public List getDependencies() { + return Collections.unmodifiableList(dependencies); + } + } +} diff --git a/src/net/mosstest/servercore/AbstractMossScript.java b/src/net/mosstest/servercore/AbstractMossScript.java index cfdf55c..e9feb76 100644 --- a/src/net/mosstest/servercore/AbstractMossScript.java +++ b/src/net/mosstest/servercore/AbstractMossScript.java @@ -9,12 +9,12 @@ public abstract class AbstractMossScript { this.name = name; } - final String name; - abstract void exec(ScriptEnv sEnv) throws IOException, MossWorldLoadException; + protected final String name; + public abstract void exec(ScriptEnv sEnv) throws IOException, MossWorldLoadException; - abstract IMossFile getInitFile() throws IOException; + public abstract IMossFile getInitFile() throws IOException; - abstract List getDependencies(); + public abstract List getDependencies(); @Override public final boolean equals(Object o) { diff --git a/src/net/mosstest/servercore/IFileManager.java b/src/net/mosstest/servercore/IFileManager.java index eee3802..cf2a6f5 100644 --- a/src/net/mosstest/servercore/IFileManager.java +++ b/src/net/mosstest/servercore/IFileManager.java @@ -2,16 +2,61 @@ package net.mosstest.servercore; import com.jme3.asset.AssetLocator; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.util.List; public interface IFileManager { + static String getHash(File f) throws IOException, + NoSuchAlgorithmException, FileNotFoundException { + + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + + try (FileInputStream fis = new FileInputStream(f)) { + try (FileChannel fc = fis.getChannel()) { + ByteBuffer bbf = ByteBuffer.allocateDirect(LocalFileManager.HASHING_BUFFER_SIZE); + + int bytesRead; + + bytesRead = fc.read(bbf); + + while ((bytesRead != -1) && (bytesRead != 0)) { + bbf.flip(); + + + md.update(bbf); + + bbf.clear(); + bytesRead = fc.read(bbf); + } + + fis.close(); + + byte[] mdBytes = md.digest(); + + StringBuilder hexString = new StringBuilder(); + + for (byte b : mdBytes) { + hexString.append(Integer.toHexString((LocalFileManager.BYTE_CAST_MASK & b))); + } + + return hexString.toString(); + } + } + } + public IMossFile getFile(String name) throws IOException; - public void registerFile(String name, String sha256, long size); + public void registerFile(String name, String sha256, long size) throws IOException; - public void receiveFileChunk(String sha512, int chunkId, ByteBuffer buf) throws IOException; + public void receiveFileChunk(String sha256, int chunkId, ByteBuffer buf) throws IOException; public Class getAssetLocatorClass(); diff --git a/src/net/mosstest/servercore/IMossFile.java b/src/net/mosstest/servercore/IMossFile.java index 268b3ad..d8b5b8d 100644 --- a/src/net/mosstest/servercore/IMossFile.java +++ b/src/net/mosstest/servercore/IMossFile.java @@ -19,4 +19,8 @@ public interface IMossFile { public String getSha256(); public String getName(); + + public boolean isComplete(); + + public long getSize(); } \ No newline at end of file diff --git a/src/net/mosstest/servercore/LocalFile.java b/src/net/mosstest/servercore/LocalFile.java index 67920df..695fa2e 100644 --- a/src/net/mosstest/servercore/LocalFile.java +++ b/src/net/mosstest/servercore/LocalFile.java @@ -33,6 +33,17 @@ public class LocalFile implements IMossFile { return name; } + @Override + public boolean isComplete() { + // local files are always complete + return true; + } + + @Override + public long getSize() { + return f.length(); + } + private final String sha256; public LocalFile(String name, File f) throws IOException, FileNotFoundException { @@ -46,7 +57,7 @@ public class LocalFile implements IMossFile { this.numChunks = (int) Math.ceil(this.length / ((double) IMossFile.CHUNK_SIZE)); try { - this.sha256 = LocalFileManager.getHash(f); + this.sha256 = IFileManager.getHash(f); logger.info("Hashed " + f.getAbsolutePath() + " as " + this.sha256); } catch (NoSuchAlgorithmException e) { logger.error("Could not find algorithm SHA-256 while hashing " + f.getAbsolutePath()); diff --git a/src/net/mosstest/servercore/LocalFileManager.java b/src/net/mosstest/servercore/LocalFileManager.java index 004ee5b..06d8929 100644 --- a/src/net/mosstest/servercore/LocalFileManager.java +++ b/src/net/mosstest/servercore/LocalFileManager.java @@ -75,7 +75,7 @@ public class LocalFileManager implements IFileManager { } @Override - public void receiveFileChunk(String sha512, int chunkId, ByteBuffer buf) throws IOException { + public void receiveFileChunk(String sha256, int chunkId, ByteBuffer buf) throws IOException { throw new IOException("This file is read-only due to its being in a non-cache directory."); } @@ -89,45 +89,6 @@ public class LocalFileManager implements IFileManager { } - public static String getHash(File f) throws IOException, - NoSuchAlgorithmException, FileNotFoundException { - - - MessageDigest md = MessageDigest.getInstance("SHA-256"); - - try (FileInputStream fis = new FileInputStream(f)) { - try (FileChannel fc = fis.getChannel()) { - ByteBuffer bbf = ByteBuffer.allocateDirect(HASHING_BUFFER_SIZE); - - int bytesRead; - - bytesRead = fc.read(bbf); - - while ((bytesRead != -1) && (bytesRead != 0)) { - bbf.flip(); - - - md.update(bbf); - - bbf.clear(); - bytesRead = fc.read(bbf); - } - - fis.close(); - - byte[] mdBytes = md.digest(); - - StringBuilder hexString = new StringBuilder(); - - for (byte b : mdBytes) { - hexString.append(Integer.toHexString((BYTE_CAST_MASK & b))); - } - - return hexString.toString(); - } - } - } - @Override public List getFiles() { return ImmutableList.copyOf(files.values()); From a9e4e95687a893edf9720c05fc24e46054e861df Mon Sep 17 00:00:00 2001 From: rarkenin Date: Sat, 3 May 2014 20:47:30 -0400 Subject: [PATCH 07/20] lots of client rework --- .zanata-cache/etag-cache.xml | 2 + README.md | 2 +- mosstest.iml | 2 +- pom.xml | 6 + src/net/mosstest/client/ClientDispatcher.java | 134 ++++++++++++++++++ .../ClientNetworkingManager.java | 32 +++-- src/net/mosstest/client/Messages.java | 49 +++++++ src/net/mosstest/client/MossClient.java | 71 ++++++++++ .../mosstest/client/RemoteFileManager.java | 6 +- src/net/mosstest/client/messages.properties | 19 +++ .../mosstest/launcher/messages_it.properties | 51 +++++++ .../netcommand/MalformedPacketException.java | 2 +- .../netcommand/ToClientAuthDenied.java | 113 +++++++++++++++ .../netcommand/ToClientAuthRequested.java | 12 +- .../netcommand/ToClientCommand.java | 2 +- .../mosstest/netcommand/ToServerCommand.java | 10 ++ .../mosstest/netcommand/ToServerHello.java | 43 ++++++ src/net/mosstest/scripting/MossScriptEnv.java | 34 +++-- src/net/mosstest/scripting/Player.java | 2 + .../mosstest/scripting/WrappedHandler.java | 23 +++ .../mosstest/scripting/messages_it.properties | 4 + .../ApplicationLevelNetworkingManager.java | 1 + .../mosstest/servercore/ClientManager.java | 2 + .../mosstest/servercore/CommonNetworking.java | 6 +- .../mosstest/servercore/EventProcessor.java | 34 ++--- .../mosstest/servercore/MossNetPacket.java | 33 +---- src/net/mosstest/servercore/MossWorld.java | 2 + .../servercore/messages_it.properties | 53 +++++++ 28 files changed, 676 insertions(+), 74 deletions(-) create mode 100644 .zanata-cache/etag-cache.xml create mode 100644 src/net/mosstest/client/ClientDispatcher.java rename src/net/mosstest/{servercore => client}/ClientNetworkingManager.java (93%) create mode 100644 src/net/mosstest/client/Messages.java create mode 100644 src/net/mosstest/client/messages.properties create mode 100644 src/net/mosstest/launcher/messages_it.properties rename src/net/mosstest/{servercore => }/netcommand/MalformedPacketException.java (67%) create mode 100644 src/net/mosstest/netcommand/ToClientAuthDenied.java rename src/net/mosstest/{servercore => }/netcommand/ToClientAuthRequested.java (92%) rename src/net/mosstest/{servercore => }/netcommand/ToClientCommand.java (63%) create mode 100644 src/net/mosstest/netcommand/ToServerCommand.java create mode 100644 src/net/mosstest/netcommand/ToServerHello.java create mode 100644 src/net/mosstest/scripting/WrappedHandler.java create mode 100644 src/net/mosstest/scripting/messages_it.properties create mode 100644 src/net/mosstest/servercore/messages_it.properties diff --git a/.zanata-cache/etag-cache.xml b/.zanata-cache/etag-cache.xml new file mode 100644 index 0000000..5cd9553 --- /dev/null +++ b/.zanata-cache/etag-cache.xml @@ -0,0 +1,2 @@ + + diff --git a/README.md b/README.md index 63ffe00..89eb03c 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,4 @@ Pull requesters: Don't touch the thread pool or the scripting interface. Electrocution, drowning, or security bots attacking you may occur. -pom.xml refers to non-maven jars in a custom jMonkey reporitory. Please hold as our server will have that repository available for download soon. +pom.xml refers to non-maven jars in a custom jMonkey repository. `pom.xml` refers to that repository, although it may go down when the forum or wiki goes down for updates or maintenance. diff --git a/mosstest.iml b/mosstest.iml index d6d4e78..476f474 100644 --- a/mosstest.iml +++ b/mosstest.iml @@ -10,7 +10,6 @@ - @@ -45,6 +44,7 @@ + diff --git a/pom.xml b/pom.xml index 238bf63..5657a05 100644 --- a/pom.xml +++ b/pom.xml @@ -336,6 +336,12 @@ annotations 9.0.4 + + commons-codec + commons-codec + 1.9 + + diff --git a/src/net/mosstest/client/ClientDispatcher.java b/src/net/mosstest/client/ClientDispatcher.java new file mode 100644 index 0000000..3a1009c --- /dev/null +++ b/src/net/mosstest/client/ClientDispatcher.java @@ -0,0 +1,134 @@ +package net.mosstest.client; + +import net.mosstest.netcommand.MalformedPacketException; +import net.mosstest.netcommand.ToClientAuthDenied; +import net.mosstest.netcommand.ToClientAuthRequested; +import net.mosstest.servercore.MossNetPacket; +import net.mosstest.servercore.MosstestFatalDeathException; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.log4j.Logger; + +import java.io.IOException; +import java.text.MessageFormat; + +/** + * Created by hexafraction on 4/27/14. + */ +public class ClientDispatcher { + public static final byte[] EMPTY_PAYLOAD = {}; + private MossClient client; + private boolean hasAuthed, hasBootstrapped; + + private static final Logger logger = Logger.getLogger(ClientDispatcher.class); + + public void dispatch(MossNetPacket inbound) { + + this.dispatch0(inbound); + + } + + + private void dispatch0(MossNetPacket inbound) { + switch (inbound.commandId) { + case 0x01: //TOCLIENT_AUTH_REQUESTED + handleAuthRequested(inbound); + break; + case 0x03: //TOCLIENT_AUTH_DENIED + handleAuthDenied(inbound); + break; + case 0x00: //SYS_NOP + case 0xFE: //SYS_BIND_CODE + case 0xFF: //SYS_QUENCH + // fall-through for packets already handled at a lower level + break; + default: + logger.warn(Messages.getString("PACKET_NOT_DISPATCHABLE")); + } + } + + private void handleAuthDenied(MossNetPacket inbound) { + try { + ToClientAuthDenied parsed = new ToClientAuthDenied(inbound.payload); + switch (parsed.getReason()) { + case REASON_UNKNWN: + logger.fatal(Messages.getString("AUTH_FAILED_UNKNWN")); + break; + case REASON_BAD_PASS: + logger.fatal(Messages.getString("AUTH_FAILED_BAD_PASS")); + break; + case REASON_BANNED: + logger.fatal(Messages.getString("AUTH_FAILED_BAN")); + break; + case REASON_PLAYER_LIMIT: + logger.fatal(Messages.getString("AUTH_FAILED_PLAYER_LIM")); + break; + case REASON_LOGON_HOUR: + logger.fatal(Messages.getString("AUTH_FAILED_LOGON_HOUR")); + break; + case REASON_NO_NEW_PLAYERS: + logger.fatal(Messages.getString("AUTH_FAILED_NO_REGISTER")); + break; + case REASON_VERSION_MISMATCH: + logger.fatal(Messages.getString("AUTH_FAILED_VERSION")); + break; + case REASON_AUTH_TIMED_OUT: + logger.fatal(Messages.getString("AUTH_FAILED_TIMEOUT")); + break; + case REASON_SERVER_MAINT: + logger.fatal(Messages.getString("AUTH_FAILED_MAINTENANCE")); + break; + case REASON_FAILED_CONNECTION: + logger.fatal(Messages.getString("AUTH_FAILED_CONN")); + break; + } + } catch (IOException e) { + logger.fatal(Messages.getString("IOEXCEPTION_DESERIALIZE_AUTH_FAIL_PCKT")); + throw new MosstestFatalDeathException(e); + } + } + + private void handleAuthRequested(MossNetPacket inbound) { + if (hasAuthed) { + logger.error(Messages.getString("ALREADY_AUTHED")); + return; + } + try { + ToClientAuthRequested parsed = new ToClientAuthRequested(inbound.payload); + authenticate(parsed); + } catch (IOException e) { + logger.fatal(Messages.getString("IOEXCEPTION_DESERIALIZE_AUTH_PCKT")); + throw new MosstestFatalDeathException(e); + } catch (MalformedPacketException e) { + logger.warn(Messages.getString("MALFORMED_TC_AUTH_REQUESTED")); + } + } + + private void authenticate(ToClientAuthRequested parsed) throws IOException { + + byte[] pass = client.getPassword(); + switch (parsed.getAuthType()) { + case AUTH_NIL: + logger.warn(Messages.getString("SVR_NO_AUTH")); + client.net.sendPacket(new MossNetPacket(0x02, EMPTY_PAYLOAD)); + case AUTH_PLAIN: + logger.warn(Messages.getString("SVR_AUTH_PLAIN")); + // FIXME some sort of confirmation dialog + client.net.sendPacket(new MossNetPacket(0x02, pass)); + case AUTH_HASH_SHA512: + client.net.sendPacket(new MossNetPacket(0x02, DigestUtils.sha512( + ArrayUtils.addAll( + ArrayUtils.addAll( + client.getUsername().getBytes(), pass), parsed.getAuthParam() + ) + ) + ) + ); + case AUTH_CHALLENGE_RESPONSE: + logger.fatal(Messages.getString("SERVER_AUTH_CHALLENGE_RESP")); + throw new MosstestFatalDeathException(Messages.getString("AUTH_CHAP_FAILED")); + } + + + } +} diff --git a/src/net/mosstest/servercore/ClientNetworkingManager.java b/src/net/mosstest/client/ClientNetworkingManager.java similarity index 93% rename from src/net/mosstest/servercore/ClientNetworkingManager.java rename to src/net/mosstest/client/ClientNetworkingManager.java index ea9c446..60f0547 100644 --- a/src/net/mosstest/servercore/ClientNetworkingManager.java +++ b/src/net/mosstest/client/ClientNetworkingManager.java @@ -1,5 +1,9 @@ -package net.mosstest.servercore; +package net.mosstest.client; +import net.mosstest.servercore.ClientManager; +import net.mosstest.servercore.CommonNetworking; +import net.mosstest.servercore.Messages; +import net.mosstest.servercore.MossNetPacket; import org.apache.log4j.Logger; import java.io.*; @@ -24,6 +28,8 @@ public class ClientNetworkingManager { public static final int PACKET_QUEUE_CAPACITY = 1024; public static final int TIME_TO_KEEPALIVE = 4000; public static final byte[] EMPTY_PAYLOAD = new byte[]{}; + + public static final MossNetPacket QUENCH_PACKET = new MossNetPacket(CMD_QUENCH, EMPTY_PAYLOAD, true, true, true); /** * The logger. */ @@ -125,7 +131,7 @@ public class ClientNetworkingManager { * performance */ /** - * The packets. + * The packet receive queue */ public ArrayBlockingQueue packets = new ArrayBlockingQueue<>( PACKET_QUEUE_CAPACITY); @@ -351,7 +357,7 @@ public class ClientNetworkingManager { this.bulkReadHandler.start(); this.fastReadHandler.start(); this.dgramReadHandler.start(); - /* The send queue thread. */ + /* The send queue thread. */ Thread sendQueueThread = new Thread(new Runnable() { @Override @@ -433,7 +439,13 @@ public class ClientNetworkingManager { ClientNetworkingManager.this.lastUdpOut .get(), ClientNetworkingManager.this.quenchedSince - .get()))))))); + .get() + ) + ) + ) + ) + ) + )); } catch (InterruptedException e) { // pass } @@ -451,25 +463,23 @@ public class ClientNetworkingManager { * @param seqnum the seqnum */ protected void sendAck(int seqnum) { - // TODO Auto-generated method stub - + logger.error("UDP acks are not supported at this time."); } /** * Send tos udp conn. */ protected void sendTosUdpConn() { - // TODO Auto-generated method stub - + logger.error("UDP connections are not supported at this time."); } /** - * Send quench. + * Send QUENCH_PACKET. */ - protected void sendQuench() { + protected void sendQuench() throws IOException { // TODO Sends a request for the server to back off with data and skip // non-essential data. - + this.sendPacket(QUENCH_PACKET); } /** diff --git a/src/net/mosstest/client/Messages.java b/src/net/mosstest/client/Messages.java new file mode 100644 index 0000000..7685fa1 --- /dev/null +++ b/src/net/mosstest/client/Messages.java @@ -0,0 +1,49 @@ +package net.mosstest.client; + +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +// TODO: Auto-generated Javadoc + +/** + * The Class Messages. + */ +public class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.mosstest.client.messages"; //$NON-NLS-1$ + + /** The res bundle. */ + private static ResourceBundle resBundle = ResourceBundle + .getBundle(BUNDLE_NAME); + + /** + * Change language. + * + * @param identifier the identifier + */ + public static void changeLanguage(Locale identifier) { + resBundle = ResourceBundle.getBundle(BUNDLE_NAME, identifier); + } + + /** + * Instantiates a new messages. + */ + private Messages() { + } + + /** + * Gets the string. + * + * @param key the key + * @return the string + */ + public static String getString(String key) { + try { + return resBundle.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/src/net/mosstest/client/MossClient.java b/src/net/mosstest/client/MossClient.java index 171fd37..30b3a29 100644 --- a/src/net/mosstest/client/MossClient.java +++ b/src/net/mosstest/client/MossClient.java @@ -1,9 +1,80 @@ package net.mosstest.client; +import net.mosstest.netcommand.ToServerHello; +import net.mosstest.scripting.MossScriptEnv; +import net.mosstest.scripting.NodePosition; +import net.mosstest.scripting.Player; +import net.mosstest.servercore.MossNetPacket; +import net.mosstest.servercore.MosstestSecurityManager; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.SocketException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; + /** * Created by hexafraction on 4/26/14. */ public class MossClient { + public static final short PROTOCOL_VERSION = 1; + private String username; RemoteFileManager fileManager; + ClientNetworkingManager net; + private byte[] password; + public ClientState getState() { + return state; + } + + private volatile ClientState state; + + private Player ownPlayer; + + private ClientDispatcher dispatcher; + + public MossClient(String remoteHost, int port, String username, byte[] pass) throws IOException, InterruptedException { + this.username = username; + this.password = pass; + this.state = ClientState.PREPARING; + this.fileManager = RemoteFileManager.getInstance(); + this.state = ClientState.CONNECTING; + this.fileManager.setClient(this); + this.net = new ClientNetworkingManager(remoteHost, port, false); // so far no UDP + // we need to send the hello to kick things off + this.net.sendPacket(new MossNetPacket(0x01, new ToServerHello(username, PROTOCOL_VERSION, MossScriptEnv.MIN_SCRIPT_API_VERSION, MossScriptEnv.MAX_SCRIPT_API_VERSION).toByteArray())); + } + + + public byte[] getPassword() { + + SecurityManager sm = System.getSecurityManager(); + if (sm instanceof MosstestSecurityManager) { + ((MosstestSecurityManager) sm).checkMosstestControl(); + } + + return password; + } + + public void setPassword(byte[] password) { + this.password = password; + } + + public String getUsername() { + return username; + } + + public enum ClientState { + PREPARING, + CONNECTING, + BUILDING_FILE_LIST, + FETCHING_FILES, + EXECUTING_STARTUP_SCRIPTS, + RENDERER_STARTING, + PLAYING, + CRASHED, + TIMED_OUT + } } diff --git a/src/net/mosstest/client/RemoteFileManager.java b/src/net/mosstest/client/RemoteFileManager.java index 8edf3b5..dca92ae 100644 --- a/src/net/mosstest/client/RemoteFileManager.java +++ b/src/net/mosstest/client/RemoteFileManager.java @@ -38,10 +38,14 @@ public class RemoteFileManager implements IFileManager { private HashMap knownByName = new HashMap<>(); private HashMap knownByHash = new HashMap<>(); - private File cacheBasedir; + private File cacheBasedir = new File("cache"); // used to request files private MossClient client; + public void setClient(MossClient client) { + this.client = client; + } + @Override public RemoteFile getFile(String name) throws IOException { return knownByName.get(name); diff --git a/src/net/mosstest/client/messages.properties b/src/net/mosstest/client/messages.properties new file mode 100644 index 0000000..7b539b9 --- /dev/null +++ b/src/net/mosstest/client/messages.properties @@ -0,0 +1,19 @@ +IOEXCEPTION_DESERIALIZE_AUTH_PCKT=IOException deserializing an authentication packet, or sending its reply. +IOEXCEPTION_DESERIALIZE_AUTH_FAIL_PCKT=IOException deserializing an authentication failure packet, or sending its reply. +AUTH_FAILED_UNKNWN=Authentication failed for an unknown reason +AUTH_FAILED_BAD_PASS=Authentication failed due to a bad password. +AUTH_FAILED_BAN=You are banned. +AUTH_FAILED_PLAYER_LIM=The server is at its player limit; no more players can join. +AUTH_FAILED_LOGON_HOUR=A server reports a logon hour restriction. The meaning of this may depend as Mosstest does not use this type of failure in its default implementation +AUTH_FAILED_NO_REGISTER=The server is not allowing new players to register. +AUTH_FAILED_VERSION=The server and client versions do not match and no common version can be negotiated upon. +AUTH_FAILED_TIMEOUT=Authentication has timed out +AUTH_FAILED_MAINTENANCE=The server is undergoing maintenance. Generally, only administrators can join in such a case +AUTH_FAILED_CONN=The connection failed; cannot authenticate +ALREADY_AUTHED=Server request authentication, but we've already authenticated. Throwing away request for security. +SVR_NO_AUTH=Server is not using authentication... +SVR_AUTH_PLAIN=Server is requesting password in plain text. +SERVER_AUTH_CHALLENGE_RESP=Challenge-response authentication is not supported at this time. +AUTH_CHAP_FAILED=Challenge-Response auth unsupported +MALFORMED_TC_AUTH_REQUESTED=Malformed TOCLIENT_AUTH_REQUESTED packet. +PACKET_NOT_DISPATCHABLE=Received a packet that cannot be dispatched at this time. \ No newline at end of file diff --git a/src/net/mosstest/launcher/messages_it.properties b/src/net/mosstest/launcher/messages_it.properties new file mode 100644 index 0000000..baaeb03 --- /dev/null +++ b/src/net/mosstest/launcher/messages_it.properties @@ -0,0 +1,51 @@ +GUIBugReportDialog.DLG_BUG_DESC=Descrizione dettagliata del problema\: +GUIBugReportDialog.DLG_BUG_DESC_DEFAULT=Per favore descrivete qui il vostro problema, preferibilmente includendo quello che vi aspettavate che succedesse, che cosa \u00E8 successo, e qualsiasi altro dettaglio riguardante il mondo o il gioco.\n\nPer favore tenete presente che non possiamo aiutarvi con giochi o mod di terze parti. +GUIBugReportDialog.DLG_BUG_EMAIL=e-mail (facoltativa)\: +GUIBugReportDialog.DLG_BUG_NAME=Nome\: +GUIBugReportDialog.DLG_BUG_SUMMARY=Riassunto del problema\: +GUIBugReportDialog.DLG_BUG_TITLE=Segnalare un bug +GUIBugReportDialog.DLG_CHECKBOX_INCLUDE_TECH_INFO=Includere informazioni tecniche +GUIBugReportDialog.DLG_CXL=Annullare +GUIBugReportDialog.DLG_OK=OK +GUIBugReportDialog.DLG_SUBMIT=Inviare +GUIBugReportDialog.NOTICE_INFO_INCLUDED=Se questa casella viene marcata verranno aggiunte alla segnalazione del bug le seguenti informazioni\: \n\n +GUIClientsideLauncher.23=Segnalare un bug... +GUIClientsideLauncher.24=Richiedere una caratteristica nuova... +GUIClientsideLauncher.25=Visitare il sito web +GUIClientsideLauncher.26=Progetto GitHub +GUIClientsideLauncher.27=Visitare i forum +GUIClientsideLauncher.COL_GAME_PRESET=Gioco preimpostato +GUIClientsideLauncher.COL_WORLD_DESC=Descrizione +GUIClientsideLauncher.COL_WORLD_NAME=Nome del mondo +GUIClientsideLauncher.DLG_ABOUT=Informazioni +GUIClientsideLauncher.DLG_DELETE=Cancellare... +GUIClientsideLauncher.DLG_NEW=Nuovo... +GUIClientsideLauncher.DLG_NO_WORLD_TO_DELETE=Non \u00E8 stato scelto nessun mondo da cancellare. Per favore selezionate un mondo esistente nella tabella. +GUIClientsideLauncher.DLG_PLAY=Giocare +GUIClientsideLauncher.DLG_SETTINGS=Impostazioni... +GUIClientsideLauncher.DLG_SINGLEPLAYER=Giocatore singolo +GUIClientsideLauncher.DLG_TITLE=Avviatore del Client Mosstest <0.0.1-initial> +GUIClientsideLauncher.ERR_NO_WORLD_SELECTED=Non \u00E8 stato selezionato nessun mondo da avviare. Per favore selezionate un mondo esistente nella tabella, o create un mondo nuovo. +GUIClientsideLauncher.ERR_NO_WORLD_SELECTED_TITLE=Nessun mondo selezionato +GUIClientsideLauncher.NOTICE_DEFAULT_GAME_CODE=Il codice e le immagini predefinite del gioco sono state create da dolinksy296, hexafraction, e altri.\n +GUIClientsideLauncher.NOTICE_PRIMARY_AUTHORS=Creato da hexafraction, thatnerd2, e altri.\n +GUIClientsideLauncher.NOTICE_TOOLS_USED=Creato con l'aiuto di Eclipse, Git, Maven e innumerevoli servizi come TravisCI e GitHub.\n +GUIClientsideLauncher.SYS_NEWLINE=\n +GUIClientsideLauncher.USES_LIBS=Utilizza le librerie seguenti\:\n +GUIClientsideLauncher.WARN_SET_LAF=Avviso\: l'aspetto non pu\u00F2 essere applicato al sistema. Si utilizza l'aspetto predefinito. +GUIWorldCreationDialog.CXL=Annullare +GUIWorldCreationDialog.DLG_TITLE=Creare un nuovo mondo per giocatore singolo... +GUIWorldCreationDialog.GAME_PROFILE=Profilo di gioco\: +GUIWorldCreationDialog.OK=OK +GUIWorldCreationDialog.WORLD_DESC=Descrizione\: +GUIWorldCreationDialog.WORLD_NAME=Nome del mondo\: +GUIWorldDeletionDialog.AREYOUSURE_TEXT=Siete certi di volere cancellare {0}? Ci\u00F2 non pu\u00F2 essere annullato. +GUIWorldDeletionDialog.DLG_TITLE=Cancellare un mondo per giocatore singolo... +GUIWorldDeletionDialog.NO=No +GUIWorldDeletionDialog.QUESTIONMARK_CANNOT_UNDO=? Questa operazione non pu\u00F2 essere annullata. +GUIWorldDeletionDialog.YES=S\u00EC +GAMEPLAY_NO_WORLD=Si \u00E8 tentato di avviare il gioco senza selezionare un mondo. +GAME_UNCAUGHT_EXCEPT=Eccezione non notata nel codice del gioco, apertura del segnalatore di bug. +STACKTRACE_WRITTEN=Lo stack trace \u00E8 stato scritto su {0} +WORLD_CREATION_CXLD=Creazione del mondo annullata +NO_WORLD_TO_DELETE=Si \u00E8 tentato di cancellare un mondo, ma non ne \u00E8 stato selezionato nessuno. diff --git a/src/net/mosstest/servercore/netcommand/MalformedPacketException.java b/src/net/mosstest/netcommand/MalformedPacketException.java similarity index 67% rename from src/net/mosstest/servercore/netcommand/MalformedPacketException.java rename to src/net/mosstest/netcommand/MalformedPacketException.java index 2ce4194..5d5583f 100644 --- a/src/net/mosstest/servercore/netcommand/MalformedPacketException.java +++ b/src/net/mosstest/netcommand/MalformedPacketException.java @@ -1,4 +1,4 @@ -package net.mosstest.servercore.netcommand; +package net.mosstest.netcommand; /** * The Class MalformedPacketException. diff --git a/src/net/mosstest/netcommand/ToClientAuthDenied.java b/src/net/mosstest/netcommand/ToClientAuthDenied.java new file mode 100644 index 0000000..2d629d0 --- /dev/null +++ b/src/net/mosstest/netcommand/ToClientAuthDenied.java @@ -0,0 +1,113 @@ +package net.mosstest.netcommand; + +import java.io.*; + +/** + * Created by hexafraction on 5/3/14. + */ +public class ToClientAuthDenied extends ToClientCommand { + public enum DenyReason { + REASON_UNKNWN, + REASON_BAD_PASS, + REASON_BANNED, + REASON_PLAYER_LIMIT, + REASON_LOGON_HOUR, + REASON_NO_NEW_PLAYERS, + REASON_VERSION_MISMATCH, + REASON_AUTH_TIMED_OUT, + REASON_SERVER_MAINT, + REASON_FAILED_CONNECTION + } + + public DenyReason getReason() { + return reason; + } + + private final DenyReason reason; + + public ToClientAuthDenied(DenyReason reason) { + this.reason = reason; + } + + public ToClientAuthDenied(byte[] buf) throws IOException { + ByteArrayInputStream bs = new ByteArrayInputStream(buf); + DataInputStream ds = new DataInputStream(bs); + int reason_ = ds.readUnsignedByte(); + switch(reason_){ + case 0x01: + this.reason = DenyReason.REASON_BAD_PASS; + break; + case 0x02: + this.reason = DenyReason.REASON_BANNED; + break; + case 0x03: + this.reason = DenyReason.REASON_PLAYER_LIMIT; + break; + case 0x04: + this.reason = DenyReason.REASON_LOGON_HOUR; + break; + case 0x05: + this.reason = DenyReason.REASON_NO_NEW_PLAYERS; + break; + case 0x06: + this.reason = DenyReason.REASON_PLAYER_LIMIT; + break; + case 0x07: + this.reason = DenyReason.REASON_VERSION_MISMATCH; + break; + case 0x08: + this.reason = DenyReason.REASON_AUTH_TIMED_OUT; + break; + case 0x09: + this.reason = DenyReason.REASON_SERVER_MAINT; + break; + case 0x0a: + this.reason = DenyReason.REASON_FAILED_CONNECTION; + break; + // fall through for unknwn + case 0x00: + default: + this.reason = DenyReason.REASON_UNKNWN; + + } + } + + public byte[] toByteArray() throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream dos = new DataOutputStream(bos); + switch (this.reason) { + + case REASON_UNKNWN: + dos.writeByte(0x00); + break; + case REASON_BAD_PASS: + dos.writeByte(0x01); + break; + case REASON_BANNED: + dos.writeByte(0x02); + break; + case REASON_PLAYER_LIMIT: + dos.writeByte(0x03); + break; + case REASON_LOGON_HOUR: + dos.writeByte(0x04); + break; + case REASON_NO_NEW_PLAYERS: + dos.writeByte(0x06); + break; + case REASON_VERSION_MISMATCH: + dos.writeByte(0x07); + break; + case REASON_AUTH_TIMED_OUT: + dos.writeByte(0x08); + break; + case REASON_SERVER_MAINT: + dos.writeByte(0x09); + break; + case REASON_FAILED_CONNECTION: + dos.writeByte(0x0a); + break; + } + return bos.toByteArray(); + } +} diff --git a/src/net/mosstest/servercore/netcommand/ToClientAuthRequested.java b/src/net/mosstest/netcommand/ToClientAuthRequested.java similarity index 92% rename from src/net/mosstest/servercore/netcommand/ToClientAuthRequested.java rename to src/net/mosstest/netcommand/ToClientAuthRequested.java index b6d800d..a0d77a3 100644 --- a/src/net/mosstest/servercore/netcommand/ToClientAuthRequested.java +++ b/src/net/mosstest/netcommand/ToClientAuthRequested.java @@ -1,5 +1,5 @@ //just keep the same package and import lines -package net.mosstest.servercore.netcommand; +package net.mosstest.netcommand; import java.io.*; @@ -26,7 +26,7 @@ public class ToClientAuthRequested extends ToClientCommand { /** * The Enum AuthType. */ - enum AuthType { + public enum AuthType { /** * The auth nil. @@ -144,4 +144,12 @@ public class ToClientAuthRequested extends ToClientCommand { //Use this line at the end to finish up return bos.toByteArray(); } + + public AuthType getAuthType() { + return authType; + } + + public byte[] getAuthParam() { + return authParam; + } } diff --git a/src/net/mosstest/servercore/netcommand/ToClientCommand.java b/src/net/mosstest/netcommand/ToClientCommand.java similarity index 63% rename from src/net/mosstest/servercore/netcommand/ToClientCommand.java rename to src/net/mosstest/netcommand/ToClientCommand.java index f3ec40d..31e2c2e 100644 --- a/src/net/mosstest/servercore/netcommand/ToClientCommand.java +++ b/src/net/mosstest/netcommand/ToClientCommand.java @@ -1,4 +1,4 @@ -package net.mosstest.servercore.netcommand; +package net.mosstest.netcommand; /** * The Class ToClientCommand. diff --git a/src/net/mosstest/netcommand/ToServerCommand.java b/src/net/mosstest/netcommand/ToServerCommand.java new file mode 100644 index 0000000..bf6a3c9 --- /dev/null +++ b/src/net/mosstest/netcommand/ToServerCommand.java @@ -0,0 +1,10 @@ +package net.mosstest.netcommand; + +/** + * The Class ToServerCommand. + */ +public abstract class ToServerCommand { + + //ignore + +} diff --git a/src/net/mosstest/netcommand/ToServerHello.java b/src/net/mosstest/netcommand/ToServerHello.java new file mode 100644 index 0000000..7647cba --- /dev/null +++ b/src/net/mosstest/netcommand/ToServerHello.java @@ -0,0 +1,43 @@ +package net.mosstest.netcommand; + +import java.io.*; + +/** + * Created by hexafraction on 4/27/14. + */ +public class ToServerHello { + private final String username; + private final int protocolVersion; + private final int minScriptApi; + private final int maxScriptApi; + + public ToServerHello(byte[] buf) throws IOException, + MalformedPacketException { + + // constructor from byte[] is parsing + // Keep lines below for all of these tasks + ByteArrayInputStream bs = new ByteArrayInputStream(buf); + DataInputStream ds = new DataInputStream(bs); + this.protocolVersion = ds.readUnsignedShort(); + this.minScriptApi = ds.readUnsignedShort(); + this.maxScriptApi = ds.readUnsignedShort(); + this.username = ds.readUTF(); + } + + public ToServerHello(String username, int protocolVersion, int minScriptApi, int maxScriptApi) { + this.username = username; + this.protocolVersion = protocolVersion; + this.minScriptApi = minScriptApi; + this.maxScriptApi = maxScriptApi; + } + + public byte[] toByteArray() throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream dos = new DataOutputStream(bos); + dos.writeShort(this.protocolVersion); + dos.writeShort(this.minScriptApi); + dos.writeShort(this.maxScriptApi); + dos.writeUTF(this.username); + return bos.toByteArray(); + } +} \ No newline at end of file diff --git a/src/net/mosstest/scripting/MossScriptEnv.java b/src/net/mosstest/scripting/MossScriptEnv.java index 0b38308..2ebfe85 100644 --- a/src/net/mosstest/scripting/MossScriptEnv.java +++ b/src/net/mosstest/scripting/MossScriptEnv.java @@ -37,11 +37,27 @@ import java.util.List; * @since 0.0 */ public class MossScriptEnv { - + public static final short SCRIPT_API_VERSION = 1; + public static final short MIN_SCRIPT_API_VERSION = 1; + public static final short MAX_SCRIPT_API_VERSION = 1; public void registerNodeChangeHandler(MossNodeChangeHandler h) { } + private InheritableThreadLocal requestedScriptApiVer = new InheritableThreadLocal(){ + @Override + protected Short initialValue() { + return MAX_SCRIPT_API_VERSION; + } + }; + + public void setRequestedScriptApiVer(short requestedScriptApiVer) { + if(requestedScriptApiVer >= MIN_SCRIPT_API_VERSION && requestedScriptApiVer <= MAX_SCRIPT_API_VERSION) + this.requestedScriptApiVer.set(requestedScriptApiVer); + else { + throw new MosstestFatalDeathException("A plugin requests an unsatisfiable script API version."); + } + } private HashMap, ArrayList> eventHandlers; @@ -315,13 +331,13 @@ public class MossScriptEnv { return this.fp; } - private HashMap, List> handlers = new HashMap<>(); + private HashMap, List> handlers = new HashMap<>(); - public List getEventHandlers( + public List getEventHandlers( Class clazz) { - List l = Collections.unmodifiableList(handlers.get(clazz)); + List l = Collections.unmodifiableList(handlers.get(clazz)); if (l == null) { - handlers.put(clazz, new ArrayList()); + handlers.put(clazz, new ArrayList()); return Collections.EMPTY_LIST; } return l; @@ -329,14 +345,12 @@ public class MossScriptEnv { } public void registerHandler(MossEventHandler handler, Class clazz) { - List l = handlers.get(clazz); + List l = handlers.get(clazz); if (l == null) { - l = new ArrayList(); + l = new ArrayList(); handlers.put(clazz, l); - l.add(handler); - return; } - l.add(handler); + l.add(new WrappedHandler(handler, this.requestedScriptApiVer.get())); } diff --git a/src/net/mosstest/scripting/Player.java b/src/net/mosstest/scripting/Player.java index 79595ea..3cda4fd 100644 --- a/src/net/mosstest/scripting/Player.java +++ b/src/net/mosstest/scripting/Player.java @@ -26,6 +26,8 @@ public class Player { */ private HashMap inventories = new HashMap<>(); + public int playerId; + /** * The name. */ diff --git a/src/net/mosstest/scripting/WrappedHandler.java b/src/net/mosstest/scripting/WrappedHandler.java new file mode 100644 index 0000000..680cb35 --- /dev/null +++ b/src/net/mosstest/scripting/WrappedHandler.java @@ -0,0 +1,23 @@ +package net.mosstest.scripting; + +import net.mosstest.scripting.handlers.MossEventHandler; + +/** + * Created by hexafraction on 5/3/14. + */ +public class WrappedHandler { + private final MossEventHandler handler; + private final short requestedApiVer; + public WrappedHandler(MossEventHandler handler, short requestedApiVer) { + this.handler = handler; + this.requestedApiVer = requestedApiVer; + } + + public MossEventHandler getHandler() { + return handler; + } + + public short getRequestedApiVer() { + return requestedApiVer; + } +} diff --git a/src/net/mosstest/scripting/messages_it.properties b/src/net/mosstest/scripting/messages_it.properties new file mode 100644 index 0000000..c0b1f52 --- /dev/null +++ b/src/net/mosstest/scripting/messages_it.properties @@ -0,0 +1,4 @@ +AntiCheatController.THREAD_NAME=antitruffa +MossEvent.MSG_CROSS_DMZ_SECURITY_WARNING=Tentativo di accedere alle risorse controllate nello script DMZ. +ScriptableDatabase.DB_NAME_INVALID=Nome della banca dati non valido. +INV_IOEXCEPTION_FATAL=IOException durante la serializzazione di un inventario. IL MONDO CADRA' A BREVE. diff --git a/src/net/mosstest/servercore/ApplicationLevelNetworkingManager.java b/src/net/mosstest/servercore/ApplicationLevelNetworkingManager.java index a7a2a64..4df0b48 100644 --- a/src/net/mosstest/servercore/ApplicationLevelNetworkingManager.java +++ b/src/net/mosstest/servercore/ApplicationLevelNetworkingManager.java @@ -1,5 +1,6 @@ package net.mosstest.servercore; +import net.mosstest.client.ClientNetworkingManager; import net.mosstest.scripting.Position; // TODO: Auto-generated Javadoc diff --git a/src/net/mosstest/servercore/ClientManager.java b/src/net/mosstest/servercore/ClientManager.java index 9159162..8b24ddb 100644 --- a/src/net/mosstest/servercore/ClientManager.java +++ b/src/net/mosstest/servercore/ClientManager.java @@ -1,5 +1,7 @@ package net.mosstest.servercore; +import net.mosstest.client.ClientNetworkingManager; + import java.io.IOException; diff --git a/src/net/mosstest/servercore/CommonNetworking.java b/src/net/mosstest/servercore/CommonNetworking.java index 00604fc..7277e86 100644 --- a/src/net/mosstest/servercore/CommonNetworking.java +++ b/src/net/mosstest/servercore/CommonNetworking.java @@ -7,11 +7,11 @@ package net.mosstest.servercore; public class CommonNetworking { /** The Constant magic. */ - static final int magic=0xfa7d2e4a; + public static final int magic=0xfa7d2e4a; /** The Constant magicNoAck. */ - static final int magicNoAck=0xfa7d2e4f; + public static final int magicNoAck=0xfa7d2e4f; /** The Constant magicAck. */ - static final int magicAck=0xfa7d2740; + public static final int magicAck=0xfa7d2740; } diff --git a/src/net/mosstest/servercore/EventProcessor.java b/src/net/mosstest/servercore/EventProcessor.java index 28da6ee..846e777 100644 --- a/src/net/mosstest/servercore/EventProcessor.java +++ b/src/net/mosstest/servercore/EventProcessor.java @@ -1,9 +1,6 @@ package net.mosstest.servercore; -import net.mosstest.scripting.MapNode; -import net.mosstest.scripting.MossScriptEnv; -import net.mosstest.scripting.MossScriptException; -import net.mosstest.scripting.NodePosition; +import net.mosstest.scripting.*; import net.mosstest.scripting.events.IMossEvent; import net.mosstest.scripting.events.MossNodeChangeEvent; import net.mosstest.scripting.events.ThreadStopEvent; @@ -27,9 +24,9 @@ import java.util.concurrent.atomic.AtomicInteger; * The Class EventProcessor. * * @author rarkenin, hexafraction - *

+ *

* Blargh. - *

+ *

* This is a nasty thread pool. If you don't understand threading or * Java well, you may want to stick to only accessing the queue as * otherwise asphyxiation, drowning, or chlorine poisoning may occur. @@ -101,10 +98,10 @@ public class EventProcessor { } private void dispatchEvent(IMossEvent evt) { - List evtHandlerList = this.ev + List evtHandlerList = this.ev .getEventHandlers(evt.getClass()); try { - for (MossEventHandler ourHandler : evtHandlerList) { + for (WrappedHandler ourHandler : evtHandlerList) { if (dispatchEventInner(ourHandler, evt)) { return; } @@ -116,13 +113,16 @@ public class EventProcessor { } } - private boolean dispatchEventInner(MossEventHandler ourHandler, + private boolean dispatchEventInner(WrappedHandler wrappedHandler, IMossEvent evt) throws IllegalArgumentException { + MossEventHandler ourHandler = wrappedHandler.getHandler(); try { if (evt instanceof MossNodeChangeEvent) { - - return ((MossNodeChangeHandler) ourHandler) - .onAction((MossNodeChangeEvent) evt); + { + this.ev.setRequestedScriptApiVer(wrappedHandler.getRequestedApiVer()); + return ((MossNodeChangeHandler) ourHandler) + .onAction((MossNodeChangeEvent) evt); + } } else throw new IllegalArgumentException( @@ -174,7 +174,8 @@ public class EventProcessor { processEvents(); } - }); + } + ); threads[c].start(); EventProcessor.this.currentThreads.incrementAndGet(); @@ -199,7 +200,8 @@ public class EventProcessor { processEvents(); } - }).run(); + } + ).run(); EventProcessor.this.currentThreads .incrementAndGet(); @@ -221,11 +223,11 @@ public class EventProcessor { } } } - }, Messages.getString("EventProcessor.THREAD_NAME_MGR")); + }, Messages.getString("EventProcessor.THREAD_NAME_MGR") + ); manager.start(); } - } diff --git a/src/net/mosstest/servercore/MossNetPacket.java b/src/net/mosstest/servercore/MossNetPacket.java index 750b61e..c901698 100644 --- a/src/net/mosstest/servercore/MossNetPacket.java +++ b/src/net/mosstest/servercore/MossNetPacket.java @@ -4,40 +4,19 @@ package net.mosstest.servercore; import java.util.Arrays; -/** - * The Class MossNetPacket. - */ public class MossNetPacket { - /** - * The command id. - */ - int commandId; + public int commandId; - /** - * The payload. - */ - byte[] payload; + public byte[] payload; - /** - * The needs fast. - */ - boolean needsFast; + public boolean needsFast; - /** - * The needs ack. - */ - boolean needsAck; + public boolean needsAck; - /** - * The is important. - */ - boolean isImportant; + public boolean isImportant; - /** - * The sess. - */ - ServerSession sess; + public ServerSession sess; /** * Constructs a packet, for either sending or from receiving. diff --git a/src/net/mosstest/servercore/MossWorld.java b/src/net/mosstest/servercore/MossWorld.java index 94d066c..ea5c01f 100644 --- a/src/net/mosstest/servercore/MossWorld.java +++ b/src/net/mosstest/servercore/MossWorld.java @@ -14,6 +14,7 @@ import org.jetbrains.annotations.NonNls; import java.io.File; import java.io.IOException; import java.util.List; +import java.util.Locale; public class MossWorld { static { @@ -72,6 +73,7 @@ public class MossWorld { @SuppressWarnings("nls") public MossWorld(@NonNls String name, int port) throws MossWorldLoadException, MapDatabaseException, IOException { + //Thread.currentThread().setContextClassLoader( // MosstestSecurityManager.instance.getScriptClassLoader(Thread // .currentThread().getContextClassLoader())); diff --git a/src/net/mosstest/servercore/messages_it.properties b/src/net/mosstest/servercore/messages_it.properties new file mode 100644 index 0000000..45b7990 --- /dev/null +++ b/src/net/mosstest/servercore/messages_it.properties @@ -0,0 +1,53 @@ +AbstractNodeManager.DESC_UNKNOWN_NODE=Un pezzo sconosciuto del mondo +ClientNetworkingManager.DESC_NETWORK_TIMEOUT=La connessione al server \u00E8 stata persa o \u00E8 diventata troppo lenta per continuare. \nProbabilmente questo \u00E8 dovuto a una connessione instabile, WiFi debole, cavi allentati, o un problema di firewall. +ClientNetworkingManager.THREAD_NET_TIMEOUT=netTimeout +ClientNetworkingManager.THREAD_QUEUEING=netClientSendQueue +DefaultEventHandlers.NO_SUCH_CMD=Comando di chat inesistente. +EventProcessor.MSG_ADD_DYNAMIC=Thread aggiunto dinamicamente +EventProcessor.MSG_STOP_ONE_THREAD=Arresto di un thread... +EventProcessor.MSG_THREAD_START=E' iniziato un thread di lavoro. +EventProcessor.THREAD_NAME_MGR=EventProcessorManager +EventProcessor.THREADGROUP=EventProcessor +FuturesProcessor.FUTURES_THREAD=futuri +LocalRenderPreparator.MG_EXCEPT=Il generatore di mappe ha emesso una eccezione. +LocalRenderPreparator.MSG_REQUESTED=Aree richieste {0}, {1}, {2}. +LocalRenderPreparator.START_MSG=Il preparatore di rendering locale si sta avviando. +MapChunk.BAD_SER_VER=Versione di serializzazione sbagliata +MapDatabase.ERR_DB_FAIL=Caricamento della banca dati fallito. +MossDebugUtils.27=git.build.time +MossDebugUtils.MSG_BUILT_ON=Costruito su\: +MossDebugUtils.MSG_CORES=Processori disponibili\: +MossDebugUtils.MSG_EXCEPTION_CAUGHT=<<>> \n +MossDebugUtils.MSG_FREE_SPACE=Spazio libero (byte)\: +MossDebugUtils.MSG_FREEMEM=Memoria libera (byte)\: +MossDebugUtils.MSG_FS_ROOT=File sistem radice\: +MossDebugUtils.MSG_IO_EXCEPTION=IOException in caricamento, forse inesistente? +MossDebugUtils.MSG_JAVA_PROPS=<<>>\n +MossDebugUtils.MSG_MAXMEM=Memoria massima (byte)\: +MossDebugUtils.MSG_MEM_NO_LIMIT=nessun limite +MossDebugUtils.MSG_SYS_PROPS=<<>>\n +MossDebugUtils.MSG_TOTAL_MEM=Memoria totale (byte)\: +MossDebugUtils.MSG_TOTAL_SPACE=Spazio totale (byte)\: +MossDebugUtils.MSG_USABLE_SPACE=Spazio utilizzabile (byte)\: +MossGame.CFG_LOAD_ERR=Errore nel caricamento del file di configurazione. +MossGame.DIR_OR_CFG_NOT_FOUND=Cartella del gioco o file di configurazione non trovati. +MossGame.FILE_NOT_FOUND=Il file {0} non \u00E8 stato trovato. +MossScript.[NAME]_NOT_FOUND=\ non trovato\! +MossScript.MSG_IO_EXCEPTION=IOException con lo script chiamato +MossScript.MSG_OOPS=Abbiamo per le mani una situazione estremamente inaspettata +MossScript.MSG_SCRIPT_NAMED_[NAME]=Script chiamato +MossTest.PORT_DESC=Numero della porta da usare +MossTest.RUN_STANDALONE=Eseguire come server autonomo +MossWorld.ERR_DB=E' avvenuto un errore nell'apertura della banca dati. Probabilmente non \u00E8 accessibile, su un disco pieno, o corrotta. +MossWorld.MG_SELECT_FAILURE=Non \u00E8 stato possibile inserire il seme nel generatore di mappe. +MossWorld.NO_GAME_ID=Non \u00E8 specificato lo ID del gioco. Lo ID del gioco deve essere specificato in game.xml come pincopallino dove data/games/pincopallino \u00E8 una cartella con un gioco valido. +MossWorld.NO_NETWORKING_NOW=La connettivit\u00E0 non \u00E8 completa in questa versione. +NodeManager.DESC_UNKNWN_NODE=Un pezzo sconosciuto del mondo +ScriptEnv.ERR_SCRIPT_ERR=E'' avvenuto un errore di script. Eccezione impacchettata\: {0} \n +ServerNetworkingManager.ACCEPT_THREAD=svrNetAccept +ServerNetworkingManager.CONN_THREAD_NAME=thread di connessione +ServerNetworkingManager.THREADGROUP=SvrNetGroup +PACKET_INVALID_MAGIC=E'' stato ricevuto un pacchetto con un numero magico non valido ed \u00E8 stato gettato. +SERVER_CONN_TIMEOUT=La connessione al server \u00E8 scaduta o fallita in un altro modo. +FIXME_MESSAGE=Toccato un blocco di codice che rappresenta una funzionalit\u00E0 mancante. Per favore compilate un rapporto di bug oppure ricordatelo bruscamente agli sviluppatori in un altro modo. +EVENT_PROCESS_EXCEPTION=Notato {0} nell''elaborazione di un evento di tipo {1}. Il messaggio dell''eccezione era {2}. From 14f60804a045c2c8289e17b88ba3fcc60d1d654e Mon Sep 17 00:00:00 2001 From: rarkenin Date: Sun, 4 May 2014 11:05:09 -0400 Subject: [PATCH 08/20] More dispatcher fixes --- src/net/mosstest/client/ClientDispatcher.java | 1 + src/net/mosstest/client/messages.properties | 3 ++- src/net/mosstest/servercore/MossWorld.java | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/net/mosstest/client/ClientDispatcher.java b/src/net/mosstest/client/ClientDispatcher.java index 3a1009c..35d0bce 100644 --- a/src/net/mosstest/client/ClientDispatcher.java +++ b/src/net/mosstest/client/ClientDispatcher.java @@ -82,6 +82,7 @@ public class ClientDispatcher { logger.fatal(Messages.getString("AUTH_FAILED_CONN")); break; } + throw new MosstestFatalDeathException(Messages.getString("AUTH_FAIL_EXCEPTION")); } catch (IOException e) { logger.fatal(Messages.getString("IOEXCEPTION_DESERIALIZE_AUTH_FAIL_PCKT")); throw new MosstestFatalDeathException(e); diff --git a/src/net/mosstest/client/messages.properties b/src/net/mosstest/client/messages.properties index 7b539b9..3867b7b 100644 --- a/src/net/mosstest/client/messages.properties +++ b/src/net/mosstest/client/messages.properties @@ -16,4 +16,5 @@ SVR_AUTH_PLAIN=Server is requesting password in plain text. SERVER_AUTH_CHALLENGE_RESP=Challenge-response authentication is not supported at this time. AUTH_CHAP_FAILED=Challenge-Response auth unsupported MALFORMED_TC_AUTH_REQUESTED=Malformed TOCLIENT_AUTH_REQUESTED packet. -PACKET_NOT_DISPATCHABLE=Received a packet that cannot be dispatched at this time. \ No newline at end of file +PACKET_NOT_DISPATCHABLE=Received a packet that cannot be dispatched at this time. +AUTH_FAIL_EXCEPTION=Server denied authentication; client cannot continue \ No newline at end of file diff --git a/src/net/mosstest/servercore/MossWorld.java b/src/net/mosstest/servercore/MossWorld.java index ea5c01f..4480466 100644 --- a/src/net/mosstest/servercore/MossWorld.java +++ b/src/net/mosstest/servercore/MossWorld.java @@ -19,6 +19,8 @@ import java.util.Locale; public class MossWorld { static { System.setSecurityManager(MosstestSecurityManager.instance); + Messages.changeLanguage(Locale.ITALIAN); + net.mosstest.scripting.Messages.changeLanguage(Locale.ITALIAN); } static Logger logger = Logger.getLogger(MossWorld.class); @@ -73,7 +75,6 @@ public class MossWorld { @SuppressWarnings("nls") public MossWorld(@NonNls String name, int port) throws MossWorldLoadException, MapDatabaseException, IOException { - //Thread.currentThread().setContextClassLoader( // MosstestSecurityManager.instance.getScriptClassLoader(Thread // .currentThread().getContextClassLoader())); From 94ffe473ca0c614d12313054d4397ae980fdd8e6 Mon Sep 17 00:00:00 2001 From: rarkenin Date: Fri, 9 May 2014 15:28:29 -0400 Subject: [PATCH 09/20] Add debian directory for debhelper --- debian/README.source | 9 +++++++++ debian/changelog | 6 ++++++ debian/compat | 1 + debian/control | 22 ++++++++++++++++++++++ debian/copyright | 24 ++++++++++++++++++++++++ debian/maven.cleanIgnoreRules | 1 + debian/maven.ignoreRules | 14 ++++++++++++++ debian/maven.properties | 5 +++++ debian/maven.publishedRules | 3 +++ debian/maven.rules | 10 ++++++++++ debian/mosstest-all.poms | 28 ++++++++++++++++++++++++++++ debian/mosstest-java.poms | 28 ++++++++++++++++++++++++++++ debian/rules | 9 +++++++++ debian/source/format | 1 + 14 files changed, 161 insertions(+) create mode 100644 debian/README.source create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/maven.cleanIgnoreRules create mode 100644 debian/maven.ignoreRules create mode 100644 debian/maven.properties create mode 100644 debian/maven.publishedRules create mode 100644 debian/maven.rules create mode 100644 debian/mosstest-all.poms create mode 100644 debian/mosstest-java.poms create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..2abbba8 --- /dev/null +++ b/debian/README.source @@ -0,0 +1,9 @@ +Information about mosstest +-------------------------- + +This package was debianized using the mh_make command +from the maven-debian-helper package. + +The build system uses Maven but prevents it from downloading +anything from the Internet, making the build compliant with +the Debian policy. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..a4416c6 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +mosstest (0.1.0-SNAPSHOT-1) UNRELEASED; urgency=medium + + * Initial release (Closes: #nnnn) + + -- hexafraction Thu, 08 May 2014 20:51:08 -0400 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..ccf94c6 --- /dev/null +++ b/debian/control @@ -0,0 +1,22 @@ +Source: mosstest +Section: java +Priority: optional +Maintainer: Debian Java Maintainers +Uploaders: hexafraction +Build-Depends: debhelper (>= 9), cdbs, default-jdk, maven-debian-helper (>= 1.5) +Build-Depends-Indep: libmaven-shade-plugin-java, libcommons-cli-java, libcommons-codec-java, + libcommons-collections3-java, libcommons-configuration-java, libcommons-io-java, + libcommons-lang-java, libcommons-lang3-java, libcommons-math-java, libguava-java, + liblog4j1.2-java (>= 1.2.17), librhino-java +Standards-Version: 3.9.5 +Vcs-Svn: svn://anonscm.debian.org/pkg-java/trunk/mosstest +Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-java/trunk/mosstest +Homepage: https://github.com/mosstest/mosstest + +Package: mosstest-all +Architecture: all +Depends: ${misc:Depends}, ${maven:Depends} +Recommends: ${maven:OptionalDepends} +Description: Mosstest + Open-source voxel engine with some extra features + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..881ead2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,24 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Mosstest +Source: https://github.com/mosstest/mosstest + +Files: * +Copyright: 2014, hexafraction +License: GPL-3 or LGPL-2.1 + +Files: debian/* +Copyright: 2014, hexafraction +License: GPL-3+ + +License: GPL-3 + On Debian systems, the full text of the GPL-3 license + can be found in the file '/usr/share/common-licenses/GPL-3' + +License: GPL-3+ + TODO: include the full text of the license here + +License: LGPL-2.1 + On Debian systems, the full text of the LGPL-2.1 license + can be found in the file '/usr/share/common-licenses/LGPL-2.1' + + diff --git a/debian/maven.cleanIgnoreRules b/debian/maven.cleanIgnoreRules new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/debian/maven.cleanIgnoreRules @@ -0,0 +1 @@ + diff --git a/debian/maven.ignoreRules b/debian/maven.ignoreRules new file mode 100644 index 0000000..dc95592 --- /dev/null +++ b/debian/maven.ignoreRules @@ -0,0 +1,14 @@ + +com.intellij annotations * * * * +jme3 jme3-core * * * * +jme3 jme3-desktop * * * * +jme3 jme3-lwjgl-natives * * * * +jme3 jme3-lwjgl-niftygui * * * * +jme3 jme3-lwjgl * * * * +jme3 lwjgl-workaround * * * * +jme3 niftygui * * * * +junit junit * * * * +net.java.jinput jinput * * * * +org.fusesource.leveldbjni leveldbjni-all * * * * +org.lwjgl.lwjgl parent * * * * +pl.project13.maven git-commit-id-plugin * * * * diff --git a/debian/maven.properties b/debian/maven.properties new file mode 100644 index 0000000..e593715 --- /dev/null +++ b/debian/maven.properties @@ -0,0 +1,5 @@ +# Include here properties to pass to Maven during the build. +# For example: +# maven.test.skip=true + +maven.test.skip=true diff --git a/debian/maven.publishedRules b/debian/maven.publishedRules new file mode 100644 index 0000000..bc12bb3 --- /dev/null +++ b/debian/maven.publishedRules @@ -0,0 +1,3 @@ + +mosstest mosstest jar * * * +mosstest mosstest jar s/.*/debian/ * * diff --git a/debian/maven.rules b/debian/maven.rules new file mode 100644 index 0000000..2a71f4f --- /dev/null +++ b/debian/maven.rules @@ -0,0 +1,10 @@ + +com.google.guava guava bundle s/.*/debian/ * * +com.google.guava guava s/jar/bundle/ s/.*/debian/ * * +commons-collections commons-collections jar s/3\..*/3.x/ * * +mosstest mosstest jar * * * +mosstest mosstest jar s/.*/debian/ * * +org.apache.commons commons-lang3 jar s/3\..*/3.x/ * * +log4j log4j * s/1\.2\..*/1.2.x/ * * +s/com.google.code.google-collections/com.google.guava/ s/google-collect/guava/ s/jar/bundle/ s/.*/debian/ * * +s/com.google.collections/com.google.guava/ s/google-collections/guava/ s/jar/bundle/ s/.*/debian/ * * diff --git a/debian/mosstest-all.poms b/debian/mosstest-all.poms new file mode 100644 index 0000000..0417132 --- /dev/null +++ b/debian/mosstest-all.poms @@ -0,0 +1,28 @@ +# List of POM files for the package +# Format of this file is: +# [option]* +# where option can be: +# --ignore: ignore this POM and its artifact if any +# --ignore-pom: don't install the POM. To use on POM files that are created +# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] +# --no-parent: remove the tag from the POM +# --package=: an alternative package to use when installing this POM +# and its artifact +# --has-package-version: to indicate that the original version of the POM is the same as the upstream part +# of the version for the package. +# --keep-elements=: a list of XML elements to keep in the POM +# during a clean operation with mh_cleanpom or mh_installpom +# --artifact=: path to the build artifact associated with this POM, +# it will be installed when using the command mh_install. [mh_install] +# --java-lib: install the jar into /usr/share/java to comply with Debian +# packaging guidelines +# --usj-name=: name to use when installing the library in /usr/share/java +# --usj-version=: version to use when installing the library in /usr/share/java +# --no-usj-versionless: don't install the versionless link in /usr/share/java +# --dest-jar=: the destination for the real jar. +# It will be installed with mh_install. [mh_install] +# --classifier=: Optional, the classifier for the jar. Empty by default. +# --site-xml=: Optional, the location for site.xml if it needs to be installed. +# Empty by default. [mh_install] +# +pom.xml --has-package-version diff --git a/debian/mosstest-java.poms b/debian/mosstest-java.poms new file mode 100644 index 0000000..0417132 --- /dev/null +++ b/debian/mosstest-java.poms @@ -0,0 +1,28 @@ +# List of POM files for the package +# Format of this file is: +# [option]* +# where option can be: +# --ignore: ignore this POM and its artifact if any +# --ignore-pom: don't install the POM. To use on POM files that are created +# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] +# --no-parent: remove the tag from the POM +# --package=: an alternative package to use when installing this POM +# and its artifact +# --has-package-version: to indicate that the original version of the POM is the same as the upstream part +# of the version for the package. +# --keep-elements=: a list of XML elements to keep in the POM +# during a clean operation with mh_cleanpom or mh_installpom +# --artifact=: path to the build artifact associated with this POM, +# it will be installed when using the command mh_install. [mh_install] +# --java-lib: install the jar into /usr/share/java to comply with Debian +# packaging guidelines +# --usj-name=: name to use when installing the library in /usr/share/java +# --usj-version=: version to use when installing the library in /usr/share/java +# --no-usj-versionless: don't install the versionless link in /usr/share/java +# --dest-jar=: the destination for the real jar. +# It will be installed with mh_install. [mh_install] +# --classifier=: Optional, the classifier for the jar. Empty by default. +# --site-xml=: Optional, the location for site.xml if it needs to be installed. +# Empty by default. [mh_install] +# +pom.xml --has-package-version diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b76c54a --- /dev/null +++ b/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/maven.mk + +JAVA_HOME := /usr/lib/jvm/default-java + +get-orig-source: + uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) From 9b820e668dbaa98ce88c09258dd01e4431c4b069 Mon Sep 17 00:00:00 2001 From: rarkenin Date: Fri, 9 May 2014 16:22:36 -0400 Subject: [PATCH 10/20] Try once more with a codehaus mojo --- debian/control | 2 +- debian/mosstest-game.poms | 28 ++++ debian/rules.new | 46 ++++++ dependency-reduced-pom.xml | 312 ++++++++++++++++++++----------------- pom.xml | 30 ++++ 5 files changed, 273 insertions(+), 145 deletions(-) create mode 100644 debian/mosstest-game.poms create mode 100644 debian/rules.new diff --git a/debian/control b/debian/control index ccf94c6..7bae2b0 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,7 @@ Vcs-Svn: svn://anonscm.debian.org/pkg-java/trunk/mosstest Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-java/trunk/mosstest Homepage: https://github.com/mosstest/mosstest -Package: mosstest-all +Package: mosstest-game Architecture: all Depends: ${misc:Depends}, ${maven:Depends} Recommends: ${maven:OptionalDepends} diff --git a/debian/mosstest-game.poms b/debian/mosstest-game.poms new file mode 100644 index 0000000..0417132 --- /dev/null +++ b/debian/mosstest-game.poms @@ -0,0 +1,28 @@ +# List of POM files for the package +# Format of this file is: +# [option]* +# where option can be: +# --ignore: ignore this POM and its artifact if any +# --ignore-pom: don't install the POM. To use on POM files that are created +# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] +# --no-parent: remove the tag from the POM +# --package=: an alternative package to use when installing this POM +# and its artifact +# --has-package-version: to indicate that the original version of the POM is the same as the upstream part +# of the version for the package. +# --keep-elements=: a list of XML elements to keep in the POM +# during a clean operation with mh_cleanpom or mh_installpom +# --artifact=: path to the build artifact associated with this POM, +# it will be installed when using the command mh_install. [mh_install] +# --java-lib: install the jar into /usr/share/java to comply with Debian +# packaging guidelines +# --usj-name=: name to use when installing the library in /usr/share/java +# --usj-version=: version to use when installing the library in /usr/share/java +# --no-usj-versionless: don't install the versionless link in /usr/share/java +# --dest-jar=: the destination for the real jar. +# It will be installed with mh_install. [mh_install] +# --classifier=: Optional, the classifier for the jar. Empty by default. +# --site-xml=: Optional, the location for site.xml if it needs to be installed. +# Empty by default. [mh_install] +# +pom.xml --has-package-version diff --git a/debian/rules.new b/debian/rules.new new file mode 100644 index 0000000..d4f84b4 --- /dev/null +++ b/debian/rules.new @@ -0,0 +1,46 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/ant.mk + +PACKAGE := $(DEB_SOURCE_PACKAGE) +VERSION := $(DEB_UPSTREAM_VERSION) +JAVA_HOME := /usr/lib/jvm/default-java +DEB_JARS := # TODO - fill the list of jars +DEB_ANT_BUILD_TARGET := package +DEB_ANT_BUILDFILE := debian/build.xml +DEB_ANT_ARGS := -Dpackage=$(PACKAGE) -DartifactId=$(PACKAGE) -Dversion=$(VERSION) + +binary-post-install/$(PACKAGE):: + mh_installpoms -p$(PACKAGE) + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar + mh_installjar -p$(PACKAGE) -l pom.xml build/$(PACKAGE)-$(VERSION).jar + +clean:: + -rm -rf debian/tmp diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 0d1ea26..221ba03 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -1,144 +1,168 @@ - - - 4.0.0 - mosstest - mosstest - Mosstest - 0.1.0-SNAPSHOT - Open-source InfiniMiner remake - https://github.com/mosstest/mosstest - - Launchpad - https://bugs.launchpad.net/mosstest - - - Travis-CI - - - src - tests - - - src - - **/*.java - - - - - - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - - - - pl.project13.maven - git-commit-id-plugin - 2.1.7 - - - - revision - - - - - git - yyyy.MM.dd '@' HH:mm:ss z - true - ${project.basedir}/.git - true - true - src/git.properties - false - - false - false - 7 - -dirty - false - - - - - maven-shade-plugin - 2.1 - - - package - - shade - - - - - bouncycastle:bcprov-jdk15 - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - net.mosstest.servercore.MossWorld - - - properties.properties - - - applicationContext.xml - - - META-INF/cxf/cxf.extension - - - META-INF/cxf/bus-extensions.xml - - - - - - - - - - - - false - - central - Central Repository - http://repo.maven.apache.org/maven2 - - - moss-forums - http://forum-mosstest.rhcloud.com/repository/ - - - - - org.lwjgl.lwjgl - parent - 2.9.0 - pom - compile - - - junit - junit - 4.8.1 - test - - - - + + + 4.0.0 + mosstest + mosstest + Mosstest + 0.1.0-SNAPSHOT + Open-source voxel engine with some extra features + https://github.com/mosstest/mosstest + + Launchpad + https://bugs.launchpad.net/mosstest + + + Travis-CI + + + src + tests + + + src + + **/*.java + + + + + + org.codehaus.mojo + deb-maven-plugin + 1.0-SNAPSHOT + + + package + + + + An open-source voxel game created in Java + hexafraction <hexafraction@gmail.com> +

games
+ optional + all + + + + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + + + pl.project13.maven + git-commit-id-plugin + 2.1.7 + + + + revision + + + + + git + yyyy.MM.dd '@' HH:mm:ss z + true + ${project.basedir}/.git + true + true + src/git.properties + false + + false + false + 7 + -dirty + false + + + + + maven-shade-plugin + 2.1 + + + package + + shade + + + + + bouncycastle:bcprov-jdk15 + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + net.mosstest.servercore.MossWorld + + + properties.properties + + + applicationContext.xml + + + META-INF/cxf/cxf.extension + + + META-INF/cxf/bus-extensions.xml + + + + + + + + + + + + false + + central + Central Repository + http://repo.maven.apache.org/maven2 + + + moss-forums + http://forum-mosstest.rhcloud.com/repository/ + + + + + codehaus-mojo-staging + codehaus-mojo-staging + https://nexus.codehaus.org/content/groups/snapshots-group/ + + + + + org.lwjgl.lwjgl + parent + 2.9.0 + pom + compile + + + junit + junit + 4.8.1 + test + + + + diff --git a/pom.xml b/pom.xml index 5657a05..908deb3 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,15 @@ moss-forums http://forum-mosstest.rhcloud.com/repository/ + + + + codehaus-mojo-staging + codehaus-mojo-staging + https://nexus.codehaus.org/content/groups/snapshots-group/ + + tests src @@ -32,6 +40,28 @@ + + + org.codehaus.mojo + deb-maven-plugin + 1.0-SNAPSHOT + + An open-source voxel game created in Java + hexafraction <hexafraction@gmail.com> +
games
+ optional + all +
+ + + package + + + +
+ maven-compiler-plugin 3.1 From b448e256500ebe125726ddc5efe98086333a899a Mon Sep 17 00:00:00 2001 From: rarkenin Date: Sat, 10 May 2014 15:02:35 -0400 Subject: [PATCH 11/20] Update playermesh --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index f1f89a3..35f6e8d 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit f1f89a367f6a564267b625198a54ec9d9da46316 +Subproject commit 35f6e8df53a94c3de59902bea70b707b102f40d5 From 942f8d51ae80ad4b7120c3fbe94641db934b2fa2 Mon Sep 17 00:00:00 2001 From: rarkenin Date: Sat, 10 May 2014 19:17:35 -0400 Subject: [PATCH 12/20] Point to the newest commit in data --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 35f6e8d..f2c4f5f 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 35f6e8df53a94c3de59902bea70b707b102f40d5 +Subproject commit f2c4f5f9307d12d0e37ce9d7fab5d3583fc566f9 From 324375bc0ddd05ddcb19e19d217c7f33a2175aef Mon Sep 17 00:00:00 2001 From: Aaron Chan Date: Sun, 11 May 2014 15:26:08 -0400 Subject: [PATCH 13/20] Culling faces not shown - performance optimization --- src/net/mosstest/servercore/FaceRenderer.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/net/mosstest/servercore/FaceRenderer.java b/src/net/mosstest/servercore/FaceRenderer.java index 5ad95cd..e56c274 100644 --- a/src/net/mosstest/servercore/FaceRenderer.java +++ b/src/net/mosstest/servercore/FaceRenderer.java @@ -30,12 +30,24 @@ public class FaceRenderer { return true; } case BACK: + if (k + 1 >= nodes[i][j].length || nodes[i][j][k + 1] == 0) { + return true; + } break; case BOTTOM: + if (j - 1 < 0 || nodes[i][j - 1][k] == 0) { + return true; + } break; case LEFT: + if (i + 1 <= nodes.length || nodes[i + 1][j][k] == 0) { + return true; + } break; case RIGHT: + /*if (i - 1 < 0 || nodes[i - 1][j][k] == 0) { + return true; + }*/ break; } return false; From d067a9ab92daddff07842c0eb30da59e84b91ce3 Mon Sep 17 00:00:00 2001 From: rarkenin Date: Tue, 13 May 2014 20:53:55 -0400 Subject: [PATCH 14/20] Fix .travis.yml by removing old merge conflict crap, add new data --- .travis.yml | 4 ---- data | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c0ae2b7..7bd8e2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,3 @@ -<<<<<<< HEAD -language: java -======= language: java jdk: - oraclejdk8 @@ -13,4 +10,3 @@ notifications: - "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}" - "Change view : %{compare_url}" - "Build details : %{build_url}" ->>>>>>> origin diff --git a/data b/data index f2c4f5f..f1d70e6 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit f2c4f5f9307d12d0e37ce9d7fab5d3583fc566f9 +Subproject commit f1d70e6783c187a09e0f6763b67b208c978caa23 From c53f4e1e495004544fc8c1d2f8108eb3ed4db705 Mon Sep 17 00:00:00 2001 From: rarkenin Date: Mon, 19 May 2014 19:07:40 -0400 Subject: [PATCH 15/20] Add temporary build for coverity (ignore for other purposes for now!) and reference newest data repo commit --- build.sh | 2 ++ data | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..01a1f63 --- /dev/null +++ b/build.sh @@ -0,0 +1,2 @@ +/usr/lib/jvm/java-8-oracle/bin/java -classpath /usr/share/maven/boot/plexus-classworlds-2.x.jar -Dclassworlds.conf=/usr/share/maven/bin/m2.conf -Dmaven.home=/usr/share/maven org.codehaus.plexus.classworlds.launcher.Launcher clean compile + diff --git a/data b/data index f1d70e6..a7a97d7 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit f1d70e6783c187a09e0f6763b67b208c978caa23 +Subproject commit a7a97d7b7e16d8c4dfd5074f3e2d2255c6542dd4 From 9c6c1b69a5be5108731ca33e9889341fef50b1f8 Mon Sep 17 00:00:00 2001 From: rarkenin Date: Fri, 23 May 2014 16:53:12 -0400 Subject: [PATCH 16/20] Update readme --- README.md | 22 +++++++++++++++++++ data | 2 +- .../scripting/gametext/game.properties~ | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/net/mosstest/scripting/gametext/game.properties~ diff --git a/README.md b/README.md index 89eb03c..a932431 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,25 @@ Don't touch the thread pool or the scripting interface. Electrocution, drowning, or security bots attacking you may occur. pom.xml refers to non-maven jars in a custom jMonkey repository. `pom.xml` refers to that repository, although it may go down when the forum or wiki goes down for updates or maintenance. + +## Licensing and legalities + +The entire project is licensed under the GNU GPLv3 or higher. + +The burden of ensuring license compatibility for scripts is delegated to the script author. Server operators and players are not responsible +for non-compliant scripts. As obfuscated, "JSfuck"ed, minified, or otherwise non-original script files are not "the preferred way of making modifications" +they may not be used as scripts without permission from the authors. As a courtesy, please comment scripts, although comments are not required. + +## Privacy laws + +The authors of a script, or the Mosstest developers will not be responsible for violations of privacy laws in any jurisdictions. The burden of ensuring privacy laws are followed is delegated to server owners (as a courtesy, script authors should explicitly state what data is collected by their scripts) + +The Mosstest engine itself receives, and may *collect in any format, including the database or logfiles*, player usernames, IP addresses, and passwords. + +In addition, operating system and network details may be collected as an artifact of network communication, for example where OS-specific or network-equipment-specific "quirks" of how network connections are created and negotiated, or details such as text encodings or line ending characters are recorded in these logs. By running this software, the user acknowledges the recording and potential use of these details, by any game server. + +## Security + +While Mosstest strives to be secure, the script sandbox on a client will execute code given by a server. In case of a security breach, a rogue server can compromise a client. Please play on untrusted servers at your own risk. + +If you believe a security bug exists, please report it at [Launchpad](https://bugs.launchpad.net/mosstest/+filebug). Before submitting, please mark it as private security. Developers will make it public as soon as reasonably possible. diff --git a/data b/data index a7a97d7..f4facc0 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit a7a97d7b7e16d8c4dfd5074f3e2d2255c6542dd4 +Subproject commit f4facc00498d5d848a1aa3384ce7da0107f5e526 diff --git a/src/net/mosstest/scripting/gametext/game.properties~ b/src/net/mosstest/scripting/gametext/game.properties~ new file mode 100644 index 0000000..04ab351 --- /dev/null +++ b/src/net/mosstest/scripting/gametext/game.properties~ @@ -0,0 +1,2 @@ +#This properties file describes game tidbits such as item names, materials, and other things a player might interact with. These are for modders' convenience. + From e69810c2802489d752edaa9a1a6ad7fd6ce498bb Mon Sep 17 00:00:00 2001 From: rarkenin Date: Mon, 16 Jun 2014 17:49:14 -0400 Subject: [PATCH 17/20] Update builtins --- builtins/crosshair.png | Bin 0 -> 231 bytes data | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 builtins/crosshair.png diff --git a/builtins/crosshair.png b/builtins/crosshair.png new file mode 100644 index 0000000000000000000000000000000000000000..0b57b316d4ef67885bebc3668599f4660600b7a4 GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwQO+b`a%inSF0icj%iEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI8c$lr;B4q#NoHs47nH-c$_aD`+eV1Pc}xzWWj0v9VHXkb+?2% z-tqh=@zoNj80fU#-xr%+zbKjO6?OgNwqpWDE&dGKv~4&u89}mt*nPgtl~Fl;`;;h% N>*?y}vd$@?2>_1$MhXA` literal 0 HcmV?d00001 diff --git a/data b/data index f4facc0..44ac299 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit f4facc00498d5d848a1aa3384ce7da0107f5e526 +Subproject commit 44ac2996cb2d330d2e3160ffc86cc2440d781c06 From 10710d913789aaeb682f715b05d61f097fc0918e Mon Sep 17 00:00:00 2001 From: rarkenin Date: Mon, 16 Jun 2014 17:55:21 -0400 Subject: [PATCH 18/20] Real fixes. --- src/net/mosstest/scripting/MossScriptEnv.java | 347 +----------------- .../servercore/AbstractMossScript.java | 41 +-- .../mosstest/servercore/RenderProcessor.java | 10 + 3 files changed, 13 insertions(+), 385 deletions(-) diff --git a/src/net/mosstest/scripting/MossScriptEnv.java b/src/net/mosstest/scripting/MossScriptEnv.java index 360ad23..64f4196 100644 --- a/src/net/mosstest/scripting/MossScriptEnv.java +++ b/src/net/mosstest/scripting/MossScriptEnv.java @@ -1,348 +1,4 @@ -<<<<<<< HEAD -package net.mosstest.scripting; - -import net.mosstest.scripting.events.IMossEvent; -import net.mosstest.scripting.handlers.MossEventHandler; -import net.mosstest.scripting.handlers.MossNodeChangeHandler; -import net.mosstest.servercore.*; -import org.jetbrains.annotations.NonNls; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; - -/** - * This class is used by scripts and script-facing portions of Mosstest. Methods - * restricted to be called from trusted Java-side shall pass a - * {@link ScriptSandboxBorderToken}. Each event fired will run in the thread - * pool. All requests via this API need not concern themselves with threading as - * everything is handled by Mosstest itself. - *

- * The event handlers called are the ones defined via this class's registerOnFoo - * methods, followed by any handlers defined in an instance of NodeParams via an - * anonymous inner class, and finally with the default handler. - *

- * The order in which handlers registered here are called is undefined due to - * the undefined order of scripts being loaded. Generally, this is planned to - * occur in an order based on the SHA512 hash of the script. Comments with dummy - * information may be used by the script author to attempt to set the position - * of a script in the execution order via manipulating the hash. Handlers of the - * same types within the same script are guaranteed to be called in order. - *

- * An event handler may interrupt handling of the event so that no further event - * handlers nor the default are ever called, by returning the proper boolean value - * - * @author rarkenin - * @version 0.0 - * @since 0.0 - */ -public class MossScriptEnv { - - public void registerNodeChangeHandler(MossNodeChangeHandler h) { - - } - - - private HashMap, ArrayList> eventHandlers; - - private ScriptableDatabase db; - - private MapCache nc; - - private FuturesProcessor fp; - - private INodeManager nm; - - - /** - * Sends a chat message to a player. - * - * @param recipient A {@link Player} object representing the recipient. A Player - * object may be constructed with - * {@link MossScriptEnv#getPlayerByName(String)}. - * @param from A player object representing the sender. A Player object may - * be constructed with - * {@link MossScriptEnv#getPlayerByName(String)}. If null a - * message is sent showing to users as having been sent by the - * server with the prefix [*] Server: - * @param message A string representing the message that shall be sent to the - * specified recipient. - */ - public void sendChatMessage(Player recipient, Player from, String message) { - // TODO - } - - /** - * Sends a chat message to all players. - * - * @param from A player object representing the sender. A Player object may - * be constructed with - * {@link MossScriptEnv#getPlayerByName(String)}. If null a - * message is sent showing to users as having been sent by the - * server with the prefix [*] Server: - * @param message A string representing the message that shall be sent to the - * specified recipient. - */ - public void sendChatAll(Player from, String message) { - // TODO - } - - /** - * Sets the health on an entity or player. - * - * @param p The player to set health on. - * @param health A positive integer representing the amount of health to set. - */ - public void setHp(Player p, int health) { - // TODO Once we have players doing stuff - } - - /** - * Damages the tool of a player corresponding to a dig. The player's - * currently selected tool is damaged. - * - * @param actor The player that is digging a node. - * @param nd The node dug. - * @throws MossScriptException Thrown if the current tool cannot be used to dig the node. - */ - public void damageTool(Player actor, MapNode nd) throws MossScriptException { - // TODO Auto-generated method stub - - } - - /** - * Gives a player an item. The item stack will be added to the player's - * default inventory, adding to the first available partial stack. If no - * partial stacks are available the item is added to the first open slot in - * the inventory. - * - * @param player the player - * @param item the item - * @return True if the item could be added, false if the item could not be - * added due to insufficient space. - */ - public boolean givePlayer(Player player, MossItem.Stack item) { - MossInventory mi = player.getInventory("default", 4, 8, 128); - - // use side effect - return (mi.addItem(item) == item.amount); - - } - - /** - * Sets a node of the world to a given type. This cannot be called on a - * NodePosition with an existing solid node; use - * {@link #removeNode(NodePosition)} first. - * - * @param pos The position at which to set a node. - * @param node The node to place at that position. - */ - public void setNode(NodePosition pos, MapNode node) throws MapGeneratorException { - MapChunk chk = this.nc.getChunkNoGenerate(pos.chunk); - if (chk == null) - return; - if (!(this.nm.containsNode(node) || node instanceof IDynamicNode)) - throw new IllegalArgumentException("The mapnode passed is not contained in the world node manager"); - - chk.setNode(pos.xl, pos.yl, pos.zl, node.getNodeId()); - } - - /** - * Removes a node, setting it to air. This may be called on a NodePosition - * with an existing solid node. - * - * @param pos The NodePosition at which to remove the node. - */ - public void removeNode(NodePosition pos) throws MapGeneratorException { - MapChunk chk = this.nc.getChunkNoGenerate(pos.chunk); - if (chk == null) - return; - chk.setNode(pos.xl, pos.yl, pos.zl, this.nm.getNode("mg:air") //$NON-NLS-1$ - .getNodeId()); - this.nc.setChunk(pos.chunk, chk); - } - - /** - * Get the MapNode at a certain location. - * - * @param pos The location at which to get the node - * @return A MapNode object representing the node at that location. - * @throws MapGeneratorException the map generator exception - */ - public MapNode getNode(NodePosition pos) throws MapGeneratorException { - return this.nm.getNode((short) this.nc.getChunk(pos.chunk).getNodeId( - pos.xl, pos.yl, pos.zl)); - - } - - /** - * Registers a mapnode in the world, allowing it to be placed. - * - * @param nd - * @throws MossWorldLoadException - */ - public void registerNode(MapNode nd) throws MossWorldLoadException { - this.nm.putNode(nd); - } - - /** - * Register a new liquid in the node manager, generating intermediates as needed. - * - * @param sysname The name such as default:lava to set. The prefix mg: is used - * for mapgen-specific nodes, and should be done by creating a - * node with a different prefix and aliasing mg:foo to it. - * @param userFacingName The name to display in the UI, such as Lava or Iron Ore - * @param params An implementation of the {@link LiquidNodeParams} interface - * detailing the action of the node. {@link LiquidSourceNodeParams} and - * {@link LiquidFlowingNodeParams} are valid for liquid sources and flowing liquid nodes, - * respectively. - * @param flowParams the source params - * @param textures A string stating the filename of the textures image. - * @param light The amount of light from 0 to 255 to be emitted. - * @return The MapNode object that has been created and added to the - * manager. - * @throws MossWorldLoadException If an exception occurs during the execution of the - * registering. - */ - public LiquidNode registerLiquid(@NonNls String sysname, String userFacingName, - LiquidNodeParams params, LiquidNodeParams flowParams, - String textures, int light) throws MossWorldLoadException { - LiquidNode nd = new LiquidNode(params, textures, sysname, - userFacingName, light); - this.nm.putNode(nd); - nd.level = 0; - for (int i = 1; i < 8; i++) { - LiquidNode innerNd = new LiquidNode(flowParams, textures, sysname - + "$LEVEL$" + i, userFacingName, light); //$NON-NLS-1$ - innerNd.setByBounds(-.5f, .5f, -.5f, .5f, -.5f, (i / 8f) - 0.5f); - nd.liquidLevels[i] = innerNd; - innerNd.liquidLevels = nd.liquidLevels; - innerNd.level = i; - this.nm.putNode(innerNd); - } - nd.liquidLevels[0] = nd; - return nd; - } - - /** - * Registers a node alias. Since the map generator and scripts work via - * string names, registering an alias of mg:dirt to myscript:specialdirt - * will cause a mapgen that recognizes mg:dirt as a generated element to use - * specialdirt for that. - * - * @param alias The alias to create, i.e. mg:dirt - * @param dst The existing node to set as the alias target, i.e - * myscript:specialdirt. This element must already exist. - */ - public void registerNodeAlias(String alias, String dst) { - this.nm.putNodeAlias(alias, dst); - } - - - /** - * Gets the inv by name. - * - * @param player the player - * @param name the name - * @return the inv by name - */ - public MossInventory getInvByName(Player player, String name) { - return null; - } - - /** - * Creates the inv by name. - * - * @param p the p - * @param name the name - * @return the moss inventory - */ - public MossInventory createInvByName(Player p, String name) { - return null; - } - - /** - * Gets the player by name. - * - * @param name the name - * @return the player by name - */ - public Player getPlayerByName(String name) { - return null; - } - - /** - * Gets the node by name. - * - * @param name the name - * @return the node by name - */ - public MapNode getNodeByName(String name) { - return null; - } - - /** - * Gets the db. - * - * @return the db - */ - public ScriptableDatabase getDb() { - return this.db; - } - - /** - * Instantiates a new moss script env. - * - * @param db the db - * @param nc the nc - * @param fp the fp - * @param nm the nm - */ - public MossScriptEnv(ScriptableDatabase db, MapCache nc, - FuturesProcessor fp, INodeManager nm) { - this.db = db; - this.nc = nc; - this.fp = fp; - this.nm = nm; - } - - /** - * Gets the futures processor. - * - * @return the futures processor - */ - public FuturesProcessor getFuturesProcessor() { - return this.fp; - } - - private HashMap, List> handlers = new HashMap<>(); - - public List getEventHandlers( - Class clazz) { - List l = Collections.unmodifiableList(handlers.get(clazz)); - if (l == null) { - handlers.put(clazz, new ArrayList()); - return Collections.EMPTY_LIST; - } - return l; - - } - - public void registerHandler(MossEventHandler handler, Class clazz) { - List l = handlers.get(clazz); - if (l == null) { - l = new ArrayList(); - handlers.put(clazz, l); - l.add(handler); - return; - } - l.add(handler); - - } - -} -======= + package net.mosstest.scripting; import net.mosstest.scripting.events.IMossEvent; @@ -700,4 +356,3 @@ public class MossScriptEnv { } } ->>>>>>> netclient diff --git a/src/net/mosstest/servercore/AbstractMossScript.java b/src/net/mosstest/servercore/AbstractMossScript.java index 8f05e1d..9c1cd4a 100644 --- a/src/net/mosstest/servercore/AbstractMossScript.java +++ b/src/net/mosstest/servercore/AbstractMossScript.java @@ -1,41 +1,4 @@ -<<<<<<< HEAD -package net.mosstest.servercore; - -import java.io.IOException; -import java.util.List; - -public abstract class AbstractMossScript { - - protected AbstractMossScript(String name) { - this.name = name; - } - - @org.jetbrains.annotations.NonNls - final String name; - abstract void exec(ScriptEnv sEnv) throws IOException, MossWorldLoadException; - - abstract IMossFile getInitFile() throws IOException; - - abstract List getDependencies(); - - @Override - public final boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof AbstractMossScript)) return false; - - AbstractMossScript that = (AbstractMossScript) o; - - if (!name.equals(that.name)) return false; - - return true; - } - - @Override - public final int hashCode() { - return name.hashCode(); - } -} -======= + package net.mosstest.servercore; import java.io.IOException; @@ -72,4 +35,4 @@ public abstract class AbstractMossScript { return name.hashCode(); } } ->>>>>>> netclient + diff --git a/src/net/mosstest/servercore/RenderProcessor.java b/src/net/mosstest/servercore/RenderProcessor.java index 096288a..3bebd28 100644 --- a/src/net/mosstest/servercore/RenderProcessor.java +++ b/src/net/mosstest/servercore/RenderProcessor.java @@ -7,6 +7,7 @@ import java.util.concurrent.ArrayBlockingQueue; import java.util.logging.Level; import com.jme3.material.RenderState; +import com.jme3.ui.Picture; import jme3tools.optimize.GeometryBatchFactory; import net.mosstest.scripting.MapChunk; import net.mosstest.scripting.Player; @@ -103,13 +104,22 @@ public class RenderProcessor extends SimpleApplication { setupLamplight(); setupPlayer(); assetManager.registerLocator("scripts", LocalAssetLocator.class); + setupHud(); flyCam.setEnabled(false); setupListeners(cam.getUp().clone()); initKeyBindings(); preparatorChunkTest(); //blankChunkTest(); } + private void setupHud() { + Picture pic = new Picture("Crosshair"); + pic.setImage(assetManager, "builtins/crosshair.png", true); + pic.setWidth(32); + pic.setHeight(32); + pic.setPosition(settings.getWidth()/2-16, settings.getHeight()/2-16); + guiNode.attachChild(pic); + } @Override public void simpleUpdate(float tpf) { if (lastTime + 10 < System.currentTimeMillis()) { From 05a2fa1075f1e10f002168195c235dd2d3b9259c Mon Sep 17 00:00:00 2001 From: rarkenin Date: Sun, 22 Jun 2014 17:13:18 -0400 Subject: [PATCH 19/20] rm debian directory --- debian/README.source | 9 ---- debian/changelog | 6 --- debian/compat | 1 - debian/control | 22 --------- debian/copyright | 24 ---------- debian/maven.cleanIgnoreRules | 1 - debian/maven.ignoreRules | 14 ------ debian/maven.properties | 5 -- debian/maven.publishedRules | 3 -- debian/maven.rules | 10 ---- debian/mosstest-all.poms | 28 ----------- debian/mosstest-game.poms | 28 ----------- debian/mosstest-java.poms | 28 ----------- debian/rules | 9 ---- debian/rules.new | 46 ------------------- debian/source/format | 1 - .../mosstest/servercore/DrawableHudset.java | 7 ++- 17 files changed, 6 insertions(+), 236 deletions(-) delete mode 100644 debian/README.source delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/maven.cleanIgnoreRules delete mode 100644 debian/maven.ignoreRules delete mode 100644 debian/maven.properties delete mode 100644 debian/maven.publishedRules delete mode 100644 debian/maven.rules delete mode 100644 debian/mosstest-all.poms delete mode 100644 debian/mosstest-game.poms delete mode 100644 debian/mosstest-java.poms delete mode 100755 debian/rules delete mode 100644 debian/rules.new delete mode 100644 debian/source/format diff --git a/debian/README.source b/debian/README.source deleted file mode 100644 index 2abbba8..0000000 --- a/debian/README.source +++ /dev/null @@ -1,9 +0,0 @@ -Information about mosstest --------------------------- - -This package was debianized using the mh_make command -from the maven-debian-helper package. - -The build system uses Maven but prevents it from downloading -anything from the Internet, making the build compliant with -the Debian policy. diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index a4416c6..0000000 --- a/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -mosstest (0.1.0-SNAPSHOT-1) UNRELEASED; urgency=medium - - * Initial release (Closes: #nnnn) - - -- hexafraction Thu, 08 May 2014 20:51:08 -0400 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control deleted file mode 100644 index 7bae2b0..0000000 --- a/debian/control +++ /dev/null @@ -1,22 +0,0 @@ -Source: mosstest -Section: java -Priority: optional -Maintainer: Debian Java Maintainers -Uploaders: hexafraction -Build-Depends: debhelper (>= 9), cdbs, default-jdk, maven-debian-helper (>= 1.5) -Build-Depends-Indep: libmaven-shade-plugin-java, libcommons-cli-java, libcommons-codec-java, - libcommons-collections3-java, libcommons-configuration-java, libcommons-io-java, - libcommons-lang-java, libcommons-lang3-java, libcommons-math-java, libguava-java, - liblog4j1.2-java (>= 1.2.17), librhino-java -Standards-Version: 3.9.5 -Vcs-Svn: svn://anonscm.debian.org/pkg-java/trunk/mosstest -Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-java/trunk/mosstest -Homepage: https://github.com/mosstest/mosstest - -Package: mosstest-game -Architecture: all -Depends: ${misc:Depends}, ${maven:Depends} -Recommends: ${maven:OptionalDepends} -Description: Mosstest - Open-source voxel engine with some extra features - diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 881ead2..0000000 --- a/debian/copyright +++ /dev/null @@ -1,24 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: Mosstest -Source: https://github.com/mosstest/mosstest - -Files: * -Copyright: 2014, hexafraction -License: GPL-3 or LGPL-2.1 - -Files: debian/* -Copyright: 2014, hexafraction -License: GPL-3+ - -License: GPL-3 - On Debian systems, the full text of the GPL-3 license - can be found in the file '/usr/share/common-licenses/GPL-3' - -License: GPL-3+ - TODO: include the full text of the license here - -License: LGPL-2.1 - On Debian systems, the full text of the LGPL-2.1 license - can be found in the file '/usr/share/common-licenses/LGPL-2.1' - - diff --git a/debian/maven.cleanIgnoreRules b/debian/maven.cleanIgnoreRules deleted file mode 100644 index 8b13789..0000000 --- a/debian/maven.cleanIgnoreRules +++ /dev/null @@ -1 +0,0 @@ - diff --git a/debian/maven.ignoreRules b/debian/maven.ignoreRules deleted file mode 100644 index dc95592..0000000 --- a/debian/maven.ignoreRules +++ /dev/null @@ -1,14 +0,0 @@ - -com.intellij annotations * * * * -jme3 jme3-core * * * * -jme3 jme3-desktop * * * * -jme3 jme3-lwjgl-natives * * * * -jme3 jme3-lwjgl-niftygui * * * * -jme3 jme3-lwjgl * * * * -jme3 lwjgl-workaround * * * * -jme3 niftygui * * * * -junit junit * * * * -net.java.jinput jinput * * * * -org.fusesource.leveldbjni leveldbjni-all * * * * -org.lwjgl.lwjgl parent * * * * -pl.project13.maven git-commit-id-plugin * * * * diff --git a/debian/maven.properties b/debian/maven.properties deleted file mode 100644 index e593715..0000000 --- a/debian/maven.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Include here properties to pass to Maven during the build. -# For example: -# maven.test.skip=true - -maven.test.skip=true diff --git a/debian/maven.publishedRules b/debian/maven.publishedRules deleted file mode 100644 index bc12bb3..0000000 --- a/debian/maven.publishedRules +++ /dev/null @@ -1,3 +0,0 @@ - -mosstest mosstest jar * * * -mosstest mosstest jar s/.*/debian/ * * diff --git a/debian/maven.rules b/debian/maven.rules deleted file mode 100644 index 2a71f4f..0000000 --- a/debian/maven.rules +++ /dev/null @@ -1,10 +0,0 @@ - -com.google.guava guava bundle s/.*/debian/ * * -com.google.guava guava s/jar/bundle/ s/.*/debian/ * * -commons-collections commons-collections jar s/3\..*/3.x/ * * -mosstest mosstest jar * * * -mosstest mosstest jar s/.*/debian/ * * -org.apache.commons commons-lang3 jar s/3\..*/3.x/ * * -log4j log4j * s/1\.2\..*/1.2.x/ * * -s/com.google.code.google-collections/com.google.guava/ s/google-collect/guava/ s/jar/bundle/ s/.*/debian/ * * -s/com.google.collections/com.google.guava/ s/google-collections/guava/ s/jar/bundle/ s/.*/debian/ * * diff --git a/debian/mosstest-all.poms b/debian/mosstest-all.poms deleted file mode 100644 index 0417132..0000000 --- a/debian/mosstest-all.poms +++ /dev/null @@ -1,28 +0,0 @@ -# List of POM files for the package -# Format of this file is: -# [option]* -# where option can be: -# --ignore: ignore this POM and its artifact if any -# --ignore-pom: don't install the POM. To use on POM files that are created -# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] -# --no-parent: remove the tag from the POM -# --package=: an alternative package to use when installing this POM -# and its artifact -# --has-package-version: to indicate that the original version of the POM is the same as the upstream part -# of the version for the package. -# --keep-elements=: a list of XML elements to keep in the POM -# during a clean operation with mh_cleanpom or mh_installpom -# --artifact=: path to the build artifact associated with this POM, -# it will be installed when using the command mh_install. [mh_install] -# --java-lib: install the jar into /usr/share/java to comply with Debian -# packaging guidelines -# --usj-name=: name to use when installing the library in /usr/share/java -# --usj-version=: version to use when installing the library in /usr/share/java -# --no-usj-versionless: don't install the versionless link in /usr/share/java -# --dest-jar=: the destination for the real jar. -# It will be installed with mh_install. [mh_install] -# --classifier=: Optional, the classifier for the jar. Empty by default. -# --site-xml=: Optional, the location for site.xml if it needs to be installed. -# Empty by default. [mh_install] -# -pom.xml --has-package-version diff --git a/debian/mosstest-game.poms b/debian/mosstest-game.poms deleted file mode 100644 index 0417132..0000000 --- a/debian/mosstest-game.poms +++ /dev/null @@ -1,28 +0,0 @@ -# List of POM files for the package -# Format of this file is: -# [option]* -# where option can be: -# --ignore: ignore this POM and its artifact if any -# --ignore-pom: don't install the POM. To use on POM files that are created -# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] -# --no-parent: remove the tag from the POM -# --package=: an alternative package to use when installing this POM -# and its artifact -# --has-package-version: to indicate that the original version of the POM is the same as the upstream part -# of the version for the package. -# --keep-elements=: a list of XML elements to keep in the POM -# during a clean operation with mh_cleanpom or mh_installpom -# --artifact=: path to the build artifact associated with this POM, -# it will be installed when using the command mh_install. [mh_install] -# --java-lib: install the jar into /usr/share/java to comply with Debian -# packaging guidelines -# --usj-name=: name to use when installing the library in /usr/share/java -# --usj-version=: version to use when installing the library in /usr/share/java -# --no-usj-versionless: don't install the versionless link in /usr/share/java -# --dest-jar=: the destination for the real jar. -# It will be installed with mh_install. [mh_install] -# --classifier=: Optional, the classifier for the jar. Empty by default. -# --site-xml=: Optional, the location for site.xml if it needs to be installed. -# Empty by default. [mh_install] -# -pom.xml --has-package-version diff --git a/debian/mosstest-java.poms b/debian/mosstest-java.poms deleted file mode 100644 index 0417132..0000000 --- a/debian/mosstest-java.poms +++ /dev/null @@ -1,28 +0,0 @@ -# List of POM files for the package -# Format of this file is: -# [option]* -# where option can be: -# --ignore: ignore this POM and its artifact if any -# --ignore-pom: don't install the POM. To use on POM files that are created -# temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] -# --no-parent: remove the tag from the POM -# --package=: an alternative package to use when installing this POM -# and its artifact -# --has-package-version: to indicate that the original version of the POM is the same as the upstream part -# of the version for the package. -# --keep-elements=: a list of XML elements to keep in the POM -# during a clean operation with mh_cleanpom or mh_installpom -# --artifact=: path to the build artifact associated with this POM, -# it will be installed when using the command mh_install. [mh_install] -# --java-lib: install the jar into /usr/share/java to comply with Debian -# packaging guidelines -# --usj-name=: name to use when installing the library in /usr/share/java -# --usj-version=: version to use when installing the library in /usr/share/java -# --no-usj-versionless: don't install the versionless link in /usr/share/java -# --dest-jar=: the destination for the real jar. -# It will be installed with mh_install. [mh_install] -# --classifier=: Optional, the classifier for the jar. Empty by default. -# --site-xml=: Optional, the location for site.xml if it needs to be installed. -# Empty by default. [mh_install] -# -pom.xml --has-package-version diff --git a/debian/rules b/debian/rules deleted file mode 100755 index b76c54a..0000000 --- a/debian/rules +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/maven.mk - -JAVA_HOME := /usr/lib/jvm/default-java - -get-orig-source: - uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename diff --git a/debian/rules.new b/debian/rules.new deleted file mode 100644 index d4f84b4..0000000 --- a/debian/rules.new +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/ant.mk - -PACKAGE := $(DEB_SOURCE_PACKAGE) -VERSION := $(DEB_UPSTREAM_VERSION) -JAVA_HOME := /usr/lib/jvm/default-java -DEB_JARS := # TODO - fill the list of jars -DEB_ANT_BUILD_TARGET := package -DEB_ANT_BUILDFILE := debian/build.xml -DEB_ANT_ARGS := -Dpackage=$(PACKAGE) -DartifactId=$(PACKAGE) -Dversion=$(VERSION) - -binary-post-install/$(PACKAGE):: - mh_installpoms -p$(PACKAGE) - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l # ./build/.-$(VERSION).jar - mh_installjar -p$(PACKAGE) -l pom.xml build/$(PACKAGE)-$(VERSION).jar - -clean:: - -rm -rf debian/tmp diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 163aaf8..0000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/src/net/mosstest/servercore/DrawableHudset.java b/src/net/mosstest/servercore/DrawableHudset.java index a765358..4859033 100644 --- a/src/net/mosstest/servercore/DrawableHudset.java +++ b/src/net/mosstest/servercore/DrawableHudset.java @@ -1,8 +1,13 @@ package net.mosstest.servercore; +import com.jme3.scene.Node; + /** * The Class DrawableHudset. */ public class DrawableHudset { - + public Node getHudNode(){ + return null; + } + } From 88989528c8e42f65a20579ecd99511a857ff07d5 Mon Sep 17 00:00:00 2001 From: rarkenin Date: Fri, 27 Jun 2014 10:58:35 -0400 Subject: [PATCH 20/20] Push unrelated data --- data | 2 +- nbproject/build-impl.xml | 1381 ---------------------- nbproject/configs/MapDatabase.properties | 1 - nbproject/configs/ScriptEnv.properties | 1 - nbproject/genfiles.properties | 8 - nbproject/project.properties | 83 -- nbproject/project.xml | 13 - 7 files changed, 1 insertion(+), 1488 deletions(-) delete mode 100644 nbproject/build-impl.xml delete mode 100644 nbproject/configs/MapDatabase.properties delete mode 100644 nbproject/configs/ScriptEnv.properties delete mode 100644 nbproject/genfiles.properties delete mode 100644 nbproject/project.properties delete mode 100644 nbproject/project.xml diff --git a/data b/data index 44ac299..ffad2ac 160000 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 44ac2996cb2d330d2e3160ffc86cc2440d781c06 +Subproject commit ffad2ac0a03a4a181efd7ef5d5583c2448c30d78 diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml deleted file mode 100644 index 0badc8f..0000000 --- a/nbproject/build-impl.xml +++ /dev/null @@ -1,1381 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - - - - - - java -cp "${run.classpath.with.dist.jar}" ${main.class} - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbproject/configs/MapDatabase.properties b/nbproject/configs/MapDatabase.properties deleted file mode 100644 index c541371..0000000 --- a/nbproject/configs/MapDatabase.properties +++ /dev/null @@ -1 +0,0 @@ -main.class=org.nodetest.servercore.EventProcessor diff --git a/nbproject/configs/ScriptEnv.properties b/nbproject/configs/ScriptEnv.properties deleted file mode 100644 index ea66e7a..0000000 --- a/nbproject/configs/ScriptEnv.properties +++ /dev/null @@ -1 +0,0 @@ -main.class=org.nodetest.common.ScriptEnv diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties deleted file mode 100644 index b7e4237..0000000 --- a/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=23062b59 -build.xml.script.CRC32=9ea92df2 -build.xml.stylesheet.CRC32=28e38971@1.53.1.46 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=23062b59 -nbproject/build-impl.xml.script.CRC32=3b7463a5 -nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 diff --git a/nbproject/project.properties b/nbproject/project.properties deleted file mode 100644 index 848cc4c..0000000 --- a/nbproject/project.properties +++ /dev/null @@ -1,83 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processor.options= -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -auxiliary.org-netbeans-modules-projectimport-eclipse-core.key=src=src;file=lib/commons-cli-1.2.jar;file=lib/js-14.jar;file=lib/commons-cli-1.2-sources.jar;file=lib/db4o-8.0.249.16098-all-java5.jar;output=bin; -auxiliary.org-netbeans-modules-projectimport-eclipse-core.project=. -auxiliary.org-netbeans-modules-projectimport-eclipse-core.timestamp=1370875172897 -auxiliary.org-netbeans-modules-projectimport-eclipse-core.workspace=C:\\Users\\Alexander\\workspace -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/MossTest.jar -dist.javadoc.dir=${dist.dir}/javadoc -excludes= -file.reference.commons-cli-1.2-sources.jar=lib/commons-cli-1.2-sources.jar -file.reference.commons-cli-1.2.jar=lib/commons-cli-1.2.jar -file.reference.db4o-8.0.249.16098-all-java5.jar=lib/db4o-8.0.249.16098-all-java5.jar -file.reference.js-14.jar=lib/js-14.jar -file.reference.mosstest-src=src -includes=** -jar.compress=false -javac.classpath=\ - ${file.reference.commons-cli-1.2.jar}:\ - ${file.reference.js-14.jar}:\ - ${file.reference.commons-cli-1.2-sources.jar}:\ - ${file.reference.db4o-8.0.249.16098-all-java5.jar} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.7 -javac.target=1.7 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=true -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -source.reference.commons-cli-1.2.jar=lib/commons-cli-1.2-sources.jar -src.dir=${file.reference.mosstest-src} diff --git a/nbproject/project.xml b/nbproject/project.xml deleted file mode 100644 index f50124b..0000000 --- a/nbproject/project.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - MossTest - - - - - - -