Fix Folia compatibility and allow self-mute

- Use FoliaUtil.runAsync instead of scheduler.runTaskAsynchronously
- Remove self-mute restriction (can now mute yourself)
This commit is contained in:
loki5512344 2026-01-03 12:40:05 +01:00
parent b74fa21272
commit d00ecc88d5
2 changed files with 3 additions and 8 deletions

View file

@ -122,12 +122,6 @@ public class MuteCommand implements CommandExecutor, TabCompleter {
} else {
targetUUID = target.getUniqueId();
finalTargetName = target.getName();
// Проверка на себя
if (sender instanceof Player && ((Player) sender).getUniqueId().equals(targetUUID)) {
sender.sendMessage("§cВы не можете замутить себя!");
return true;
}
}
// Проверяем, не замучен ли уже

View file

@ -4,6 +4,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.loki.lochat.LoChat;
import com.loki.lochat.gradient.util.FoliaUtil;
import java.io.*;
import java.lang.reflect.Type;
@ -234,11 +235,11 @@ public class MuteManager {
}
private void saveHistoryAsync() {
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, this::saveHistory);
FoliaUtil.runAsync(plugin, this::saveHistory);
}
private void saveAsync() {
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
FoliaUtil.runAsync(plugin, () -> {
save();
saveHistory();
});