Skip to content

Commit

Permalink
Change some default config options, fix typos, update authors and add…
Browse files Browse the repository at this point in the history
… keklist info command

POV: You forgot to commit the individual changes <3
  • Loading branch information
SageSphinx63920 committed Aug 8, 2024
1 parent c4c7565 commit 32658b8
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 13 deletions.
28 changes: 28 additions & 0 deletions src/main/java/de/hdg/keklist/commands/KeklistCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.hdg.keklist.commands;

import de.hdg.keklist.Keklist;
import de.hdg.keklist.database.DB;
import de.hdg.keklist.gui.GuiManager;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
Expand All @@ -12,6 +13,7 @@

import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -226,6 +228,32 @@ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLab
GuiManager.openMainGUI((Player) sender);
}

case "info" -> {
try {
int whitelisted = Keklist.getDatabase().onQuery("SELECT SUM(c) FROM (SELECT COUNT(*) AS c FROM whitelist UNION ALL SELECT COUNT(*) FROM whitelistIp UNION ALL SELECT COUNT(*) FROM whitelistDomain) as whitelistCound").getInt(1);
int blacklisted = Keklist.getDatabase().onQuery("SELECT SUM(c) FROM (SELECT COUNT(*) AS c FROM blacklist UNION ALL SELECT COUNT(*) FROM blacklistIp) as blacklistCount").getInt(1);

boolean whitelist = Keklist.getInstance().getConfig().getBoolean("whitelist.enabled");
boolean blacklist = Keklist.getInstance().getConfig().getBoolean("blacklist.enabled");

DB.DBType type = Keklist.getDatabase().getType();

String version = Keklist.getInstance().getPluginMeta().getVersion();

sender.sendMessage(Keklist.getInstance().getMiniMessage().deserialize(Keklist.getTranslations().get("keklist.info")
.replace("%whitelisted%", String.valueOf(whitelisted))
.replace("%blacklisted%", String.valueOf(blacklisted))
.replace("%whitelist%", whitelist ? "<green>" + Keklist.getTranslations().get("enabled") : "<red>" + Keklist.getTranslations().get("disabled"))
.replace("%blacklist%", blacklist ? "<green>" + Keklist.getTranslations().get("enabled") : "<red>" + Keklist.getTranslations().get("disabled"))
.replace("%database%", type.toString())
.replace("%version%", version)
));

} catch (SQLException e) {
throw new RuntimeException(e);
}
}

default ->
sender.sendMessage(Keklist.getInstance().getMiniMessage().deserialize(Keklist.getTranslations().get("keklist.usage.command")));
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/de/hdg/keklist/database/DB.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.hdg.keklist.database;

import de.hdg.keklist.Keklist;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NotNull;
Expand All @@ -16,7 +17,7 @@
public class DB {

private Connection connection;
private final DBType type;
private final @Getter DBType type;
private final Keklist plugin;
private final AtomicInteger count = new AtomicInteger(0);

Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/assets/lang/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
"keklist.usage.command": "Please use: /keklist <blacklist/whitelist/reload> [feature/enable/disable]",
"keklist.description": "Command to manage the Keklist plugin's features.",
"keklist.manage.disabled": "<red>This command is disabled due to security reasons! <grey><i>This can be enabled in the config.",
"keklist.info": "<gray><b><u>Keklist Info</u></b> \n<white> Whitelist: %whitelist% \n<white>Whitelisted: <dark_green>%whitelisted% \n<white>Blacklist: %blacklist% \n<white>Blacklisted: <dark_green>%blacklisted% \n<blue>Database: <aqua>%database% \n<gold>Version: <white>%version% \n<gold>Made with <red><3 <gold>by SageSphinx63920 and jxnxsdev",

"floodgate.api-key-not-set": "<orange>You did not set the Floodgate API key in the config! Either get the floodgate uuid from https://mcprofile.io using the UUID directly or the floodgate user must be in the server's cache otherwise the request will fail!",
"geyser.prefix": "Geyser detected, using prefix: %s",
Expand All @@ -237,5 +238,8 @@
"http.not-found": "<red>Could not find the player! More information: %s",
"http.null-response": "Response is null! Please try again later!",
"http.detail": "Details: %s",
"http.rate-limit": "Rate limit reached! Please try again later! Non cached bedrock players can only be requested 200 times per hour!"
"http.rate-limit": "Rate limit reached! Please try again later! Non cached bedrock players can only be requested 200 times per hour!",

"enabled": "enabled",
"disabled": "disabled"
}
12 changes: 6 additions & 6 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
language: "en-us" # Language for the plugin
enable-manage-command: false # Enable the /keklist command to enable/disable the blacklist/whitelist
date-format: "dd-MM-yyyy HH:mm" # Date format for the blacklist/whitelist GUI
chat-notify: false # Notify the player if someone joins the server and is blacklisted/whitelisted
chat-notify: false # Notify the player if someone joins the server which is blacklisted/whitelisted

update:
check: true # Check for updates
Expand All @@ -15,13 +15,13 @@ blacklist:
allow-join-with-admin: false # Allows blacklisted player to join if a player with the admin-permission is online
admin-permission: "blacklist.admin"
limbo: false # May let the player join if nobody is online but fallback kicked; Needs velocity plugin
icon-file: "default" # The icon for the server if player is blacklisted. Put the file in the same folder as the config
icon-file: "default" # The icon for the server if player is blacklisted. Put the file in the same folder as the config. Use default for the default icon

# Settings for the whitelist feature
# Note: THIS WILL OVERRIDE THE DEFAULT WHITELIST; It works the same way as the default whitelist but does not import the players automatically
whitelist:
enabled: false # Enable the whitelist feature
change-motd: true # Change the motd if the server is in whitelist mode
change-motd: false # Change the motd if the server is in whitelist mode
hide-online-players: false # This sends fake player's AND fake player counts to the client
fake-players: # List of fake players that are shown to the client NOTE: Can be empty
- SageSphinx63920
Expand All @@ -30,14 +30,14 @@ whitelist:
fake-max-range: 20-40 # Please use the format: INTEGER-INTEGER
fake-online-range: 0-10 # Please use the format: INTEGER-INTEGER

# Extentions for the plugin
# Extensions for the plugin
placeholderapi: false # Enable PlaceholderAPI support
plan-support: false # Enable support for the Plan plugin

# Note: If you use a proxy you need to enable 'send-floodgate-data' on the proxy's config
# More: https://wiki.geysermc.org/floodgate/setup/
floodgate:
prefix: "." # Prefix for the floodgate player
prefix: "." # Prefix for the floodgate player. Gets automatically set if geyser is installed
api-key: "your-api" # https://mcprofile.io api key for getting the floodgate uuid for a bedrock player not being in the server's cache. Please read the wiki for more information

discord:
Expand All @@ -57,7 +57,7 @@ mariadb:
database: keklist
username: root
password: root
options: "?useSSL=false&serverTimezone=MEZ"
options: "?useSSL=false&serverTimezone=UTC"

# Messages for the plugin
# This fully supports minimessage
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Keklist
version: ${project.version}
main: de.hdg.keklist.Keklist
api-version: '1.20'
api-version: '1.21'
description: ${project.description}
authors: [ "hdgamer1404Jonas", "SageSphinx63920" ]
authors: [ "jxnxsdev", "SageSphinx63920" ]
website: https://keklist.pages.dev
loader: de.hdg.keklist.KeklistLoader
contributors: [ "LPTP1" ]
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Keklist
version: ${project.version}
main: de.hdg.keklist.Keklist
api-version: 1.20
api-version: 1.21
description: ${project.description}
authors: ["hdgamer1404Jonas", "SageSphinx63920"]
authors: ["jxnxsdev", "SageSphinx63920"]
website: https://keklist.pages.dev
contributors: [ "LPTP1" ]
database: true
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/velocity-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ language: en-us
# This section uses the limboapi plugin
# You can find it here: https://github.com/Elytrium/LimboAPI
limbo:
enabled: true # Enable the limbo but requires the limboapi plugin
enabled: false # Enable the limbo but requires the limboapi plugin
nbt-file: "limbo.nbt"
offset: [0, 0, 0] # Offset for the nbt file. Offset: x,y,z; Y CAN'T BE NEGATIVE
enable-command: true # This adds /whereami command to the limbo, which gives some weird text
Expand Down

0 comments on commit 32658b8

Please sign in to comment.