mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-23 00:12:29 +00:00
Move persistant logger calls to trace
This commit is contained in:
parent
71a8ca2a8a
commit
97f74d9d55
@ -360,7 +360,10 @@ public class QuestManager extends BasePlayerManager {
|
||||
}
|
||||
|
||||
public void triggerEvent(QuestContent condType, String paramStr, int... params) {
|
||||
Grasscutter.getLogger().debug("Trigger Event {}, {}, {}", condType, paramStr, params);
|
||||
if (condType != QuestContent.QUEST_CONTENT_GAME_TIME_TICK)
|
||||
Grasscutter.getLogger().debug("Trigger Event {}, {}, {}", condType, paramStr, params);
|
||||
else Grasscutter.getLogger().trace("Trigger Event {}, {}, {}", condType, paramStr, params);
|
||||
|
||||
List<GameMainQuest> checkMainQuests = this.getMainQuests().values().stream()
|
||||
.filter(i -> i.getState() != ParentQuestState.PARENT_QUEST_STATE_FINISHED)
|
||||
.toList();
|
||||
|
@ -1,65 +1,64 @@
|
||||
package emu.grasscutter.task.tasks;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.game.systems.AnnouncementSystem;
|
||||
import emu.grasscutter.task.Task;
|
||||
import emu.grasscutter.task.TaskHandler;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
@Task(
|
||||
taskName = "Announcement",
|
||||
taskCronExpression = "0 * * * * ?",
|
||||
triggerName = "AnnouncementTrigger")
|
||||
public final class AnnouncementTask extends TaskHandler {
|
||||
|
||||
static Map<Integer, Integer> intervalMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Grasscutter.getLogger().debug("[Task] Announcement task enabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
Grasscutter.getLogger().debug("[Task] Announcement task disabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
var current = new Date();
|
||||
var announceConfigItems =
|
||||
Grasscutter.getGameServer()
|
||||
.getAnnouncementSystem()
|
||||
.getAnnounceConfigItemMap()
|
||||
.values()
|
||||
.stream()
|
||||
.filter(AnnouncementSystem.AnnounceConfigItem::isTick)
|
||||
.filter(i -> current.after(i.getBeginTime()))
|
||||
.filter(i -> current.before(i.getEndTime()))
|
||||
.collect(
|
||||
Collectors.toMap(AnnouncementSystem.AnnounceConfigItem::getTemplateId, y -> y));
|
||||
|
||||
announceConfigItems
|
||||
.values()
|
||||
.forEach(i -> intervalMap.compute(i.getTemplateId(), (k, v) -> v == null ? 1 : v + 1));
|
||||
|
||||
var toSend =
|
||||
intervalMap.entrySet().stream()
|
||||
.filter(i -> announceConfigItems.containsKey(i.getKey()))
|
||||
.filter(i -> i.getValue() >= announceConfigItems.get(i.getKey()).getInterval())
|
||||
.map(i -> announceConfigItems.get(i.getKey()))
|
||||
.toList();
|
||||
|
||||
Grasscutter.getGameServer().getAnnouncementSystem().broadcast(toSend);
|
||||
Grasscutter.getLogger()
|
||||
.debug("Broadcast {} announcement(s) to all online players", toSend.size());
|
||||
|
||||
// clear the interval count
|
||||
toSend.forEach(i -> intervalMap.put(i.getTemplateId(), 0));
|
||||
}
|
||||
}
|
||||
package emu.grasscutter.task.tasks;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.game.systems.AnnouncementSystem;
|
||||
import emu.grasscutter.task.Task;
|
||||
import emu.grasscutter.task.TaskHandler;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
@Task(
|
||||
taskName = "Announcement",
|
||||
taskCronExpression = "0 * * * * ?",
|
||||
triggerName = "AnnouncementTrigger")
|
||||
public final class AnnouncementTask extends TaskHandler {
|
||||
|
||||
static Map<Integer, Integer> intervalMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Grasscutter.getLogger().debug("[Task] Announcement task enabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
Grasscutter.getLogger().debug("[Task] Announcement task disabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
var current = new Date();
|
||||
var announceConfigItems =
|
||||
Grasscutter.getGameServer()
|
||||
.getAnnouncementSystem()
|
||||
.getAnnounceConfigItemMap()
|
||||
.values()
|
||||
.stream()
|
||||
.filter(AnnouncementSystem.AnnounceConfigItem::isTick)
|
||||
.filter(i -> current.after(i.getBeginTime()))
|
||||
.filter(i -> current.before(i.getEndTime()))
|
||||
.collect(
|
||||
Collectors.toMap(AnnouncementSystem.AnnounceConfigItem::getTemplateId, y -> y));
|
||||
|
||||
announceConfigItems
|
||||
.values()
|
||||
.forEach(i -> intervalMap.compute(i.getTemplateId(), (k, v) -> v == null ? 1 : v + 1));
|
||||
|
||||
var toSend =
|
||||
intervalMap.entrySet().stream()
|
||||
.filter(i -> announceConfigItems.containsKey(i.getKey()))
|
||||
.filter(i -> i.getValue() >= announceConfigItems.get(i.getKey()).getInterval())
|
||||
.map(i -> announceConfigItems.get(i.getKey()))
|
||||
.toList();
|
||||
|
||||
Grasscutter.getGameServer().getAnnouncementSystem().broadcast(toSend);
|
||||
Grasscutter.getLogger().trace("Broadcast {} announcement(s) to all online players", toSend.size());
|
||||
|
||||
// clear the interval count
|
||||
toSend.forEach(i -> intervalMap.put(i.getTemplateId(), 0));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user