Added internal MC support for multiple worlds

This commit is contained in:
Dinnerbone
2011-02-05 18:15:04 +00:00
parent 9e7991ab52
commit 2be5181b0c
10 changed files with 631 additions and 73 deletions

View File

@@ -22,22 +22,24 @@ public class PlayerManager {
this.c.clear();
}
private PlayerInstance a(int i, int j, boolean flag) {
// Craftbukkit - method signature changed!
private PlayerInstance a(int i, int j, boolean flag, WorldServer world) {
long k = (long) i + 2147483647L | (long) j + 2147483647L << 32;
PlayerInstance playerinstance = (PlayerInstance) this.b.a(k);
if (playerinstance == null && flag) {
playerinstance = new PlayerInstance(this, i, j);
playerinstance = new PlayerInstance(this, i, j, world);
this.b.a(k, playerinstance);
}
return playerinstance;
}
public void a(int i, int j, int k) {
// Craftbukkit - method signature changed!
public void a(int i, int j, int k, WorldServer world) {
int l = i >> 4;
int i1 = k >> 4;
PlayerInstance playerinstance = this.a(l, i1, false);
PlayerInstance playerinstance = this.a(l, i1, false, world);
if (playerinstance != null) {
playerinstance.a(i & 15, j, k & 15);
@@ -67,7 +69,7 @@ public class PlayerManager {
int dz = 0;
// Origin
this.a(i, j, true).a(entityplayer);
this.a(i, j, true, ((WorldServer)entityplayer.world)).a(entityplayer);
// All but the last leg
for (int legSize = 1; legSize <= size * 2; legSize++) {
@@ -77,7 +79,7 @@ public class PlayerManager {
for (int k = 0; k < legSize; k++ ) {
dx += dir[0];
dz += dir[1];
this.a(i + dx, j + dz, true).a(entityplayer);
this.a(i + dx, j + dz, true, ((WorldServer)entityplayer.world)).a(entityplayer); // Craftbukkit
}
}
}
@@ -87,7 +89,7 @@ public class PlayerManager {
for (int k = 0; k < size * 2; k++) {
dx += direction[facing][0];
dz += direction[facing][1];
this.a(i + dx, j + dz, true).a(entityplayer);
this.a(i + dx, j + dz, true, ((WorldServer)entityplayer.world)).a(entityplayer);
}
// CraftBukkit end
@@ -100,7 +102,7 @@ public class PlayerManager {
for (int k = i - 10; k <= i + 10; ++k) {
for (int l = j - 10; l <= j + 10; ++l) {
PlayerInstance playerinstance = this.a(k, l, false);
PlayerInstance playerinstance = this.a(k, l, false, ((WorldServer)entityplayer.world));
if (playerinstance != null) {
playerinstance.b(entityplayer);
@@ -135,11 +137,11 @@ public class PlayerManager {
for (int k1 = i - 10; k1 <= i + 10; ++k1) {
for (int l1 = j - 10; l1 <= j + 10; ++l1) {
if (!this.a(k1, l1, k, l)) {
this.a(k1, l1, true).a(entityplayer);
this.a(k1, l1, true, ((WorldServer)entityplayer.world)).a(entityplayer);
}
if (!this.a(k1 - i1, l1 - j1, i, j)) {
PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false);
PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false, ((WorldServer)entityplayer.world));
if (playerinstance != null) {
playerinstance.b(entityplayer);