From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 2 Dec 2020 20:04:01 -0800 Subject: [PATCH] Added ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 138ea4c3e4a1ed2426d9b9f40026b5dc0617c76d..c2a2a14164d2431413c773fb5944ad68a8f6ad6b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2,9 +2,6 @@ package net.minecraft.server; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; -import co.aikar.timings.Timings; -import com.destroystokyo.paper.event.server.PaperServerListPingEvent; -import com.google.common.base.Stopwatch; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -183,6 +180,7 @@ import org.bukkit.event.server.ServerLoadEvent; import co.aikar.timings.MinecraftTimings; // Paper import org.spigotmc.SlackActivityAccountant; // Spigot import io.papermc.paper.util.PaperJvmChecker; // Paper +import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { @@ -1936,7 +1934,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant a(Collection collection) { + return this.reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.PLUGIN); + } + public CompletableFuture reloadServerResources(Collection collection, ServerResourcesReloadedEvent.Cause cause) { + // Paper end CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { Stream stream = collection.stream(); // CraftBukkit - decompile error ResourcePackRepository resourcepackrepository = this.resourcePackRepository; @@ -1952,6 +1956,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant collection, CommandListenerWrapper commandlistenerwrapper) { - commandlistenerwrapper.getServer().a(collection).exceptionally((throwable) -> { + commandlistenerwrapper.getServer().reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper CommandReload.LOGGER.warn("Failed to execute reload", throwable); commandlistenerwrapper.sendFailureMessage(new ChatMessage("commands.reload.failure")); return null; @@ -48,7 +49,7 @@ public class CommandReload { SaveData savedata = minecraftserver.getSaveData(); Collection collection = resourcepackrepository.d(); Collection collection1 = a(resourcepackrepository, savedata, collection); - minecraftserver.a(collection1); + minecraftserver.reloadServerResources(collection1, ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper } // CraftBukkit end