mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 01:39:52 +03:00
121 lines
5.0 KiB
Diff
121 lines
5.0 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java
|
|
@@ -7,16 +7,59 @@
|
|
import net.minecraft.world.border.WorldBorder;
|
|
import net.minecraft.world.storage.DerivedWorldInfo;
|
|
import net.minecraft.world.storage.ISaveHandler;
|
|
+import net.minecraft.world.storage.WorldInfo;
|
|
|
|
public class WorldServerMulti extends WorldServer
|
|
{
|
|
private final WorldServer delegate;
|
|
+ private IBorderListener borderListener;
|
|
|
|
+ // CraftBukkit start - Add WorldInfo, Environment and ChunkGenerator arguments
|
|
+ public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn, WorldInfo worldData, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen)
|
|
+ {
|
|
+ super(server, saveHandlerIn, worldData, dimensionId, profilerIn, env, gen);
|
|
+ this.delegate = delegate;
|
|
+ /* CraftBukkit start
|
|
+ this.borderListener = new IBorderListener()
|
|
+ {
|
|
+ public void onSizeChanged(WorldBorder border, double newSize)
|
|
+ {
|
|
+ WorldServerMulti.this.getWorldBorder().setTransition(newSize);
|
|
+ }
|
|
+ public void onTransitionStarted(WorldBorder border, double oldSize, double newSize, long time)
|
|
+ {
|
|
+ WorldServerMulti.this.getWorldBorder().setTransition(oldSize, newSize, time);
|
|
+ }
|
|
+ public void onCenterChanged(WorldBorder border, double x, double z)
|
|
+ {
|
|
+ WorldServerMulti.this.getWorldBorder().setCenter(x, z);
|
|
+ }
|
|
+ public void onWarningTimeChanged(WorldBorder border, int newTime)
|
|
+ {
|
|
+ WorldServerMulti.this.getWorldBorder().setWarningTime(newTime);
|
|
+ }
|
|
+ public void onWarningDistanceChanged(WorldBorder border, int newDistance)
|
|
+ {
|
|
+ WorldServerMulti.this.getWorldBorder().setWarningDistance(newDistance);
|
|
+ }
|
|
+ public void onDamageAmountChanged(WorldBorder border, double newAmount)
|
|
+ {
|
|
+ WorldServerMulti.this.getWorldBorder().setDamageAmount(newAmount);
|
|
+ }
|
|
+ public void onDamageBufferChanged(WorldBorder border, double newSize)
|
|
+ {
|
|
+ WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize);
|
|
+ }
|
|
+ };
|
|
+ this.delegate.getWorldBorder().addListener(this.borderListener);
|
|
+ // CraftBukkit end */
|
|
+ }
|
|
+
|
|
public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn)
|
|
{
|
|
super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn);
|
|
this.delegate = delegate;
|
|
- delegate.getWorldBorder().addListener(new IBorderListener()
|
|
+ this.borderListener = new IBorderListener()
|
|
{
|
|
public void onSizeChanged(WorldBorder border, double newSize)
|
|
{
|
|
@@ -46,12 +89,19 @@
|
|
{
|
|
WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize);
|
|
}
|
|
- });
|
|
+ };
|
|
+ this.delegate.getWorldBorder().addListener(this.borderListener);
|
|
}
|
|
|
|
+ /* we handle all saving including perWorldStorage in WorldServer.saveLevel. This needs to be disabled since we follow
|
|
+ // bukkit's world saving methods by using a seperate save handler for each world. Each world folder needs to generate a corresponding
|
|
+ // level.dat for plugins that require it such as MultiWorld.
|
|
+ /*
|
|
protected void saveLevel() throws MinecraftException
|
|
{
|
|
+ this.perWorldStorage.saveAllData();
|
|
}
|
|
+ */
|
|
|
|
public World init()
|
|
{
|
|
@@ -60,12 +110,12 @@
|
|
this.lootTable = this.delegate.getLootTableManager();
|
|
this.advancementManager = this.delegate.getAdvancementManager();
|
|
String s = VillageCollection.fileNameForProvider(this.provider);
|
|
- VillageCollection villagecollection = (VillageCollection)this.mapStorage.getOrLoadData(VillageCollection.class, s);
|
|
+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.getOrLoadData(VillageCollection.class, s);
|
|
|
|
if (villagecollection == null)
|
|
{
|
|
this.villageCollection = new VillageCollection(this);
|
|
- this.mapStorage.setData(s, this.villageCollection);
|
|
+ this.perWorldStorage.setData(s, this.villageCollection);
|
|
}
|
|
else
|
|
{
|
|
@@ -73,9 +123,19 @@
|
|
this.villageCollection.setWorldsForAll(this);
|
|
}
|
|
|
|
- return this;
|
|
+ this.initCapabilities();
|
|
+ // return this;
|
|
+ return super.init(); // CraftBukkit
|
|
}
|
|
|
|
+
|
|
+ @Override
|
|
+ public void flush()
|
|
+ {
|
|
+ super.flush();
|
|
+ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak.
|
|
+ }
|
|
+
|
|
public void saveAdditionalData()
|
|
{
|
|
this.provider.onWorldSave();
|