#11 Provide readonly config, extend readme, refactor database location #12

Merged
hiajen merged 2 commits from 11-Readonly_Database into master 2021-07-28 19:31:52 +02:00
8 changed files with 64 additions and 16 deletions

View file

@ -1,8 +1,46 @@
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 modfolder called settings.properties containing following values: Mod needs a file in mod folder called settings.properties containing following values:
``` ```
url=mysql://<DATABASE_URL>/ url=mysql://<DATABASE_URL>/
@ -10,3 +48,9 @@ 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

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

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

View file

@ -35,7 +35,8 @@ 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(argument("tag", StringArgumentType.word()) .then(
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());
@ -43,6 +44,7 @@ public class TagCommand extends EaaModCommand{
})) }))
.then( .then(
argument("grade", IntegerArgumentType.integer(0,10)) argument("grade", IntegerArgumentType.integer(0,10))
.suggests((ctx, builder) -> IntegerArgumentType.integer(0,10).listSuggestions(ctx, builder))
.executes(this) .executes(this)
))); )));
} }

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){ } else if (type == DB_Tag.Type.IDIOT || type == DB_Tag.Type.NOOB){
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!")); SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.TUTORIAL_HINT, Text.of("MEH!"), Text.of("There is an Idiot or Noob!"));
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,7 +1,5 @@
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;