Remove Spigot timings
This commit is contained in:
@@ -379,7 +379,6 @@ public final class CraftServer implements Server {
|
||||
this.saveCommandsConfig();
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
this.pluginManager.useTimings(this.configuration.getBoolean("settings.plugin-profiling"));
|
||||
this.overrideSpawnLimits();
|
||||
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
|
||||
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
|
||||
@@ -2646,12 +2645,31 @@ public final class CraftServer implements Server {
|
||||
private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot()
|
||||
{
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public YamlConfiguration getConfig()
|
||||
{
|
||||
return org.spigotmc.SpigotConfig.config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YamlConfiguration getBukkitConfig()
|
||||
{
|
||||
return configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YamlConfiguration getSpigotConfig()
|
||||
{
|
||||
return org.spigotmc.SpigotConfig.config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YamlConfiguration getPaperConfig()
|
||||
{
|
||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restart() {
|
||||
org.spigotmc.RestartCommand.restart();
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.storage.PrimaryLevelData;
|
||||
import org.bukkit.craftbukkit.scheduler.CraftTask;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.spigotmc.CustomTimingsHandler;
|
||||
|
||||
public class SpigotTimings {
|
||||
|
||||
public static final CustomTimingsHandler serverTickTimer = new CustomTimingsHandler("** Full Server Tick");
|
||||
public static final CustomTimingsHandler playerListTimer = new CustomTimingsHandler("Player List");
|
||||
public static final CustomTimingsHandler commandFunctionsTimer = new CustomTimingsHandler("Command Functions");
|
||||
public static final CustomTimingsHandler connectionTimer = new CustomTimingsHandler("Connection Handler");
|
||||
public static final CustomTimingsHandler playerConnectionTimer = new CustomTimingsHandler("** PlayerConnection");
|
||||
public static final CustomTimingsHandler tickablesTimer = new CustomTimingsHandler("Tickables");
|
||||
public static final CustomTimingsHandler schedulerTimer = new CustomTimingsHandler("Scheduler");
|
||||
public static final CustomTimingsHandler timeUpdateTimer = new CustomTimingsHandler("Time Update");
|
||||
public static final CustomTimingsHandler serverCommandTimer = new CustomTimingsHandler("Server Command");
|
||||
public static final CustomTimingsHandler worldSaveTimer = new CustomTimingsHandler("World Save");
|
||||
|
||||
public static final CustomTimingsHandler entityMoveTimer = new CustomTimingsHandler("** entityMove");
|
||||
public static final CustomTimingsHandler tickEntityTimer = new CustomTimingsHandler("** tickEntity");
|
||||
public static final CustomTimingsHandler activatedEntityTimer = new CustomTimingsHandler("** activatedTickEntity");
|
||||
public static final CustomTimingsHandler tickTileEntityTimer = new CustomTimingsHandler("** tickTileEntity");
|
||||
|
||||
public static final CustomTimingsHandler timerEntityBaseTick = new CustomTimingsHandler("** livingEntityBaseTick");
|
||||
public static final CustomTimingsHandler timerEntityAI = new CustomTimingsHandler("** livingEntityAI");
|
||||
public static final CustomTimingsHandler timerEntityAICollision = new CustomTimingsHandler("** livingEntityAICollision");
|
||||
public static final CustomTimingsHandler timerEntityAIMove = new CustomTimingsHandler("** livingEntityAIMove");
|
||||
public static final CustomTimingsHandler timerEntityTickRest = new CustomTimingsHandler("** livingEntityTickRest");
|
||||
|
||||
public static final CustomTimingsHandler processQueueTimer = new CustomTimingsHandler("processQueue");
|
||||
public static final CustomTimingsHandler schedulerSyncTimer = new CustomTimingsHandler("** Scheduler - Sync Tasks", JavaPluginLoader.pluginParentTimer);
|
||||
|
||||
public static final CustomTimingsHandler playerCommandTimer = new CustomTimingsHandler("** playerCommand");
|
||||
|
||||
public static final CustomTimingsHandler entityActivationCheckTimer = new CustomTimingsHandler("entityActivationCheck");
|
||||
public static final CustomTimingsHandler checkIfActiveTimer = new CustomTimingsHandler("** checkIfActive");
|
||||
|
||||
public static final HashMap<String, CustomTimingsHandler> entityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
|
||||
public static final HashMap<String, CustomTimingsHandler> tileEntityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
|
||||
public static final HashMap<String, CustomTimingsHandler> pluginTaskTimingMap = new HashMap<String, CustomTimingsHandler>();
|
||||
|
||||
/**
|
||||
* Gets a timer associated with a plugins tasks.
|
||||
* @param task
|
||||
* @param period
|
||||
* @return
|
||||
*/
|
||||
public static CustomTimingsHandler getPluginTaskTimings(BukkitTask task, long period) {
|
||||
if (!task.isSync()) {
|
||||
return null;
|
||||
}
|
||||
String plugin;
|
||||
final CraftTask ctask = (CraftTask) task;
|
||||
|
||||
if (task.getOwner() != null) {
|
||||
plugin = task.getOwner().getDescription().getFullName();
|
||||
} else {
|
||||
plugin = "Unknown";
|
||||
}
|
||||
String taskname = ctask.getTaskName();
|
||||
|
||||
String name = "Task: " + plugin + " Runnable: " + taskname;
|
||||
if (period > 0) {
|
||||
name += "(interval:" + period + ")";
|
||||
} else {
|
||||
name += "(Single)";
|
||||
}
|
||||
CustomTimingsHandler result = SpigotTimings.pluginTaskTimingMap.get(name);
|
||||
if (result == null) {
|
||||
result = new CustomTimingsHandler(name, SpigotTimings.schedulerSyncTimer);
|
||||
SpigotTimings.pluginTaskTimingMap.put(name, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a named timer for the specified entity type to track type specific timings.
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public static CustomTimingsHandler getEntityTimings(Entity entity) {
|
||||
String entityType = entity.getClass().getName();
|
||||
CustomTimingsHandler result = SpigotTimings.entityTypeTimingMap.get(entityType);
|
||||
if (result == null) {
|
||||
result = new CustomTimingsHandler("** tickEntity - " + entity.getClass().getSimpleName(), SpigotTimings.activatedEntityTimer);
|
||||
SpigotTimings.entityTypeTimingMap.put(entityType, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a named timer for the specified tile entity type to track type specific timings.
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public static CustomTimingsHandler getTileEntityTimings(BlockEntity entity) {
|
||||
String entityType = entity.getClass().getName();
|
||||
CustomTimingsHandler result = SpigotTimings.tileEntityTypeTimingMap.get(entityType);
|
||||
if (result == null) {
|
||||
result = new CustomTimingsHandler("** tickTileEntity - " + entity.getClass().getSimpleName(), SpigotTimings.tickTileEntityTimer);
|
||||
SpigotTimings.tileEntityTypeTimingMap.put(entityType, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of timers per world, to track world specific timings.
|
||||
*/
|
||||
public static class WorldTimingsHandler {
|
||||
public final CustomTimingsHandler mobSpawn;
|
||||
public final CustomTimingsHandler doChunkUnload;
|
||||
public final CustomTimingsHandler doTickPending;
|
||||
public final CustomTimingsHandler doTickTiles;
|
||||
public final CustomTimingsHandler doChunkMap;
|
||||
public final CustomTimingsHandler doSounds;
|
||||
public final CustomTimingsHandler entityTick;
|
||||
public final CustomTimingsHandler tileEntityTick;
|
||||
public final CustomTimingsHandler tileEntityPending;
|
||||
public final CustomTimingsHandler tracker;
|
||||
public final CustomTimingsHandler doTick;
|
||||
public final CustomTimingsHandler tickEntities;
|
||||
|
||||
public final CustomTimingsHandler syncChunkLoadTimer;
|
||||
public final CustomTimingsHandler syncChunkLoadStructuresTimer;
|
||||
public final CustomTimingsHandler syncChunkLoadEntitiesTimer;
|
||||
public final CustomTimingsHandler syncChunkLoadTileEntitiesTimer;
|
||||
public final CustomTimingsHandler syncChunkLoadTileTicksTimer;
|
||||
public final CustomTimingsHandler syncChunkLoadPostTimer;
|
||||
|
||||
public WorldTimingsHandler(Level server) {
|
||||
String name = ((PrimaryLevelData) server.levelData).getLevelName() + " - ";
|
||||
|
||||
this.mobSpawn = new CustomTimingsHandler("** " + name + "mobSpawn");
|
||||
this.doChunkUnload = new CustomTimingsHandler("** " + name + "doChunkUnload");
|
||||
this.doTickPending = new CustomTimingsHandler("** " + name + "doTickPending");
|
||||
this.doTickTiles = new CustomTimingsHandler("** " + name + "doTickTiles");
|
||||
this.doChunkMap = new CustomTimingsHandler("** " + name + "doChunkMap");
|
||||
this.doSounds = new CustomTimingsHandler("** " + name + "doSounds");
|
||||
this.entityTick = new CustomTimingsHandler("** " + name + "entityTick");
|
||||
this.tileEntityTick = new CustomTimingsHandler("** " + name + "tileEntityTick");
|
||||
this.tileEntityPending = new CustomTimingsHandler("** " + name + "tileEntityPending");
|
||||
|
||||
this.syncChunkLoadTimer = new CustomTimingsHandler("** " + name + "syncChunkLoad");
|
||||
this.syncChunkLoadStructuresTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Structures");
|
||||
this.syncChunkLoadEntitiesTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Entities");
|
||||
this.syncChunkLoadTileEntitiesTimer = new CustomTimingsHandler("** " + name + "chunkLoad - TileEntities");
|
||||
this.syncChunkLoadTileTicksTimer = new CustomTimingsHandler("** " + name + "chunkLoad - TileTicks");
|
||||
this.syncChunkLoadPostTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Post");
|
||||
|
||||
|
||||
this.tracker = new CustomTimingsHandler(name + "tracker");
|
||||
this.doTick = new CustomTimingsHandler(name + "doTick");
|
||||
this.tickEntities = new CustomTimingsHandler(name + "tickEntities");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2794,6 +2794,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, position == net.md_5.bungee.api.ChatMessageType.ACTION_BAR));
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public int getPing()
|
||||
{
|
||||
return CraftPlayer.this.getPing();
|
||||
}
|
||||
// Paper end
|
||||
};
|
||||
|
||||
public Player.Spigot spigot()
|
||||
|
||||
@@ -413,9 +413,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
if (task.isSync()) {
|
||||
this.currentTask = task;
|
||||
try {
|
||||
task.timings.startTiming(); // Spigot
|
||||
task.run();
|
||||
task.timings.stopTiming(); // Spigot
|
||||
} catch (final Throwable throwable) {
|
||||
task.getOwner().getLogger().log(
|
||||
Level.WARNING,
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package org.bukkit.craftbukkit.scheduler;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
import org.spigotmc.CustomTimingsHandler; // Spigot
|
||||
|
||||
public class CraftTask implements BukkitTask, Runnable { // Spigot
|
||||
|
||||
private volatile CraftTask next = null;
|
||||
@@ -26,13 +24,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
|
||||
*/
|
||||
private volatile long period;
|
||||
private long nextRun;
|
||||
private final Runnable rTask;
|
||||
private final Consumer<BukkitTask> cTask;
|
||||
public final Runnable rTask;
|
||||
public final Consumer<BukkitTask> cTask;
|
||||
private final Plugin plugin;
|
||||
private final int id;
|
||||
private final long createdAt = System.nanoTime();
|
||||
|
||||
final CustomTimingsHandler timings; // Spigot
|
||||
CraftTask() {
|
||||
this(null, null, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING);
|
||||
}
|
||||
@@ -58,7 +55,6 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
|
||||
}
|
||||
this.id = id;
|
||||
this.period = period;
|
||||
this.timings = this.isSync() ? SpigotTimings.getPluginTaskTimings(this, period) : null; // Spigot
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,9 +133,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
|
||||
return true;
|
||||
}
|
||||
|
||||
// Spigot start
|
||||
public String getTaskName() {
|
||||
return (this.getTaskClass() == null) ? "Unknown" : this.getTaskClass().getName();
|
||||
}
|
||||
// Spigot end
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit.util;
|
||||
|
||||
import org.bukkit.util.CachedServerIcon;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CraftIconCache implements CachedServerIcon {
|
||||
public final byte[] value;
|
||||
@@ -8,4 +9,12 @@ public class CraftIconCache implements CachedServerIcon {
|
||||
public CraftIconCache(final byte[] value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getData() {
|
||||
if (this.value == null) {
|
||||
return null;
|
||||
}
|
||||
return "data:image/png;base64," + new String(java.util.Base64.getEncoder().encode(this.value), java.nio.charset.StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import net.minecraft.world.entity.projectile.ThrownTrident;
|
||||
import net.minecraft.world.entity.raid.Raider;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import org.bukkit.craftbukkit.SpigotTimings;
|
||||
|
||||
public class ActivationRange
|
||||
{
|
||||
@@ -111,7 +110,6 @@ public class ActivationRange
|
||||
*/
|
||||
public static void activateEntities(Level world)
|
||||
{
|
||||
SpigotTimings.entityActivationCheckTimer.startTiming();
|
||||
final int miscActivationRange = world.spigotConfig.miscActivationRange;
|
||||
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
|
||||
final int animalActivationRange = world.spigotConfig.animalActivationRange;
|
||||
@@ -138,7 +136,6 @@ public class ActivationRange
|
||||
|
||||
world.getEntities().get(ActivationRange.maxBB, ActivationRange::activateEntity);
|
||||
}
|
||||
SpigotTimings.entityActivationCheckTimer.stopTiming();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,10 +230,8 @@ public class ActivationRange
|
||||
*/
|
||||
public static boolean checkIfActive(Entity entity)
|
||||
{
|
||||
SpigotTimings.checkIfActiveTimer.startTiming();
|
||||
// Never safe to skip fireworks or item gravity
|
||||
if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId() + 1) % 4 == 0)) {
|
||||
SpigotTimings.checkIfActiveTimer.stopTiming();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -260,7 +255,6 @@ public class ActivationRange
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
SpigotTimings.checkIfActiveTimer.stopTiming();
|
||||
return isActive;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user