initial commit
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
@@ -0,0 +1,80 @@
|
||||
# To contribute improvements to CI/CD templates, please follow the Development guide at:
|
||||
# https://docs.gitlab.com/ee/development/cicd/templates.html
|
||||
# This specific template is located at:
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Maven.gitlab-ci.yml
|
||||
|
||||
# Build JAVA applications using Apache Maven (http://maven.apache.org)
|
||||
# For docker image tags see https://hub.docker.com/_/maven/
|
||||
#
|
||||
# For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
|
||||
|
||||
# This template will build and test your projects
|
||||
# * Caches downloaded dependencies and plugins between invocation.
|
||||
# * Verify but don't deploy merge requests.
|
||||
# * Deploy built artifacts from master branch only.
|
||||
|
||||
variables:
|
||||
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
|
||||
MAVEN_OPTS: >-
|
||||
-Dhttps.protocols=TLSv1.2
|
||||
-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository
|
||||
-Dorg.slf4j.simpleLogger.showDateTime=true
|
||||
-Djava.awt.headless=true
|
||||
|
||||
# As of Maven 3.3.0 instead of this you MAY define these options in `.mvn/maven.config` so the same config is used
|
||||
# when running from the command line.
|
||||
# As of Maven 3.6.1, the use of `--no-tranfer-progress` (or `-ntp`) suppresses download and upload messages. The use
|
||||
# of the `Slf4jMavenTransferListener` is no longer necessary.
|
||||
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
|
||||
MAVEN_CLI_OPTS: >-
|
||||
--batch-mode
|
||||
--errors
|
||||
--fail-at-end
|
||||
--show-version
|
||||
--no-transfer-progress
|
||||
-DinstallAtEnd=true
|
||||
-DdeployAtEnd=true
|
||||
|
||||
# This template uses the latest Maven 3 release, e.g., 3.8.6, and OpenJDK 8 (LTS)
|
||||
# for verifying and deploying images
|
||||
# Maven 3.8.x REQUIRES HTTPS repositories.
|
||||
# See https://maven.apache.org/docs/3.8.1/release-notes.html#how-to-fix-when-i-get-a-http-repository-blocked for more.
|
||||
image: maven:3-openjdk-20
|
||||
|
||||
# Cache downloaded dependencies and plugins between builds.
|
||||
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
|
||||
# Be aware that `mvn deploy` will install the built jar into this repository. If you notice your cache size
|
||||
# increasing, consider adding `-Dmaven.install.skip=true` to `MAVEN_OPTS` or in `.mvn/maven.config`
|
||||
cache:
|
||||
paths:
|
||||
- .m2/repository
|
||||
|
||||
# For merge requests do not `deploy` but only run `verify`.
|
||||
# See https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
|
||||
.verify:
|
||||
stage: test
|
||||
script:
|
||||
- 'mvn $MAVEN_CLI_OPTS verify'
|
||||
except:
|
||||
variables:
|
||||
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
|
||||
# Verify merge requests using JDK8
|
||||
verify:jdk20:
|
||||
extends:
|
||||
- .verify
|
||||
|
||||
# To deploy packages from CI, create a `ci_settings.xml` file
|
||||
# For deploying packages to GitLab's Maven Repository: See https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd for more details.
|
||||
# Please note: The GitLab Maven Repository is currently only available in GitLab Premium / Ultimate.
|
||||
# For `master` or `main` branch run `mvn deploy` automatically.
|
||||
deploy:jdk20:
|
||||
stage: deploy
|
||||
script:
|
||||
- if [ ! -f ci_settings.xml ]; then
|
||||
echo "CI settings missing\! If deploying to GitLab Maven Repository, please see https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd for instructions.";
|
||||
fi
|
||||
- 'mvn $MAVEN_CLI_OPTS deploy --settings ci_settings.xml'
|
||||
only:
|
||||
variables:
|
||||
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
Generated
+3
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+18
@@ -0,0 +1,18 @@
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="net.md_5.bungee.event.EventHandler" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="corretto-18" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+124
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,81 @@
|
||||
# Bansystem API
|
||||
|
||||
## Benutzung
|
||||
## Vorraussetzungen
|
||||
- Eine Datenbank inkl. Ban Table(Struktur siehe Code)
|
||||
- Einen MariaDB Server MySQL ansich wird NICHT unterstützt.
|
||||
|
||||
|
||||
### initialisierung des Basis API Codes
|
||||
|
||||
```java
|
||||
public void onEnable(){
|
||||
Bansystem bansystem = new Bansystem();
|
||||
bansystem.enableAPI("Benutzer","Passwort","Host","Datenbank");
|
||||
ban = bansystem.getBan();
|
||||
}
|
||||
```
|
||||
|
||||
### Spieler Bannen
|
||||
```java
|
||||
public class BanPlayer{
|
||||
Ban ban;
|
||||
public BanPlayer(Ban ban) {
|
||||
this.ban = ban;
|
||||
}
|
||||
public void test(String UUID,String Reason, String Punisher, Long Time){
|
||||
ban.addPunishment(UUID(String),Reason(String) ,Punisher(String) ,Time(Long));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
### der Spieler sollte aktuell optional vom server gekickt werden (bald wird über Netty ein Packet an den Discord Bot server gesendet welches dem ProxySystem sagt das es den Spieler kicken soll)
|
||||
|
||||
### Spieler entbannen
|
||||
```java
|
||||
public class BanPlayer{
|
||||
//Initialize Class
|
||||
Ban ban;
|
||||
public BanPlayer(Ban ban) {
|
||||
this.ban = ban;
|
||||
}
|
||||
public void test(String UUID){
|
||||
// deletes the Punishment(s) from the following UUID
|
||||
ban.deletePunishment(args[0]);
|
||||
}
|
||||
}
|
||||
```
|
||||
### Spieler auf Banzeit checken
|
||||
```java
|
||||
public class PlayerJoin {
|
||||
|
||||
Ban ban;
|
||||
|
||||
public PlayerJoin(Ban ban) {
|
||||
this.ban = ban;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPostLogin(PostLoginEvent event) {
|
||||
|
||||
System.out.println("neuer Join erkannt");
|
||||
UUID player = event.getPlayer().getUniqueId();
|
||||
ProxiedPlayer proxiedPlayer = event.getPlayer();
|
||||
|
||||
|
||||
System.out.println("Joinevent | Neuer Datenabruf");
|
||||
//Spieler mittels Banzeit joinen lassen oder nicht, die != 0 muss so sein weil sonst ne OutOfBounds kommen wird
|
||||
if (ban.getBanTime(player.toString()) != 0) {
|
||||
if (ban.getBanTime(player.toString()) >= System.currentTimeMillis()) {
|
||||
proxiedPlayer.disconnect("du wurdest gebannt grund siehste im discord");
|
||||
}
|
||||
} else {
|
||||
System.out.println("Spieler nit gebannt");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<settings>
|
||||
<servers>
|
||||
<server>
|
||||
<id>gitlab-maven</id>
|
||||
<configuration>
|
||||
<httpHeaders>
|
||||
<property>
|
||||
<name>Job-Token</name>
|
||||
<value>${CI_JOB_TOKEN}</value>
|
||||
</property>
|
||||
</httpHeaders>
|
||||
</configuration>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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>com.softwarerat</groupId>
|
||||
<artifactId>BansystemAPI</artifactId>
|
||||
<version>1.6.7-BETA</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>18</maven.compiler.source>
|
||||
<maven.compiler.target>18</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gitlab-maven</id>
|
||||
<url>https://gitlab.softwarerat.com/api/v4/projects/8/packages/maven</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>gitlab-maven</id>
|
||||
<url>https://gitlab.softwarerat.com/api/v4/projects/8/packages/maven</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc-repo</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>gitlab-zyonic</id>
|
||||
<url>https://gitlab.zyonicsoftware.com/api/v4/projects/119/packages/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.github.waterfallmc</groupId>
|
||||
<artifactId>waterfall-api</artifactId>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.mint</groupId>
|
||||
<artifactId>AsyncMySQLPoolHandler</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
<settings>
|
||||
<servers>
|
||||
<server>
|
||||
<id>gitlab-maven</id>
|
||||
<configuration>
|
||||
<httpHeaders>
|
||||
<property>
|
||||
<name>Job-Token</name>
|
||||
<value>${CI_JOB_TOKEN}</value>
|
||||
</property>
|
||||
</httpHeaders>
|
||||
</configuration>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.softwarerat;
|
||||
|
||||
import com.softwarerat.MySQL.Ban;
|
||||
import com.softwarerat.MySQL.Login;
|
||||
import com.softwarerat.MySQL.Report;
|
||||
import com.softwarerat.MySQL.SQLHandler;
|
||||
import lombok.Getter;
|
||||
import com.softwarerat.MySQL.Mute;
|
||||
@Getter
|
||||
public class Bansystem {
|
||||
Ban ban;
|
||||
Report report;
|
||||
Mute mute;
|
||||
SQLHandler sqlHandler;
|
||||
Login login;
|
||||
public void enableAPI(String user,String pw,String host,String db){
|
||||
login = new Login();
|
||||
sqlHandler = new SQLHandler(host,user, db, pw);
|
||||
ban = new Ban(sqlHandler);
|
||||
report = new Report(sqlHandler);
|
||||
mute = new Mute(sqlHandler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.softwarerat.MySQL;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
// Class containing all SQL things for the Ban Topic
|
||||
public class Ban {
|
||||
SQLHandler sqlHandler;
|
||||
|
||||
public Ban(SQLHandler sqlHandler) {
|
||||
this.sqlHandler = sqlHandler;
|
||||
}
|
||||
|
||||
public void addPunishment(String uuid, String Reason ,String punisher,long time) {
|
||||
|
||||
System.out.println("Neuer Datenabruf");
|
||||
String BanID = UUID.randomUUID().toString();
|
||||
System.out.println("INSERT INTO Ban (UUID, BanID ,Name , Reason, Time) VALUES ('"+uuid+"','"+BanID+"','"+punisher+"','"+Reason+"','"+time+"');");
|
||||
try {
|
||||
sqlHandler.executeUpdate("INSERT INTO Ban (UUID, BanID ,Name , Reason, Time) VALUES ('"+uuid+"','"+BanID+"','"+punisher+"','"+Reason+"','"+time+"');");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Long getBanTime(String uuid){
|
||||
ResultSet resultSet = null;
|
||||
System.out.println("Neuer Datenabruf");
|
||||
try {
|
||||
System.out.println("SELECT * FROM Ban WHERE UUID = '"+uuid+"';");
|
||||
resultSet = sqlHandler.executeQuery("SELECT * FROM Ban WHERE UUID = '"+uuid+"';");
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.next();
|
||||
return resultSet.getLong("Time");
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getBanUUID(String UUID) {
|
||||
System.out.println("Loading Kit");
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
resultSet = sqlHandler.executeQuery("SELECT * FROM Ban WHERE UUID = '"+UUID+"';");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.next();
|
||||
return resultSet.getString("UUID");
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
System.out.println("Loaded Kit");
|
||||
return null;
|
||||
}
|
||||
public void deletePunishment(String uuid) {
|
||||
|
||||
System.out.println("Neuer Datenabruf");
|
||||
try {
|
||||
sqlHandler.executeUpdate("DELETE FROM Ban WHERE UUID = '"+ uuid + "';");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.softwarerat.MySQL;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class Login {
|
||||
String hostname = "127.0.0.1";
|
||||
String database = "Ban";
|
||||
String username = "BanSystem";
|
||||
String password = "GGoders0";
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.softwarerat.MySQL;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
// Class containing all SQL things for the Ban Topic
|
||||
public class Mute {
|
||||
|
||||
SQLHandler sqlHandler;
|
||||
|
||||
|
||||
public Mute(SQLHandler sqlHandler) {
|
||||
this.sqlHandler = sqlHandler;
|
||||
}
|
||||
|
||||
public void addPunishment(String uuid, String Reason , String punisher, long time) {
|
||||
|
||||
System.out.println("Neuer Datenabruf");
|
||||
String BanID = UUID.randomUUID().toString();
|
||||
System.out.println("INSERT INTO Mute (UUID, MuteID ,Name , Reason, Time) VALUES ('"+uuid+"','"+BanID+"','"+punisher+"','"+Reason+"','"+time+"');");
|
||||
try {
|
||||
sqlHandler.executeUpdate("INSERT INTO Mute (UUID, MuteID ,Name , Reason, Time) VALUES ('"+uuid+"','"+BanID+"','"+punisher+"','"+Reason+"','"+time+"');");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Long getMuteTime(String uuid){
|
||||
ResultSet resultSet = null;
|
||||
System.out.println("Neuer Datenabruf");
|
||||
try {
|
||||
System.out.println("SELECT * FROM Mute WHERE UUID = '"+uuid+"';");
|
||||
resultSet = sqlHandler.executeQuery("SELECT * FROM Mute WHERE UUID = '"+uuid+"';");
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.next();
|
||||
return resultSet.getLong("Time");
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMuteUUID(String UUID) {
|
||||
System.out.println("Loading Kit");
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
resultSet = sqlHandler.executeQuery("SELECT * FROM Mute WHERE UUID = '"+UUID+"';");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
resultSet.next();
|
||||
return resultSet.getString("UUID");
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
System.out.println("Loaded Kit");
|
||||
return null;
|
||||
}
|
||||
public void deletePunishment(String uuid) {
|
||||
|
||||
System.out.println("Neuer Datenabruf");
|
||||
try {
|
||||
sqlHandler.executeUpdate("DELETE FROM Mute WHERE UUID = '"+ uuid + "';");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.softwarerat.MySQL;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class Report {
|
||||
|
||||
SQLHandler sqlHandler;
|
||||
|
||||
public Report(SQLHandler sqlHandler) {
|
||||
this.sqlHandler = sqlHandler;
|
||||
}
|
||||
|
||||
public void addReport(String uuid, String Reason , String reporter) {
|
||||
|
||||
System.out.println("Neuer Datenabruf");
|
||||
String BanID = UUID.randomUUID().toString();
|
||||
System.out.println("INSERT INTO Report (UUID, ReportID ,Name , Reason) VALUES ('"+uuid+"','"+BanID+"','"+reporter+"','"+Reason+"');");
|
||||
try {
|
||||
sqlHandler.executeUpdate("INSERT INTO Report (UUID, ReportID ,Name , Reason) VALUES ('"+uuid+"','"+BanID+"','"+reporter+"','"+Reason+"');");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<String> getReports() {
|
||||
List<String> reportIDs = new ArrayList<>();
|
||||
System.out.println("Loading Kit");
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
resultSet = sqlHandler.executeQuery("SELECT * FROM Report;");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (resultSet != null) {
|
||||
try {
|
||||
while (resultSet.next()){
|
||||
reportIDs.add(resultSet.getString("ReportID"));
|
||||
}
|
||||
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
System.out.println("Loaded Kit");
|
||||
return null;
|
||||
}
|
||||
public void deleteReport(String uuid) {
|
||||
|
||||
System.out.println("Neuer Datenabruf");
|
||||
try {
|
||||
sqlHandler.executeUpdate("DELETE FROM Report WHERE ReportID = '"+ uuid + "';");
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.softwarerat.MySQL;
|
||||
|
||||
import de.mint.asyncmysqlpoolhandler.configservice.ConfigBuilder;
|
||||
import de.mint.asyncmysqlpoolhandler.configservice.ConfigPoolFramework;
|
||||
import de.mint.asyncmysqlpoolhandler.enumservice.EnumPoolFramework;
|
||||
import de.mint.asyncmysqlpoolhandler.mainservice.AsyncMySQLPoolHandler;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class SQLHandler {
|
||||
|
||||
private final AsyncMySQLPoolHandler MySQLPoolHandler;
|
||||
private final ConfigPoolFramework configPoolFramework = ConfigBuilder.getConfigBuilder().build();
|
||||
|
||||
public SQLHandler(String hostname, String user, String pw, String DB) {
|
||||
this.MySQLPoolHandler = new AsyncMySQLPoolHandler(hostname, user, pw, DB, EnumPoolFramework.HIKARICP, configPoolFramework);
|
||||
this.openConnection();
|
||||
}
|
||||
|
||||
private void openConnection() {
|
||||
this.MySQLPoolHandler.openPool();
|
||||
}
|
||||
|
||||
// Basic SQL Things
|
||||
protected ResultSet executeQuery(String sql) throws ExecutionException, InterruptedException {
|
||||
return this.MySQLPoolHandler.executeQueryAsync(sql).get();
|
||||
}
|
||||
|
||||
protected void executeUpdate(String sql) throws ExecutionException, InterruptedException {
|
||||
this.MySQLPoolHandler.executeUpdateAsync(sql).get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.softwarerat.Netty;
|
||||
|
||||
|
||||
//because of Client Server communication to the discord bot, netty will be the easiest Client for that.
|
||||
public class SyncDiscord {
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user