first commit

This commit is contained in:
Johannes Theiner 2019-11-27 08:54:27 +01:00
commit 517f14138b
9 changed files with 391 additions and 0 deletions

96
impact.iml Normal file
View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>PAPER</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<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/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.mojang:authlib:1.5.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:2.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.18" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-all:5.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="module" module-name="Core" scope="PROVIDED" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.dmulloy2:PacketWrapper:master-2b4bfddd12-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: co.aikar:taskchain-bukkit:3.6.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: co.aikar:taskchain-core:3.6.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: pl.kacperduras:tasket-core:1.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: pl.kacperduras:tasket-bukkit:1.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.github.lordakkarin:nbt:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-buffer:5.0.0.Alpha2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-common:5.0.0.Alpha2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Trigary:AdvancementCreator:v1.0" level="project" />
<orderEntry type="module" module-name="commons (1) (eu.univento)" scope="PROVIDED" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-core:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-handler-proxy:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-socks:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-http2:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-resolver-dns:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec-dns:4.1.8.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.7.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.7.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.7.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-redis-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-mysql-postgresql-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-sql-common:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.scala-lang:scala-library:2.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:postgresql-async_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:db-async-common_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: joda-time:joda-time:2.9.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.joda:joda-convert:1.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.mauricio:mysql-async_2.12:0.2.21" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-mongo-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongodb-driver-async:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:mongodb-driver-core:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mongodb:bson:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-rabbitmq-client:3.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.rabbitmq:amqp-client:3.6.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-web-client:3.4.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.vertx:vertx-web-common:3.4.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.sentry:sentry:1.2.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.ben-manes.caffeine:caffeine:2.5.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.gesundkrank.jskills:jskills:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:simple:0.30" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:core:0.30" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ejml:dense64:0.30" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.dagger:dagger:2.14.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
</component>
</module>

76
pom.xml Normal file
View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.univento.eu</groupId>
<artifactId>impact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Impact</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<archive>
<manifest>
<mainClass>eu.univento.maya.Maya</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>eu.univento</groupId>
<artifactId>Core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.impact;
import eu.univento.commons.server.ServerType;
import eu.univento.core.Core;
import eu.univento.core.api.command.CommandFramework;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.core.commands.PlayerCommands;
import eu.univento.impact.listeners.JoinQuit;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
/**
* @author joethei
* @version 0.1
*/
public class Impact extends JavaPlugin{
@Getter private static Impact instance;
@Override
public void onEnable() {
instance = this;
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new JoinQuit(), this);
CommandFramework commandFramework = Core.getCommandFramework();
commandFramework.registerCommands(new PlayerCommands());
ServerSettings.setServerType(ServerType.GAME_IMPACT);
ServerSettings.setGameMode(GameMode.ADVENTURE);
}
@Override
public void onDisable() {
}
}

View File

@ -0,0 +1,53 @@
package eu.univento.impact.commands;
import eu.univento.core.Core;
import eu.univento.core.api.command.Command;
import eu.univento.core.api.command.CommandArgs;
import eu.univento.core.api.command.Completer;
import eu.univento.core.api.player.CustomPlayer;
import java.util.LinkedList;
import java.util.List;
/**
* @author joethei
* @version 1.0
*/
public class PlayerCommands {
@Command(name = "stats", description = "view statistics", usage = "/stats <Player>", inGameOnly = true)
public void stats(CommandArgs args) {
CustomPlayer p = args.getPlayer();
if (args.length() == 1) {
CustomPlayer t = CustomPlayer.getPlayer(args.getArg(0));
if (t == null) {
p.sendMessage("§cDieser Spieler ist nicht online");
} else {
Core.getCommons().getGameStatistics().getImpact().get(t.getDatabasePlayer()).whenComplete((impactStatistics, throwable) -> {
p.sendMessage("Impact Stats von " + t.getDisplayName());
p.sendMessage("Gespielte Spiele: " + impactStatistics.getGamesPlayed());
p.sendMessage("Gewonne Spiele: " + impactStatistics.getGamesWon());
p.sendMessage("Verlorene Spiele: " + impactStatistics.getGamesLost());
p.sendMessage("Kills: " + impactStatistics.getKills());
p.sendMessage("Deaths: " + impactStatistics.getDeaths());
});
}
} else {
Core.getCommons().getGameStatistics().getImpact().get(p.getDatabasePlayer()).whenComplete((impactStatistics, throwable) -> {
p.sendMessage("Deine Impact Stats");
p.sendMessage("Gespielte Spiele: " + impactStatistics.getGamesPlayed());
p.sendMessage("Gewonne Spiele: " + impactStatistics.getGamesWon());
p.sendMessage("Verlorene Spiele: " + impactStatistics.getGamesLost());
p.sendMessage("Kills: " + impactStatistics.getKills());
p.sendMessage("Deaths: " + impactStatistics.getDeaths());
});
}
}
@Completer(name = "stats")
public List<String> statsCompleter(CommandArgs args) {
List<String> list = new LinkedList<>();
for (CustomPlayer player : Core.getOnlinePlayers()) list.add(player.getDisplayName());
return list;
}
}

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.impact.game;
import lombok.Getter;
import lombok.Setter;
/**
* @author joethei
* @version 1.0
*/
public enum GameState {
Lobby,
Warmup,
Ingame;
@Getter @Setter private static GameState state;
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.impact.listeners;
import eu.univento.core.Core;
import eu.univento.core.api.game.TeamManager;
import eu.univento.core.api.player.CustomPlayer;
import eu.univento.core.api.player.SpectateManager;
import eu.univento.core.api.player.Spectator;
import eu.univento.core.api.server.ServerSettings;
import eu.univento.impact.game.GameState;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
/**
* @author joethei
* @version 0.1
*/
public class JoinQuit implements Listener{
@EventHandler
public void onJoin(PlayerJoinEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(GameState.getState() == GameState.Lobby) {
}
if(GameState.getState() == GameState.Warmup) {
e.setJoinMessage(null);
new Spectator(p);
}
if(GameState.getState() == GameState.Ingame) {
e.setJoinMessage(null);
new Spectator(p);
}
}
@EventHandler
public void onQuit(PlayerQuitEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(GameState.getState() == GameState.Lobby) {
}
if(GameState.getState() == GameState.Warmup) {
e.setQuitMessage(null);
}
if(GameState.getState() == GameState.Ingame) {
e.setQuitMessage(null);
}
if (SpectateManager.contains(p)) {
SpectateManager.get(p).remove();
}
if(TeamManager.getTeam(p) != null) {
TeamManager.getTeam(p).removePlayer(p);
}
}
@EventHandler
public void onLogin(PlayerLoginEvent e) {
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
if(GameState.getState() != GameState.Lobby && Core.getOnlinePlayers().size() >= ServerSettings.getMaxPlayers()) {
e.disallow(PlayerLoginEvent.Result.KICK_FULL, "§cDas Spiel ist voll");
}
}
}

20
src/main/main11.iml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="target11" level="project" />
<orderEntry type="library" name="target1" level="project" />
<orderEntry type="library" name="target" level="project" />
<orderEntry type="library" name="target8" level="project" />
<orderEntry type="library" name="target2" level="project" />
<orderEntry type="library" name="target3" level="project" />
<orderEntry type="library" name="target6" level="project" />
<orderEntry type="module" module-name="main18" />
<orderEntry type="module" module-name="main19" />
</component>
</module>

View File

@ -0,0 +1,4 @@
name: Impact
version: ${project.version}
main: eu.univento.impact.Impact
author: joethei

View File

@ -0,0 +1,4 @@
name: Impact
version: ${project.version}
main: eu.univento.impact.Impact
author: joethei