added Ranking System
This commit is contained in:
parent
5ee9cd550b
commit
1fa03cb94a
13
Commons.iml
13
Commons.iml
|
@ -6,27 +6,30 @@
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.8" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-async:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-async:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.2.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:bson:3.2.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: io.netty:netty-all:4.0.36.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb.morphia:morphia:1.2.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.3.1" level="project" />
|
<orderEntry type="library" name="Maven: cglib:cglib-nodep:2.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.thoughtworks.proxytoys:proxytoys:1.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.4.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.16" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:19.0" level="project" />
|
<orderEntry type="library" name="Maven: io.netty:netty-all:4.0.36.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.3.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:19.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.6.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.6.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.4" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
82
pom.xml
82
pom.xml
|
@ -66,53 +66,15 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>com.github.wvengen</groupId>
|
|
||||||
<artifactId>proguard-maven-plugin</artifactId>
|
|
||||||
<version>2.0.13</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>proguard</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<obfuscate>true</obfuscate>
|
|
||||||
<injar>${project.build.finalName}.jar</injar>
|
|
||||||
<outjar>${project.build.finalName}-small.jar</outjar>
|
|
||||||
<includeDependency>true</includeDependency>
|
|
||||||
<options>
|
|
||||||
<option>-keep public class eu.univento.commons.Commons { *; }</option>
|
|
||||||
</options>
|
|
||||||
<libs>
|
|
||||||
<lib>${java.home}/lib/rt.jar</lib>
|
|
||||||
<lib>${java.home}/lib/jce.jar</lib>
|
|
||||||
</libs>
|
|
||||||
<archive>
|
|
||||||
<manifest>
|
|
||||||
<mainClass>Commons</mainClass>
|
|
||||||
<packageName>eu.univento.commons</packageName>
|
|
||||||
</manifest>
|
|
||||||
</archive>
|
|
||||||
|
|
||||||
</configuration>
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.sf.proguard</groupId>
|
|
||||||
<artifactId>proguard-base</artifactId>
|
|
||||||
<version>5.2.1</version>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.16.8</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mongodb</groupId>
|
<groupId>org.mongodb</groupId>
|
||||||
<artifactId>mongo-java-driver</artifactId>
|
<artifactId>mongo-java-driver</artifactId>
|
||||||
|
@ -123,6 +85,16 @@
|
||||||
<artifactId>mongodb-driver-async</artifactId>
|
<artifactId>mongodb-driver-async</artifactId>
|
||||||
<version>3.2.2</version>
|
<version>3.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mongodb.morphia</groupId>
|
||||||
|
<artifactId>morphia</artifactId>
|
||||||
|
<version>1.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zaxxer</groupId>
|
||||||
|
<artifactId>HikariCP</artifactId>
|
||||||
|
<version>2.4.5</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-all</artifactId>
|
<artifactId>netty-all</artifactId>
|
||||||
|
@ -133,26 +105,15 @@
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.zaxxer</groupId>
|
|
||||||
<artifactId>HikariCP</artifactId>
|
|
||||||
<version>2.4.5</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.guava</groupId>
|
|
||||||
<artifactId>guava</artifactId>
|
|
||||||
<version>19.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.googlecode.json-simple</groupId>
|
<groupId>com.googlecode.json-simple</groupId>
|
||||||
<artifactId>json-simple</artifactId>
|
<artifactId>json-simple</artifactId>
|
||||||
<version>1.1.1</version>
|
<version>1.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>joda-time</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>joda-time</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>2.9.4</version>
|
<version>19.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
@ -172,7 +133,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>RELEASE</version>
|
<version>2.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>2.9.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -40,7 +40,6 @@ public class Commons {
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
getDatabaseManager().closeConnections();
|
getDatabaseManager().closeConnections();
|
||||||
//loggingHandler.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,6 +17,7 @@ public class DatabaseManager {
|
||||||
|
|
||||||
public DatabaseManager(Commons commons) {
|
public DatabaseManager(Commons commons) {
|
||||||
ConfigurationHandler config = commons.getConfigurationHandler();
|
ConfigurationHandler config = commons.getConfigurationHandler();
|
||||||
|
//TODO: remove hardcoded variables
|
||||||
mongoDB = new MongoDB(config.getString("MongoDB.Host"), config.getInteger("MongoDB.Port"), config.getString("MongoDB.Username"), config.getString("MongoDB.Password"), config.getString("MongoDB.Database"));
|
mongoDB = new MongoDB(config.getString("MongoDB.Host"), config.getInteger("MongoDB.Port"), config.getString("MongoDB.Username"), config.getString("MongoDB.Password"), config.getString("MongoDB.Database"));
|
||||||
asyncMongoDB = new AsyncMongoDB(config.getString("MongoDB.Host"), config.getInteger("MongoDB.Port"), config.getString("MongoDB.Username"), config.getString("MongoDB.Password"), config.getString("MongoDB.Database"));
|
asyncMongoDB = new AsyncMongoDB(config.getString("MongoDB.Host"), config.getInteger("MongoDB.Port"), config.getString("MongoDB.Username"), config.getString("MongoDB.Password"), config.getString("MongoDB.Database"));
|
||||||
mySQL = new MySQL(config.getString("MySQL.Host"), config.getString("MySQL.Port"), config.getString("MySQL.Database"), config.getString("MySQL.Username"), config.getString("MySQL.Password"));
|
mySQL = new MySQL(config.getString("MySQL.Host"), config.getString("MySQL.Port"), config.getString("MySQL.Database"), config.getString("MySQL.Username"), config.getString("MySQL.Password"));
|
||||||
|
|
|
@ -13,20 +13,10 @@ import java.sql.SQLException;
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*/
|
*/
|
||||||
public class MySQL {
|
public class MySQL {
|
||||||
private final String username;
|
|
||||||
private final String database;
|
|
||||||
private final String password;
|
|
||||||
private final String port;
|
|
||||||
private final String hostname;
|
|
||||||
|
|
||||||
private final HikariDataSource dataSource;
|
private final HikariDataSource dataSource;
|
||||||
|
|
||||||
public MySQL(String hostname, String port, String database, String username, String password) {
|
public MySQL(String hostname, String port, String database, String username, String password) {
|
||||||
this.username = username;
|
|
||||||
this.database = database;
|
|
||||||
this.password = password;
|
|
||||||
this.port = port;
|
|
||||||
this.hostname = hostname;
|
|
||||||
HikariConfig config = new HikariConfig();
|
HikariConfig config = new HikariConfig();
|
||||||
config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database);
|
config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database);
|
||||||
config.setUsername(username);
|
config.setUsername(username);
|
||||||
|
@ -38,8 +28,13 @@ public class MySQL {
|
||||||
dataSource = new HikariDataSource(config);
|
dataSource = new HikariDataSource(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void close() {
|
public void close() {
|
||||||
dataSource.close();
|
try {
|
||||||
|
dataSource.getConnection().close();
|
||||||
|
dataSource.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public HikariDataSource getDataSource() {
|
public HikariDataSource getDataSource() {
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package eu.univento.commons.helpers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
public class Location {
|
||||||
|
|
||||||
|
private final String world;
|
||||||
|
private final double x;
|
||||||
|
private final double y;
|
||||||
|
private final double z;
|
||||||
|
private final float pitch;
|
||||||
|
private final float yaw;
|
||||||
|
|
||||||
|
public Location(String world, double x, double y, double z, float pitch, float yaw) {
|
||||||
|
this.world = world;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.pitch = pitch;
|
||||||
|
this.yaw = yaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorld() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getZ() {
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getPitch() {
|
||||||
|
return pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getYaw() {
|
||||||
|
return yaw;
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,8 +35,4 @@ public class LoggingHandler {
|
||||||
|
|
||||||
public LoggingHandler() {
|
public LoggingHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
|
||||||
LogManager.shutdown();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -8,12 +8,14 @@ import eu.univento.commons.database.MongoDB;
|
||||||
import eu.univento.commons.player.ban.BanData;
|
import eu.univento.commons.player.ban.BanData;
|
||||||
import eu.univento.commons.player.ban.BanReason;
|
import eu.univento.commons.player.ban.BanReason;
|
||||||
import eu.univento.commons.player.friend.FriendData;
|
import eu.univento.commons.player.friend.FriendData;
|
||||||
|
import eu.univento.commons.player.hacks.HackData;
|
||||||
import eu.univento.commons.player.kick.KickData;
|
import eu.univento.commons.player.kick.KickData;
|
||||||
import eu.univento.commons.player.kick.KickReason;
|
import eu.univento.commons.player.kick.KickReason;
|
||||||
import eu.univento.commons.player.language.Language;
|
import eu.univento.commons.player.language.Language;
|
||||||
import eu.univento.commons.player.mute.MuteData;
|
import eu.univento.commons.player.mute.MuteData;
|
||||||
import eu.univento.commons.player.mute.MuteReason;
|
import eu.univento.commons.player.mute.MuteReason;
|
||||||
import eu.univento.commons.player.profiles.Profile;
|
import eu.univento.commons.player.profiles.Profile;
|
||||||
|
import eu.univento.commons.player.ranking.PlayerRanking;
|
||||||
import eu.univento.commons.player.settings.PlayerSettings;
|
import eu.univento.commons.player.settings.PlayerSettings;
|
||||||
import eu.univento.commons.player.warn.WarnData;
|
import eu.univento.commons.player.warn.WarnData;
|
||||||
import eu.univento.commons.player.warn.WarnReason;
|
import eu.univento.commons.player.warn.WarnReason;
|
||||||
|
@ -29,10 +31,10 @@ import java.util.stream.Collectors;
|
||||||
public class DatabasePlayer {
|
public class DatabasePlayer {
|
||||||
|
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
private Commons commons;
|
|
||||||
|
|
||||||
private final MongoDB mongoDB;
|
|
||||||
private final PlayerSettings settings;
|
private final PlayerSettings settings;
|
||||||
|
private final PlayerRanking ranking;
|
||||||
|
private final HackData hackData;
|
||||||
|
|
||||||
private final MongoCollection<Document> playerCollection;
|
private final MongoCollection<Document> playerCollection;
|
||||||
private final MongoCollection<Document> friendCollection;
|
private final MongoCollection<Document> friendCollection;
|
||||||
|
@ -44,11 +46,12 @@ public class DatabasePlayer {
|
||||||
private final MongoCollection<Document> profileCollection;
|
private final MongoCollection<Document> profileCollection;
|
||||||
|
|
||||||
public DatabasePlayer(Commons commons, UUID uuid) {
|
public DatabasePlayer(Commons commons, UUID uuid) {
|
||||||
this.commons = commons;
|
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
settings = new PlayerSettings(this);
|
settings = new PlayerSettings(this);
|
||||||
|
ranking = new PlayerRanking(this);
|
||||||
|
hackData = new HackData(this);
|
||||||
|
|
||||||
this.mongoDB = commons.getDatabaseManager().getMongoDB();
|
MongoDB mongoDB = commons.getDatabaseManager().getMongoDB();
|
||||||
playerCollection = mongoDB.getDatabase().getCollection("players");
|
playerCollection = mongoDB.getDatabase().getCollection("players");
|
||||||
friendCollection = mongoDB.getDatabase().getCollection("friends");
|
friendCollection = mongoDB.getDatabase().getCollection("friends");
|
||||||
onlinePlayerCollection = mongoDB.getDatabase().getCollection("online-players");
|
onlinePlayerCollection = mongoDB.getDatabase().getCollection("online-players");
|
||||||
|
@ -95,6 +98,14 @@ public class DatabasePlayer {
|
||||||
return profileCollection;
|
return profileCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerRanking getPlayerRanking() {
|
||||||
|
return ranking;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HackData getHackData() {
|
||||||
|
return hackData;
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<Profile> getProfiles() {
|
public Collection<Profile> getProfiles() {
|
||||||
ArrayList<String> list = getArrayListFromDatabase("profiles");
|
ArrayList<String> list = getArrayListFromDatabase("profiles");
|
||||||
return list.stream().map(id -> new Profile(this, id)).collect(Collectors.toCollection(LinkedList::new));
|
return list.stream().map(id -> new Profile(this, id)).collect(Collectors.toCollection(LinkedList::new));
|
||||||
|
@ -118,9 +129,9 @@ public class DatabasePlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BanData getBan() {
|
public BanData getBan() {
|
||||||
if(!isBanned()) return null;
|
|
||||||
FindIterable<Document> cursor = banCollection.find(new Document("uuid", uuid.toString()));
|
FindIterable<Document> cursor = banCollection.find(new Document("uuid", uuid.toString()));
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
cursor.cursorType(CursorType.NonTailable);
|
||||||
|
if(cursor.first() == null) return null;
|
||||||
Document doc = cursor.first();
|
Document doc = cursor.first();
|
||||||
return new BanData(BanReason.valueOf(doc.getString("reason")), UUID.fromString(doc.getString("banner")), doc.getString("customMessage"), doc.getDate("date"), doc.getString("proof"));
|
return new BanData(BanReason.valueOf(doc.getString("reason")), UUID.fromString(doc.getString("banner")), doc.getString("customMessage"), doc.getDate("date"), doc.getString("proof"));
|
||||||
}
|
}
|
||||||
|
@ -192,9 +203,13 @@ public class DatabasePlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mute(UUID muter, MuteReason reason) {
|
public void mute(UUID muter, MuteReason reason) {
|
||||||
|
int i = 0;
|
||||||
|
if(getAllBans().size() > 1) {
|
||||||
|
for (MuteData mute : getAllMutes()) i =+ mute.getReason().getValue();
|
||||||
|
}
|
||||||
Document doc = new Document("uuid", uuid.toString());
|
Document doc = new Document("uuid", uuid.toString());
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_YEAR, reason.getTime());
|
calendar.add(Calendar.DAY_OF_YEAR, reason.getValue() + i);
|
||||||
doc.put("reason", reason.name());
|
doc.put("reason", reason.name());
|
||||||
doc.put("muter", muter.toString());
|
doc.put("muter", muter.toString());
|
||||||
doc.put("date", calendar.getTime());
|
doc.put("date", calendar.getTime());
|
||||||
|
|
|
@ -6,21 +6,21 @@ package eu.univento.commons.player;
|
||||||
*/
|
*/
|
||||||
public enum Rank {
|
public enum Rank {
|
||||||
|
|
||||||
Admin(16, 107, 5, "§4", "§8[§4Admin§8] ", " §8»§7 ", "a", "§4Admin | "),
|
Admin(16, 107, 5, "§4", "§8[§4Admin§8] §4", " §8»§7 ", "a", "§4Admin | "),
|
||||||
SrDeveloper(15, 141, 18, "§3", "§8[§3SrDev§8] ", " §8»§7 ", "c", "§3SrDev | "),
|
SrDeveloper(15, 141, 18, "§3", "§8[§3SrDev§8] §3", " §8»§7 ", "c", "§3SrDev | "),
|
||||||
SrBuilder(14, 142, 15, "§2", "§8[§2SrBuilder§8] ", " §8»§7 ", "f", "§2SrBuilder | "),
|
SrBuilder(14, 142, 15, "§2", "§8[§2SrBuilder§8] §2", " §8»§7 ", "f", "§2SrBuilder | "),
|
||||||
SrSupporter(13, 149, 12, "§9", "§8[§9SrSupr§8] ", " §8»§7 ", "i", "§9SrSup | "),
|
SrSupporter(13, 149, 12, "§9", "§8[§9SrSupr§8] §9", " §8»§7 ", "i", "§9SrSup | "),
|
||||||
Developer(12, 144, 17, "§3", "§8[§3Dev§8] ", " §8»§7 ", "d", "§3Dev | "),
|
Developer(12, 144, 17, "§3", "§8[§3Dev§8] §3", " §8»§7 ", "d", "§3Dev | "),
|
||||||
Builder(11, 145, 14, "§2", "§8[§2Builder§8] ", " §8»§7 ", "g", "§2Builder | "),
|
Builder(11, 145, 14, "§2", "§8[§2Builder§8] §2", " §8»§7 ", "g", "§2Builder | "),
|
||||||
Supporter(10, 146, 11, "§9", "§8[§9Sup§8] ", " §8»§7 ", "j", "§9Sup | "),
|
Supporter(10, 146, 11, "§9", "§8[§9Sup§8] §9", " §8»§7 ", "j", "§9Sup | "),
|
||||||
JrDeveloper(9, 147, 16, "§3", "§8[§3JrDev§8] ", " §8»§7 ", "e", "§3JrDev | "),
|
JrDeveloper(9, 147, 16, "§3", "§8[§3JrDev§8] §3", " §8»§7 ", "e", "§3JrDev | "),
|
||||||
JrBuilder(8, 148, 13, "§2", "§8[§2JrBuilder§8] ", " §8»§7 ", "h", "§2JrBuilder | "),
|
JrBuilder(8, 148, 13, "§2", "§8[§2JrBuilder§8] §2", " §8»§7 ", "h", "§2JrBuilder | "),
|
||||||
JrSupporter(7, 149, 10, "§9", "§8[§9JrSup§8] ", " §8»§7 ", "k", "§9JrSup | "),
|
JrSupporter(7, 149, 10, "§9", "§8[§9JrSup§8] §9", " §8»§7 ", "k", "§9JrSup | "),
|
||||||
Manager(6, 150, 19, "§c", "§8[§cManager§8] ", " §8»§7 ", "b", "§cManager | "),
|
Manager(6, 150, 19, "§c", "§8[§cManager§8] §c", " §8»§7 ", "b", "§cManager | "),
|
||||||
Grafik(5, 151, 8, "§e", "§8[§eGrafiker§8] ", " §8»§7 ", "l", "§eGrafik | "),
|
Grafik(5, 151, 8, "§e", "§8[§eGrafiker§8] §e", " §8»§7 ", "l", "§eGrafik | "),
|
||||||
Sound(4, 152, 9, "§e", "§8[§eSound§8] ", " §8»§7 ", "m", "§eSound | "),
|
Sound(4, 152, 9, "§e", "§8[§eSound§8] §e", " §8»§7 ", "m", "§eSound | "),
|
||||||
Partner(3, 155, 7, "§5", "§5", " §8»§7 ", "n", "§5"),
|
Partner(3, 155, 7, "§5", "§5", " §8»§7 ", "n", "§5"),
|
||||||
Premium(2, 156, 6, "§6", "§6", " §8§7» ", "o", "§6"),
|
Premium(2, 156, 6, "§6", "§6", " §8»§7 ", "o", "§6"),
|
||||||
Player(1, 164, 2, "§7", "§7", " §8»§7 ", "p", "§7");
|
Player(1, 164, 2, "§7", "§7", " §8»§7 ", "p", "§7");
|
||||||
|
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
|
@ -54,6 +54,8 @@ public class BanData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBannerName() {
|
public String getBannerName() {
|
||||||
|
if(banner == null)
|
||||||
|
return "Auto Ban";
|
||||||
return NameFetcher.getRequest(banner);
|
return NameFetcher.getRequest(banner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,26 +6,23 @@ package eu.univento.commons.player.ban;
|
||||||
*/
|
*/
|
||||||
public enum BanReason {
|
public enum BanReason {
|
||||||
|
|
||||||
//int represents ban points, ban points represent ban time
|
HACK_CRITICALS("Ban.Reason.Hack.Criticals", 10),
|
||||||
HACK_CRITICALS("Criticals Hack", 10),
|
HACK_AUTOCLICKER("Ban.Reason.Hack.Autoclicker", 10),
|
||||||
HACK_AUTOCLICKER("AutoClicker Hack", 10),
|
HACK_GLIDE("Ban.Reason.Hack.Glide", 10),
|
||||||
HACK_GLIDE("Glide Hack", 10),
|
HACK_REACH("Ban.Reason.Hack.Reach", 10),
|
||||||
HACK_REACH("Reach Hack", 10),
|
HACK_NOSLOWDOWN("Ban.Reason.Hack.NoSlowDown", 10),
|
||||||
HACK_NOSLOWDOWN("NoSlowDown Hack", 10),
|
HACK_REGEN("Ban.Reason.Hack.Regen", 10),
|
||||||
HACK_REGEN("Regen Hack", 10),
|
HACK_AUTORESPAWN("Ban.Reason.Hack.AutoRespawn", 10),
|
||||||
HACK_AUTORESPAWN("AutoRespawn Hack", 10),
|
HACK_FASTPLACE("Ban.Reason.Hack.FastPlace", 10),
|
||||||
HACK_FASTPLACE("FastPlace Hack", 10),
|
HACK_KILLAURA("Ban.Reason.Hack.KillAura", 10),
|
||||||
HACK_KILLAURA("KillAura Hack", 10),
|
HACK_FLY("Ban.Reason.Hack.Fly", 10),
|
||||||
HACK_FLY("Fly Hack", 10),
|
HACK_WDL("Ban.Reason.Hack.WDL", 10),
|
||||||
HACK_WDL("Massive use of WorldDownloader", 10),
|
GRIEFING("Ban.Reason.Griefing", 10),
|
||||||
ADVERTISING("Advertising", 10),
|
BUGUSING("Ban.Reason.Bugusing", 10),
|
||||||
GRIEFING("Griefing", 10),
|
HACKED_ACCOUNT("Ban.Reason.Hacked_Account", 10),
|
||||||
INSULT("Insut", 10),
|
TO_MANY_WARNS("Ban.Reason.Warns", 10),
|
||||||
RACISM("Racism", 10),
|
TO_MANY_MUTES("Ban.Reason.Mutes", 10),
|
||||||
BUGUSING("Bugusing", 10),
|
CUSTOM("Ban.Reason.Custom", 10);
|
||||||
HACKED_ACCOUNT("using hacked account", 10),
|
|
||||||
TO_MANY_WARNS("To many warns", 10),
|
|
||||||
CUSTOM("Custom", 10);
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
package eu.univento.commons.player.hacks;
|
||||||
|
|
||||||
|
import eu.univento.commons.helpers.Location;
|
||||||
|
import eu.univento.commons.player.DatabasePlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
public class HackData {
|
||||||
|
|
||||||
|
private DatabasePlayer player;
|
||||||
|
private Location lastLocation;
|
||||||
|
private Location realLocation;
|
||||||
|
private boolean lastHealth;
|
||||||
|
private long lastPlacedBlock;
|
||||||
|
private long lastBow;
|
||||||
|
private long lastRegen;
|
||||||
|
private long lastAnimation;
|
||||||
|
private long lastForcefield;
|
||||||
|
private long lastY;
|
||||||
|
private long highestY;
|
||||||
|
private boolean ascending;
|
||||||
|
private boolean descending;
|
||||||
|
private Location lastBlockLocation;
|
||||||
|
private double blocksMoved;
|
||||||
|
private int fakePlayer;
|
||||||
|
private long lastTimeFakePlayerAttack;
|
||||||
|
private long lastFood;
|
||||||
|
private long lastInventory;
|
||||||
|
private long lastNotification;
|
||||||
|
|
||||||
|
public HackData(DatabasePlayer player) {
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatabasePlayer getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayer(DatabasePlayer player) {
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLastLocation() {
|
||||||
|
return lastLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastLocation(Location lastLocation) {
|
||||||
|
this.lastLocation = lastLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getRealLocation() {
|
||||||
|
return realLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRealLocation(Location realLocation) {
|
||||||
|
this.realLocation = realLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLastHealth() {
|
||||||
|
return lastHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastHealth(boolean lastHealth) {
|
||||||
|
this.lastHealth = lastHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastPlacedBlock() {
|
||||||
|
return lastPlacedBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastPlacedBlock(long lastPlacedBlock) {
|
||||||
|
this.lastPlacedBlock = lastPlacedBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastBow() {
|
||||||
|
return lastBow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastBow(long lastBow) {
|
||||||
|
this.lastBow = lastBow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastRegen() {
|
||||||
|
return lastRegen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastRegen(long lastRegen) {
|
||||||
|
this.lastRegen = lastRegen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastAnimation() {
|
||||||
|
return lastAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastAnimation(long lastAnimation) {
|
||||||
|
this.lastAnimation = lastAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastForcefield() {
|
||||||
|
return lastForcefield;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastForcefield(long lastForcefield) {
|
||||||
|
this.lastForcefield = lastForcefield;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastY() {
|
||||||
|
return lastY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastY(long lastY) {
|
||||||
|
this.lastY = lastY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getHighestY() {
|
||||||
|
return highestY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHighestY(long highestY) {
|
||||||
|
this.highestY = highestY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAscending() {
|
||||||
|
return ascending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAscending(boolean ascending) {
|
||||||
|
this.ascending = ascending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDescending() {
|
||||||
|
return descending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescending(boolean descending) {
|
||||||
|
this.descending = descending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLastBlockLocation() {
|
||||||
|
return lastBlockLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastBlockLocation(Location lastBlockLocation) {
|
||||||
|
this.lastBlockLocation = lastBlockLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getBlocksMoved() {
|
||||||
|
return blocksMoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlocksMoved(double blocksMoved) {
|
||||||
|
this.blocksMoved = blocksMoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFakePlayer() {
|
||||||
|
return fakePlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFakePlayer(int fakePlayer) {
|
||||||
|
this.fakePlayer = fakePlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastTimeFakePlayerAttack() {
|
||||||
|
return lastTimeFakePlayerAttack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastTimeFakePlayerAttack(long lastTimeFakePlayerAttack) {
|
||||||
|
this.lastTimeFakePlayerAttack = lastTimeFakePlayerAttack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastFood() {
|
||||||
|
return lastFood;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastFood(long lastFood) {
|
||||||
|
this.lastFood = lastFood;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastInventory() {
|
||||||
|
return lastInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastInventory(long lastInventory) {
|
||||||
|
this.lastInventory = lastInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastNotification() {
|
||||||
|
return lastNotification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastNotification(long lastNotification) {
|
||||||
|
this.lastNotification = lastNotification;
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,6 +34,8 @@ public class KickData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKickerName() {
|
public String getKickerName() {
|
||||||
|
if(kicker == null)
|
||||||
|
return "Auto Kick";
|
||||||
return NameFetcher.getRequest(kicker);
|
return NameFetcher.getRequest(kicker);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,7 @@ public enum KickReason {
|
||||||
private int points;
|
private int points;
|
||||||
|
|
||||||
KickReason(String name, int points) {
|
KickReason(String name, int points) {
|
||||||
|
this.name = name;
|
||||||
this.points = points;
|
this.points = points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package eu.univento.commons.player.mute;
|
package eu.univento.commons.player.mute;
|
||||||
|
|
||||||
import eu.univento.commons.player.uuid.NameFetcher;
|
import eu.univento.commons.player.uuid.NameFetcher;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.Period;
|
||||||
|
import org.joda.time.format.PeriodFormatter;
|
||||||
|
import org.joda.time.format.PeriodFormatterBuilder;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -40,6 +44,29 @@ public class MuteData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMuterName() {
|
public String getMuterName() {
|
||||||
|
if(muter == null)
|
||||||
|
return "Auto Mute";
|
||||||
return NameFetcher.getRequest(muter);
|
return NameFetcher.getRequest(muter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTimeTillUnmute() {
|
||||||
|
assert getDate() != null;
|
||||||
|
final DateTime end = new DateTime(getDate().getTime());
|
||||||
|
final DateTime now = new DateTime(new Date().getTime());
|
||||||
|
Period period = new Period(now, end);
|
||||||
|
PeriodFormatter formatter = new PeriodFormatterBuilder().printZeroAlways().minimumPrintedDigits(2)
|
||||||
|
.appendYears().appendSuffix(" Jahr", " Jahre")
|
||||||
|
.appendSeparator(", ")
|
||||||
|
.appendMonths().appendSuffix(" Monat", " Monate")
|
||||||
|
.appendSeparator(", ")
|
||||||
|
.appendDays().appendSuffix(" Tag", " Tage")
|
||||||
|
.appendSeparator(" und ")
|
||||||
|
.appendHours().appendSuffix(" Stunde", " Stunden")
|
||||||
|
.appendMinutes().appendSuffix(" Minute", " Minuten")
|
||||||
|
.appendSeconds().appendSuffix(" Sekunde", " Sekunden")
|
||||||
|
.toFormatter();
|
||||||
|
|
||||||
|
return period.toString(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -6,21 +6,28 @@ package eu.univento.commons.player.mute;
|
||||||
*/
|
*/
|
||||||
public enum MuteReason {
|
public enum MuteReason {
|
||||||
|
|
||||||
SPAM("Spam", 30);
|
SPAM("Mute.Reason.Spam", 1),
|
||||||
|
ADVERTISMENT("Mute.Reason.Advertisement", 3),
|
||||||
|
RASISM("Mute.Reason.Rasim", 5),
|
||||||
|
SEXISM("Mute.Reason.Sexism", 1),
|
||||||
|
THREAT("Mute.Reason.Threat", 30),
|
||||||
|
INSULT("Mute.Reason.Insult", 1),
|
||||||
|
WORD_CHOICE("Mute.Reason.Word_Choice", 1);
|
||||||
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private int time;
|
private int value;
|
||||||
|
|
||||||
MuteReason(String name, int time) {
|
MuteReason(String name, int value) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.time = time;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTime() {
|
public int getValue() {
|
||||||
return time;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,24 +0,0 @@
|
||||||
package eu.univento.commons.player.profiles;
|
|
||||||
|
|
||||||
import com.mongodb.client.MongoCollection;
|
|
||||||
import eu.univento.commons.player.DatabasePlayer;
|
|
||||||
import org.bson.Document;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author joethei
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public class PlayerProfiles {
|
|
||||||
|
|
||||||
private UUID uuid;
|
|
||||||
private final MongoCollection<Document> collection;
|
|
||||||
|
|
||||||
public PlayerProfiles(DatabasePlayer player) {
|
|
||||||
this.uuid = player.getUuid();
|
|
||||||
this.collection = player.getProfileCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -24,6 +24,7 @@ public class Profile {
|
||||||
private Collection<StoryItem> items;
|
private Collection<StoryItem> items;
|
||||||
|
|
||||||
public Profile(DatabasePlayer player, String id) {
|
public Profile(DatabasePlayer player, String id) {
|
||||||
|
this.player = player;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
FindIterable<Document> cursor = player.getProfileCollection().find(new Document("_id", id));
|
FindIterable<Document> cursor = player.getProfileCollection().find(new Document("_id", id));
|
||||||
cursor.cursorType(CursorType.NonTailable);
|
cursor.cursorType(CursorType.NonTailable);
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package eu.univento.commons.player.ranking;
|
||||||
|
|
||||||
|
import eu.univento.commons.player.DatabasePlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
public class PlayerRanking {
|
||||||
|
|
||||||
|
private final DatabasePlayer player;
|
||||||
|
|
||||||
|
public PlayerRanking(DatabasePlayer player){
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ranking getRanking() {
|
||||||
|
return Ranking.getRanking(player.getIntegerFromDatabase("ranking"));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package eu.univento.commons.player.ranking;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author joethei
|
||||||
|
* @version 0.1
|
||||||
|
*/
|
||||||
|
public enum Ranking {
|
||||||
|
|
||||||
|
SILVER_1("Silver 1", 2, 5);
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private int min;
|
||||||
|
private int max;
|
||||||
|
|
||||||
|
Ranking(String name, int min, int max) {
|
||||||
|
this.name = name;
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMin() {
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMax() {
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Ranking getRanking(int ranking) {
|
||||||
|
for(Ranking rank : values()) {
|
||||||
|
if(rank.getMax() > ranking && rank.getMin() < ranking) {
|
||||||
|
return rank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -40,10 +40,8 @@ public class WarnData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWarnerName() {
|
public String getWarnerName() {
|
||||||
if(warner == null) {
|
if(warner == null)
|
||||||
return "Auto Warn";
|
return "Auto Warn";
|
||||||
}else {
|
return NameFetcher.getRequest(warner);
|
||||||
return NameFetcher.getRequest(warner);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package eu.univento.commons.security;
|
package eu.univento.commons.security;
|
||||||
|
|
||||||
import eu.univento.commons.Commons;
|
import eu.univento.commons.Commons;
|
||||||
import eu.univento.commons.database.AsyncMySQL;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -19,8 +18,7 @@ public class SecurityHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void isValidServer(String ip, Consumer<Boolean> consumer) {
|
public void isValidServer(String ip, Consumer<Boolean> consumer) {
|
||||||
AsyncMySQL sql = commons.getDatabaseManager().getAsyncMySQL();
|
commons.getDatabaseManager().getAsyncMySQL().query("SELECT * FROM Servers WHERE ip='" + ip + "';", resultSet -> {
|
||||||
sql.query("SELECT * FROM Servers WHERE ip='" + ip + "';", resultSet -> {
|
|
||||||
try {
|
try {
|
||||||
consumer.accept(resultSet.next());
|
consumer.accept(resultSet.next());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|
|
@ -7,18 +7,17 @@ import java.net.PasswordAuthentication;
|
||||||
* @author joethei
|
* @author joethei
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*/
|
*/
|
||||||
public class CustomAuthenicator extends Authenticator{
|
public class CustomAuthenticator extends Authenticator{
|
||||||
|
|
||||||
private static String username = "";
|
private static String username = "";
|
||||||
private static String password = "";
|
private static String password = "";
|
||||||
|
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
return new PasswordAuthentication (username,
|
return new PasswordAuthentication (username, password.toCharArray());
|
||||||
password.toCharArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPasswordAuthentication(String username, String password) {
|
public static void setPasswordAuthentication(String username, String password) {
|
||||||
CustomAuthenicator.username = username;
|
CustomAuthenticator.username = username;
|
||||||
CustomAuthenicator.password = password;
|
CustomAuthenticator.password = password;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,8 +11,7 @@ import java.util.regex.Pattern;
|
||||||
* @version 1.5
|
* @version 1.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final class Maths
|
final class Maths {
|
||||||
{
|
|
||||||
public static final float nanoToSec = 1.0E-009F;
|
public static final float nanoToSec = 1.0E-009F;
|
||||||
public static final float FLOAT_ROUNDING_ERROR = 1.0E-006F;
|
public static final float FLOAT_ROUNDING_ERROR = 1.0E-006F;
|
||||||
public static final float PI = 3.141593F;
|
public static final float PI = 3.141593F;
|
||||||
|
|
|
@ -13,7 +13,7 @@ Server.ts_ip = TeamSpeak IP: ts.univento.eu
|
||||||
Server.board_ip = Foren Adresse: forum.univento.eu
|
Server.board_ip = Foren Adresse: forum.univento.eu
|
||||||
|
|
||||||
Command.prefix = univento.eu Default Command Prefix
|
Command.prefix = univento.eu Default Command Prefix
|
||||||
Command.command_not_found = Dieser Befehl konnte nicht gefunden werden
|
Command.not_found = Dieser Befehl konnte nicht gefunden werden
|
||||||
Command.not_online = Der Spieler $player ist nicht online
|
Command.not_online = Der Spieler $player ist nicht online
|
||||||
Command.no_perms = Um diesen Befehl zu benutzen hast du keine Rechte
|
Command.no_perms = Um diesen Befehl zu benutzen hast du keine Rechte
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue