Update dependencies and improve configuration management
- Updated LoLib dependency to version 3.0.0 in build.gradle.kts - Added HikariCP and MySQL connector dependencies for improved database handling - Enhanced jar minimization process to exclude JDBC pool and driver - Refactored configuration management by introducing ConfigAccessor and ConfigLoader for better file handling and validation - Removed deprecated GenerationOptions class and integrated its functionality into the new structure - Improved command error handling and added cooldown hints for admin commands
This commit is contained in:
parent
978f739045
commit
3100c53229
86 changed files with 4324 additions and 3248 deletions
|
|
@ -60,7 +60,13 @@ public class PlayerCommandHandler {
|
|||
case "menu", "main" -> {
|
||||
if (ParkourOption.MAIN.mayPerform(player)) Menus.MAIN.open(player);
|
||||
}
|
||||
case "leaderboard" -> player.performCommand("LoParkour leaderboard invalid");
|
||||
case "leaderboard" -> {
|
||||
if (!ParkourOption.LEADERBOARDS.mayPerform(player)) {
|
||||
send(sender, Locales.getString(player, "other.no_do"));
|
||||
return;
|
||||
}
|
||||
Menus.LEADERBOARDS.open(player);
|
||||
}
|
||||
case "schematic" -> {
|
||||
if (!player.hasPermission(ParkourOption.ADMIN.permission)) {
|
||||
send(sender, Locales.getString(player, "other.no_do"));
|
||||
|
|
@ -107,10 +113,22 @@ public class PlayerCommandHandler {
|
|||
}
|
||||
|
||||
public boolean cooldown(CommandSender sender, String key, long millis) {
|
||||
return cooldown(sender, key, millis, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param whenBlocked message sent (MiniMessage color) if still on cooldown; may be null for silent block
|
||||
*/
|
||||
public boolean cooldown(CommandSender sender, String key, long millis, @Nullable String whenBlocked) {
|
||||
String fullKey = sender.getName() + ":" + key;
|
||||
long now = System.currentTimeMillis();
|
||||
Long last = cooldowns.get(fullKey);
|
||||
if (last != null && now - last < millis) return false;
|
||||
if (last != null && now - last < millis) {
|
||||
if (whenBlocked != null) {
|
||||
send(sender, whenBlocked);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
cooldowns.put(fullKey, now);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue