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:
parent
b74fa21272
commit
d00ecc88d5
2 changed files with 3 additions and 8 deletions
|
|
@ -122,12 +122,6 @@ public class MuteCommand implements CommandExecutor, TabCompleter {
|
||||||
} else {
|
} else {
|
||||||
targetUUID = target.getUniqueId();
|
targetUUID = target.getUniqueId();
|
||||||
finalTargetName = target.getName();
|
finalTargetName = target.getName();
|
||||||
|
|
||||||
// Проверка на себя
|
|
||||||
if (sender instanceof Player && ((Player) sender).getUniqueId().equals(targetUUID)) {
|
|
||||||
sender.sendMessage("§cВы не можете замутить себя!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверяем, не замучен ли уже
|
// Проверяем, не замучен ли уже
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.loki.lochat.LoChat;
|
import com.loki.lochat.LoChat;
|
||||||
|
import com.loki.lochat.gradient.util.FoliaUtil;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -234,11 +235,11 @@ public class MuteManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveHistoryAsync() {
|
private void saveHistoryAsync() {
|
||||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, this::saveHistory);
|
FoliaUtil.runAsync(plugin, this::saveHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveAsync() {
|
private void saveAsync() {
|
||||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
|
FoliaUtil.runAsync(plugin, () -> {
|
||||||
save();
|
save();
|
||||||
saveHistory();
|
saveHistory();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue