From dead4f21a8fbbc46813633a85d03f9334644c6dd Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Wed, 23 Jun 2021 20:27:19 +0200 Subject: [PATCH 1/9] add new Tag, Use Style instead of Textformating, implement grade indicator, fix offset --- gradle.properties | 2 +- .../eaa/custom/ping/CustomPlayerListHud.java | 11 ++++--- .../saltymc/eaa/custom/ping/PingColors.java | 2 +- .../net/saltymc/eaa/custom/ping/TagDTO.java | 33 +++++++++++++++++++ .../saltymc/eaa/function/CheckFunction.java | 6 ++-- .../net/saltymc/eaa/function/TagFunction.java | 14 ++++---- .../net/saltymc/eaa/util/database/DB_Tag.java | 23 +++++-------- 7 files changed, 62 insertions(+), 29 deletions(-) create mode 100644 src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java diff --git a/gradle.properties b/gradle.properties index a5a1f56..3f6f809 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.11.3 # Mod Properties - mod_version = 1.0.1 + mod_version = 1.0.2 maven_group = net.saltymc.eaa archives_base_name = EAA_MOD diff --git a/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java b/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java index 3e909b3..ee02343 100644 --- a/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java +++ b/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java @@ -27,7 +27,6 @@ import net.minecraft.text.OrderedText; import net.minecraft.text.Text; import net.minecraft.world.GameMode; import net.saltymc.eaa.function.TagFunction; -import net.saltymc.eaa.util.database.DB_Tag; /** * By: https://github.com/vladmarica/better-ping-display-fabric/ @@ -165,9 +164,11 @@ public final class CustomPlayerListHud { * PLAYER TAG */ int offset_tag_playername = aa; - DB_Tag.Type playerTAG = TagFunction.getScoreboardTag(player.getProfile().getId().toString()); - mc.textRenderer.drawWithShadow(stack, playerTAG.getTag(), (float)aa, (float)ab, playerTAG.getColor()); - offset_tag_playername += mc.textRenderer.getWidth(playerTAG.getTag()) + 2; + TagDTO playerTAG = TagFunction.getScoreboardTag(player.getProfile().getId().toString()); + mc.textRenderer.drawWithShadow(stack, playerTAG.getType().getTag(), (float)aa, (float)ab, playerTAG.getType().getColor()); + offset_tag_playername += mc.textRenderer.getWidth(playerTAG.getType().getTag()) + 1; + mc.textRenderer.drawWithShadow(stack,"|", (float) offset_tag_playername, (float) ab, playerTAG.getGradeColor()); + offset_tag_playername += mc.textRenderer.getWidth("|") + 2; Text playerName = hud.getPlayerName(player); @@ -178,7 +179,7 @@ public final class CustomPlayerListHud { } if (obj != null && player.getGameMode() != GameMode.SPECTATOR) { - int ag = aa + i + 1; + int ag = offset_tag_playername + i + 1; ah = ag + q; if (ah - ag > 5) { PlayerListHudUtil.renderScoreboardObjective(hud, stack, obj, ab, gameProfile.getName(), ag, ah, player); diff --git a/src/main/java/net/saltymc/eaa/custom/ping/PingColors.java b/src/main/java/net/saltymc/eaa/custom/ping/PingColors.java index 6521f62..43a42f0 100644 --- a/src/main/java/net/saltymc/eaa/custom/ping/PingColors.java +++ b/src/main/java/net/saltymc/eaa/custom/ping/PingColors.java @@ -33,7 +33,7 @@ public class PingColors { computeOffset(PING_MID, PING_END, Math.min(ping, PING_END))); } - static float computeOffset(int start, int end, int value) { + public static float computeOffset(int start, int end, int value) { float offset = (value - start) / (float) ( end - start); return MathHelper.clamp(offset, 0.0F, 1.0F); } diff --git a/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java b/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java new file mode 100644 index 0000000..aa41272 --- /dev/null +++ b/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java @@ -0,0 +1,33 @@ +package net.saltymc.eaa.custom.ping; + +import net.saltymc.eaa.util.database.DB_Tag; + +import static net.saltymc.eaa.custom.ping.PingColors.computeOffset; + +public class TagDTO { + final int gradeColor; + final DB_Tag.Type type; + + public TagDTO(int grade, DB_Tag.Type type) { + this.gradeColor = calcGradient(grade); + this.type = type; + } + + public int getGradeColor() { + return gradeColor; + } + + public DB_Tag.Type getType() { + return type; + } + + private static int calcGradient(int grade){ + if (grade < 1) + return 0xaaaaaa; + + return ColorUtil.interpolate( + 0xffffff, + 0x0000aa, + computeOffset(0, 10, grade)); + } +} diff --git a/src/main/java/net/saltymc/eaa/function/CheckFunction.java b/src/main/java/net/saltymc/eaa/function/CheckFunction.java index 29d12e3..f7a1d11 100644 --- a/src/main/java/net/saltymc/eaa/function/CheckFunction.java +++ b/src/main/java/net/saltymc/eaa/function/CheckFunction.java @@ -4,7 +4,9 @@ import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; import net.minecraft.client.MinecraftClient; import net.minecraft.client.toast.SystemToast; import net.minecraft.text.LiteralText; +import net.minecraft.text.Style; import net.minecraft.text.Text; +import net.minecraft.text.TextColor; import net.minecraft.util.Formatting; import net.saltymc.eaa.util.database.DB_Player; import net.saltymc.eaa.util.database.DB_Tag; @@ -57,7 +59,7 @@ public class CheckFunction { source.sendFeedback(new LiteralText(dateformat.format(curr.getTagDate())).formatted(Formatting.GRAY) .append(new LiteralText(" | ")) - .append(new LiteralText(curr.getType().getTag()).formatted(curr.getType().getFormatting())) + .append(new LiteralText(curr.getType().getTag()).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(curr.getType().getColor())))) .append(new LiteralText(" (" + curr.getGrade() + ") ").formatted(getScaleFormat(curr.getGrade()))) ); } @@ -71,7 +73,7 @@ public class CheckFunction { } } - private static Formatting getScaleFormat(int grade){ + public static Formatting getScaleFormat(int grade){ if (grade <= 5) return Formatting.WHITE; else if (grade < 9) diff --git a/src/main/java/net/saltymc/eaa/function/TagFunction.java b/src/main/java/net/saltymc/eaa/function/TagFunction.java index 435969d..9e09a2d 100644 --- a/src/main/java/net/saltymc/eaa/function/TagFunction.java +++ b/src/main/java/net/saltymc/eaa/function/TagFunction.java @@ -1,9 +1,9 @@ package net.saltymc.eaa.function; import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.toast.SystemToast; import net.minecraft.text.Text; +import net.saltymc.eaa.custom.ping.TagDTO; import net.saltymc.eaa.util.database.DB_Player; import net.saltymc.eaa.util.database.DB_Tag; import net.saltymc.eaa.util.mojangApi.PlayerInfo; @@ -23,16 +23,18 @@ public class TagFunction { } } - public static DB_Tag.Type getScoreboardTag(String uuid){ - if (player_tags.containsKey(uuid)) - return player_tags.get(uuid).getType(); - else { + public static TagDTO getScoreboardTag(String uuid){ + if (player_tags.containsKey(uuid)) { + DB_Tag tag = player_tags.get(uuid); + return new TagDTO(tag.getGrade(), tag.getType()); + + } else { if (free) { free = false; loadPlayer(uuid, false); } } - return DB_Tag.Type.NOTLOADED; + return new TagDTO(-1, DB_Tag.Type.NOTLOADED); } public static void tagPlayer(String player, DB_Tag.Type tag, int grade, FabricClientCommandSource source){ diff --git a/src/main/java/net/saltymc/eaa/util/database/DB_Tag.java b/src/main/java/net/saltymc/eaa/util/database/DB_Tag.java index cac36f5..05dbf8a 100644 --- a/src/main/java/net/saltymc/eaa/util/database/DB_Tag.java +++ b/src/main/java/net/saltymc/eaa/util/database/DB_Tag.java @@ -96,31 +96,30 @@ public class DB_Tag { public enum Type { HACKER( - "HAX", "PLayer who hacks", 0xaa0000, Formatting.RED + "HAX", "PLayer who hacks", 0xaa0000 ), FRIENDLY( - "FND", "Player you like", 0x55ff55, Formatting.GREEN + "FND", "Player you like", 0x55ff55 ), GOODPLAYER( - "PRO", "Fair player with good skill", 0xffaa00, Formatting.GOLD + "PRO", "Fair player with good skill", 0xffaa00 ), IDIOT( - "BAD", "Person who is annoying and bad", 0x55ffff, Formatting.AQUA + "A$$", "Person who is annoying and bad", 0x55ffff + ), NOOB( + "BAD", "Person with low skill", 0xff55ff ), NOTTAGGED( - "NaN", "Player is not tagged", 0x555555, Formatting.DARK_GRAY + "NaN", "Player is not tagged", 0x555555 ), NOTLOADED( - "---", "PLayer not loaded", 0xffffff, Formatting.WHITE + "---", "PLayer not loaded", 0xffffff ); String tag, description; int color; - Formatting formatting; - Type(String tag, String description, int color, Formatting formatting){ + Type(String tag, String description, int color){ this.tag = tag; this.description = description; this.color = color; - this.formatting = formatting; } - public String getTag() { return tag; } @@ -132,9 +131,5 @@ public class DB_Tag { public int getColor() { return color; } - - public Formatting getFormatting(){ - return formatting; - } } } From 593360c2aa6a4e5ed9910ae14b9c91c54a49f763 Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Wed, 23 Jun 2021 20:36:39 +0200 Subject: [PATCH 2/9] change color --- src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java b/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java index aa41272..f9d63b3 100644 --- a/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java +++ b/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java @@ -26,8 +26,8 @@ public class TagDTO { return 0xaaaaaa; return ColorUtil.interpolate( - 0xffffff, - 0x0000aa, + 0x00ff00, + 0xff0000, computeOffset(0, 10, grade)); } } From df9060798d71960718eddb4e2ed3edfa77108934 Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Fri, 25 Jun 2021 22:02:56 +0200 Subject: [PATCH 3/9] implement gradient from tag color to grey --- src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java b/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java index f9d63b3..42c14e8 100644 --- a/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java +++ b/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java @@ -9,7 +9,7 @@ public class TagDTO { final DB_Tag.Type type; public TagDTO(int grade, DB_Tag.Type type) { - this.gradeColor = calcGradient(grade); + this.gradeColor = calcGradient(grade, type); this.type = type; } @@ -21,13 +21,13 @@ public class TagDTO { return type; } - private static int calcGradient(int grade){ + private static int calcGradient(int grade, DB_Tag.Type type){ if (grade < 1) return 0xaaaaaa; return ColorUtil.interpolate( - 0x00ff00, - 0xff0000, + 0xaaaaaa, + type.getColor(), computeOffset(0, 10, grade)); } } From 1d69f7d2a4f0981934afd38513cc19dd481e64d1 Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Fri, 25 Jun 2021 23:03:00 +0200 Subject: [PATCH 4/9] implement settings as Properties --- src/main/java/net/saltymc/eaa/EaaMod.java | 15 ++++++++++- .../saltymc/eaa/util/database/Postgre.java | 15 ++++++++--- .../saltymc/eaa/util/io/PropertieLoader.java | 26 +++++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 src/main/java/net/saltymc/eaa/util/io/PropertieLoader.java diff --git a/src/main/java/net/saltymc/eaa/EaaMod.java b/src/main/java/net/saltymc/eaa/EaaMod.java index 2c50258..d90d58b 100644 --- a/src/main/java/net/saltymc/eaa/EaaMod.java +++ b/src/main/java/net/saltymc/eaa/EaaMod.java @@ -2,6 +2,7 @@ package net.saltymc.eaa; import net.saltymc.eaa.commands.*; +import net.saltymc.eaa.util.io.PropertieLoader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,15 +10,27 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import java.util.Properties; + @Environment(EnvType.CLIENT) public final class EaaMod implements ClientModInitializer { - public static final Logger LOGGER = LogManager.getLogger("EAA-MOD"); + private static final String SETTINGS_FILE_NAME = "settings.properties"; + + public static final Logger LOGGER = LogManager.getLogger("EAA-MOD"); + private static Properties settings; public static Logger getLogger() { return LOGGER; } + public static Properties getSettings(){ + if (settings == null) + settings = PropertieLoader.loadProperties(SETTINGS_FILE_NAME); + + return settings; + } + @Override public void onInitializeClient() { diff --git a/src/main/java/net/saltymc/eaa/util/database/Postgre.java b/src/main/java/net/saltymc/eaa/util/database/Postgre.java index cdea712..107c25c 100644 --- a/src/main/java/net/saltymc/eaa/util/database/Postgre.java +++ b/src/main/java/net/saltymc/eaa/util/database/Postgre.java @@ -7,15 +7,24 @@ import com.mysql.cj.jdbc.Driver; public class Postgre { - private final String url = "jdbc:postgresql://localhost/myDB"; - private final String user = "postgres"; - private final String password = "root"; + private String url; + private String user; + private String password; + private String db_name; + + private final String driverName = "com.mysql.cj.jdbc.Driver"; + private static Postgre postgre; private Connection connection; public Postgre() { + this.url = EaaMod.getSettings().getProperty("url"); + this.user = EaaMod.getSettings().getProperty("user"); + this.password = EaaMod.getSettings().getProperty("password"); + this.db_name = EaaMod.getSettings().getProperty("db_name"); + try { //load driver / config driver EaaMod.LOGGER.debug("Lade DB Treiber"); diff --git a/src/main/java/net/saltymc/eaa/util/io/PropertieLoader.java b/src/main/java/net/saltymc/eaa/util/io/PropertieLoader.java new file mode 100644 index 0000000..0ac7266 --- /dev/null +++ b/src/main/java/net/saltymc/eaa/util/io/PropertieLoader.java @@ -0,0 +1,26 @@ +package net.saltymc.eaa.util.io; + +import net.saltymc.eaa.EaaMod; + +import java.io.FileReader; +import java.io.FileWriter; +import java.util.Properties; + +public class PropertieLoader { + + public static Properties loadProperties(String fileName){ + Properties p = new Properties(); + + try (FileReader reader = new FileReader(System.getProperty("user.dir") + "/mods/" + fileName)){ + p.load(reader); + } catch (Exception e){ + try (FileWriter writer = new FileWriter(System.getProperty("user.dir") + "/mods/" + fileName)) { + p.store(writer, "init config file"); + } catch (Exception ex){ + EaaMod.getLogger().error("Cant save Properties" + fileName, e); + } + return loadProperties(fileName); + } + return p; + } +} \ No newline at end of file From 8e829e3a01654db412b53760d01320a7c4fec3cd Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Fri, 25 Jun 2021 23:07:31 +0200 Subject: [PATCH 5/9] version Up, edit readme --- README.md | 10 +++++++++- gradle.properties | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aa5ab2f..3cea151 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ EAA_MOD =============== -EAA \ No newline at end of file +## Settings +Mod needs a file in modfolder called settings.properties containing following values: + +``` +url=mysql:/// +user= +password= +db_name= +``` \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 3f6f809..9654a03 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.11.3 # Mod Properties - mod_version = 1.0.2 + mod_version = 1.1.0 maven_group = net.saltymc.eaa archives_base_name = EAA_MOD From 3d2ba396efe20fc0e0d6d5f724ac54c11286ac22 Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Sat, 24 Jul 2021 20:06:11 +0200 Subject: [PATCH 6/9] #8 implement grade as number and gradient --- gradle.properties | 2 +- .../eaa/custom/ping/CustomPlayerListHud.java | 21 +++++++++++++------ .../net/saltymc/eaa/custom/ping/TagDTO.java | 6 ++++++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9654a03..e223165 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.11.3 # Mod Properties - mod_version = 1.1.0 + mod_version = 1.1.1 maven_group = net.saltymc.eaa archives_base_name = EAA_MOD diff --git a/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java b/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java index ee02343..292ad3b 100644 --- a/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java +++ b/src/main/java/net/saltymc/eaa/custom/ping/CustomPlayerListHud.java @@ -163,12 +163,21 @@ public final class CustomPlayerListHud { /* * PLAYER TAG */ - int offset_tag_playername = aa; - TagDTO playerTAG = TagFunction.getScoreboardTag(player.getProfile().getId().toString()); - mc.textRenderer.drawWithShadow(stack, playerTAG.getType().getTag(), (float)aa, (float)ab, playerTAG.getType().getColor()); - offset_tag_playername += mc.textRenderer.getWidth(playerTAG.getType().getTag()) + 1; - mc.textRenderer.drawWithShadow(stack,"|", (float) offset_tag_playername, (float) ab, playerTAG.getGradeColor()); - offset_tag_playername += mc.textRenderer.getWidth("|") + 2; + int offset_tag_playername = aa; // safe current x offset -> + TagDTO playerTAG = TagFunction.getScoreboardTag(player.getProfile().getId().toString()); // retrieve Tag object + mc.textRenderer.drawWithShadow(stack, playerTAG.getType().getTag(), (float)aa, (float)ab, playerTAG.getType().getColor()); // draw tag name + + offset_tag_playername += mc.textRenderer.getWidth(playerTAG.getType().getTag()) + 1; // add tag name length to offset + + // 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); diff --git a/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java b/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java index 42c14e8..47d36b3 100644 --- a/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java +++ b/src/main/java/net/saltymc/eaa/custom/ping/TagDTO.java @@ -5,10 +5,12 @@ import net.saltymc.eaa.util.database.DB_Tag; import static net.saltymc.eaa.custom.ping.PingColors.computeOffset; public class TagDTO { + final int grade; final int gradeColor; final DB_Tag.Type type; public TagDTO(int grade, DB_Tag.Type type) { + this.grade = grade; this.gradeColor = calcGradient(grade, type); this.type = type; } @@ -30,4 +32,8 @@ public class TagDTO { type.getColor(), computeOffset(0, 10, grade)); } + + public int getGrade(){ + return grade; + } } From 87d167d87b13be56c26fd8d66fd9be520276d482 Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Tue, 27 Jul 2021 12:17:39 +0200 Subject: [PATCH 7/9] #11 Provide readonly config, extend readme, refactor database location --- README.md | 46 +++++++++++++++++- .../database}/datenbank_shema.mwb | Bin .../database}/datenbank_shema.png | Bin .../database}/datenbank_shema.sql | 0 config/settings.properties | 4 ++ .../net/saltymc/eaa/commands/TagCommand.java | 22 +++++---- .../saltymc/eaa/function/LobbyFunction.java | 4 +- .../net/saltymc/eaa/util/database/DB_Tag.java | 2 - 8 files changed, 63 insertions(+), 15 deletions(-) rename {src/main/resources/datenbank => config/database}/datenbank_shema.mwb (100%) rename {src/main/resources/datenbank => config/database}/datenbank_shema.png (100%) rename {src/main/resources/datenbank => config/database}/datenbank_shema.sql (100%) create mode 100644 config/settings.properties diff --git a/README.md b/README.md index 3cea151..b347c7a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,43 @@ 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% clientside 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 mark other players with a set of tags. As example as Hacker/Friend/Goodplayer and so on. +In addition, the tag gets weighted by a scale from 0 to 10. + +Tagged players are shown at the player overview (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 + +## Commands +All mod commands start with a double slash (`//`), so they don't get confused with other commands + +* `//tag ` + * Tags player with chosen tag and grade. On success a toast is shown. +* `//lobby` + * Checks if any negative tagged players (Hacker/Idiot/Noob) are in the current lobby. +* `//check ` + * shows detailed information about player including past playernames and tags. +* `//echo ` + * 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 Mod needs a file in modfolder called settings.properties containing following values: @@ -9,4 +47,10 @@ url=mysql:/// user= password= db_name= -``` \ No newline at end of file +``` + +A working sample config is provided in the config folder, setup with a readonly 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 itself. \ No newline at end of file diff --git a/src/main/resources/datenbank/datenbank_shema.mwb b/config/database/datenbank_shema.mwb similarity index 100% rename from src/main/resources/datenbank/datenbank_shema.mwb rename to config/database/datenbank_shema.mwb diff --git a/src/main/resources/datenbank/datenbank_shema.png b/config/database/datenbank_shema.png similarity index 100% rename from src/main/resources/datenbank/datenbank_shema.png rename to config/database/datenbank_shema.png diff --git a/src/main/resources/datenbank/datenbank_shema.sql b/config/database/datenbank_shema.sql similarity index 100% rename from src/main/resources/datenbank/datenbank_shema.sql rename to config/database/datenbank_shema.sql diff --git a/config/settings.properties b/config/settings.properties new file mode 100644 index 0000000..8bc9426 --- /dev/null +++ b/config/settings.properties @@ -0,0 +1,4 @@ +url=mysql://mysql2f88.netcup.net/ +user=k85020_EAA_MOD_RO +password=EeChf3dfZmwDgMo4rYSFj9bC9i5EaFkKtXfw5F7hPSQyKTZfNv3qougR3jn99ehUiRAgyr9ypLQJUyQhDQAdLf35ymst5sXf34Zo +db_name=k85020_EAA_MOD \ No newline at end of file diff --git a/src/main/java/net/saltymc/eaa/commands/TagCommand.java b/src/main/java/net/saltymc/eaa/commands/TagCommand.java index c02d634..fc3dfe2 100644 --- a/src/main/java/net/saltymc/eaa/commands/TagCommand.java +++ b/src/main/java/net/saltymc/eaa/commands/TagCommand.java @@ -35,15 +35,17 @@ public class TagCommand extends EaaModCommand{ .then( argument("player", StringArgumentType.word()) .suggests((ctx, builder) -> EntityArgumentType.player().listSuggestions(ctx, builder)) - .then(argument("tag", StringArgumentType.word()) - .suggests(((context, builder) -> { - for (DB_Tag.Type tag : DB_Tag.Type.values()) - builder.suggest(tag.name()); - return builder.buildFuture(); - })) - .then( - argument("grade", IntegerArgumentType.integer(0,10)) - .executes(this) - ))); + .then( + argument("tag", StringArgumentType.word()) + .suggests(((context, builder) -> { + for (DB_Tag.Type tag : DB_Tag.Type.values()) + builder.suggest(tag.name()); + return builder.buildFuture(); + })) + .then( + argument("grade", IntegerArgumentType.integer(0,10)) + .suggests((ctx, builder) -> IntegerArgumentType.integer(0,10).listSuggestions(ctx, builder)) + .executes(this) + ))); } } diff --git a/src/main/java/net/saltymc/eaa/function/LobbyFunction.java b/src/main/java/net/saltymc/eaa/function/LobbyFunction.java index a427705..9d026af 100644 --- a/src/main/java/net/saltymc/eaa/function/LobbyFunction.java +++ b/src/main/java/net/saltymc/eaa/function/LobbyFunction.java @@ -38,7 +38,7 @@ public class LobbyFunction { if (type == DB_Tag.Type.HACKER){ dangerLvl = 2; break; - } else if (type == DB_Tag.Type.IDIOT){ + } else if (type == DB_Tag.Type.IDIOT || type == DB_Tag.Type.NOOB){ 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")); break; 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; case 2: SystemToast.add(source.getClient().getToastManager(), SystemToast.Type.WORLD_ACCESS_FAILURE, Text.of("ALARM!"), Text.of("There is a Hacker!")); diff --git a/src/main/java/net/saltymc/eaa/util/database/DB_Tag.java b/src/main/java/net/saltymc/eaa/util/database/DB_Tag.java index 05dbf8a..8b94394 100644 --- a/src/main/java/net/saltymc/eaa/util/database/DB_Tag.java +++ b/src/main/java/net/saltymc/eaa/util/database/DB_Tag.java @@ -1,7 +1,5 @@ package net.saltymc.eaa.util.database; -import net.minecraft.util.Formatting; - import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; From 4192c554a5a4bb24f9ef533a860504e7bffcf2cd Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Wed, 28 Jul 2021 19:30:34 +0200 Subject: [PATCH 8/9] #11 spelling --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b347c7a..83db887 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ 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% clientside and does not interact with the server you are playing on. +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 +Following a list of features, this mod provides ### TAG It's basically a report system. -Users are able to mark other players with a set of tags. As example as Hacker/Friend/Goodplayer and so on. +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 at the player overview (TAB) including their recent tag with grade. +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 @@ -22,25 +22,25 @@ 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 ` - * Tags player with chosen tag and grade. On success a toast is shown. + * Tags player with chosen tag and grade. On success, a notification is shown. * `//lobby` - * Checks if any negative tagged players (Hacker/Idiot/Noob) are in the current lobby. + * Checks if any unwanted players (Hacker/Idiot/Noob) are in the current lobby. * `//check ` - * shows detailed information about player including past playernames and tags. + * shows detailed information about a player, including past player names and tags. * `//echo ` * 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. - - + * 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 -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:/// @@ -49,8 +49,8 @@ password= db_name= ``` -A working sample config is provided in the config folder, setup with a readonly user of the developers Database. +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 itself. \ No newline at end of file +The Mod itself does not create the needed Database structure. The user has to init the Database by himself. \ No newline at end of file From 2c1d63966c766e579edc7a8bd097004eb15ec8f1 Mon Sep 17 00:00:00 2001 From: "Ansgar [Hiajen]" Date: Sat, 11 Dec 2021 17:20:20 +0100 Subject: [PATCH 9/9] update some lib versions --- build.gradle | 11 +++++------ gradle.properties | 15 ++++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 128dc3f..a1eb4bc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.7-SNAPSHOT' + id 'fabric-loom' version '0.10-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_1_8 @@ -24,12 +24,11 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" //include group: 'org.postgresql', name: 'postgresql', version: '42.2.9' // https://mvnrepository.com/artifact/mysql/mysql-connector-java - //implementation(include('mysql:mysql-connector-java:8.0.25')) - include group: 'mysql', name: 'mysql-connector-java', version: '8.0.25' - implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.25' + include group: 'mysql', name: 'mysql-connector-java', version: "${project.jdbc_mysql}" + implementation group: 'mysql', name: 'mysql-connector-java', version: "${project.jdbc_mysql}" //modImplementation(group: 'mysql', name: 'mysql-connector-java', version: '8.0.25') - include group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1' - implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1' + include group: 'com.googlecode.json-simple', name: 'json-simple', version: "${project.json_simple}" + implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: "${project.json_simple}" // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" diff --git a/gradle.properties b/gradle.properties index e223165..9983820 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,14 +4,19 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/versions.html minecraft_version=1.16.5 - yarn_mappings=1.16.5+build.9 - loader_version=0.11.3 - + yarn_mappings=1.16.5+build.10 + loader_version=0.12.11 # Mod Properties - mod_version = 1.1.1 + mod_version = 1.1.3 maven_group = net.saltymc.eaa archives_base_name = EAA_MOD # 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) - fabric_version=0.34.2+1.16 \ No newline at end of file + fabric_version=0.42.0+1.16 + +#SQL +jdbc_mysql=8.0.27 + +#JSON +json_simple=1.1.1 \ No newline at end of file