diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java | 143 |
1 files changed, 122 insertions, 21 deletions
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java index c3aa44a1..93e8ef6f 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java @@ -4,6 +4,7 @@ import java.io.File; import java.net.SocketAddress; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -91,10 +92,10 @@ public abstract class ServerConfigurationManagerAbstract { // this.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - handled in event this.c(entityplayer); netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); - this.server.ac().a(netserverhandler); - netserverhandler.sendPacket(new Packet4UpdateTime(worldserver.getTime())); + this.server.ae().a(netserverhandler); + netserverhandler.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.F())); if (this.server.getTexturePack().length() > 0) { - entityplayer.a(this.server.getTexturePack(), this.server.R()); + entityplayer.a(this.server.getTexturePack(), this.server.S()); } Iterator iterator = entityplayer.getEffects().iterator(); @@ -114,7 +115,7 @@ public abstract class ServerConfigurationManagerAbstract { } public void a(EntityPlayer entityplayer, WorldServer worldserver) { - WorldServer worldserver1 = entityplayer.q(); + WorldServer worldserver1 = entityplayer.p(); if (worldserver != null) { worldserver.getPlayerManager().removePlayer(entityplayer); @@ -129,9 +130,9 @@ public abstract class ServerConfigurationManagerAbstract { } public void a(EntityPlayer entityplayer) { - NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().h(); // CraftBukkit + NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().i(); // CraftBukkit - if (entityplayer.getName().equals(this.server.G()) && nbttagcompound != null) { + if (entityplayer.getName().equals(this.server.H()) && nbttagcompound != null) { entityplayer.e(nbttagcompound); } else { this.playerFileData.load(entityplayer); @@ -195,7 +196,7 @@ public abstract class ServerConfigurationManagerAbstract { } public void d(EntityPlayer entityplayer) { - entityplayer.q().getPlayerManager().movePlayer(entityplayer); + entityplayer.p().getPlayerManager().movePlayer(entityplayer); } public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string @@ -207,7 +208,7 @@ public abstract class ServerConfigurationManagerAbstract { // CraftBukkit end this.b(entityplayer); - WorldServer worldserver = entityplayer.q(); + WorldServer worldserver = entityplayer.p(); worldserver.kill(entityplayer); worldserver.getPlayerManager().removePlayer(entityplayer); @@ -232,7 +233,7 @@ public abstract class ServerConfigurationManagerAbstract { // Instead of kicking then returning, we need to store the kick reason // in the event, check with plugins to see if it's ok, and THEN kick // depending on the outcome. - EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.L() ? new DemoItemInWorldManager(this.server.getWorldServer(0)) : new ItemInWorldManager(this.server.getWorldServer(0))); + EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.M() ? new DemoItemInWorldManager(this.server.getWorldServer(0)) : new ItemInWorldManager(this.server.getWorldServer(0))); Player player = entity.getBukkitEntity(); PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, netloginhandler.getSocket().getInetAddress()); @@ -304,7 +305,7 @@ public abstract class ServerConfigurationManagerAbstract { /* CraftBukkit start Object object; - if (this.server.L()) { + if (this.server.M()) { object = new DemoItemInWorldManager(this.server.getWorldServer(0)); } else { object = new ItemInWorldManager(this.server.getWorldServer(0)); @@ -323,12 +324,13 @@ public abstract class ServerConfigurationManagerAbstract { public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location) { // CraftBukkit end - entityplayer.q().getTracker().untrackPlayer(entityplayer); - // entityplayer.q().getTracker().untrackEntity(entityplayer); // CraftBukkit - entityplayer.q().getPlayerManager().removePlayer(entityplayer); + entityplayer.p().getTracker().untrackPlayer(entityplayer); + // entityplayer.p().getTracker().untrackEntity(entityplayer); // CraftBukkit + entityplayer.p().getPlayerManager().removePlayer(entityplayer); this.players.remove(entityplayer); this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer); ChunkCoordinates chunkcoordinates = entityplayer.getBed(); + boolean flag1 = entityplayer.isRespawnForced(); // CraftBukkit start EntityPlayer entityplayer1 = entityplayer; @@ -342,12 +344,12 @@ public abstract class ServerConfigurationManagerAbstract { boolean isBedSpawn = false; CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld); if (cworld != null && chunkcoordinates != null) { - chunkcoordinates1 = EntityHuman.getBed(cworld.getHandle(), chunkcoordinates); + chunkcoordinates1 = EntityHuman.getBed(cworld.getHandle(), chunkcoordinates, flag); if (chunkcoordinates1 != null) { isBedSpawn = true; location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5); } else { - entityplayer1.setRespawnPosition(null); + entityplayer1.setRespawnPosition(null, true); entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0, 0)); } } @@ -389,6 +391,7 @@ public abstract class ServerConfigurationManagerAbstract { chunkcoordinates1 = worldserver.getSpawn(); // CraftBukkit end entityplayer1.netServerHandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z)); + entityplayer1.netServerHandler.sendPacket(new Packet43SetExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel)); this.b(entityplayer1, worldserver); worldserver.getPlayerManager().addPlayer(entityplayer1); worldserver.addEntity(entityplayer1); @@ -485,6 +488,61 @@ public abstract class ServerConfigurationManagerAbstract { // CraftBukkit end } + public void a(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) { + double d0 = entity.locX; + double d1 = entity.locZ; + double d2 = 8.0D; + double d3 = entity.locX; + double d4 = entity.locY; + double d5 = entity.locZ; + float f = entity.yaw; + + if (entity.dimension == -1) { + d0 /= d2; + d1 /= d2; + entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); + if (entity.isAlive()) { + worldserver.entityJoinedWorld(entity, false); + } + } else if (entity.dimension == 0) { + d0 *= d2; + d1 *= d2; + entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); + if (entity.isAlive()) { + worldserver.entityJoinedWorld(entity, false); + } + } else { + ChunkCoordinates chunkcoordinates; + + if (i == 1) { + chunkcoordinates = worldserver1.getSpawn(); + } else { + chunkcoordinates = worldserver1.getDimensionSpawn(); + } + + d0 = (double) chunkcoordinates.x; + entity.locY = (double) chunkcoordinates.y; + d1 = (double) chunkcoordinates.z; + entity.setPositionRotation(d0, entity.locY, d1, 90.0F, 0.0F); + if (entity.isAlive()) { + worldserver.entityJoinedWorld(entity, false); + } + } + + if (i != 1) { + d0 = (double) MathHelper.a((int) d0, -29999872, 29999872); + d1 = (double) MathHelper.a((int) d1, -29999872, 29999872); + if (entity.isAlive()) { + worldserver1.addEntity(entity); + entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); + worldserver1.entityJoinedWorld(entity, false); + (new PortalTravelAgent()).a(worldserver1, entity, d3, d4, d5, f); + } + } + + entity.spawnIn(worldserver1); + } + public void tick() { if (++this.o > 600) { this.o = 0; @@ -578,7 +636,7 @@ public abstract class ServerConfigurationManagerAbstract { public boolean isOp(String s) { // CraftBukkit - return this.operators.contains(s.trim().toLowerCase()) || this.server.H() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.G().equalsIgnoreCase(s) || this.n; + return this.operators.contains(s.trim().toLowerCase()) || this.server.I() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.H().equalsIgnoreCase(s) || this.n; } public EntityPlayer f(String s) { @@ -597,8 +655,51 @@ public abstract class ServerConfigurationManagerAbstract { return entityplayer; } + public List a(ChunkCoordinates chunkcoordinates, int i, int j, int k, int l, int i1, int j1) { + if (this.players.isEmpty()) { + return null; + } else { + Object object = new ArrayList(); + boolean flag = k < 0; + int k1 = i * i; + int l1 = j * j; + + k = MathHelper.a(k); + + for (int i2 = 0; i2 < this.players.size(); ++i2) { + EntityPlayer entityplayer = (EntityPlayer) this.players.get(i2); + + if (chunkcoordinates != null && (i > 0 || j > 0)) { + float f = chunkcoordinates.e(entityplayer.b()); + + if (i > 0 && f < (float) k1 || j > 0 && f > (float) l1) { + continue; + } + } + + if ((l == EnumGamemode.NONE.a() || l == entityplayer.itemInWorldManager.getGameMode().a()) && (i1 <= 0 || entityplayer.expLevel >= i1) && entityplayer.expLevel <= j1) { + ((List) object).add(entityplayer); + } + } + + if (chunkcoordinates != null) { + Collections.sort((List) object, new PlayerDistanceComparator(chunkcoordinates)); + } + + if (flag) { + Collections.reverse((List) object); + } + + if (k > 0) { + object = ((List) object).subList(0, Math.min(k, ((List) object).size())); + } + + return (List) object; + } + } + public void sendPacketNearby(double d0, double d1, double d2, double d3, int i, Packet packet) { - this.sendPacketNearby((EntityHuman) null, d0, d1, d2, d3, i, packet); + this.sendPacketNearby(d0, d1, d2, d3, i, packet, null); // CraftBukkit } // CraftBukkit start - Add support for entity who caused the packet @@ -663,15 +764,15 @@ public abstract class ServerConfigurationManagerAbstract { public void reloadWhitelist() {} public void b(EntityPlayer entityplayer, WorldServer worldserver) { - entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime())); - if (worldserver.J()) { + entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.F())); + if (worldserver.M()) { entityplayer.netServerHandler.sendPacket(new Packet70Bed(1, 0)); } } public void updateClient(EntityPlayer entityplayer) { entityplayer.updateInventory(entityplayer.defaultContainer); - entityplayer.n(); + entityplayer.m(); } public int getPlayerCount() { @@ -701,7 +802,7 @@ public abstract class ServerConfigurationManagerAbstract { while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); - if (entityplayer.r().equals(s)) { + if (entityplayer.q().equals(s)) { arraylist.add(entityplayer); } } |