From 4239926b34b543ff376bf43ca5e82a6034eb132d Mon Sep 17 00:00:00 2001 From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com> Date: Sat, 5 Oct 2024 18:48:54 +0800 Subject: [PATCH] qwp --- .../asw/bukkit/manage/notice/Notifier.java | 27 ++++++++----------- .../task/punish/ViolationResetTask.java | 3 +-- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/bukkit/src/main/java/io/wdsj/asw/bukkit/manage/notice/Notifier.java b/bukkit/src/main/java/io/wdsj/asw/bukkit/manage/notice/Notifier.java index d750701..16fb76f 100644 --- a/bukkit/src/main/java/io/wdsj/asw/bukkit/manage/notice/Notifier.java +++ b/bukkit/src/main/java/io/wdsj/asw/bukkit/manage/notice/Notifier.java @@ -5,7 +5,6 @@ import io.wdsj.asw.bukkit.permission.cache.CachingPermTool; import io.wdsj.asw.bukkit.setting.PluginMessages; import io.wdsj.asw.bukkit.type.ModuleType; -import io.wdsj.asw.bukkit.util.SchedulingUtils; import io.wdsj.asw.bukkit.util.message.MessageUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -22,26 +21,22 @@ public class Notifier { * @param censoredList censored list */ public static void notice(Player violatedPlayer, ModuleType moduleType, String originalMessage, List censoredList) { - SchedulingUtils.runSyncIfNotOnMainThread(() -> { - Collection players = Bukkit.getOnlinePlayers(); - String message = MessageUtils.retrieveMessage(PluginMessages.ADMIN_REMINDER).replace("%player%", violatedPlayer.getName()).replace("%type%", moduleType.toString()).replace("%message%", originalMessage).replace("%censored_list%", censoredList.toString()).replace("%violation%", String.valueOf(ViolationCounter.getViolationCount(violatedPlayer))); - for (Player player : players) { - if (CachingPermTool.hasPermission(PermissionsEnum.NOTICE, player)) { - MessageUtils.sendMessage(player, message); - } + Collection players = Bukkit.getOnlinePlayers(); + String message = MessageUtils.retrieveMessage(PluginMessages.ADMIN_REMINDER).replace("%player%", violatedPlayer.getName()).replace("%type%", moduleType.toString()).replace("%message%", originalMessage).replace("%censored_list%", censoredList.toString()).replace("%violation%", String.valueOf(ViolationCounter.getViolationCount(violatedPlayer))); + for (Player player : players) { + if (CachingPermTool.hasPermission(PermissionsEnum.NOTICE, player)) { + MessageUtils.sendMessage(player, message); } - }); + } } public static void normalNotice(String message) { - SchedulingUtils.runSyncIfNotOnMainThread(() -> { - Collection players = Bukkit.getOnlinePlayers(); - for (Player player : players) { - if (CachingPermTool.hasPermission(PermissionsEnum.NOTICE, player)) { - MessageUtils.sendMessage(player, message); - } + Collection players = Bukkit.getOnlinePlayers(); + for (Player player : players) { + if (CachingPermTool.hasPermission(PermissionsEnum.NOTICE, player)) { + MessageUtils.sendMessage(player, message); } - }); + } } /** diff --git a/bukkit/src/main/java/io/wdsj/asw/bukkit/task/punish/ViolationResetTask.java b/bukkit/src/main/java/io/wdsj/asw/bukkit/task/punish/ViolationResetTask.java index 882618c..da444d9 100644 --- a/bukkit/src/main/java/io/wdsj/asw/bukkit/task/punish/ViolationResetTask.java +++ b/bukkit/src/main/java/io/wdsj/asw/bukkit/task/punish/ViolationResetTask.java @@ -5,7 +5,6 @@ import io.wdsj.asw.bukkit.manage.punish.ViolationCounter; import io.wdsj.asw.bukkit.setting.PluginMessages; import io.wdsj.asw.bukkit.setting.PluginSettings; -import io.wdsj.asw.bukkit.util.SchedulingUtils; import io.wdsj.asw.bukkit.util.message.MessageUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -19,7 +18,7 @@ public class ViolationResetTask extends UniversalRunnable { @Override public void run() { if (settingsManager.getProperty(PluginSettings.ONLY_RESET_ONLINE_PLAYERS)) { - for (Player player : SchedulingUtils.callSyncMethod(Bukkit::getOnlinePlayers)) { + for (Player player : Bukkit.getOnlinePlayers()) { ViolationCounter.resetViolationCount(player); } } else {