diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d9e9ff0c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,102 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + pull_request: + branches: + - master + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Install Dependencies + run: sudo apt-get install -y genisoimage + - name: Build with Maven + run: mvn -B package --file pom.xml + - name: Get Maven version + run: echo "::set-env name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + Changes in this Release + - First Change + - Second Change + draft: true + prerelease: false + - name: Upload Tracks + id: upload-tracks + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: shared/target/tracks.zip + asset_name: tracks.zip + asset_content_type: application/zip + - name: Upload Server Jar + id: upload-server-jar + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: server/target/server-${{ env.VERSION }}.jar + asset_name: server-${{ env.VERSION }}.jar + asset_content_type: application/jar + - name: Upload Editor Jar + id: upload-editor-jar + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: editor/target/editor-${{ env.VERSION }}.jar + asset_name: editor-${{ env.VERSION }}.jar + asset_content_type: application/jar + - name: Upload Client Jar + id: upload-client-jar + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: client/target/client-${{ env.VERSION }}.jar + asset_name: client-${{ env.VERSION }}.jar + asset_content_type: application/jar + - name: Upload Client exe + id: upload-client-exe + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: client/target/client-${{ env.VERSION }}.exe + asset_name: client-${{ env.VERSION }}.exe + asset_content_type: application/exe + - name: Upload Client dmg + id: upload-client-dmg + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: client/target/client-${{ env.VERSION }}.dmg + asset_name: client-${{ env.VERSION }}.dmg + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9827a4b0..44ed3a42 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/workspace.xml +.idea/ excluded out diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 037a3714..00000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -language: java -os: linux -dist: xenial - -jdk: - - openjdk8 - -script: "date" - -before_deploy: - - "export TITLE=testtitle" - - "export BODY=testbody" - - "zip -r tracks.zip tracks/*" - - "cd client ; ant compile ; cd .." - - "cd server ; ant compile ; cd .." - - "cd editor ; ant compile ; cd .." - -jobs: - include: - - stage: compile - name: "Client" - script: "cd client ; ant compile" - - name: "Server" - script: "cd server ; ant compile" - - name: "Editor" - script: "cd editor ; ant compile" - - stage: release - deploy: - provider: releases - api_key: $GitHub_Token - #title: ${TITLE} - #body: ${BODY} - file: - - "server/server.jar" - - "client/client.jar" - - "editor/editor.jar" - - "tracks.zip" - skip_cleanup: true - on: - tags: true diff --git a/client/build.xml b/client/build.xml deleted file mode 100644 index 27148954..00000000 --- a/client/build.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/client/client.iml b/client/client.iml index d691968e..c0da2a22 100644 --- a/client/client.iml +++ b/client/client.iml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/client/pom.xml b/client/pom.xml new file mode 100644 index 00000000..4322d3bb --- /dev/null +++ b/client/pom.xml @@ -0,0 +1,120 @@ + + + 4.0.0 + + client + 1.0 + + + org.moparforia + playforia-minigolf + 1.0 + + + + org.moparforia.client.Launcher + Playforia Minigolf Client + + + + + io.netty + netty + 3.6.6.Final + compile + + + + + + + res + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.apache.maven.plugins + maven-shade-plugin + + + + org.codehaus.mojo + exec-maven-plugin + + ${project.mainClass} + true + true + + + + + sh.tak.appbundler + appbundle-maven-plugin + 1.2.0 + + ${project.name} + res/icons/playforia.icns + ${project.mainClass} + true + + + + osx-build + package + + bundle + + + + + + com.akathist.maven.plugins.launch4j + launch4j-maven-plugin + 1.5.1 + + + windows-build + package + + launch4j + + + gui + ${project.build.directory}/${project.artifactId}-${project.version}.jar + ${project.build.directory}/${project.artifactId}-${project.version}.exe + http://java.com/download + + ${project.mainClass} + anything + + res/icons/playforia.ico + + 1.8.0 + preferJre + + + 1.0.0.0 + ${project.version} + ${project.name} + Maintained by Philipp v. K. - 2020 + 1.0.0.0 + 1.0.0.0 + ${project.name} + ${project.name} + ${project.artifactId}-${project.version}.exe + + + + + + + + + \ No newline at end of file diff --git a/client/res/icons/playforia.icns b/client/res/icons/playforia.icns new file mode 100644 index 00000000..c1c10149 Binary files /dev/null and b/client/res/icons/playforia.icns differ diff --git a/client/res/icons/playforia.ico b/client/res/icons/playforia.ico new file mode 100644 index 00000000..44aa3628 Binary files /dev/null and b/client/res/icons/playforia.ico differ diff --git a/client/src/com/aapeli/tools/EncodedXmlReader.java b/client/src/com/aapeli/tools/EncodedXmlReader.java index b688b2e7..9ed1ace9 100644 --- a/client/src/com/aapeli/tools/EncodedXmlReader.java +++ b/client/src/com/aapeli/tools/EncodedXmlReader.java @@ -1,7 +1,5 @@ package com.aapeli.tools; -import com.sun.xml.internal.bind.v2.runtime.output.Encoded; - import java.io.*; import java.net.URL; diff --git a/editor/build.xml b/editor/build.xml deleted file mode 100644 index 2a583923..00000000 --- a/editor/build.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/editor/editor.iml b/editor/editor.iml index 6d59135e..e7bbeac3 100644 --- a/editor/editor.iml +++ b/editor/editor.iml @@ -1,2 +1,15 @@ - \ No newline at end of file + + + + + + + + + + + + + + \ No newline at end of file diff --git a/editor/pom.xml b/editor/pom.xml new file mode 100644 index 00000000..d8f8e7b6 --- /dev/null +++ b/editor/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + editor + 1.0 + + + org.moparforia + playforia-minigolf + 1.0 + + + + org.moparforia.editor.TrackEditor + + + + + org.moparforia + shared + + + + + + res + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-shade-plugin + + + org.codehaus.mojo + exec-maven-plugin + + ${project.mainClass} + + + + + \ No newline at end of file diff --git a/lib/mongo-java-driver-2.9.3.jar b/lib/mongo-java-driver-2.9.3.jar deleted file mode 100644 index b2673b5c..00000000 Binary files a/lib/mongo-java-driver-2.9.3.jar and /dev/null differ diff --git a/lib/morphia-1.2.2-sources.jar b/lib/morphia-1.2.2-sources.jar deleted file mode 100644 index b57d4934..00000000 Binary files a/lib/morphia-1.2.2-sources.jar and /dev/null differ diff --git a/lib/morphia-1.2.2.jar b/lib/morphia-1.2.2.jar deleted file mode 100644 index 362bc23c..00000000 Binary files a/lib/morphia-1.2.2.jar and /dev/null differ diff --git a/lib/netty-3.6.6.Final-sources.jar b/lib/netty-3.6.6.Final-sources.jar deleted file mode 100644 index 4144cf5d..00000000 Binary files a/lib/netty-3.6.6.Final-sources.jar and /dev/null differ diff --git a/lib/netty-3.6.6.Final.jar b/lib/netty-3.6.6.Final.jar deleted file mode 100644 index 35cb0730..00000000 Binary files a/lib/netty-3.6.6.Final.jar and /dev/null differ diff --git a/playforia-minigolf.iml b/playforia-minigolf.iml new file mode 100644 index 00000000..4fd5057c --- /dev/null +++ b/playforia-minigolf.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..fa4517f9 --- /dev/null +++ b/pom.xml @@ -0,0 +1,107 @@ + + 4.0.0 + + org.moparforia + playforia-minigolf + pom + 1.0 + Playforia Minigolf + + + server + editor + client + shared + + + + UTF-8 + test.mainClass + + + src + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + ${project.mainClass} + + + + + + + + sh.tak.appbundler + appbundle-maven-plugin + 1.2.0 + + + com.akathist.maven.plugins.launch4j + launch4j-maven-plugin + 1.5.1 + + + org.apache.maven.plugins + maven-assembly-plugin + 3.3.0 + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + + + + + + + io.netty + netty + 3.6.6.Final + compile + + + org.mongodb + mongo-java-driver + 3.6.0 + + + org.mongodb.morphia + morphia + 1.2.2 + + + org.moparforia + shared + 1.0 + + + + + \ No newline at end of file diff --git a/server/build.xml b/server/build.xml deleted file mode 100644 index b3938ad7..00000000 --- a/server/build.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/pom.xml b/server/pom.xml new file mode 100644 index 00000000..d70b8f78 --- /dev/null +++ b/server/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + server + 1.0 + + + org.moparforia + playforia-minigolf + 1.0 + + + + UTF-8 + org.moparforia.server.Server + + + + + io.netty + netty + compile + + + org.mongodb + mongo-java-driver + + + org.mongodb.morphia + morphia + + + org.moparforia + shared + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.codehaus.mojo + exec-maven-plugin + + ${project.mainClass} + + + + org.apache.maven.plugins + maven-shade-plugin + + + + \ No newline at end of file diff --git a/server/server.iml b/server/server.iml index 6d59135e..240f3e93 100644 --- a/server/server.iml +++ b/server/server.iml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/server/src/org/moparforia/server/db/Database.java b/server/src/org/moparforia/server/db/Database.java index 16080f93..f4b818d6 100644 --- a/server/src/org/moparforia/server/db/Database.java +++ b/server/src/org/moparforia/server/db/Database.java @@ -1,103 +1,103 @@ -package org.moparforia.server.db; - -import com.github.jmkgreen.morphia.Datastore; -import com.github.jmkgreen.morphia.Morphia; -import com.mongodb.*; -import org.moparforia.server.util.SHA1; -import org.moparforia.shared.Track; - -/** - * User: Johan - * Date: 2013-08-05 - * Time: 12:13 - */ -public class Database { - - private static Morphia morph; - private static Mongo mongo; - - private static final Database INSTANCE; - private static boolean authenticated = false; - private static Datastore ds; - - private Database() { - try { - mongo = new Mongo("ds033828.mongolab.com", 33828); - morph = new Morphia(); - morph.map(Track.class); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static Database getInstance() { - return INSTANCE; - } - - public DB getDatabase() { - DB db = mongo.getDB("heroku_app16743823"); - - if (!authenticated && !db.authenticate("moparforia", "Ub72LjsfRe".toCharArray())) { - System.out.println("Database Authentication failed!"); - return null; - } - authenticated = true; - return db; - } - - public Datastore getDatastore() { - if(!authenticated) { - ds = morph.createDatastore(mongo, "heroku_app16743823","moparforia","Ub72LjsfRe".toCharArray()); - authenticated = true; - } else if(authenticated && ds == null) { - ds = morph.createDatastore(mongo,"heroku_app16743823"); - } - - return ds; - } - - public BasicDBObject entryFor(Track track) { - DBCollection tracks = getDatabase().getCollection("tracks"); - DBCursor t = tracks.find(new BasicDBObject("data", track.getMap())); - if (t.count() >= 1) { - return (BasicDBObject) t.next(); - } - return null; - } - - private boolean authenticate(String authMethod, String email, String password) { - DBCollection users = getDatabase().getCollection("mm_users"); - DBCursor query = users.find(new BasicDBObject(authMethod, email)); - if (query.count() == 1) { - BasicDBObject user = (BasicDBObject) query.next(); - String salt = user.getString("salt"); - try { - if (SHA1.hexdigest(password + salt).equals(user.getString("hashed_password"))) { - return true; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - return false; - } - - public boolean authenticateEmail(String email, String password) { - return authenticate("email", email, password); - } - - public boolean authenticateUser(String user, String password) { - return authenticate("username", user, password); - } - - - public static void main(String[] args) { - DBCollection tracks = getInstance().getDatabase().getCollection("tracks"); - - } - - static { - INSTANCE = new Database(); - } - -} +//package org.moparforia.server.db; +// +//import com.mongodb.*; +//import org.mongodb.morphia.Datastore; +//import org.mongodb.morphia.Morphia; +//import org.moparforia.server.util.SHA1; +//import org.moparforia.shared.Track; +// +///** +// * User: Johan +// * Date: 2013-08-05 +// * Time: 12:13 +// */ +//public class Database { +// +// private static Morphia morph; +// private static MongoClient mongo; +// +// private static final Database INSTANCE; +// private static boolean authenticated = false; +// private static Datastore ds; +// +// private Database() { +// try { +// mongo = new MongoClient("ds033828.mongolab.com", 33828); +// morph = new Morphia(); +// morph.map(Track.class); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// +// public static Database getInstance() { +// return INSTANCE; +// } +// +//// public DB getDatabase() { +//// DB db = mongo.getDB("heroku_app16743823"); +//// +//// if (!authenticated && !db.authenticate("moparforia", "Ub72LjsfRe".toCharArray())) { +//// System.out.println("Database Authentication failed!"); +//// return null; +//// } +//// authenticated = true; +//// return db; +//// } +// +//// public Datastore getDatastore() { +//// if(!authenticated) { +//// ds = morph.createDatastore(mongo, "heroku_app16743823","moparforia","Ub72LjsfRe".toCharArray()); +//// authenticated = true; +//// } else if(authenticated && ds == null) { +//// ds = morph.createDatastore(mongo,"heroku_app16743823"); +//// } +//// +//// return ds; +//// } +// +// public BasicDBObject entryFor(Track track) { +// DBCollection tracks = getDatabase().getCollection("tracks"); +// DBCursor t = tracks.find(new BasicDBObject("data", track.getMap())); +// if (t.count() >= 1) { +// return (BasicDBObject) t.next(); +// } +// return null; +// } +// +// private boolean authenticate(String authMethod, String email, String password) { +// DBCollection users = getDatabase().getCollection("mm_users"); +// DBCursor query = users.find(new BasicDBObject(authMethod, email)); +// if (query.count() == 1) { +// BasicDBObject user = (BasicDBObject) query.next(); +// String salt = user.getString("salt"); +// try { +// if (SHA1.hexdigest(password + salt).equals(user.getString("hashed_password"))) { +// return true; +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// return false; +// } +// +// public boolean authenticateEmail(String email, String password) { +// return authenticate("email", email, password); +// } +// +// public boolean authenticateUser(String user, String password) { +// return authenticate("username", user, password); +// } +// +// +// public static void main(String[] args) { +// DBCollection tracks = getInstance().getDatabase().getCollection("tracks"); +// +// } +// +// static { +// INSTANCE = new Database(); +// } +// +//} diff --git a/server/src/org/moparforia/server/net/packethandlers/golf/TrackTestLoginHandler.java b/server/src/org/moparforia/server/net/packethandlers/golf/TrackTestLoginHandler.java index 82da1f77..597b78f1 100644 --- a/server/src/org/moparforia/server/net/packethandlers/golf/TrackTestLoginHandler.java +++ b/server/src/org/moparforia/server/net/packethandlers/golf/TrackTestLoginHandler.java @@ -1,7 +1,7 @@ package org.moparforia.server.net.packethandlers.golf; import org.moparforia.server.Server; -import org.moparforia.server.db.Database; +//import org.moparforia.server.db.Database; import org.moparforia.server.game.Player; import org.moparforia.server.net.Packet; import org.moparforia.server.net.PacketHandler; diff --git a/server/src/org/moparforia/server/track/TrackManager.java b/server/src/org/moparforia/server/track/TrackManager.java index 48af2e8f..4c40e6cc 100644 --- a/server/src/org/moparforia/server/track/TrackManager.java +++ b/server/src/org/moparforia/server/track/TrackManager.java @@ -1,7 +1,6 @@ package org.moparforia.server.track; -import com.github.jmkgreen.morphia.Datastore; -import org.moparforia.server.db.Database; +import org.mongodb.morphia.Datastore; import org.moparforia.server.game.Player; import org.moparforia.shared.Track; @@ -27,25 +26,25 @@ public final void load() throws IOException { loadTracks(); loadTrackSets(); hasLoaded = true; - schedule.scheduleAtFixedRate(new TrackUpdater(),5,5,TimeUnit.MINUTES); +// schedule.scheduleAtFixedRate(new TrackUpdater(),5,5,TimeUnit.MINUTES); } - private class TrackUpdater implements Runnable { - - @Override - public void run() { - Datastore ds = Database.getInstance().getDatastore(); - ArrayList list = (ArrayList) ds.find(Track.class).asList(); - int oldSize = tracks.size(); - for(Track t : list) { - if(!tracks.contains(t)) { - tracks.add(t); - } - } - - System.out.println("Added "+ (tracks.size() - oldSize) +" tracks."); - } - } +// private class TrackUpdater implements Runnable { +// +// @Override +// public void run() { +// Datastore ds = Database.getInstance().getDatastore(); +// ArrayList list = (ArrayList) ds.find(Track.class).asList(); +// int oldSize = tracks.size(); +// for(Track t : list) { +// if(!tracks.contains(t)) { +// tracks.add(t); +// } +// } +// +// System.out.println("Added "+ (tracks.size() - oldSize) +" tracks."); +// } +// } //private static final void loadTracks() { diff --git a/server/src/org/moparforia/server/util/StockTrackUploader.java b/server/src/org/moparforia/server/util/StockTrackUploader.java index e34b4257..dda325b5 100644 --- a/server/src/org/moparforia/server/util/StockTrackUploader.java +++ b/server/src/org/moparforia/server/util/StockTrackUploader.java @@ -4,7 +4,6 @@ import com.mongodb.DBCollection; import com.mongodb.DBObject; import org.moparforia.shared.Track; -import org.moparforia.server.db.Database; import org.moparforia.server.track.TrackCategory; import org.moparforia.server.track.TrackSet; import org.moparforia.server.track.TrackSetDifficulty; @@ -65,69 +64,69 @@ public boolean accept(Path entry) throws IOException { tracks.add(new Track(name, author, data, type.getId())); } } - uploadTracks(); + //uploadTracks(); System.out.println("Done."); } - private static final void loadTrackSets() throws IOException { - if (tracks == null) { - return; - } - ArrayList trackSets = new ArrayList(); - FileSystem fs = FileSystems.getDefault(); - DirectoryStream directoryStream = Files.newDirectoryStream(fs.getPath("tracks", "sets"), new DirectoryStream.Filter() { - @Override - public boolean accept(Path entry) throws IOException { - return entry.getFileName().toString().endsWith(".trackset"); - } - }); - for (Path filePath : directoryStream) { - Scanner scanner = new Scanner(filePath); - String setName = scanner.nextLine(); - TrackSetDifficulty trackSetDifficulty = TrackSetDifficulty.valueOf(scanner.nextLine()); - ArrayList fileNames = new ArrayList(); - while (scanner.hasNextLine()) { - String line = scanner.nextLine().trim(); - if(!line.isEmpty()) { - fileNames.add(line); - } - } - trackSets.add(new TrackSet(setName, trackSetDifficulty, fileNames)); - } - uploadTrackSets(trackSets); - } +// private static final void loadTrackSets() throws IOException { +// if (tracks == null) { +// return; +// } +// ArrayList trackSets = new ArrayList(); +// FileSystem fs = FileSystems.getDefault(); +// DirectoryStream directoryStream = Files.newDirectoryStream(fs.getPath("tracks", "sets"), new DirectoryStream.Filter() { +// @Override +// public boolean accept(Path entry) throws IOException { +// return entry.getFileName().toString().endsWith(".trackset"); +// } +// }); +// for (Path filePath : directoryStream) { +// Scanner scanner = new Scanner(filePath); +// String setName = scanner.nextLine(); +// TrackSetDifficulty trackSetDifficulty = TrackSetDifficulty.valueOf(scanner.nextLine()); +// ArrayList fileNames = new ArrayList(); +// while (scanner.hasNextLine()) { +// String line = scanner.nextLine().trim(); +// if(!line.isEmpty()) { +// fileNames.add(line); +// } +// } +// trackSets.add(new TrackSet(setName, trackSetDifficulty, fileNames)); +// } +// uploadTrackSets(trackSets); +// } - private static void uploadTracks() { - ArrayList _tracks = new ArrayList(); - for (Track track : tracks){ - _tracks.add(new BasicDBObjectBuilder().append("name", track.getName()). - append("author", track.getAuthor()). - append("data", track.getData()). - append("category", track.getCategory()). - append("version", 1). - append("num_completions", 0). - append("num_strokes", 0). - append("num_best_strokes", 0). - append("first_best_name", ""). - append("first_best_time", 0). - append("last_best_name", ""). - append("last_best_time", 0). - append("ratings", new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}). - append("num_best_players", 0).get()); - } - DBCollection tracks = Database.getInstance().getDatabase().getCollection("tracks"); - tracks.insert(_tracks); - } +// private static void uploadTracks() { +// ArrayList _tracks = new ArrayList(); +// for (Track track : tracks){ +// _tracks.add(new BasicDBObjectBuilder().append("name", track.getName()). +// append("author", track.getAuthor()). +// append("data", track.getData()). +// append("category", track.getCategory()). +// append("version", 1). +// append("num_completions", 0). +// append("num_strokes", 0). +// append("num_best_strokes", 0). +// append("first_best_name", ""). +// append("first_best_time", 0). +// append("last_best_name", ""). +// append("last_best_time", 0). +// append("ratings", new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}). +// append("num_best_players", 0).get()); +// } +// DBCollection tracks = Database.getInstance().getDatabase().getCollection("tracks"); +// tracks.insert(_tracks); +// } - private static void uploadTrackSets(ArrayList trackSets) { - ArrayList _tracks = new ArrayList(); - for (TrackSet track : trackSets){ - _tracks.add(new BasicDBObjectBuilder().append("name", track.getName()). - append("difficulty", track.getDifficulty().getId()). - append("times_played", 0). - append("ratings", new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}).get()); - } - DBCollection tracks = Database.getInstance().getDatabase().getCollection("track_sets"); - tracks.insert(_tracks); - } +// private static void uploadTrackSets(ArrayList trackSets) { +// ArrayList _tracks = new ArrayList(); +// for (TrackSet track : trackSets){ +// _tracks.add(new BasicDBObjectBuilder().append("name", track.getName()). +// append("difficulty", track.getDifficulty().getId()). +// append("times_played", 0). +// append("ratings", new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}).get()); +// } +// DBCollection tracks = Database.getInstance().getDatabase().getCollection("track_sets"); +// tracks.insert(_tracks); +// } } diff --git a/shared/assembly-tracks.xml b/shared/assembly-tracks.xml new file mode 100644 index 00000000..0a728c39 --- /dev/null +++ b/shared/assembly-tracks.xml @@ -0,0 +1,18 @@ + + tracks + true + + + zip + + + + ${project.basedir}/../tracks + / + + * + + + + \ No newline at end of file diff --git a/shared/pom.xml b/shared/pom.xml new file mode 100644 index 00000000..21a55e5a --- /dev/null +++ b/shared/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + + shared + 1.0 + + + org.moparforia + playforia-minigolf + 1.0 + + + + + org.mongodb + mongo-java-driver + provided + + + org.mongodb.morphia + morphia + provided + + + + src + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + tracks + false + + assembly-tracks.xml + + + + + + + + \ No newline at end of file diff --git a/shared/shared.iml b/shared/shared.iml index 6d59135e..ceb88b96 100644 --- a/shared/shared.iml +++ b/shared/shared.iml @@ -1,2 +1,17 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shared/src/org/moparforia/shared/Track.java b/shared/src/org/moparforia/shared/Track.java index e52cd19b..97f9763e 100644 --- a/shared/src/org/moparforia/shared/Track.java +++ b/shared/src/org/moparforia/shared/Track.java @@ -1,11 +1,11 @@ package org.moparforia.shared; -import com.github.jmkgreen.morphia.annotations.Entity; -import com.github.jmkgreen.morphia.annotations.Id; -import com.github.jmkgreen.morphia.annotations.Property; import com.mongodb.BasicDBList; import com.mongodb.BasicDBObject; import org.bson.types.ObjectId; +import org.mongodb.morphia.annotations.Entity; +import org.mongodb.morphia.annotations.Id; +import org.mongodb.morphia.annotations.Property; import java.util.Arrays;