|
1 | 1 | --- a/net/minecraft/server/MinecraftServer.java |
2 | 2 | +++ b/net/minecraft/server/MinecraftServer.java |
3 | | -@@ -296,7 +_,7 @@ |
| 3 | +@@ -43,6 +_,8 @@ |
| 4 | + import java.util.function.Function; |
| 5 | + import java.util.function.Supplier; |
| 6 | + import java.util.stream.Collectors; |
| 7 | ++ |
| 8 | ++import joptsimple.OptionSet; |
| 9 | + import net.minecraft.CrashReport; |
| 10 | + import net.minecraft.CrashReportCategory; |
| 11 | + import net.minecraft.ReportType; |
| 12 | +@@ -186,10 +_,15 @@ |
| 13 | + import net.minecraft.world.phys.Vec2; |
| 14 | + import net.minecraft.world.phys.Vec3; |
| 15 | + import net.minecraft.world.scores.ScoreboardSaveData; |
| 16 | ++import org.bukkit.Bukkit; |
| 17 | ++import org.bukkit.craftbukkit.CraftRegistry; |
| 18 | ++import org.bukkit.craftbukkit.CraftServer; |
| 19 | ++import org.jline.terminal.Terminal; |
| 20 | + import org.jspecify.annotations.Nullable; |
| 21 | + import org.slf4j.Logger; |
| 22 | ++import org.teneted.neotenet.injection.server.MinecraftServerInjection; |
| 23 | + |
| 24 | +-public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, ServerInfo, ChunkIOErrorReporter { |
| 25 | ++public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, ServerInfo, ChunkIOErrorReporter, MinecraftServerInjection { |
| 26 | + public static final Logger LOGGER = LogUtils.getLogger(); |
| 27 | + public static final String VANILLA_BRAND = "vanilla"; |
| 28 | + private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F; |
| 29 | +@@ -293,10 +_,21 @@ |
| 30 | + private final PacketProcessor packetProcessor; |
| 31 | + private final TimerQueue<MinecraftServer> scheduledEvents; |
| 32 | + private final ServerClockManager clockManager; |
| 33 | ++ // CraftBukkit start |
| 34 | ++ public WorldLoader.DataLoadContext worldLoader; |
| 35 | ++ public org.bukkit.craftbukkit.CraftServer server; |
| 36 | ++ public OptionSet options; |
| 37 | ++ public org.bukkit.command.ConsoleCommandSender console; |
| 38 | ++ public Terminal terminal; |
| 39 | ++ public static int currentTick = (int) (System.currentTimeMillis() / 50); |
| 40 | ++ public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); |
| 41 | ++ public int autosavePeriod; |
| 42 | ++ public Commands vanillaCommandDispatcher; |
| 43 | ++ // CraftBukkit end |
4 | 44 |
|
5 | 45 | public static <S extends MinecraftServer> S spin(Function<Thread, S> factory) { |
6 | 46 | AtomicReference<S> serverReference = new AtomicReference<>(); |
|
277 | 317 | public void dumpServerProperties(Path path) throws IOException { |
278 | 318 | } |
279 | 319 |
|
| 320 | +@@ -1937,6 +_,17 @@ |
| 321 | + } |
| 322 | + } |
| 323 | + |
| 324 | ++ @Deprecated |
| 325 | ++ public static MinecraftServer getServer() { |
| 326 | ++ return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null; |
| 327 | ++ } |
| 328 | ++ |
| 329 | ++ @Deprecated |
| 330 | ++ public static RegistryAccess getDefaultRegistryAccess() { |
| 331 | ++ return CraftRegistry.getMinecraftRegistry(); |
| 332 | ++ } |
| 333 | ++ // CraftBukkit end |
| 334 | ++ |
| 335 | + private ProfilerFiller createProfiler() { |
| 336 | + if (this.willStartRecordingMetrics) { |
| 337 | + this.metricsRecorder = ActiveMetricsRecorder.createStarted( |
280 | 338 | @@ -2002,6 +_,10 @@ |
281 | 339 | return this.worldData; |
282 | 340 | } |
|
288 | 346 | public RegistryAccess.Frozen registryAccess() { |
289 | 347 | return this.registries.compositeAccess(); |
290 | 348 | } |
| 349 | +@@ -2065,6 +_,11 @@ |
| 350 | + } |
| 351 | + } |
| 352 | + |
| 353 | ++ // CraftBukkit start |
| 354 | ++ public final java.util.concurrent.ExecutorService chatExecutor = java.util.concurrent.Executors.newCachedThreadPool( |
| 355 | ++ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Chat Thread - #%d").build()); |
| 356 | ++ // CraftBukkit end |
| 357 | ++ |
| 358 | + public ChatDecorator getChatDecorator() { |
| 359 | + return ChatDecorator.PLAIN; |
| 360 | + } |
291 | 361 | @@ -2073,6 +_,13 @@ |
292 | 362 | return true; |
293 | 363 | } |
|
0 commit comments