initial commit

This commit is contained in:
Laura
2026-01-18 15:01:25 +01:00
commit 3ec59b4074
38 changed files with 1021 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '20'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
+80
View File
@@ -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
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Bansystem" />
</profile>
</annotationProcessing>
</component>
</project>
+7
View File
@@ -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>
+45
View File
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="sonatype" />
<option name="name" value="sonatype" />
<option name="url" value="https://oss.sonatype.org/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="gitlab-maven" />
<option name="name" value="gitlab-maven" />
<option name="url" value="https://gitlab.softwarerat.com/api/v4/projects/4/packages/maven" />
</remote-repository>
<remote-repository>
<option name="id" value="papermc-repo" />
<option name="name" value="papermc-repo" />
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="bytemc" />
<option name="name" value="bytemc" />
<option name="url" value="https://artifactory.bytemc.de/artifactory/bytemc-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="gitlab-zyonic" />
<option name="name" value="gitlab-zyonic" />
<option name="url" value="https://gitlab.zyonicsoftware.com/api/v4/projects/119/packages/maven" />
</remote-repository>
</component>
</project>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<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_20_PREVIEW" project-jdk-name="openjdk-20" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Bansystem.iml" filepath="$PROJECT_DIR$/Bansystem.iml" />
</modules>
</component>
</project>
Generated
+6
View File
@@ -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>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>WATERFALL</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
+92
View File
@@ -0,0 +1,92 @@
# Bansystem
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://Gitlab.Softwarerat.com/surotraining/bansystem.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://Gitlab.Softwarerat.com/surotraining/bansystem/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
+16
View File
@@ -0,0 +1,16 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Job-Token</name>
<value>${CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
Binary file not shown.
+111
View File
@@ -0,0 +1,111 @@
<?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>de.softwarerat</groupId>
<artifactId>Bansystem</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Bansystem</name>
<properties>
<java.version>16</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<evelon.path>C:/Users/Fraus/Documents/Libs/evelon-1.0.2-SNAPSHOT.jar</evelon.path>
</properties>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.softwarerat.com/api/v4/projects/4/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>https://gitlab.softwarerat.com/api/v4/projects/4/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.softwarerat.com/api/v4/projects/4/packages/maven</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<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>
<repository>
<id>bytemc</id>
<url>https://artifactory.bytemc.de/artifactory/bytemc-public/</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>net.bytemc</groupId>
<artifactId>evelon</artifactId>
<version>1.0.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
+15
View File
@@ -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,12 @@
package de.softwarerat.bansystem.Api;
public class MiliCalc {
public Long addDays(Long ms,int days){
int dayMS = days*86400000;
return dayMS+ms;
};
}
@@ -0,0 +1,55 @@
package de.softwarerat.bansystem;
import de.softwarerat.bansystem.Api.MiliCalc;
import de.softwarerat.bansystem.Command.*;
import de.softwarerat.bansystem.Evelon.Ban;
import de.softwarerat.bansystem.Evelon.Mute;
import de.softwarerat.bansystem.Listener.PlayerJoin;
import de.softwarerat.bansystem.Listener.PlayerSwitchServer;
import de.softwarerat.bansystem.Moderation.ModifyReason;
import net.bytemc.evelon.DatabaseCradinates;
import net.bytemc.evelon.DatabaseProtocol;
import net.bytemc.evelon.Evelon;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Plugin;
public final class Bansystem extends Plugin {
Ban ban;
Mute mute;
MiliCalc miliCalc;
ModifyReason modifyReason;
@Override
public void onEnable() {
getProxy().getPluginManager().registerListener(this, new PlayerJoin(ban));
getProxy().getPluginManager().registerListener(this, new PlayerSwitchServer(ban));
getProxy().getPluginManager().registerCommand(this, new BanPlayer(ban,miliCalc,modifyReason));
getProxy().getPluginManager().registerCommand(this, new MutePlayer(mute, miliCalc, modifyReason) {
@Override
public Iterable<String> onTabComplete(CommandSender commandSender, String[] strings) {
return null;
}
});
getProxy().getPluginManager().registerCommand(this, new UnbanPlayer(ban));
getProxy().getPluginManager().registerCommand(this, new UnmutePlayer(ban));
getProxy().getPluginManager().registerCommand(this, new UUIDBanPlayer(ban,miliCalc,modifyReason));
Evelon.setDatabaseCradinates(new DatabaseCradinates(
DatabaseProtocol.MARIADB,
"127.0.0.1", //ToDo set Right Data
"GGoders0", //ToDo set Right Data
"Admin", //ToDo set Right Data
"BanSystem", //ToDo set Right Data
3306
));
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
@@ -0,0 +1,79 @@
package de.softwarerat.bansystem.Command;
import de.softwarerat.bansystem.Api.MiliCalc;
import de.softwarerat.bansystem.Evelon.Ban;
import de.softwarerat.bansystem.Moderation.BanLocation;
import de.softwarerat.bansystem.Moderation.BanReason;
import de.softwarerat.bansystem.Moderation.ModifyReason;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.TabExecutor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
public class BanPlayer extends Command implements TabExecutor {
Ban ban;
MiliCalc miliCalc;
ModifyReason modifyReason;
public BanPlayer(Ban ban, MiliCalc miliCalc, ModifyReason modifyReason) {
super("bungeeBan", "Group.Moderator", "");
this.ban = ban;
this.miliCalc = miliCalc;
this.modifyReason = modifyReason;
}
public void execute(CommandSender sender, String[] args) {
if (ProxyServer.getInstance().getPlayer(args[0]).isConnected()){
var p = ProxyServer.getInstance().getPlayer(args[0]);
var sp = sender.getName();
var reason = modifyReason.toBanReason(args[1].toUpperCase(Locale.ROOT));
var l = miliCalc.addDays(System.currentTimeMillis(), Integer.parseInt(args[2]));
ban.processBan(p.getUniqueId(),l,reason,sp, BanLocation.BAN_LOCATION_MINECRAFT);
//ToDo: Add Styling lol
p.disconnect("Du wurdest Gebannt Melde Dich für weitere infos im Discord");
} else {
sender.sendMessage("bitte Nutz den UUID Ban Command da der Spieler nicht online ist.");
}
}
@Override
public Iterable<String> onTabComplete(CommandSender sender, String[] args) {
if (args.length == 1) {
return generatePlayerNameSuggestions(args[0]);
} else if (args.length == 2) {
// Hier könntest du Tab-Vervollständigungen für das zweite Argument hinzufügen
// ...
}
// Weitere Fälle für zusätzliche Argumente hinzufügen...
return Collections.emptyList(); // Wenn keine Vorschläge vorhanden sind
}
private List<String> generatePlayerNameSuggestions(String input) {
List<String> suggestions = new ArrayList<>();
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
String playerName = player.getName();
if (playerName.startsWith(input)) {
suggestions.add(playerName);
}
}
return suggestions;
}
private List<String> generateReasonString(String input){
List<String> suggestions = new ArrayList<>();
suggestions.add(BanReason.BAN_REASON_BAN_EVADING.name());
suggestions.add(BanReason.BAN_REASON_TEAMING.name());
suggestions.add(BanReason.BAN_REASON_TEAMING_CROSS.name());
suggestions.add(BanReason.BAN_REASON_HOUSE_BAN.name());
suggestions.add(BanReason.BAN_REASON_BAN_EVADING.name());
return suggestions;
}
}
@@ -0,0 +1,38 @@
package de.softwarerat.bansystem.Command;
import de.softwarerat.bansystem.Api.MiliCalc;
import de.softwarerat.bansystem.Evelon.Ban;
import de.softwarerat.bansystem.Evelon.Mute;
import de.softwarerat.bansystem.Moderation.BanLocation;
import de.softwarerat.bansystem.Moderation.ModifyReason;
import de.softwarerat.bansystem.Moderation.MuteLocation;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.TabExecutor;
import java.util.Locale;
public abstract class MutePlayer extends Command implements TabExecutor {
Mute mute;
MiliCalc miliCalc;
ModifyReason modifyReason;
public MutePlayer(Mute mute, MiliCalc miliCalc, ModifyReason modifyReason) {
super("bungeeMute", "Group.Moderator", "");
this.miliCalc = miliCalc;
this.modifyReason = modifyReason;
}
public void execute(CommandSender sender, String[] args) {
var p = ProxyServer.getInstance().getPlayer(args[0]);
var sp = sender.getName();
var reason = modifyReason.toMuteReason(args[1].toUpperCase(Locale.ROOT));
var l = miliCalc.addDays(System.currentTimeMillis(), Integer.parseInt(args[2]));
mute.processMute(p.getUniqueId(),l,reason,sp, MuteLocation.MUTE_LOCATION_MINECRAFT);
//ToDo: Add Styling lol
p.sendMessage("Du wurdest gemuted, Melde Dich im Discord für weitere Infos");
}
}
@@ -0,0 +1,32 @@
package de.softwarerat.bansystem.Command;
import de.softwarerat.bansystem.Api.MiliCalc;
import de.softwarerat.bansystem.Evelon.Ban;
import de.softwarerat.bansystem.Moderation.BanLocation;
import de.softwarerat.bansystem.Moderation.ModifyReason;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;
import java.util.*;
public class UUIDBanPlayer extends Command {
Ban ban;
MiliCalc miliCalc;
ModifyReason modifyReason;
public UUIDBanPlayer(Ban ban, MiliCalc miliCalc, ModifyReason modifyReason) {
super("bungeeBanUUID", "Group.Moderator", "");
this.ban = ban;
this.miliCalc = miliCalc;
this.modifyReason = modifyReason;
}
public void execute(CommandSender sender, String[] args) {
var sp = sender.getName();
var reason = modifyReason.toBanReason(args[1].toUpperCase(Locale.ROOT));
var l = miliCalc.addDays(System.currentTimeMillis(), Integer.parseInt(args[2]));
ban.processBan(UUID.fromString(args[0]),l,reason,sp, BanLocation.BAN_LOCATION_MINECRAFT);
//ToDo: Add DIscord message
}
}
@@ -0,0 +1,26 @@
package de.softwarerat.bansystem.Command;
import de.softwarerat.bansystem.Api.MiliCalc;
import de.softwarerat.bansystem.Evelon.Ban;
import de.softwarerat.bansystem.Moderation.ModifyReason;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;
import java.util.UUID;
public class UnbanPlayer extends Command {
Ban ban;
public UnbanPlayer(Ban ban) {
super("BungeeUnban", "Group.Moderator", "");
this.ban = ban;
}
public void execute(CommandSender sender, String[] args) {
sender.sendMessage("Bansystem | Erfolgreich Spieler Entbannt");
ban.deleteBan(UUID.fromString(args[0]));
}
}
@@ -0,0 +1,27 @@
package de.softwarerat.bansystem.Command;
import de.softwarerat.bansystem.Api.MiliCalc;
import de.softwarerat.bansystem.Evelon.Ban;
import de.softwarerat.bansystem.Moderation.ModifyReason;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;
import java.util.UUID;
public class UnmutePlayer extends Command {
ModifyReason modifyReason;
Ban ban;
MiliCalc miliCalc;
public UnmutePlayer(Ban ban) {
super("BungeeUnmute", "Group.Moderator", "");
this.ban = ban;
}
public void execute(CommandSender sender, String[] args) {
sender.sendMessage("Bansystem | Erfolgreich Spieler Entbannt");
ban.deleteBan(UUID.fromString(args[0]));
//ToDo: Add Unban Discord msg
}
}
@@ -0,0 +1,29 @@
package de.softwarerat.bansystem.Evelon;
import de.softwarerat.bansystem.Moderation.BanLocation;
import de.softwarerat.bansystem.Moderation.BanReason;
import net.bytemc.evelon.repository.Filters;
import net.bytemc.evelon.repository.Repository;
import java.util.UUID;
public class Ban {
public void processBan(UUID u, long l , BanReason br , String s, BanLocation bl){
var repository = Repository.create(BanPlayer.class);
repository.query().create(new BanPlayer(u,br,l,s,bl));
}
//getting infos about the ban(like Reason and Time, later planned to add a Proof that the Ban is Right and not a Falseban or a troll from the)
public BanPlayer queryBan (UUID uuid){
var repository = Repository.create(BanPlayer.class);
for (var banPlayer : repository.query().filter(Filters.match("UUID", uuid)).database().findAll()) {
return new BanPlayer(banPlayer.getUuid(),banPlayer.getBanReason(),banPlayer.getBanTime(),banPlayer.getModeratorName(),banPlayer.getBanLocation());
}
return null;
}
//Unbanning the Specified User from the Network
public void deleteBan(UUID uuid){
var repository = Repository.create(BanPlayer.class);
repository.query().filter(Filters.match("UUID", uuid)).delete();
}
}
@@ -0,0 +1,23 @@
package de.softwarerat.bansystem.Evelon;
import de.softwarerat.bansystem.Moderation.BanLocation;
import de.softwarerat.bansystem.Moderation.BanReason;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.bytemc.evelon.repository.annotations.Entity;
import net.bytemc.evelon.repository.annotations.PrimaryKey;
import net.bytemc.evelon.repository.annotations.Row;
import java.util.UUID;
@Entity(name = "BannedPlayers")
@AllArgsConstructor
@Getter
public class BanPlayer {
@PrimaryKey
private UUID uuid;
private BanReason banReason;
private long banTime;
private String ModeratorName;
private BanLocation banLocation;
}
@@ -0,0 +1,28 @@
package de.softwarerat.bansystem.Evelon;
import de.softwarerat.bansystem.Moderation.MuteLocation;
import de.softwarerat.bansystem.Moderation.MuteReason;
import net.bytemc.evelon.repository.Filters;
import net.bytemc.evelon.repository.Repository;
import java.util.UUID;
public class Mute {
public void processMute(UUID u, long l , MuteReason br,String mp, MuteLocation ml){
var repository = Repository.create(MutePlayer.class);
repository.query().create(new MutePlayer(u,br,l,mp,ml));
}
public MutePlayer queryMute (UUID uuid){
var repository = Repository.create(MutePlayer.class);
for (var mutePlayer : repository.query().filter(Filters.match("UUID", uuid)).database().findAll()) {
return new MutePlayer(mutePlayer.getUuid(),mutePlayer.getMuteReason(),mutePlayer.getMuteTime(), mutePlayer.getModeratingPlayerName(), mutePlayer.getMuteLocation());
}
return null;
}
public void deleteMute(UUID uuid){
var repository = Repository.create(BanPlayer.class);
repository.query().delete();
}
}
@@ -0,0 +1,22 @@
package de.softwarerat.bansystem.Evelon;
import de.softwarerat.bansystem.Moderation.BanReason;
import de.softwarerat.bansystem.Moderation.MuteLocation;
import de.softwarerat.bansystem.Moderation.MuteReason;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.bytemc.evelon.repository.annotations.Entity;
import net.bytemc.evelon.repository.annotations.PrimaryKey;
import java.util.UUID;
@Getter
@Entity(name = "MutedPlayers")
@AllArgsConstructor
public class MutePlayer {
@PrimaryKey
private UUID uuid ;
private MuteReason muteReason;
private long muteTime;
private String ModeratingPlayerName;
private MuteLocation muteLocation;
}
@@ -0,0 +1,8 @@
package de.softwarerat.bansystem.Event;
public enum MessageType {
MESSAGE_TYPE_REPORT,
MESSAGE_TYPE_BAN,
MESSAGE_TYPE_MUTE,
MESSAGE_TYPE_KICK;
}
@@ -0,0 +1,26 @@
package de.softwarerat.bansystem.Event;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.ArrayList;
public class Report {
public void PushMsg(ArrayList<ProxiedPlayer>p , ProxiedPlayer repP, ProxiedPlayer player, MessageType messageType, String s){
switch (messageType){
case MESSAGE_TYPE_BAN:
String msg_ban = "Notify Ban | "+ repP.getName()+ " wurde von "+ player.getName() + " Gebannt Grund "+s;
break;
case MESSAGE_TYPE_KICK:
String msg_kick = "Notify Kick | "+ repP.getName()+ " wurde von "+ player.getName() + " Gekickt Grund "+s;
break;
case MESSAGE_TYPE_MUTE:
String msg_mute = "Notify Mute | "+ repP.getName()+ " wurde von "+ player.getName() + " Gemuted";
break;
case MESSAGE_TYPE_REPORT:
String msg_report = "Notify Report | "+ repP.getName()+ " wurde von "+ player.getName() + " Gemeldet";
break;
}
}
}
@@ -0,0 +1,28 @@
package de.softwarerat.bansystem.Listener;
import de.softwarerat.bansystem.Evelon.Ban;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import java.util.UUID;
public class PlayerJoin implements Listener {
Ban ban;
public PlayerJoin(Ban ban) {
this.ban = ban;
}
public void onPostLogin(PostLoginEvent event) {
UUID player = event.getPlayer().getUniqueId();
ProxiedPlayer proxiedPlayer = event.getPlayer();
if (ban.queryBan(player) != null){
//ToDo add Styling
proxiedPlayer.disconnect(ban.queryBan(player).getBanReason().toString());
}
}
}
@@ -0,0 +1,13 @@
package de.softwarerat.bansystem.Listener;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
public class PlayerSendMessage implements Listener {
@EventHandler
public void onPlayerMessage(){
}
}
@@ -0,0 +1,28 @@
package de.softwarerat.bansystem.Listener;
import de.softwarerat.bansystem.Evelon.Ban;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.event.ServerSwitchEvent;
import net.md_5.bungee.api.plugin.Listener;
import java.util.UUID;
public class PlayerSwitchServer implements Listener {
Ban ban;
public PlayerSwitchServer(Ban ban) {
this.ban = ban;
}
public void onServerSwitch(ServerSwitchEvent event) {
UUID player = event.getPlayer().getUniqueId();
ProxiedPlayer proxiedPlayer = event.getPlayer();
if (ban.queryBan(player) != null){
//ToDo add Styling
proxiedPlayer.disconnect(ban.queryBan(player).getBanReason().toString());
}
}
}
@@ -0,0 +1,6 @@
package de.softwarerat.bansystem.Moderation;
public enum BanLocation {
BAN_LOCATION_DISCORD,
BAN_LOCATION_MINECRAFT
}
@@ -0,0 +1,16 @@
package de.softwarerat.bansystem.Moderation;
public enum BanReason {
BAN_REASON_FORBIDDEN_BUILDING,
BAN_REASON_HACKING,
BAN_REASON_TEAMING,
BAN_REASON_TEAMING_CROSS,
BAN_REASON_HOUSE_BAN,
BAN_REASON_GRIEFING,
BAN_REASON_BAN_EVADING;
}
@@ -0,0 +1,39 @@
package de.softwarerat.bansystem.Moderation;
import de.softwarerat.bansystem.Evelon.Mute;
public class ModifyReason {
public BanReason toBanReason(String s) {
switch (s){
case "BAN_REASON_FORBIDDEN_BUILDING":
return BanReason.BAN_REASON_FORBIDDEN_BUILDING;
case "BAN_REASON_HACKING":
return BanReason.BAN_REASON_HACKING;
case "BAN_REASON_TEAMING":
return BanReason.BAN_REASON_TEAMING;
case "BAN_REASON_TEAMING_CROSS":
return BanReason.BAN_REASON_TEAMING_CROSS;
case "BAN_REASON_HOUSE_BAN":
return BanReason.BAN_REASON_HOUSE_BAN;
case "BAN_REASON_GRIEFING":
return BanReason.BAN_REASON_GRIEFING;
case "BAN_REASON_BAN_EVADING":
return BanReason.BAN_REASON_BAN_EVADING;
}
return BanReason.BAN_REASON_HOUSE_BAN;
}
public MuteReason toMuteReason(String s) {
switch (s){
case "MUTE_REASON_CHAT_BEHAVIOR":
return MuteReason.MUTE_REASON_CHAT_BEHAVIOR;
case "MUTE_REASON_AD_SM":
return MuteReason.MUTE_REASON_AD_SM;
case "MUTE_REASON_FORBIDDEN_WORDS":
return MuteReason.MUTE_REASON_FORBIDDEN_WORDS;
}
return MuteReason.MUTE_REASON_MUTE;
}
}
@@ -0,0 +1,6 @@
package de.softwarerat.bansystem.Moderation;
public enum MuteLocation {
MUTE_LOCATION_DISCORD,
MUTE_LOCATION_MINECRAFT
}
@@ -0,0 +1,12 @@
package de.softwarerat.bansystem.Moderation;
public enum MuteReason {
MUTE_REASON_CHAT_BEHAVIOR,
MUTE_REASON_AD_SM,
MUTE_REASON_FORBIDDEN_WORDS,
MUTE_REASON_MUTE;
}
+3
View File
@@ -0,0 +1,3 @@
name: Bansystem
version: '${project.version}'
main: de.softwarerat.bansystem.Bansystem
+3
View File
@@ -0,0 +1,3 @@
name: Bansystem
version: '1.0-SNAPSHOT'
main: de.softwarerat.bansystem.Bansystem