From 64492523a761fb37d2b73f4aad8b8041f7a30d83 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 3 Dec 2014 14:35:33 -0500 Subject: Move WorldSaveEvent to proper location calling CraftWorld.save() currently does not call WorldSaveEvent, and WorldSaveEvent could fire on worlds that have saving disabled. New location will always fire during a world save and only during an actual save. --- nms-patches/MinecraftServer.patch | 60 ++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 32 deletions(-) (limited to 'nms-patches/MinecraftServer.patch') diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch index ea9982db..e5605805 100644 --- a/nms-patches/MinecraftServer.patch +++ b/nms-patches/MinecraftServer.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/MinecraftServer.java Sat Nov 29 19:31:45 2014 -+++ src/main/java/net/minecraft/server/MinecraftServer.java Sat Nov 29 19:27:57 2014 +--- ../decompile-8eb82bde//net/minecraft/server/MinecraftServer.java 2014-12-03 14:33:55.037564649 -0500 ++++ src/main/java/net/minecraft/server/MinecraftServer.java 2014-12-03 14:33:47.061564766 -0500 @@ -37,6 +37,18 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -276,7 +276,7 @@ this.q(); } -@@ -247,35 +390,42 @@ +@@ -247,35 +390,38 @@ protected void q() { this.e = null; this.f = 0; @@ -309,10 +309,6 @@ - } + worldserver.save(true, (IProgressUpdate) null); + worldserver.saveLevel(); -+ -+ WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld()); -+ this.server.getPluginManager().callEvent(event); -+ // CraftBukkit end } } @@ -331,7 +327,7 @@ if (this.ao() != null) { this.ao().b(); } -@@ -290,11 +440,13 @@ +@@ -290,11 +436,13 @@ MinecraftServer.LOGGER.info("Saving worlds"); this.saveChunks(false); @@ -345,7 +341,7 @@ } if (this.m.d()) { -@@ -335,6 +487,7 @@ +@@ -335,6 +483,7 @@ long k = j - this.ab; if (k > 2000L && this.ab - this.R >= 15000L) { @@ -353,7 +349,7 @@ MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)}); k = 2000L; this.R = this.ab; -@@ -347,11 +500,12 @@ +@@ -347,11 +496,12 @@ i += k; this.ab = j; @@ -367,7 +363,7 @@ i -= 50L; this.y(); } -@@ -389,6 +543,12 @@ +@@ -389,6 +539,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -380,7 +376,7 @@ this.x(); } -@@ -428,7 +588,7 @@ +@@ -428,7 +584,7 @@ protected void x() {} @@ -389,7 +385,7 @@ long i = System.nanoTime(); ++this.ticks; -@@ -454,7 +614,7 @@ +@@ -454,7 +610,7 @@ this.r.b().a(agameprofile); } @@ -398,7 +394,7 @@ this.methodProfiler.a("save"); this.v.savePlayers(); this.saveChunks(true); -@@ -493,20 +653,40 @@ +@@ -493,20 +649,40 @@ this.methodProfiler.c("levels"); @@ -442,7 +438,7 @@ this.methodProfiler.a("tick"); -@@ -533,9 +713,9 @@ +@@ -533,9 +709,9 @@ worldserver.getTracker().updatePlayers(); this.methodProfiler.b(); this.methodProfiler.b(); @@ -454,7 +450,7 @@ } this.methodProfiler.c("connection"); -@@ -559,10 +739,11 @@ +@@ -559,10 +735,11 @@ this.o.add(iupdateplayerlistbox); } @@ -467,7 +463,7 @@ boolean flag = true; String s = null; String s1 = "."; -@@ -636,6 +817,27 @@ +@@ -636,6 +813,27 @@ dedicatedserver.B(); Runtime.getRuntime().addShutdownHook(new ThreadShutdown("Server Shutdown Thread", dedicatedserver)); @@ -495,7 +491,7 @@ } catch (Exception exception) { MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); } -@@ -643,8 +845,10 @@ +@@ -643,8 +841,10 @@ } public void B() { @@ -506,7 +502,7 @@ } public File d(String s) { -@@ -660,7 +864,14 @@ +@@ -660,7 +860,14 @@ } public WorldServer getWorldServer(int i) { @@ -522,7 +518,7 @@ } public String C() { -@@ -696,17 +907,62 @@ +@@ -696,17 +903,62 @@ } public String getPlugins() { @@ -592,7 +588,7 @@ } public void h(String s) { -@@ -721,7 +977,7 @@ +@@ -721,7 +973,7 @@ } public String getServerModName() { @@ -601,7 +597,7 @@ } public CrashReport b(CrashReport crashreport) { -@@ -734,6 +990,7 @@ +@@ -734,6 +986,7 @@ } public List tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition) { @@ -609,7 +605,7 @@ ArrayList arraylist = Lists.newArrayList(); if (s.startsWith("/")) { -@@ -772,6 +1029,9 @@ +@@ -772,6 +1025,9 @@ return arraylist; } @@ -619,7 +615,7 @@ } public static MinecraftServer getServer() { -@@ -779,7 +1039,7 @@ +@@ -779,7 +1035,7 @@ } public boolean N() { @@ -628,7 +624,7 @@ } public String getName() { -@@ -835,8 +1095,10 @@ +@@ -835,8 +1091,10 @@ } public void a(EnumDifficulty enumdifficulty) { @@ -641,7 +637,7 @@ if (worldserver != null) { if (worldserver.getWorldData().isHardcore()) { -@@ -878,15 +1140,17 @@ +@@ -878,15 +1136,17 @@ this.N = true; this.getConvertable().d(); @@ -662,7 +658,7 @@ this.safeShutdown(); } -@@ -919,9 +1183,11 @@ +@@ -919,9 +1179,11 @@ int i = 0; if (this.worldServer != null) { @@ -677,7 +673,7 @@ WorldData worlddata = worldserver.getWorldData(); mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimension())); -@@ -954,7 +1220,7 @@ +@@ -954,7 +1216,7 @@ public abstract boolean ad(); public boolean getOnlineMode() { @@ -686,7 +682,7 @@ } public void setOnlineMode(boolean flag) { -@@ -1024,8 +1290,10 @@ +@@ -1024,8 +1286,10 @@ } public void setGamemode(EnumGamemode enumgamemode) { @@ -699,7 +695,7 @@ } } -@@ -1057,7 +1325,7 @@ +@@ -1057,7 +1321,7 @@ } public World getWorld() { @@ -708,7 +704,7 @@ } public Entity f() { -@@ -1125,11 +1393,10 @@ +@@ -1125,11 +1389,10 @@ } public Entity a(UUID uuid) { @@ -724,7 +720,7 @@ if (worldserver != null) { Entity entity = worldserver.getEntity(uuid); -@@ -1144,7 +1411,7 @@ +@@ -1144,7 +1407,7 @@ } public boolean getSendCommandFeedback() { -- cgit v1.2.3