summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2014-12-10 19:16:37 +0000
committerThinkofdeath <thinkofdeath@spigotmc.org>2014-12-10 19:17:17 +0000
commitf48410a39c98aa5a25f243877e2aa47357d46afc (patch)
tree82da298d74781ba8406034950a096acf44ed0951 /nms-patches
parente24569a9ed3e65942c0de667d2f4b66fc9dcec82 (diff)
downloadcraftbukkit-f48410a39c98aa5a25f243877e2aa47357d46afc.tar
craftbukkit-f48410a39c98aa5a25f243877e2aa47357d46afc.tar.gz
craftbukkit-f48410a39c98aa5a25f243877e2aa47357d46afc.tar.lz
craftbukkit-f48410a39c98aa5a25f243877e2aa47357d46afc.tar.xz
craftbukkit-f48410a39c98aa5a25f243877e2aa47357d46afc.zip
Fix per a world world borders
Well... mostly anyway
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/PlayerList.patch44
-rw-r--r--nms-patches/SecondaryWorldServer.patch22
-rw-r--r--nms-patches/World.patch70
-rw-r--r--nms-patches/WorldBorder.patch22
-rw-r--r--nms-patches/WorldBorderListener.patch31
5 files changed, 134 insertions, 55 deletions
diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch
index 162f7417..f5aa74d3 100644
--- a/nms-patches/PlayerList.patch
+++ b/nms-patches/PlayerList.patch
@@ -1,5 +1,5 @@
---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerList.java 2014-12-06 22:26:41.687189417 +0000
-+++ src/main/java/net/minecraft/server/PlayerList.java 2014-12-06 22:25:44.071190696 +0000
+--- ../work/decompile-8eb82bde/net/minecraft/server/PlayerList.java 2014-12-10 19:16:20.668465387 +0000
++++ src/main/java/net/minecraft/server/PlayerList.java 2014-12-10 19:10:19.948469302 +0000
@@ -18,6 +18,25 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -379,13 +379,13 @@
+ entityplayer1.setRespawnPosition(null, true);
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0.0F));
+ }
- }
++ }
+
+ if (location == null) {
+ cworld = (CraftWorld) this.server.server.getWorlds().get(0);
+ blockposition = cworld.getHandle().getSpawn();
+ location = new Location(cworld, blockposition.getX() + 0.5, blockposition.getY(), blockposition.getZ() + 0.5);
-+ }
+ }
+
+ Player respawnPlayer = cserver.getPlayer(entityplayer1);
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
@@ -557,7 +557,8 @@
+ double d1 = entity.locZ;
+ double d2 = 8.0D;
+ float f = entity.yaw;
-+
+
+- entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
+ worldserver.methodProfiler.a("moving");
+ */
+ if (worldserver1.dimension == -1) {
@@ -580,8 +581,7 @@
+ */
+ } else {
+ BlockPosition blockposition;
-
-- entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
++
+ if (i == 1) {
+ // use default NORMAL world spawn instead of target
+ worldserver1 = this.server.worlds.get(0);
@@ -691,7 +691,23 @@
}
public void tick() {
-@@ -549,10 +900,24 @@
+@@ -458,6 +809,15 @@
+
+ }
+
++ // CraftBukkit start - add a world limited version
++ public void sendAll(Packet packet, World world) {
++ for (int i = 0; i < world.players.size(); ++i) {
++ ((EntityPlayer) this.players.get(i)).playerConnection.sendPacket(packet);
++ }
++
++ }
++ // CraftBukkit end
++
+ public void a(Packet packet, int i) {
+ for (int j = 0; j < this.players.size(); ++j) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
+@@ -549,10 +909,24 @@
public void addOp(GameProfile gameprofile) {
this.operators.add(new OpListEntry(gameprofile, this.server.p()));
@@ -716,7 +732,7 @@
}
public boolean isWhitelisted(GameProfile gameprofile) {
-@@ -560,7 +925,7 @@
+@@ -560,7 +934,7 @@
}
public boolean isOp(GameProfile gameprofile) {
@@ -725,7 +741,7 @@
}
public EntityPlayer getPlayer(String s) {
-@@ -587,6 +952,12 @@
+@@ -587,6 +961,12 @@
for (int j = 0; j < this.players.size(); ++j) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
@@ -738,7 +754,7 @@
if (entityplayer != entityhuman && entityplayer.dimension == i) {
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
-@@ -634,21 +1005,26 @@
+@@ -634,21 +1014,26 @@
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
@@ -770,7 +786,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
}
-@@ -661,7 +1037,7 @@
+@@ -661,7 +1046,7 @@
}
public String[] getSeenPlayers() {
@@ -779,7 +795,7 @@
}
public boolean getHasWhitelist() {
-@@ -711,10 +1087,17 @@
+@@ -711,10 +1096,17 @@
public void v() {
for (int i = 0; i < this.players.size(); ++i) {
@@ -798,7 +814,7 @@
public void sendMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.server.sendMessage(ichatbasecomponent);
-@@ -754,11 +1137,10 @@
+@@ -754,11 +1146,10 @@
public void a(int i) {
this.r = i;
if (this.server.worldServer != null) {
diff --git a/nms-patches/SecondaryWorldServer.patch b/nms-patches/SecondaryWorldServer.patch
index 9cd69d5a..8356c3ad 100644
--- a/nms-patches/SecondaryWorldServer.patch
+++ b/nms-patches/SecondaryWorldServer.patch
@@ -1,6 +1,6 @@
---- /home/antony/work/spigot-BuildTools/work/decompile-8eb82bde//net/minecraft/server/SecondaryWorldServer.java 2014-12-03 12:27:34.906671655 +0200
-+++ src/main/java/net/minecraft/server/SecondaryWorldServer.java 2014-12-10 18:20:15.598416391 +0200
-@@ -4,13 +4,15 @@
+--- ../work/decompile-8eb82bde/net/minecraft/server/SecondaryWorldServer.java 2014-12-10 19:16:20.748465386 +0000
++++ src/main/java/net/minecraft/server/SecondaryWorldServer.java 2014-12-10 18:55:01.104479276 +0000
+@@ -4,17 +4,19 @@
private WorldServer a;
@@ -11,7 +11,8 @@
+ super(minecraftserver, idatamanager, worldData, i, methodprofiler, env, gen);
+ // CraftBukkit end
this.a = worldserver;
- worldserver.af().a((IWorldBorderListener) (new SecondaryWorldServerInnerClass1(this)));
+- worldserver.af().a((IWorldBorderListener) (new SecondaryWorldServerInnerClass1(this)));
++ // worldserver.af().a((IWorldBorderListener) (new SecondaryWorldServerInnerClass1(this)));
}
- protected void a() {}
@@ -19,3 +20,16 @@
public World b() {
this.worldMaps = this.a.T();
+- this.scoreboard = this.a.getScoreboard();
++ // this.scoreboard = this.a.getScoreboard(); // CraftBukkit
+ String s = PersistentVillage.a(this.worldProvider);
+ PersistentVillage persistentvillage = (PersistentVillage) this.worldMaps.get(PersistentVillage.class, s);
+
+@@ -26,6 +28,6 @@
+ this.villages.a((World) this);
+ }
+
+- return this;
++ return super.b();
+ }
+ }
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index 0effef5f..57e89847 100644
--- a/nms-patches/World.patch
+++ b/nms-patches/World.patch
@@ -1,5 +1,5 @@
---- ../work/decompile-8eb82bde//net/minecraft/server/World.java 2014-12-05 11:17:35.806563463 +0000
-+++ src/main/java/net/minecraft/server/World.java 2014-12-05 11:16:59.838564261 +0000
+--- ../work/decompile-8eb82bde/net/minecraft/server/World.java 2014-12-10 19:16:20.916465384 +0000
++++ src/main/java/net/minecraft/server/World.java 2014-12-10 19:11:37.648468459 +0000
@@ -13,6 +13,22 @@
import java.util.UUID;
import java.util.concurrent.Callable;
@@ -87,16 +87,18 @@
this.K = this.random.nextInt(12000);
this.allowMonsters = true;
this.allowAnimals = true;
-@@ -66,6 +128,8 @@
+@@ -66,6 +128,10 @@
this.worldProvider = worldprovider;
this.isStatic = flag;
this.M = worldprovider.getWorldBorder();
++ this.M.world = (WorldServer) this; // CraftBukkit
++ this.M.a(new WorldBorderListener(((WorldServer) this).getServer().getHandle())); // CraftBukkit
+
+ this.getServer().addWorld(this.world); // CraftBukkit
}
public World b() {
-@@ -184,6 +248,27 @@
+@@ -184,6 +250,27 @@
}
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
@@ -124,7 +126,7 @@
if (!this.isValidLocation(blockposition)) {
return false;
} else if (!this.isStatic && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
-@@ -191,9 +276,23 @@
+@@ -191,9 +278,23 @@
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
Block block = iblockdata.getBlock();
@@ -148,7 +150,7 @@
return false;
} else {
Block block1 = iblockdata1.getBlock();
-@@ -204,6 +303,7 @@
+@@ -204,6 +305,7 @@
this.methodProfiler.b();
}
@@ -156,7 +158,7 @@
if ((i & 2) != 0 && (!this.isStatic || (i & 4) == 0) && chunk.isReady()) {
this.notify(blockposition);
}
-@@ -214,12 +314,35 @@
+@@ -214,12 +316,35 @@
this.updateAdjacentComparators(blockposition, block);
}
}
@@ -192,7 +194,7 @@
public boolean setAir(BlockPosition blockposition) {
return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
}
-@@ -253,6 +376,11 @@
+@@ -253,6 +378,11 @@
public void update(BlockPosition blockposition, Block block) {
if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
@@ -204,7 +206,7 @@
this.applyPhysics(blockposition, block);
}
-@@ -328,6 +456,17 @@
+@@ -328,6 +458,17 @@
IBlockData iblockdata = this.getType(blockposition);
try {
@@ -222,7 +224,7 @@
iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
-@@ -497,6 +636,17 @@
+@@ -497,6 +638,17 @@
}
public IBlockData getType(BlockPosition blockposition) {
@@ -240,7 +242,7 @@
if (!this.isValidLocation(blockposition)) {
return Blocks.AIR.getBlockData();
} else {
-@@ -704,6 +854,13 @@
+@@ -704,6 +856,13 @@
}
public boolean addEntity(Entity entity) {
@@ -254,7 +256,7 @@
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = entity.attachedToPlayer;
-@@ -712,7 +869,35 @@
+@@ -712,7 +871,35 @@
flag = true;
}
@@ -290,7 +292,7 @@
return false;
} else {
if (entity instanceof EntityHuman) {
-@@ -734,6 +919,7 @@
+@@ -734,6 +921,7 @@
((IWorldAccess) this.u.get(i)).a(entity);
}
@@ -298,7 +300,7 @@
}
protected void b(Entity entity) {
-@@ -741,6 +927,7 @@
+@@ -741,6 +929,7 @@
((IWorldAccess) this.u.get(i)).b(entity);
}
@@ -306,7 +308,7 @@
}
public void kill(Entity entity) {
-@@ -775,7 +962,15 @@
+@@ -775,7 +964,15 @@
this.getChunkAt(i, j).b(entity);
}
@@ -323,7 +325,7 @@
this.b(entity);
}
-@@ -958,6 +1153,11 @@
+@@ -958,6 +1155,11 @@
for (i = 0; i < this.k.size(); ++i) {
entity = (Entity) this.k.get(i);
@@ -335,7 +337,7 @@
try {
++entity.ticksLived;
-@@ -1001,8 +1201,10 @@
+@@ -1001,8 +1203,10 @@
this.g.clear();
this.methodProfiler.c("regular");
@@ -348,7 +350,7 @@
if (entity.vehicle != null) {
if (!entity.vehicle.dead && entity.vehicle.passenger == entity) {
continue;
-@@ -1033,7 +1235,7 @@
+@@ -1033,7 +1237,7 @@
this.getChunkAt(j, k).b(entity);
}
@@ -357,7 +359,7 @@
this.b(entity);
}
-@@ -1042,6 +1244,14 @@
+@@ -1042,6 +1246,14 @@
this.methodProfiler.c("blockEntities");
this.L = true;
@@ -372,7 +374,7 @@
Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
-@@ -1073,11 +1283,13 @@
+@@ -1073,11 +1285,13 @@
}
this.L = false;
@@ -386,7 +388,7 @@
this.methodProfiler.c("pendingBlockEntities");
if (!this.a.isEmpty()) {
-@@ -1085,9 +1297,11 @@
+@@ -1085,9 +1299,11 @@
TileEntity tileentity1 = (TileEntity) this.a.get(l);
if (!tileentity1.x()) {
@@ -398,7 +400,7 @@
if (this.isLoaded(tileentity1.getPosition())) {
this.getChunkAtWorldCoords(tileentity1.getPosition()).a(tileentity1.getPosition(), tileentity1);
-@@ -1141,7 +1355,10 @@
+@@ -1141,7 +1357,10 @@
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
@@ -410,7 +412,7 @@
entity.P = entity.locX;
entity.Q = entity.locY;
entity.R = entity.locZ;
-@@ -1615,7 +1832,13 @@
+@@ -1615,7 +1834,13 @@
--j;
this.worldData.setThunderDuration(j);
if (j <= 0) {
@@ -425,7 +427,7 @@
}
}
-@@ -1639,7 +1862,14 @@
+@@ -1639,7 +1864,14 @@
--k;
this.worldData.setWeatherDuration(k);
if (k <= 0) {
@@ -441,7 +443,7 @@
}
}
-@@ -1651,12 +1881,18 @@
+@@ -1651,12 +1883,18 @@
}
this.p = MathHelper.a(this.p, 0.0F, 1.0F);
@@ -461,7 +463,7 @@
this.methodProfiler.a("buildList");
int i;
-@@ -1673,7 +1909,7 @@
+@@ -1673,7 +1911,7 @@
for (int i1 = -l; i1 <= l; ++i1) {
for (int j1 = -l; j1 <= l; ++j1) {
@@ -470,7 +472,7 @@
}
}
}
-@@ -1851,7 +2087,10 @@
+@@ -1851,7 +2089,10 @@
}
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@@ -482,7 +484,7 @@
return false;
} else {
int i = 0;
-@@ -2095,8 +2334,17 @@
+@@ -2095,8 +2336,17 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -501,7 +503,7 @@
++i;
}
}
-@@ -2105,12 +2353,17 @@
+@@ -2105,12 +2355,17 @@
}
public void b(Collection collection) {
@@ -521,7 +523,7 @@
this.a(entity);
}
-@@ -2124,7 +2377,13 @@
+@@ -2124,7 +2379,13 @@
Block block1 = this.getType(blockposition).getBlock();
AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData());
@@ -536,7 +538,7 @@
}
public int getBlockPower(BlockPosition blockposition, EnumDirection enumdirection) {
-@@ -2215,6 +2474,11 @@
+@@ -2215,6 +2476,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -548,7 +550,7 @@
if (IEntitySelector.d.apply(entityhuman1)) {
double d5 = entityhuman1.e(d0, d1, d2);
-@@ -2269,7 +2533,7 @@
+@@ -2269,7 +2535,7 @@
return null;
}
@@ -557,7 +559,7 @@
this.dataManager.checkSession();
}
-@@ -2331,6 +2595,16 @@
+@@ -2331,6 +2597,16 @@
public void everyoneSleeping() {}
@@ -574,7 +576,7 @@
public float h(float f) {
return (this.q + (this.r - this.q) * f) * this.j(f);
}
-@@ -2538,6 +2812,6 @@
+@@ -2538,6 +2814,6 @@
int l = j * 16 + 8 - blockposition.getZ();
short short0 = 128;
diff --git a/nms-patches/WorldBorder.patch b/nms-patches/WorldBorder.patch
index 841f4cba..daf3517f 100644
--- a/nms-patches/WorldBorder.patch
+++ b/nms-patches/WorldBorder.patch
@@ -1,6 +1,14 @@
---- ../work/decompile-8eb82bde//net/minecraft/server/WorldBorder.java 2014-11-28 17:43:43.417707428 +0000
-+++ src/main/java/net/minecraft/server/WorldBorder.java 2014-11-28 17:38:22.000000000 +0000
-@@ -32,9 +32,21 @@
+--- ../work/decompile-8eb82bde/net/minecraft/server/WorldBorder.java 2014-12-10 19:16:20.872465385 +0000
++++ src/main/java/net/minecraft/server/WorldBorder.java 2014-12-10 19:11:46.664468361 +0000
+@@ -18,6 +18,7 @@
+ private double j;
+ private int k;
+ private int l;
++ public WorldServer world; // CraftBukkit
+
+ public WorldBorder() {
+ this.e = this.d;
+@@ -32,9 +33,21 @@
return (double) (blockposition.getX() + 1) > this.b() && (double) blockposition.getX() < this.d() && (double) (blockposition.getZ() + 1) > this.c() && (double) blockposition.getZ() < this.e();
}
@@ -23,3 +31,11 @@
public boolean a(AxisAlignedBB axisalignedbb) {
return axisalignedbb.d > this.b() && axisalignedbb.a < this.d() && axisalignedbb.f > this.c() && axisalignedbb.c < this.e();
+@@ -177,6 +190,7 @@
+ }
+
+ public void a(IWorldBorderListener iworldborderlistener) {
++ if (a.contains(iworldborderlistener)) return; // CraftBukkit
+ this.a.add(iworldborderlistener);
+ }
+
diff --git a/nms-patches/WorldBorderListener.patch b/nms-patches/WorldBorderListener.patch
new file mode 100644
index 00000000..2a7d5284
--- /dev/null
+++ b/nms-patches/WorldBorderListener.patch
@@ -0,0 +1,31 @@
+--- ../work/decompile-8eb82bde/net/minecraft/server/WorldBorderListener.java 2014-12-10 19:16:20.876465384 +0000
++++ src/main/java/net/minecraft/server/WorldBorderListener.java 2014-12-10 18:59:49.024476151 +0000
+@@ -9,23 +9,23 @@
+ }
+
+ public void a(WorldBorder worldborder, double d0) {
+- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_SIZE));
++ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_SIZE), worldborder.world); // CraftBukkit
+ }
+
+ public void a(WorldBorder worldborder, double d0, double d1, long i) {
+- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.LERP_SIZE));
++ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.LERP_SIZE), worldborder.world); // CraftBukkit
+ }
+
+ public void a(WorldBorder worldborder, double d0, double d1) {
+- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_CENTER));
++ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_CENTER), worldborder.world); // CraftBukkit
+ }
+
+ public void a(WorldBorder worldborder, int i) {
+- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_WARNING_TIME));
++ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_WARNING_TIME), worldborder.world); // CraftBukkit
+ }
+
+ public void b(WorldBorder worldborder, int i) {
+- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_WARNING_BLOCKS));
++ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_WARNING_BLOCKS), worldborder.world); // CraftBukkit
+ }
+
+ public void b(WorldBorder worldborder, double d0) {}