mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Log Minecraft Internal Scheduler logs correctly
This commit is contained in:
parent
c09346c798
commit
900f77fa66
3 changed files with 33 additions and 21 deletions
|
@ -267,29 +267,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import org.bukkit.plugin.IllegalPluginAccessException;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
try {
|
||||
task.run();
|
||||
} catch (final Throwable throwable) {
|
||||
+ // Paper start
|
||||
+ String msg = String.format(
|
||||
+ "Task #%s for %s generated an exception",
|
||||
+ task.getTaskId(),
|
||||
+ task.getOwner().getDescription().getFullName());
|
||||
task.getOwner().getLogger().log(
|
||||
Level.WARNING,
|
||||
- String.format(
|
||||
- "Task #%s for %s generated an exception",
|
||||
- task.getTaskId(),
|
||||
- task.getOwner().getDescription().getFullName()),
|
||||
+ msg,
|
||||
msg,
|
||||
throwable);
|
||||
}
|
||||
+ task.getOwner().getServer().getPluginManager().callEvent(
|
||||
+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task))
|
||||
+ );
|
||||
+ // Paper end
|
||||
+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task)));
|
||||
// Paper end
|
||||
} finally {
|
||||
currentTask = null;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
parsePending();
|
||||
} else {
|
||||
debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass()));
|
||||
|
|
|
@ -4494,6 +4494,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public BukkitTask runTaskTimer(Plugin plugin, Object runnable, long delay, long period) {
|
||||
validate(plugin, runnable);
|
||||
if (delay < 0L) {
|
||||
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
task.run();
|
||||
task.timings.stopTiming(); // Spigot
|
||||
} catch (final Throwable throwable) {
|
||||
- task.getOwner().getLogger().log(
|
||||
+ // Paper start
|
||||
+ String msg = String.format(
|
||||
+ "Task #%s for %s generated an exception",
|
||||
+ task.getTaskId(),
|
||||
+ task.getOwner().getDescription().getFullName());
|
||||
+ if (task.getOwner() == MINECRAFT) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
|
||||
+ } else {
|
||||
+ task.getOwner().getLogger().log(
|
||||
Level.WARNING,
|
||||
- String.format(
|
||||
- "Task #%s for %s generated an exception",
|
||||
- task.getTaskId(),
|
||||
- task.getOwner().getDescription().getFullName()),
|
||||
+ msg,
|
||||
throwable);
|
||||
+ }
|
||||
+ // Paper end
|
||||
} finally {
|
||||
currentTask = null;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
|
||||
|
|
|
@ -2028,8 +2028,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
task.run();
|
||||
- task.timings.stopTiming(); // Spigot
|
||||
} catch (final Throwable throwable) {
|
||||
task.getOwner().getLogger().log(
|
||||
Level.WARNING,
|
||||
// Paper start
|
||||
String msg = String.format(
|
||||
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
runners.remove(task.getTaskId());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue