Skip to content

Commit

Permalink
qwp
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Oct 5, 2024
1 parent 34d7806 commit 4239926
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
27 changes: 11 additions & 16 deletions bukkit/src/main/java/io/wdsj/asw/bukkit/manage/notice/Notifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,26 +21,22 @@ public class Notifier {
* @param censoredList censored list
*/
public static void notice(Player violatedPlayer, ModuleType moduleType, String originalMessage, List<String> censoredList) {
SchedulingUtils.runSyncIfNotOnMainThread(() -> {
Collection<? extends Player> 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<? extends Player> 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<? extends Player> players = Bukkit.getOnlinePlayers();
for (Player player : players) {
if (CachingPermTool.hasPermission(PermissionsEnum.NOTICE, player)) {
MessageUtils.sendMessage(player, message);
}
Collection<? extends Player> players = Bukkit.getOnlinePlayers();
for (Player player : players) {
if (CachingPermTool.hasPermission(PermissionsEnum.NOTICE, player)) {
MessageUtils.sendMessage(player, message);
}
});
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down

0 comments on commit 4239926

Please sign in to comment.