Compare commits

..

No commits in common. "master" and "#1-settings_properties" have entirely different histories.

12 changed files with 33 additions and 100 deletions

View file

@ -1,56 +1,12 @@
EAA_MOD EAA_MOD
=============== ===============
This MOD is created by the "Eggwars Am Abend" (EAA) Squad, to increase fun playing Minecraft by avoiding hacking/idiotic players and providing some useful tools.
This mod is 100% client side and does not interact with the server you are playing on.
## Features
Following a list of features, this mod provides
### TAG
It's basically a report system.
Users are able to tag other players with a set of tags. As example as Hacker/Friend/Good player and so on.
In addition, the tag gets weighted by a scale from 0 to 10.
Tagged players are shown when pressing TAB, including their recent tag with grade.
Other commands like playercheck/lobbycheck also use tag data.
### Ping as Number
Heavily inspired by this cool project, check it out!
https://www.curseforge.com/minecraft/mc-mods/better-ping-display-fabric
### Echo
uhm ... yeh ... it echos ... uhm ... you
(used as PoC, will be removed sooner or later)
## Commands
All mod commands start with a double slash (`//`), so they don't get confused with other commands
* `//tag <player> <tag> <grade>`
* Tags player with chosen tag and grade. On success, a notification is shown.
* `//lobby`
* Checks if any unwanted players (Hacker/Idiot/Noob) are in the current lobby.
* `//check <player>`
* shows detailed information about a player, including past player names and tags.
* `//echo <text>`
* reply with text
* `//reload`
* reloads cashed players. Useful when playing in a team and someone tagged another player. Otherwise, the tag would not appear till next game start.
## Settings ## Settings
Mod needs a file in mod folder called settings.properties containing following values: Mod needs a file in modfolder called settings.properties containing following values:
``` ```
url=mysql://<DATABASE_URL>/ url=mysql://<DATABASE_URL>/
user=<DATABASE USER> user=<DATABASE USER>
password=<DATABASE USER PASSWORD> password=<DATABASE USER PASSWORD>
db_name=<DATABASE NAME> db_name=<DATABASE NAME>
``` ```
A working sample config is provided in the config folder, setup with a read only user of the developers Database.
## Database
Database-Model and SQL-Starterscript can be found in the config/database folder.
The Mod itself does not create the needed Database structure. The user has to init the Database by himself.

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '0.10-SNAPSHOT' id 'fabric-loom' version '0.7-SNAPSHOT'
} }
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
@ -24,11 +24,12 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
//include group: 'org.postgresql', name: 'postgresql', version: '42.2.9' //include group: 'org.postgresql', name: 'postgresql', version: '42.2.9'
// https://mvnrepository.com/artifact/mysql/mysql-connector-java // https://mvnrepository.com/artifact/mysql/mysql-connector-java
include group: 'mysql', name: 'mysql-connector-java', version: "${project.jdbc_mysql}" //implementation(include('mysql:mysql-connector-java:8.0.25'))
implementation group: 'mysql', name: 'mysql-connector-java', version: "${project.jdbc_mysql}" include group: 'mysql', name: 'mysql-connector-java', version: '8.0.25'
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.25'
//modImplementation(group: 'mysql', name: 'mysql-connector-java', version: '8.0.25') //modImplementation(group: 'mysql', name: 'mysql-connector-java', version: '8.0.25')
include group: 'com.googlecode.json-simple', name: 'json-simple', version: "${project.json_simple}" include group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: "${project.json_simple}" implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

View file

@ -1,4 +0,0 @@
url=mysql://mysql2f88.netcup.net/
user=k85020_EAA_MOD_RO
password=EeChf3dfZmwDgMo4rYSFj9bC9i5EaFkKtXfw5F7hPSQyKTZfNv3qougR3jn99ehUiRAgyr9ypLQJUyQhDQAdLf35ymst5sXf34Zo
db_name=k85020_EAA_MOD

View file

@ -4,19 +4,14 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/versions.html # check these on https://fabricmc.net/versions.html
minecraft_version=1.16.5 minecraft_version=1.16.5
yarn_mappings=1.16.5+build.10 yarn_mappings=1.16.5+build.9
loader_version=0.12.11 loader_version=0.11.3
# Mod Properties # Mod Properties
mod_version = 1.1.3 mod_version = 1.1.0
maven_group = net.saltymc.eaa maven_group = net.saltymc.eaa
archives_base_name = EAA_MOD archives_base_name = EAA_MOD
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api (or https://fabricmc.net/versions.html) # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api (or https://fabricmc.net/versions.html)
fabric_version=0.42.0+1.16 fabric_version=0.34.2+1.16
#SQL
jdbc_mysql=8.0.27
#JSON
json_simple=1.1.1

View file

@ -35,17 +35,15 @@ public class TagCommand extends EaaModCommand{
.then( .then(
argument("player", StringArgumentType.word()) argument("player", StringArgumentType.word())
.suggests((ctx, builder) -> EntityArgumentType.player().listSuggestions(ctx, builder)) .suggests((ctx, builder) -> EntityArgumentType.player().listSuggestions(ctx, builder))
.then( .then(argument("tag", StringArgumentType.word())
argument("tag", StringArgumentType.word()) .suggests(((context, builder) -> {
.suggests(((context, builder) -> { for (DB_Tag.Type tag : DB_Tag.Type.values())
for (DB_Tag.Type tag : DB_Tag.Type.values()) builder.suggest(tag.name());
builder.suggest(tag.name()); return builder.buildFuture();
return builder.buildFuture(); }))
})) .then(
.then( argument("grade", IntegerArgumentType.integer(0,10))
argument("grade", IntegerArgumentType.integer(0,10)) .executes(this)
.suggests((ctx, builder) -> IntegerArgumentType.integer(0,10).listSuggestions(ctx, builder)) )));
.executes(this)
)));
} }
} }

View file

@ -163,21 +163,12 @@ public final class CustomPlayerListHud {
/* /*
* PLAYER TAG * PLAYER TAG
*/ */
int offset_tag_playername = aa; // safe current x offset -> int offset_tag_playername = aa;
TagDTO playerTAG = TagFunction.getScoreboardTag(player.getProfile().getId().toString()); // retrieve Tag object TagDTO playerTAG = TagFunction.getScoreboardTag(player.getProfile().getId().toString());
mc.textRenderer.drawWithShadow(stack, playerTAG.getType().getTag(), (float)aa, (float)ab, playerTAG.getType().getColor()); // draw tag name mc.textRenderer.drawWithShadow(stack, playerTAG.getType().getTag(), (float)aa, (float)ab, playerTAG.getType().getColor());
offset_tag_playername += mc.textRenderer.getWidth(playerTAG.getType().getTag()) + 1;
offset_tag_playername += mc.textRenderer.getWidth(playerTAG.getType().getTag()) + 1; // add tag name length to offset mc.textRenderer.drawWithShadow(stack,"|", (float) offset_tag_playername, (float) ab, playerTAG.getGradeColor());
offset_tag_playername += mc.textRenderer.getWidth("|") + 2;
// current offset plus amount to center grade text
float tmp_x = offset_tag_playername
+ ((mc.textRenderer.getWidth("10") - mc.textRenderer.getWidth(playerTAG.getGrade() < 1 ? "|" : playerTAG.getGrade() +""))
/ 2.0f);
mc.textRenderer.drawWithShadow(stack,
playerTAG.getGrade() < 1 ? "|" : playerTAG.getGrade() +"", // if not given draw a pipe
(float) tmp_x, (float) ab, playerTAG.getGradeColor());
offset_tag_playername += mc.textRenderer.getWidth("10") + 2; // add offset of largest character
Text playerName = hud.getPlayerName(player); Text playerName = hud.getPlayerName(player);

View file

@ -5,12 +5,10 @@ import net.saltymc.eaa.util.database.DB_Tag;
import static net.saltymc.eaa.custom.ping.PingColors.computeOffset; import static net.saltymc.eaa.custom.ping.PingColors.computeOffset;
public class TagDTO { public class TagDTO {
final int grade;
final int gradeColor; final int gradeColor;
final DB_Tag.Type type; final DB_Tag.Type type;
public TagDTO(int grade, DB_Tag.Type type) { public TagDTO(int grade, DB_Tag.Type type) {
this.grade = grade;
this.gradeColor = calcGradient(grade, type); this.gradeColor = calcGradient(grade, type);
this.type = type; this.type = type;
} }
@ -32,8 +30,4 @@ public class TagDTO {
type.getColor(), type.getColor(),
computeOffset(0, 10, grade)); computeOffset(0, 10, grade));
} }
public int getGrade(){
return grade;
}
} }

View file

@ -38,7 +38,7 @@ public class LobbyFunction {
if (type == DB_Tag.Type.HACKER){ if (type == DB_Tag.Type.HACKER){
dangerLvl = 2; dangerLvl = 2;
break; break;
} else if (type == DB_Tag.Type.IDIOT || type == DB_Tag.Type.NOOB){ } else if (type == DB_Tag.Type.IDIOT){
dangerLvl = 1; dangerLvl = 1;
} }
} }
@ -49,7 +49,7 @@ public class LobbyFunction {
SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_BACKUP, Text.of("OKAY!"), Text.of("No Hackers found")); SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_BACKUP, Text.of("OKAY!"), Text.of("No Hackers found"));
break; break;
case 1: case 1:
SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of("MEH!"), Text.of("There is an Idiot or Noob!")); SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of("MEH!"), Text.of("There is an Idiot!"));
break; break;
case 2: case 2:
SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_ACCESS_FAILURE, Text.of("ALARM!"), Text.of("There is a Hacker!")); SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_ACCESS_FAILURE, Text.of("ALARM!"), Text.of("There is a Hacker!"));

View file

@ -1,5 +1,7 @@
package net.saltymc.eaa.util.database; package net.saltymc.eaa.util.database;
import net.minecraft.util.Formatting;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB