fix
This commit is contained in:
parent
c46994d192
commit
49744acc59
5 changed files with 38 additions and 22 deletions
|
|
@ -346,7 +346,7 @@ Proprietary - Все права защищены
|
||||||
|
|
||||||
- [Codeberg Repository](https://codeberg.org/loki5512344/Lochat)
|
- [Codeberg Repository](https://codeberg.org/loki5512344/Lochat)
|
||||||
- [Issues](https://codeberg.org/loki5512344/Lochat/issues)
|
- [Issues](https://codeberg.org/loki5512344/Lochat/issues)
|
||||||
- [Releases](https://codeberg.org/loki5512344/Lochat/releases)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1 @@
|
||||||
rootProject.name = "LoNetwork"
|
rootProject.name = "LoChat"
|
||||||
|
|
||||||
include("lohub")
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.loki.lochat.commands.custom;
|
package com.loki.lochat.commands.custom;
|
||||||
|
|
||||||
import com.loki.lochat.LoChat;
|
import com.loki.lochat.LoChat;
|
||||||
|
import com.loki.lochat.api.service.MuteService;
|
||||||
import com.loki.lochat.utils.ChatFormatter;
|
import com.loki.lochat.utils.ChatFormatter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
|
@ -37,19 +38,24 @@ public class MeCommand implements CommandExecutor {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверяем мут
|
// Проверяем мут через LoChat
|
||||||
if (plugin.getMuteService() != null && plugin.getMuteService().isMuted(player.getUniqueId())) {
|
if (plugin.getServiceRegistry() != null) {
|
||||||
String muteMessage = plugin.getMessagesConfig().getString("mute.you-muted",
|
try {
|
||||||
"<red>Вы замучены!</red>");
|
MuteService muteService = plugin.getServiceRegistry().get(MuteService.class);
|
||||||
player.sendMessage(ChatFormatter.parse(muteMessage));
|
if (muteService.isMuted(player.getUniqueId())) {
|
||||||
|
player.sendMessage(ChatFormatter.parse("<red>Вы замучены!</red>"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Сервис не зарегистрирован, продолжаем
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Собираем действие из аргументов
|
// Собираем действие из аргументов
|
||||||
String action = String.join(" ", args);
|
String action = String.join(" ", args);
|
||||||
|
|
||||||
// Получаем отображаемое имя игрока (с градиентом если есть)
|
// Получаем отображаемое имя игрока (с градиентом если есть)
|
||||||
String displayName = player.getDisplayName();
|
String displayName = player.getName();
|
||||||
if (plugin.getGradientModule() != null) {
|
if (plugin.getGradientModule() != null) {
|
||||||
displayName = plugin.getGradientModule().getFormattedName(player);
|
displayName = plugin.getGradientModule().getFormattedName(player);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ public class SoundsCommand implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
String playerUUID = player.getUniqueId().toString();
|
String playerUUID = player.getUniqueId().toString();
|
||||||
boolean currentState = plugin.getPlayerData().getBoolean("players." + playerUUID + ".settings.sounds-enabled", true);
|
// Используем конфиг плагина для хранения настроек
|
||||||
|
boolean currentState = plugin.getConfig().getBoolean("player-settings." + playerUUID + ".sounds-enabled", true);
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
// Показать текущее состояние
|
// Показать текущее состояние
|
||||||
|
|
@ -71,8 +72,8 @@ public class SoundsCommand implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Сохраняем настройку
|
// Сохраняем настройку
|
||||||
plugin.getPlayerData().set("players." + playerUUID + ".settings.sounds-enabled", newState);
|
plugin.getConfig().set("player-settings." + playerUUID + ".sounds-enabled", newState);
|
||||||
plugin.savePlayerData();
|
plugin.saveConfig();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.loki.lochat.commands.custom;
|
package com.loki.lochat.commands.custom;
|
||||||
|
|
||||||
import com.loki.lochat.LoChat;
|
import com.loki.lochat.LoChat;
|
||||||
|
import com.loki.lochat.api.service.MuteService;
|
||||||
import com.loki.lochat.utils.ChatFormatter;
|
import com.loki.lochat.utils.ChatFormatter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
|
@ -45,10 +46,11 @@ public class StatsCommand implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPlayerStats(CommandSender sender, Player target) {
|
private void showPlayerStats(CommandSender sender, Player target) {
|
||||||
// Получаем статистику игрока из конфига или базы данных
|
// Получаем статистику игрока из конфига
|
||||||
int messagesSent = plugin.getPlayerData().getInt("players." + target.getUniqueId() + ".messages-sent", 0);
|
String uuid = target.getUniqueId().toString();
|
||||||
int commandsUsed = plugin.getPlayerData().getInt("players." + target.getUniqueId() + ".commands-used", 0);
|
int messagesSent = plugin.getConfig().getInt("player-stats." + uuid + ".messages-sent", 0);
|
||||||
long playtime = plugin.getPlayerData().getLong("players." + target.getUniqueId() + ".total-playtime", 0);
|
int commandsUsed = plugin.getConfig().getInt("player-stats." + uuid + ".commands-used", 0);
|
||||||
|
long playtime = plugin.getConfig().getLong("player-stats." + uuid + ".total-playtime", 0);
|
||||||
|
|
||||||
String playtimeFormatted = formatTime(playtime);
|
String playtimeFormatted = formatTime(playtime);
|
||||||
|
|
||||||
|
|
@ -66,8 +68,8 @@ public class StatsCommand implements CommandExecutor {
|
||||||
|
|
||||||
private void showServerStats(CommandSender sender) {
|
private void showServerStats(CommandSender sender) {
|
||||||
// Получаем общую статистику сервера
|
// Получаем общую статистику сервера
|
||||||
int totalMessages = plugin.getStatisticsData().getInt("global.total-messages", 0);
|
int totalMessages = plugin.getConfig().getInt("server-stats.total-messages", 0);
|
||||||
int messagesToday = plugin.getStatisticsData().getInt("global.messages-today", 0);
|
int messagesToday = plugin.getConfig().getInt("server-stats.messages-today", 0);
|
||||||
int onlinePlayers = Bukkit.getOnlinePlayers().size();
|
int onlinePlayers = Bukkit.getOnlinePlayers().size();
|
||||||
int maxPlayers = Bukkit.getMaxPlayers();
|
int maxPlayers = Bukkit.getMaxPlayers();
|
||||||
|
|
||||||
|
|
@ -100,8 +102,17 @@ public class StatsCommand implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getActiveMutesCount() {
|
private int getActiveMutesCount() {
|
||||||
return plugin.getMuteData().getConfigurationSection("active-mutes") != null ?
|
// Получаем количество активных мутов через LoChat
|
||||||
plugin.getMuteData().getConfigurationSection("active-mutes").getKeys(false).size() : 0;
|
if (plugin.getServiceRegistry() != null) {
|
||||||
|
try {
|
||||||
|
MuteService muteService = plugin.getServiceRegistry().get(MuteService.class);
|
||||||
|
return (int) Bukkit.getOnlinePlayers().stream()
|
||||||
|
.filter(p -> muteService.isMuted(p.getUniqueId()))
|
||||||
|
.count();
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getCurrentTPS() {
|
private double getCurrentTPS() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue