mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 01:17:44 +01:00
Ensure Bukkit data pack is always up to date
This commit is contained in:
parent
0b107b8de3
commit
65ea162ce2
@ -307,7 +307,7 @@
|
|||||||
|
|
||||||
private void a(WorldData worlddata) {
|
private void a(WorldData worlddata) {
|
||||||
worlddata.f(false);
|
worlddata.f(false);
|
||||||
@@ -353,6 +495,25 @@
|
@@ -353,6 +495,23 @@
|
||||||
protected void a(File file, WorldData worlddata) {
|
protected void a(File file, WorldData worlddata) {
|
||||||
this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla()));
|
this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla()));
|
||||||
this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks"));
|
this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks"));
|
||||||
@ -317,23 +317,21 @@
|
|||||||
+ bukkitDataPackFolder.mkdirs();
|
+ bukkitDataPackFolder.mkdirs();
|
||||||
+ }
|
+ }
|
||||||
+ File mcMeta = new File(bukkitDataPackFolder, "pack.mcmeta");
|
+ File mcMeta = new File(bukkitDataPackFolder, "pack.mcmeta");
|
||||||
+ if (!mcMeta.exists()) {
|
|
||||||
+ try {
|
+ try {
|
||||||
+ com.google.common.io.Files.write("{\n"
|
+ com.google.common.io.Files.write("{\n"
|
||||||
+ + " \"pack\": {\n"
|
+ + " \"pack\": {\n"
|
||||||
+ + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n"
|
+ + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n"
|
||||||
+ + " \"pack_format\": 1\n"
|
+ + " \"pack_format\": " + SharedConstants.a().getPackVersion() + "\n"
|
||||||
+ + " }\n"
|
+ + " }\n"
|
||||||
+ + "}", mcMeta, com.google.common.base.Charsets.UTF_8);
|
+ + "}\n", mcMeta, com.google.common.base.Charsets.UTF_8);
|
||||||
+ } catch (IOException ex) {
|
+ } catch (IOException ex) {
|
||||||
+ throw new RuntimeException("Could not initialize Bukkit datapack", ex);
|
+ throw new RuntimeException("Could not initialize Bukkit datapack", ex);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder);
|
this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder);
|
||||||
this.resourcePackRepository.a();
|
this.resourcePackRepository.a();
|
||||||
List<ResourcePackLoader> list = Lists.newArrayList();
|
List<ResourcePackLoader> list = Lists.newArrayList();
|
||||||
@@ -373,11 +534,18 @@
|
@@ -373,11 +532,18 @@
|
||||||
this.b(worlddata);
|
this.b(worlddata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +353,7 @@
|
|||||||
BlockPosition blockposition = worldserver.getSpawn();
|
BlockPosition blockposition = worldserver.getSpawn();
|
||||||
|
|
||||||
worldloadlistener.a(new ChunkCoordIntPair(blockposition));
|
worldloadlistener.a(new ChunkCoordIntPair(blockposition));
|
||||||
@@ -388,17 +556,21 @@
|
@@ -388,17 +554,21 @@
|
||||||
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||||
|
|
||||||
while (chunkproviderserver.b() != 441) {
|
while (chunkproviderserver.b() != 441) {
|
||||||
@ -386,7 +384,7 @@
|
|||||||
|
|
||||||
if (forcedchunk != null) {
|
if (forcedchunk != null) {
|
||||||
WorldServer worldserver1 = this.getWorldServer(dimensionmanager);
|
WorldServer worldserver1 = this.getWorldServer(dimensionmanager);
|
||||||
@@ -413,10 +585,16 @@
|
@@ -413,10 +583,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +403,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void a(String s, WorldNBTStorage worldnbtstorage) {
|
protected void a(String s, WorldNBTStorage worldnbtstorage) {
|
||||||
@@ -463,12 +641,16 @@
|
@@ -463,12 +639,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +420,7 @@
|
|||||||
return flag3;
|
return flag3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,8 +659,29 @@
|
@@ -477,8 +657,29 @@
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +450,7 @@
|
|||||||
if (this.getServerConnection() != null) {
|
if (this.getServerConnection() != null) {
|
||||||
this.getServerConnection().b();
|
this.getServerConnection().b();
|
||||||
}
|
}
|
||||||
@@ -487,6 +690,7 @@
|
@@ -487,6 +688,7 @@
|
||||||
MinecraftServer.LOGGER.info("Saving players");
|
MinecraftServer.LOGGER.info("Saving players");
|
||||||
this.playerList.savePlayers();
|
this.playerList.savePlayers();
|
||||||
this.playerList.shutdown();
|
this.playerList.shutdown();
|
||||||
@ -460,7 +458,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
MinecraftServer.LOGGER.info("Saving worlds");
|
MinecraftServer.LOGGER.info("Saving worlds");
|
||||||
@@ -556,14 +760,16 @@
|
@@ -556,14 +758,16 @@
|
||||||
while (this.isRunning) {
|
while (this.isRunning) {
|
||||||
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
|
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
|
||||||
|
|
||||||
@ -478,7 +476,7 @@
|
|||||||
this.nextTick += 50L;
|
this.nextTick += 50L;
|
||||||
if (this.T) {
|
if (this.T) {
|
||||||
this.T = false;
|
this.T = false;
|
||||||
@@ -610,6 +816,12 @@
|
@@ -610,6 +814,12 @@
|
||||||
} catch (Throwable throwable1) {
|
} catch (Throwable throwable1) {
|
||||||
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
||||||
} finally {
|
} finally {
|
||||||
@ -491,7 +489,7 @@
|
|||||||
this.exit();
|
this.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,8 +830,15 @@
|
@@ -618,8 +828,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canSleepForTick() {
|
private boolean canSleepForTick() {
|
||||||
@ -508,7 +506,7 @@
|
|||||||
|
|
||||||
protected void sleepForTick() {
|
protected void sleepForTick() {
|
||||||
this.executeAll();
|
this.executeAll();
|
||||||
@@ -720,7 +939,7 @@
|
@@ -720,7 +937,7 @@
|
||||||
this.serverPing.b().a(agameprofile);
|
this.serverPing.b().a(agameprofile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +515,7 @@
|
|||||||
MinecraftServer.LOGGER.debug("Autosave started");
|
MinecraftServer.LOGGER.debug("Autosave started");
|
||||||
this.methodProfiler.enter("save");
|
this.methodProfiler.enter("save");
|
||||||
this.playerList.savePlayers();
|
this.playerList.savePlayers();
|
||||||
@@ -750,23 +969,40 @@
|
@@ -750,23 +967,40 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void b(BooleanSupplier booleansupplier) {
|
protected void b(BooleanSupplier booleansupplier) {
|
||||||
@ -559,7 +557,7 @@
|
|||||||
|
|
||||||
this.methodProfiler.enter("tick");
|
this.methodProfiler.enter("tick");
|
||||||
|
|
||||||
@@ -805,7 +1041,8 @@
|
@@ -805,7 +1039,8 @@
|
||||||
this.tickables.add(runnable);
|
this.tickables.add(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +567,7 @@
|
|||||||
OptionParser optionparser = new OptionParser();
|
OptionParser optionparser = new OptionParser();
|
||||||
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
||||||
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
||||||
@@ -828,15 +1065,17 @@
|
@@ -828,15 +1063,17 @@
|
||||||
optionparser.printHelpOn(System.err);
|
optionparser.printHelpOn(System.err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -589,7 +587,7 @@
|
|||||||
MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'");
|
MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -848,14 +1087,15 @@
|
@@ -848,14 +1085,15 @@
|
||||||
|
|
||||||
DispenserRegistry.init();
|
DispenserRegistry.init();
|
||||||
DispenserRegistry.c();
|
DispenserRegistry.c();
|
||||||
@ -608,7 +606,7 @@
|
|||||||
dedicatedserver.i((String) optionset.valueOf(optionspec7));
|
dedicatedserver.i((String) optionset.valueOf(optionspec7));
|
||||||
dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10));
|
dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10));
|
||||||
dedicatedserver.e(optionset.has(optionspec2));
|
dedicatedserver.e(optionset.has(optionspec2));
|
||||||
@@ -878,6 +1118,29 @@
|
@@ -878,6 +1116,29 @@
|
||||||
|
|
||||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER));
|
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER));
|
||||||
Runtime.getRuntime().addShutdownHook(thread);
|
Runtime.getRuntime().addShutdownHook(thread);
|
||||||
@ -638,7 +636,7 @@
|
|||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
|
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
|
||||||
}
|
}
|
||||||
@@ -897,7 +1160,9 @@
|
@@ -897,7 +1158,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startServerThread() {
|
public void startServerThread() {
|
||||||
@ -648,7 +646,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public File d(String s) {
|
public File d(String s) {
|
||||||
@@ -952,7 +1217,7 @@
|
@@ -952,7 +1215,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServerModName() {
|
public String getServerModName() {
|
||||||
@ -657,7 +655,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CrashReport b(CrashReport crashreport) {
|
public CrashReport b(CrashReport crashreport) {
|
||||||
@@ -991,7 +1256,7 @@
|
@@ -991,7 +1254,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean F() {
|
public boolean F() {
|
||||||
@ -666,7 +664,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1690,4 +1955,16 @@
|
@@ -1690,4 +1953,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user