From 36034e4f7b364c5bf75db6532c6a90a19e3e36fd Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 15 Jan 2018 12:23:58 +0100 Subject: [PATCH] einfach mal ein update --- .gitignore | 1 + Commons.iml | 8 +- commons.uml | 621 ++++++++++++++++++ pom.xml | 86 +-- .../commons/player/DatabasePlayer.java | 10 +- .../commons/player/party/PartyManager.java | 6 +- .../commons/player/user/UserInformation.java | 6 +- src/main/resources/config.properties | 7 +- .../java/eu/univento/commons/CommonsTest.java | 13 +- 9 files changed, 666 insertions(+), 92 deletions(-) create mode 100644 commons.uml diff --git a/.gitignore b/.gitignore index be0fa1e..a717bb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ Commons.iml /target/ +commons.png \ No newline at end of file diff --git a/Commons.iml b/Commons.iml index ed0fbf0..66015cd 100644 --- a/Commons.iml +++ b/Commons.iml @@ -11,7 +11,6 @@ - @@ -53,18 +52,17 @@ - + - - - + + \ No newline at end of file diff --git a/commons.uml b/commons.uml new file mode 100644 index 0000000..d247bd6 --- /dev/null +++ b/commons.uml @@ -0,0 +1,621 @@ + + + JAVA + eu.univento.commons + + eu.univento.commons.player.language.Language + eu.univento.commons.player.ban.BanData + eu.univento.commons.player.settings.PlayerSettings + eu.univento.commons.player.uuid.NameFetcher + eu.univento.commons.player.warn.WarnReason + eu.univento.commons.database.DatabaseManager + eu.univento.commons.player.rank.Group + eu.univento.commons.utils.Maths + eu.univento.commons.database.MongoDB + eu.univento.commons.player.currency.CurrencyType + eu.univento.commons.event.MessageEvent + eu.univento.commons.database.Redis + eu.univento.commons.Commons + eu.univento.commons.player.uuid.UUIDFetcher.SearchResult + eu.univento.commons.utils.Strings + eu.univento.commons.utils.Files + eu.univento.commons.player.rank.Rank + eu.univento.commons.player.user.UserInformation + eu.univento.commons.player.statistics.ImpactStatistics + eu.univento.commons.messaging.MessagingManager + eu.univento.commons.player.DatabasePlayer + eu.univento.commons.player.chat.ChatMessageType + eu.univento.commons.player.ban.BanReason + eu.univento.commons.player.user.Textures.Cape + eu.univento.commons.player.user.UserProperties + eu.univento.commons.CommonsTest + eu.univento.commons.player.party.PartyManager + eu.univento.commons.utils.Maths.Sin + eu.univento.commons.player.uuid.UUIDFetcher + eu.univento.commons.player.language.MessageConstant + eu.univento.commons.player.chat.ChatData + eu.univento.commons.database.MySQL + eu.univento.commons.player.ranking.Ranking + eu.univento.commons.player.user.Decoded + eu.univento.commons.player.statistics.GameStatistics + eu.univento.commons.player.user.Decoded.Value + eu.univento.commons.server.ServerType + eu.univento.commons.player.user.Textures + eu.univento.commons.player.user.Result + eu.univento.commons.server.ServerInfo + eu.univento.commons.configuration.ConfigurationHandler + eu.univento.commons.utils.Pool + eu.univento.commons.player.kick.KickReason + eu.univento.commons.player.user.History + eu.univento.commons.messaging.RabbitMQ + eu.univento.commons.player.kick.KickData + eu.univento.commons.player.uuid.UUIDFetcher.ProfileData + eu.univento.commons.utils.Maths.Atan2 + eu.univento.commons.player.friend.FriendData + eu.univento.commons.helpers.Location + eu.univento.commons.player.party.Party + eu.univento.commons.player.user.Updated + eu.univento.commons.server.TPS + eu.univento.commons.player.user.Textures.Skin + eu.univento.commons.messaging.MessageHandler + eu.univento.commons.player.mute.MuteData + eu.univento.commons.player.warn.WarnData + eu.univento.commons.player.user.Raw + eu.univento.commons.player.mute.MuteReason + eu.univento.commons.player.uuid.UUIDFetcher.PlayerProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eu.univento.commons.player.rank.Rank + eu.univento.commons.player.DatabasePlayer + eu.univento.commons.helpers.Location + eu.univento.commons.player.statistics.GameStatistics + eu.univento.commons.Commons + eu.univento.commons.player.rank.Group + eu.univento.commons.CommonsTest + eu.univento.commons.player.statistics.ImpactStatistics + + + Fields + Inner Classes + Constructors + Properties + Methods + + All + private + + diff --git a/pom.xml b/pom.xml index 7ebc8b0..b367756 100644 --- a/pom.xml +++ b/pom.xml @@ -38,64 +38,8 @@ - - gitlab - http://development.univento.eu/issues/Commons - - - - gitlab - https://development.univento.eu/ci/Commons - - - - - univentoEU - http://nexus.unit.univento.eu/repository/univento/ - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - org.apache.maven.plugins maven-assembly-plugin @@ -120,16 +64,26 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.8 + 1.8 + + + com.google.dagger + dagger-compiler + 2.14.1 + + + + - - ai.api - libai - 1.4.8 - - org.projectlombok lombok @@ -201,7 +155,7 @@ com.google.guava guava - 19.0 + 21.0 @@ -240,5 +194,11 @@ test + + com.google.dagger + dagger + 2.14.1 + + \ No newline at end of file diff --git a/src/main/java/eu/univento/commons/player/DatabasePlayer.java b/src/main/java/eu/univento/commons/player/DatabasePlayer.java index b9c3a18..82e5408 100644 --- a/src/main/java/eu/univento/commons/player/DatabasePlayer.java +++ b/src/main/java/eu/univento/commons/player/DatabasePlayer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -54,8 +54,12 @@ public class DatabasePlayer { this.uuid = uuid; } + public DatabasePlayer(String name) { + UserInformation.get(name).whenComplete((userInformation, throwable) -> new DatabasePlayer(UUID.fromString(userInformation.getUuid()))); + } + public void load(String host) { - Commons.getCommons().getDatabaseManager().getMongoDB().getClient().find("players", new JsonObject().put("uuid", uuid), res -> { + Commons.getCommons().getDatabaseManager().getMongoDB().getClient().find("players", new JsonObject().put("uuid", uuid.toString()), res -> { if(res.succeeded()) { if(res.result().isEmpty()) insert(host); }else { @@ -91,7 +95,7 @@ public class DatabasePlayer { } private void update() { - Commons.getCommons().getDatabaseManager().getMongoDB().getClient().findOne("players", new JsonObject().put("uuid", uuid), null, res -> { + Commons.getCommons().getDatabaseManager().getMongoDB().getClient().findOne("players", new JsonObject().put("uuid", uuid.toString()), null, res -> { if(res.failed()) res.cause().printStackTrace(); json = res.result(); }); diff --git a/src/main/java/eu/univento/commons/player/party/PartyManager.java b/src/main/java/eu/univento/commons/player/party/PartyManager.java index a2ee0b6..71b4f6d 100644 --- a/src/main/java/eu/univento/commons/player/party/PartyManager.java +++ b/src/main/java/eu/univento/commons/player/party/PartyManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -39,9 +39,7 @@ public class PartyManager { CompletableFuture future = new CompletableFuture<>(); Commons.getCommons().getDatabaseManager().getMongoDB().getClient().findOne("partys", new JsonObject().put("owner", player.getUuid().toString()), null, res -> { if(res.succeeded()) { - getParty(UUID.fromString(res.result().getString("id"))).whenComplete((party, throwable) -> { - future.complete(party); - }); + getParty(UUID.fromString(res.result().getString("id"))).whenComplete((party, throwable) -> future.complete(party)); } }); return future; diff --git a/src/main/java/eu/univento/commons/player/user/UserInformation.java b/src/main/java/eu/univento/commons/player/user/UserInformation.java index a221da9..e9dc7d3 100644 --- a/src/main/java/eu/univento/commons/player/user/UserInformation.java +++ b/src/main/java/eu/univento/commons/player/user/UserInformation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ @@ -20,14 +20,14 @@ import java.util.concurrent.CompletableFuture; @Getter @AllArgsConstructor -public class UserInformation { +public class UserInformation{ private static WebClient client; public static CompletableFuture get(String identifier) { CompletableFuture future = new CompletableFuture<>(); if(client == null) client = WebClient.create(Commons.getCommons().getVertx()); - client.getAbs("https://mcapi.de/api/user/" + identifier).ssl(true).send(ar -> { + client.getAbs("https://api.univento.eu/private/player/" + identifier).ssl(true).send(ar -> { if(ar.succeeded()) { future.complete(ar.result().bodyAsJsonObject().mapTo(UserInformation.class)); }else future.complete(null); diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties index ae4bc13..2b71c09 100644 --- a/src/main/resources/config.properties +++ b/src/main/resources/config.properties @@ -1,3 +1,8 @@ +# +# Copyright (c) 2018 univento.eu - All rights reserved +# You are not allowed to use, distribute or modify this code +# + MySQL.Host = univento.eu MySQL.Port = 3306 MySQL.Username = custo_univento @@ -20,8 +25,6 @@ RabbitMQ.Port = 5672 RabbitMQ.Username = univento RabbitMQ.Password = tYRHXZNm4exW@QB6rMm72pHnafrT8wQ5ebGPEetJDBVU2mj25kTVXuYeQavb#EYr RabbitMQ.VirtualHost = univento -Slack.hook_url = https://hooks.slack.com/services/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 -api.ai.token = e1c97924577a4743800b3fefb16dd527 Sentry.DSN.Commons = http://6b35ae68e540439da1a9b51ab3b2928e:0afbbeccc1a14ae4a10f9ba1775c93b7@sentry.dev.univento.eu/3 Sentry.DSN.Core = http://f5b6c0945a334f9398fc5baf89893c00:481956843e3c45b3be9a899f3e5fccb7@sentry.dev.univento.eu/4 Sentry.DSN.BungeeCore = http://5e48cd49a4124515aae49dac2b42a317:7c123d87046f47c987c0e2f5adadfd48@sentry.dev.univento.eu/5 \ No newline at end of file diff --git a/src/test/java/eu/univento/commons/CommonsTest.java b/src/test/java/eu/univento/commons/CommonsTest.java index 5e9c42c..9af3817 100644 --- a/src/test/java/eu/univento/commons/CommonsTest.java +++ b/src/test/java/eu/univento/commons/CommonsTest.java @@ -1,17 +1,15 @@ /* - * Copyright (c) 2017 univento.eu - All rights reserved + * Copyright (c) 2018 univento.eu - All rights reserved * You are not allowed to use, distribute or modify this code */ package eu.univento.commons; import eu.univento.commons.database.DatabaseManager; -import eu.univento.commons.player.user.UserInformation; import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicReference; import static org.awaitility.Awaitility.await; @@ -36,15 +34,6 @@ public class CommonsTest { commons.shutdown(); } - @Test - public void testUserInformationName() { - try { - assertTrue(UserInformation.get("069a79f444e94726a5befca90e38aaf5").get().getUsername().equals("Notch")); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - } - @Test public void testCommons() { assertNotNull(commons);